fix cleanup function, at todo for broken indice buffer.

This commit is contained in:
Lillian Salehi 2024-10-16 07:28:13 -05:00
parent 0a7d5a787c
commit 57496aea2c
3 changed files with 14 additions and 11 deletions

View File

@ -1,4 +1,5 @@
#include "entrypoint.h"
#include "global.h"
VkInstance vulkaninstance;
@ -83,14 +84,13 @@ void mainLoop() {
void cleanup() {
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::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();
render_present::Render::destroyFenceSemaphores();
graphics_pipeline::Graphics::destroyCommandPool();

View File

@ -200,7 +200,7 @@ namespace buffers_libs {
Global::UniformBufferObject ubo{};
ubo.time = 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.
// 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));

View File

@ -23,11 +23,14 @@ namespace modellib {
if(!reader.Error().empty()) {
throw std::runtime_error(reader.Error());
}
if(!reader.Warning().empty()) {
throw std::runtime_error(reader.Warning());
}
}
auto& attrib = reader.GetAttrib();
auto& shapes = reader.GetShapes();
auto& materials = reader.GetMaterials();
//auto& materials = reader.GetMaterials();
for (const auto& shape : shapes) {
for (const auto& index : shape.mesh.indices) {
@ -39,11 +42,11 @@ namespace modellib {
attrib.vertices[3 * index.vertex_index + 2]
};
//TODO: Major fix here, running anything but the viking room OBJ crashes on texcoord assignment!
vertex.texCoord = {
attrib.texcoords[2 * index.texcoord_index + 0],
1.0f - attrib.texcoords[2 * index.texcoord_index + 1]
};
vertex.color = {1.0f, 1.0f, 1.0f};
if (uniqueVertices.count(vertex) == 0) {