Changeset f985231 in opengl-game
- Timestamp:
- Nov 7, 2019, 2:30:59 AM (5 years ago)
- Branches:
- feature/imgui-sdl, master, points-test
- Children:
- cc4a8b5
- Parents:
- d2d9286
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
VulkanGame.vcxproj
rd2d9286 rf985231 158 158 <ClInclude Include="vulkan-utils.hpp" /> 159 159 </ItemGroup> 160 <ItemGroup> 161 <None Include="shaders\overlay.frag" /> 162 <None Include="shaders\overlay.vert" /> 163 <None Include="shaders\scene.frag" /> 164 <None Include="shaders\scene.vert" /> 165 </ItemGroup> 160 166 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 161 167 <ImportGroup Label="ExtensionTargets"> -
vulkan-game.cpp
rd2d9286 rf985231 2 2 3 3 #include <array> 4 #include <chrono> 4 5 #include <iostream> 5 6 #include <set> … … 297 298 } 298 299 300 updateUniformBuffer(imageIndex); 301 299 302 VkSubmitInfo submitInfo = {}; 300 303 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; … … 887 890 } 888 891 892 void VulkanGame::updateUniformBuffer(uint32_t currentImage) { 893 static auto startTime = chrono::high_resolution_clock::now(); 894 895 auto currentTime = chrono::high_resolution_clock::now(); 896 float time = chrono::duration<float, chrono::seconds::period>(currentTime - startTime).count(); 897 898 UniformBufferObject ubo = {}; 899 ubo.model = rotate(glm::mat4(1.0f), time * glm::radians(90.0f), glm::vec3(0.0f, 0.0f, 1.0f)); 900 ubo.view = lookAt(glm::vec3(0.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); 901 ubo.proj = perspective(radians(45.0f), swapChainExtent.width / (float)swapChainExtent.height, 0.1f, 10.0f); 902 ubo.proj[1][1] *= -1; // flip the y-axis so that +y is up 903 904 void* data; 905 vkMapMemory(device, uniformBuffersMemory[currentImage], 0, sizeof(ubo), 0, &data); 906 memcpy(data, &ubo, sizeof(ubo)); 907 vkUnmapMemory(device, uniformBuffersMemory[currentImage]); 908 } 909 889 910 void VulkanGame::cleanupSwapChain() { 890 911 VulkanUtils::destroyVulkanImage(device, depthImage); -
vulkan-game.hpp
rd2d9286 rf985231 125 125 126 126 void recreateSwapChain(); 127 void updateUniformBuffer(uint32_t currentImage); 127 128 128 129 void cleanupSwapChain(); -
vulkan-ref.cpp
rd2d9286 rf985231 1794 1794 throw runtime_error("failed to acquire swap chain image!"); 1795 1795 } 1796 /*** END OF REFACTORED CODE ***/1797 1796 1798 1797 updateUniformBuffer(imageIndex); 1799 1798 1800 /*** START OF REFACTORED CODE ***/1801 1799 VkSubmitInfo submitInfo = {}; 1802 1800 submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; … … 1876 1874 populateImageFromSDLTexture(uiOverlay, sdlOverlayImage); 1877 1875 } 1878 /*** END OF REFACTORED CODE ***/1879 1876 1880 1877 void updateUniformBuffer(uint32_t currentImage) { … … 1896 1893 } 1897 1894 1898 /*** START OF REFACTORED CODE ***/1899 1895 void recreateSwapChain() { 1900 1896 gui->refreshWindowSize();
Note:
See TracChangeset
for help on using the changeset viewer.