diff --git a/assets/textures/checkermap.png b/assets/textures/checkermap.png new file mode 100644 index 0000000..60f42f3 Binary files /dev/null and b/assets/textures/checkermap.png differ diff --git a/src/global.h b/src/global.h index a044b0c..958fda8 100644 --- a/src/global.h +++ b/src/global.h @@ -44,8 +44,8 @@ namespace Global { extern VkImageView depthImageView; extern VkImage depthImage; extern VkDeviceMemory depthImageMemory; - const std::string MODEL_PATH = "assets/models/viking_room.obj"; - const std::string TEXTURE_PATH = "assets/textures/viking_room.png"; + const std::string MODEL_PATH = "assets/models/StanfordDragon800k.obj"; + const std::string TEXTURE_PATH = "assets/textures/checkermap.png"; @@ -95,7 +95,7 @@ namespace Global { }; const uint32_t WIDTH = 800; - const uint32_t HEIGHT = 800; + const uint32_t HEIGHT = 600; extern std::vector vertices; // Index buffer definition, showing which points to reuse. extern std::vector indices; diff --git a/src/graphics/buffers.cpp b/src/graphics/buffers.cpp index 8ba41b3..d0b1316 100644 --- a/src/graphics/buffers.cpp +++ b/src/graphics/buffers.cpp @@ -203,7 +203,7 @@ namespace buffers_libs { 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)); + ubo.view = glm::lookAt(glm::vec3(2.0f, 2.0f, 3.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)); // 45 degree field of view, set aspect ratio, and near and far clipping range. ubo.proj = glm::perspective(glm::radians(45.0f), device_libs::DeviceControl::getSwapChainExtent().width / (float) device_libs::DeviceControl::getSwapChainExtent().height, 0.1f, 10.0f); diff --git a/src/graphics/graphicspipeline.cpp b/src/graphics/graphicspipeline.cpp index 72556b4..2fa0125 100644 --- a/src/graphics/graphicspipeline.cpp +++ b/src/graphics/graphicspipeline.cpp @@ -94,7 +94,7 @@ namespace graphics_pipeline { rasterizer.polygonMode = VK_POLYGON_MODE_FILL; rasterizer.lineWidth = 1.0f; // How to cull the faces, right here we cull the back faces and tell the rasterizer front facing vertices are ordered clockwise. - rasterizer.cullMode = VK_CULL_MODE_BACK_BIT; + rasterizer.cullMode = VK_CULL_MODE_NONE; rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE; // Whether or not to add depth values. e.x. for shadow maps. rasterizer.depthBiasEnable = VK_FALSE; diff --git a/src/graphics/model.cpp b/src/graphics/model.cpp index 2618eb9..72693f8 100644 --- a/src/graphics/model.cpp +++ b/src/graphics/model.cpp @@ -16,7 +16,7 @@ namespace modellib { void Model::loadModel() { tinyobj::ObjReaderConfig readerConfig; - + tinyobj::ObjReader reader; if(!reader.ParseFromFile(Global::MODEL_PATH, readerConfig)) { @@ -30,7 +30,7 @@ namespace modellib { 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) { @@ -42,7 +42,10 @@ namespace modellib { attrib.vertices[3 * index.vertex_index + 2] }; - //TODO: Major fix here, running anything but the viking room OBJ crashes on texcoord assignment! + //TODO: Small fix here, handle if there are no UV's unwrapped for the model. + // As of now, if it is not unwrapped, it segfaults on texCoord assignment. + // Obviously we should always have UV's, but it shouldn't crash, just unwrap + // in a default method. vertex.texCoord = { attrib.texcoords[2 * index.texcoord_index + 0], 1.0f - attrib.texcoords[2 * index.texcoord_index + 1]