diff --git a/ray_tracing__advance/hello_vulkan.cpp b/ray_tracing__advance/hello_vulkan.cpp index 55c0dff..c796103 100644 --- a/ray_tracing__advance/hello_vulkan.cpp +++ b/ray_tracing__advance/hello_vulkan.cpp @@ -418,8 +418,8 @@ void HelloVulkan::rasterize(const VkCommandBuffer& cmdBuf) vkCmdBindPipeline(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline); vkCmdBindDescriptorSets(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descSet, 0, nullptr); - - for(int i = 0; i < m_objInstance.size(); ++i) + uint32_t nbInst = static_cast(m_objInstance.size() - 1); // Remove the implicit object + for(uint32_t i = 0; i < nbInst; ++i) { auto& inst = m_objInstance[i]; auto& model = m_objModel[inst.objIndex]; diff --git a/ray_tracing__advance/main.cpp b/ray_tracing__advance/main.cpp index ef2d7e0..52719b9 100644 --- a/ray_tracing__advance/main.cpp +++ b/ray_tracing__advance/main.cpp @@ -200,7 +200,7 @@ int main(int argc, char** argv) for(int n = 0; n < 50; ++n) { - ObjInstance inst; + ObjInstance inst = helloVk.m_objInstance[wusonIndex]; inst.objIndex = wusonIndex; inst.txtOffset = 0; float scale = fabsf(disn(gen)); diff --git a/ray_tracing_intersection/hello_vulkan.cpp b/ray_tracing_intersection/hello_vulkan.cpp index a9e5b1e..813fdc9 100644 --- a/ray_tracing_intersection/hello_vulkan.cpp +++ b/ray_tracing_intersection/hello_vulkan.cpp @@ -427,7 +427,8 @@ void HelloVulkan::rasterize(const VkCommandBuffer& cmdBuf) vkCmdBindDescriptorSets(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descSet, 0, nullptr); - for(int i = 0; i < m_objInstance.size(); ++i) + uint32_t nbInst = static_cast(m_objInstance.size() - 1); // Remove the implicit object + for(uint32_t i = 0; i < nbInst; ++i) { auto& inst = m_objInstance[i]; auto& model = m_objModel[inst.objIndex];