1
Fork 0
mirror of https://github.com/redstrate/Novus.git synced 2025-04-23 20:47:45 +00:00

Add support for modifying the renderer view matrix

This commit is contained in:
Joshua Goins 2023-07-06 17:35:26 -04:00
parent 810a3eede3
commit b216a670b2
2 changed files with 3 additions and 1 deletions

View file

@ -113,4 +113,6 @@ public:
VkDescriptorSet createDescriptorFor(const RenderModel& model, const RenderMaterial& material);
int hash(const RenderModel& model, const RenderMaterial& material);
glm::mat4 view;
};

View file

@ -503,7 +503,7 @@ void Renderer::render(std::vector<RenderModel> models) {
glm::mat4 p = glm::perspective(glm::radians(45.0f), swapchainExtent.width / (float) swapchainExtent.height,
0.1f, 100.0f);
glm::mat4 v = glm::lookAt(glm::vec3(0, 1, 1), glm::vec3(0, 1, 0), glm::vec3(0, -1, 0));
glm::mat4 v = view;
glm::mat4 vp = p * v;
vkCmdPushConstants(commandBuffer, pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0, sizeof(glm::mat4), &vp);