fix cleanup function, at todo for broken indice buffer.
This commit is contained in:
parent
0a7d5a787c
commit
57496aea2c
@ -1,4 +1,5 @@
|
|||||||
#include "entrypoint.h"
|
#include "entrypoint.h"
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
VkInstance vulkaninstance;
|
VkInstance vulkaninstance;
|
||||||
|
|
||||||
@ -83,14 +84,13 @@ void mainLoop() {
|
|||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
render_present::Render::cleanupSwapChain();
|
render_present::Render::cleanupSwapChain();
|
||||||
texture_libs::Texture::createTextureSampler();
|
|
||||||
texture_libs::Texture::destroyTextureImage();
|
|
||||||
buffers_libs::Buffers::destroyUniformBuffer();
|
|
||||||
buffers_libs::Buffers::destroyDescriptorPool();
|
|
||||||
vkDestroyDescriptorSetLayout(Global::device, Global::descriptorSetLayout, nullptr);
|
|
||||||
graphics_pipeline::Graphics::destroyGraphicsPipeline();
|
graphics_pipeline::Graphics::destroyGraphicsPipeline();
|
||||||
graphics_pipeline::Graphics::destroyRenderPass();
|
graphics_pipeline::Graphics::destroyRenderPass();
|
||||||
|
buffers_libs::Buffers::destroyUniformBuffer();
|
||||||
|
buffers_libs::Buffers::destroyDescriptorPool();
|
||||||
|
texture_libs::Texture::destroyTextureSampler();
|
||||||
|
texture_libs::Texture::destroyTextureImage();
|
||||||
|
vkDestroyDescriptorSetLayout(Global::device, Global::descriptorSetLayout, nullptr);
|
||||||
buffers_libs::Buffers::destroyBuffers();
|
buffers_libs::Buffers::destroyBuffers();
|
||||||
render_present::Render::destroyFenceSemaphores();
|
render_present::Render::destroyFenceSemaphores();
|
||||||
graphics_pipeline::Graphics::destroyCommandPool();
|
graphics_pipeline::Graphics::destroyCommandPool();
|
||||||
|
@ -200,7 +200,7 @@ namespace buffers_libs {
|
|||||||
Global::UniformBufferObject ubo{};
|
Global::UniformBufferObject ubo{};
|
||||||
ubo.time = time;
|
ubo.time = time;
|
||||||
// Modify the model projection transformation to rotate around the Z over time.
|
// Modify the model projection transformation to rotate around the Z over time.
|
||||||
ubo.model = glm::rotate(glm::mat4(1.0f), glm::radians(30.0f), glm::vec3(0.0f, 0.0f, 1.0f));
|
ubo.model = glm::rotate(glm::mat4(1.0f), time * glm::radians(30.0f), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
// Modify the view transformation to look at the object from above at a 45 degree angle.
|
// Modify the view transformation to look at the object from above at a 45 degree angle.
|
||||||
// This takes the eye position, center position, and the up direction.
|
// This takes the eye position, center position, and the up direction.
|
||||||
ubo.view = glm::lookAt(glm::vec3(2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f));
|
ubo.view = glm::lookAt(glm::vec3(2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f));
|
||||||
|
@ -23,11 +23,14 @@ namespace modellib {
|
|||||||
if(!reader.Error().empty()) {
|
if(!reader.Error().empty()) {
|
||||||
throw std::runtime_error(reader.Error());
|
throw std::runtime_error(reader.Error());
|
||||||
}
|
}
|
||||||
|
if(!reader.Warning().empty()) {
|
||||||
|
throw std::runtime_error(reader.Warning());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& attrib = reader.GetAttrib();
|
auto& attrib = reader.GetAttrib();
|
||||||
auto& shapes = reader.GetShapes();
|
auto& shapes = reader.GetShapes();
|
||||||
auto& materials = reader.GetMaterials();
|
//auto& materials = reader.GetMaterials();
|
||||||
|
|
||||||
for (const auto& shape : shapes) {
|
for (const auto& shape : shapes) {
|
||||||
for (const auto& index : shape.mesh.indices) {
|
for (const auto& index : shape.mesh.indices) {
|
||||||
@ -39,11 +42,11 @@ namespace modellib {
|
|||||||
attrib.vertices[3 * index.vertex_index + 2]
|
attrib.vertices[3 * index.vertex_index + 2]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//TODO: Major fix here, running anything but the viking room OBJ crashes on texcoord assignment!
|
||||||
vertex.texCoord = {
|
vertex.texCoord = {
|
||||||
attrib.texcoords[2 * index.texcoord_index + 0],
|
attrib.texcoords[2 * index.texcoord_index + 0],
|
||||||
1.0f - attrib.texcoords[2 * index.texcoord_index + 1]
|
1.0f - attrib.texcoords[2 * index.texcoord_index + 1]
|
||||||
};
|
};
|
||||||
|
|
||||||
vertex.color = {1.0f, 1.0f, 1.0f};
|
vertex.color = {1.0f, 1.0f, 1.0f};
|
||||||
|
|
||||||
if (uniqueVertices.count(vertex) == 0) {
|
if (uniqueVertices.count(vertex) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user