From cd8274c2942cc18fc4734edd7e045a6a7a000b36 Mon Sep 17 00:00:00 2001 From: saschawillems Date: Sun, 24 Sep 2017 18:17:07 +0200 Subject: [PATCH] glm matrix initialization --- base/camera.hpp | 4 +-- bloom/bloom.cpp | 4 +-- computecloth/computecloth.cpp | 4 +-- computeshader/computeshader.cpp | 4 +-- debugmarker/debugmarker.cpp | 4 +-- deferred/deferred.cpp | 4 +-- .../deferredmultisampling.cpp | 10 +++---- deferredshadows/deferredshadows.cpp | 6 ++--- displacement/displacement.cpp | 4 +-- distancefieldfonts/distancefieldfonts.cpp | 4 +-- dynamicuniformbuffer/dynamicuniformbuffer.cpp | 2 +- gears/vulkangear.cpp | 2 +- geometryshader/geometryshader.cpp | 4 +-- imgui/main.cpp | 2 +- instancing/instancing.cpp | 2 +- mesh/mesh.cpp | 4 +-- multisampling/multisampling.cpp | 4 +-- multithreading/multithreading.cpp | 6 ++--- occlusionquery/occlusionquery.cpp | 10 +++---- offscreen/offscreen.cpp | 12 ++++----- parallaxmapping/parallaxmapping.cpp | 2 +- particlefire/particlefire.cpp | 4 +-- pbrbasic/pbrbasic.cpp | 2 +- pbribl/pbribl.cpp | 26 +++++++++---------- pbrtexture/main.cpp | 26 +++++++++---------- pipelines/pipelines.cpp | 4 +-- pushconstants/pushconstants.cpp | 4 +-- radialblur/radialblur.cpp | 4 +-- renderheadless/renderheadless.cpp | 2 +- scenerendering/scenerendering.cpp | 2 +- screenshot/screenshot.cpp | 2 +- shadowmapping/shadowmapping.cpp | 8 +++--- shadowmappingomni/shadowmappingomni.cpp | 10 +++---- skeletalanimation/skeletalanimation.cpp | 6 ++--- sphericalenvmapping/sphericalenvmapping.cpp | 2 +- ssao/ssao.cpp | 2 +- subpasses/subpasses.cpp | 2 +- terraintessellation/terraintessellation.cpp | 2 +- tessellation/tessellation.cpp | 4 +-- textoverlay/textoverlay.cpp | 4 +-- texture/texture.cpp | 4 +-- texture3d/texture3d.cpp | 4 +-- texturearray/texturearray.cpp | 4 +-- texturecubemap/texturecubemap.cpp | 8 +++--- texturemipmapgen/texturemipmapgen.cpp | 2 +- .../texturesparseresidency.cpp | 6 ++--- triangle/triangle.cpp | 4 +-- viewportarray/viewportarray.cpp | 6 ++--- vulkanscene/vulkanscene.cpp | 2 +- 49 files changed, 127 insertions(+), 127 deletions(-) diff --git a/base/camera.hpp b/base/camera.hpp index 8962424e..2e54974e 100644 --- a/base/camera.hpp +++ b/base/camera.hpp @@ -20,14 +20,14 @@ private: void updateViewMatrix() { - glm::mat4 rotM = glm::mat4(); + glm::mat4 rotM = glm::mat4(1.0f); glm::mat4 transM; rotM = glm::rotate(rotM, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); rotM = glm::rotate(rotM, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); rotM = glm::rotate(rotM, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); - transM = glm::translate(glm::mat4(), position); + transM = glm::translate(glm::mat4(1.0f), position); if (type == CameraType::firstperson) { diff --git a/bloom/bloom.cpp b/bloom/bloom.cpp index ad0df5b8..fe3002d6 100644 --- a/bloom/bloom.cpp +++ b/bloom/bloom.cpp @@ -827,7 +827,7 @@ public: ubos.scene.projection = camera.matrices.perspective; ubos.scene.view = camera.matrices.view; - ubos.scene.model = glm::translate(glm::mat4(), glm::vec3(sin(glm::radians(timer * 360.0f)) * 0.25f, -1.0f, cos(glm::radians(timer * 360.0f)) * 0.25f) + cameraPos); + ubos.scene.model = glm::translate(glm::mat4(1.0f), glm::vec3(sin(glm::radians(timer * 360.0f)) * 0.25f, -1.0f, cos(glm::radians(timer * 360.0f)) * 0.25f) + cameraPos); ubos.scene.model = glm::rotate(ubos.scene.model, -sinf(glm::radians(timer * 360.0f)) * 0.15f, glm::vec3(1.0f, 0.0f, 0.0f)); ubos.scene.model = glm::rotate(ubos.scene.model, glm::radians(timer * 360.0f), glm::vec3(0.0f, 1.0f, 0.0f)); @@ -836,7 +836,7 @@ public: // Skybox ubos.skyBox.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, 0.1f, 256.0f); ubos.skyBox.view = glm::mat4(glm::mat3(camera.matrices.view)); - ubos.skyBox.model = glm::mat4(); + ubos.skyBox.model = glm::mat4(1.0f); memcpy(uniformBuffers.skyBox.mapped, &ubos.skyBox, sizeof(ubos.skyBox)); } diff --git a/computecloth/computecloth.cpp b/computecloth/computecloth.cpp index 8ed6ff36..4a0239af 100644 --- a/computecloth/computecloth.cpp +++ b/computecloth/computecloth.cpp @@ -320,7 +320,7 @@ public: case 0 : { // Horz. cloth falls onto sphere - glm::mat4 transM = glm::translate(glm::mat4(), glm::vec3(- cloth.size.x / 2.0f, -2.0f, - cloth.size.y / 2.0f)); + glm::mat4 transM = glm::translate(glm::mat4(1.0f), glm::vec3(- cloth.size.x / 2.0f, -2.0f, - cloth.size.y / 2.0f)); for (uint32_t i = 0; i < cloth.gridsize.y; i++) { for (uint32_t j = 0; j < cloth.gridsize.x; j++) { particleBuffer[i + j * cloth.gridsize.y].pos = transM * glm::vec4(dx * j, 0.0f, dy * i, 1.0f); @@ -333,7 +333,7 @@ public: case 1: { // Vert. Pinned cloth - glm::mat4 transM = glm::translate(glm::mat4(), glm::vec3(- cloth.size.x / 2.0f, - cloth.size.y / 2.0f, 0.0f)); + glm::mat4 transM = glm::translate(glm::mat4(1.0f), glm::vec3(- cloth.size.x / 2.0f, - cloth.size.y / 2.0f, 0.0f)); for (uint32_t i = 0; i < cloth.gridsize.y; i++) { for (uint32_t j = 0; j < cloth.gridsize.x; j++) { particleBuffer[i + j * cloth.gridsize.y].pos = transM * glm::vec4(dx * j, dy * i, 0.0f, 1.0f); diff --git a/computeshader/computeshader.cpp b/computeshader/computeshader.cpp index 9c757e9e..cccde242 100644 --- a/computeshader/computeshader.cpp +++ b/computeshader/computeshader.cpp @@ -728,9 +728,9 @@ public: { // Vertex shader uniform buffer block uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width*0.5f / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/debugmarker/debugmarker.cpp b/debugmarker/debugmarker.cpp index 31ec70ba..75578dd4 100644 --- a/debugmarker/debugmarker.cpp +++ b/debugmarker/debugmarker.cpp @@ -893,9 +893,9 @@ public: void updateUniformBuffers() { uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/deferred/deferred.cpp b/deferred/deferred.cpp index 35c5d61e..6e1f5a7b 100644 --- a/deferred/deferred.cpp +++ b/deferred/deferred.cpp @@ -1061,7 +1061,7 @@ public: { uboVS.projection = glm::ortho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); } - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); memcpy(uniformBuffers.vsFullScreen.mapped, &uboVS, sizeof(uboVS)); } @@ -1070,7 +1070,7 @@ public: { uboOffscreenVS.projection = camera.matrices.perspective; uboOffscreenVS.view = camera.matrices.view; - uboOffscreenVS.model = glm::mat4(); + uboOffscreenVS.model = glm::mat4(1.0f); memcpy(uniformBuffers.vsOffscreen.mapped, &uboOffscreenVS, sizeof(uboOffscreenVS)); } diff --git a/deferredmultisampling/deferredmultisampling.cpp b/deferredmultisampling/deferredmultisampling.cpp index f2495644..c5b65b66 100644 --- a/deferredmultisampling/deferredmultisampling.cpp +++ b/deferredmultisampling/deferredmultisampling.cpp @@ -1039,7 +1039,7 @@ public: { uboVS.projection = glm::ortho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); } - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); memcpy(uniformBuffers.vsFullScreen.mapped, &uboVS, sizeof(uboVS)); } @@ -1047,17 +1047,17 @@ public: void updateUniformBufferDeferredMatrices() { uboOffscreenVS.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, 0.1f, 256.0f); - uboOffscreenVS.view = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + uboOffscreenVS.view = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboOffscreenVS.model = glm::mat4(); - uboOffscreenVS.model = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.25f, 0.0f) + cameraPos); + uboOffscreenVS.model = glm::mat4(1.0f); + uboOffscreenVS.model = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.25f, 0.0f) + cameraPos); uboOffscreenVS.model = glm::rotate(uboOffscreenVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboOffscreenVS.model = glm::rotate(uboOffscreenVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboOffscreenVS.model = glm::rotate(uboOffscreenVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); uboOffscreenVS.projection = camera.matrices.perspective; uboOffscreenVS.view = camera.matrices.view; - uboOffscreenVS.model = glm::mat4(); + uboOffscreenVS.model = glm::mat4(1.0f); memcpy(uniformBuffers.vsOffscreen.mapped, &uboOffscreenVS, sizeof(uboOffscreenVS)); } diff --git a/deferredshadows/deferredshadows.cpp b/deferredshadows/deferredshadows.cpp index ebc77881..549066c0 100644 --- a/deferredshadows/deferredshadows.cpp +++ b/deferredshadows/deferredshadows.cpp @@ -1042,7 +1042,7 @@ public: void updateUniformBuffersScreen() { uboVS.projection = glm::ortho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); memcpy(uniformBuffers.vsFullScreen.mapped, &uboVS, sizeof(uboVS)); } @@ -1050,7 +1050,7 @@ public: { uboOffscreenVS.projection = camera.matrices.perspective; uboOffscreenVS.view = camera.matrices.view; - uboOffscreenVS.model = glm::mat4(); + uboOffscreenVS.model = glm::mat4(1.0f); memcpy(uniformBuffers.vsOffscreen.mapped, &uboOffscreenVS, sizeof(uboOffscreenVS)); } @@ -1091,7 +1091,7 @@ public: // mvp from light's pov (for shadows) glm::mat4 shadowProj = glm::perspective(glm::radians(lightFOV), 1.0f, zNear, zFar); glm::mat4 shadowView = glm::lookAt(glm::vec3(uboFragmentLights.lights[i].position), glm::vec3(uboFragmentLights.lights[i].target), glm::vec3(0.0f, 1.0f, 0.0f)); - glm::mat4 shadowModel = glm::mat4(); + glm::mat4 shadowModel = glm::mat4(1.0f); uboShadowGS.mvp[i] = shadowProj * shadowView * shadowModel; uboFragmentLights.lights[i].viewMatrix = uboShadowGS.mvp[i]; diff --git a/displacement/displacement.cpp b/displacement/displacement.cpp index 97010ad6..5ce1bbce 100644 --- a/displacement/displacement.cpp +++ b/displacement/displacement.cpp @@ -468,11 +468,11 @@ public: void updateUniformBuffers() { // Tessellation eval - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboTessEval.projection = glm::perspective(glm::radians(45.0f), (float)(width) / (float)height, 0.1f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, zoom)); - uboTessEval.model = glm::mat4(); + uboTessEval.model = glm::mat4(1.0f); uboTessEval.model = viewMatrix * glm::translate(uboTessEval.model, glm::vec3(0, 0, 0)); uboTessEval.model = glm::rotate(uboTessEval.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboTessEval.model = glm::rotate(uboTessEval.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/distancefieldfonts/distancefieldfonts.cpp b/distancefieldfonts/distancefieldfonts.cpp index a3598934..97c58877 100644 --- a/distancefieldfonts/distancefieldfonts.cpp +++ b/distancefieldfonts/distancefieldfonts.cpp @@ -617,11 +617,11 @@ public: void updateUniformBuffers() { // Vertex shader - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboVS.projection = glm::perspective(glm::radians(splitScreen ? 30.0f : 45.0f), (float)width / (float)(height * ((splitScreen) ? 0.5f : 1.0f)), 0.001f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, splitScreen ? zoom : zoom - 2.0f)); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = viewMatrix * glm::translate(uboVS.model, cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/dynamicuniformbuffer/dynamicuniformbuffer.cpp b/dynamicuniformbuffer/dynamicuniformbuffer.cpp index 33ddf1d2..f9d4d544 100644 --- a/dynamicuniformbuffer/dynamicuniformbuffer.cpp +++ b/dynamicuniformbuffer/dynamicuniformbuffer.cpp @@ -492,7 +492,7 @@ public: // Update matrices glm::vec3 pos = glm::vec3(-((dim * offset.x) / 2.0f) + offset.x / 2.0f + x * offset.x, -((dim * offset.y) / 2.0f) + offset.y / 2.0f + y * offset.y, -((dim * offset.z) / 2.0f) + offset.z / 2.0f + z * offset.z); - *modelMat = glm::translate(glm::mat4(), pos); + *modelMat = glm::translate(glm::mat4(1.0f), pos); *modelMat = glm::rotate(*modelMat, rotations[index].x, glm::vec3(1.0f, 1.0f, 0.0f)); *modelMat = glm::rotate(*modelMat, rotations[index].y, glm::vec3(0.0f, 1.0f, 0.0f)); *modelMat = glm::rotate(*modelMat, rotations[index].z, glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/gears/vulkangear.cpp b/gears/vulkangear.cpp index f1245b0c..f0af7c75 100644 --- a/gears/vulkangear.cpp +++ b/gears/vulkangear.cpp @@ -277,7 +277,7 @@ void VulkanGear::updateUniformBuffer(glm::mat4 perspective, glm::vec3 rotation, ubo.view = glm::rotate(ubo.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); ubo.view = glm::rotate(ubo.view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); - ubo.model = glm::mat4(); + ubo.model = glm::mat4(1.0f); ubo.model = glm::translate(ubo.model, pos); rotation.z = (rotSpeed * timer) + rotOffset; ubo.model = glm::rotate(ubo.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/geometryshader/geometryshader.cpp b/geometryshader/geometryshader.cpp index 04dd2d53..8728f2f9 100644 --- a/geometryshader/geometryshader.cpp +++ b/geometryshader/geometryshader.cpp @@ -417,8 +417,8 @@ public: { // Vertex shader uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/imgui/main.cpp b/imgui/main.cpp index 3a8eecb6..7ef5d66d 100644 --- a/imgui/main.cpp +++ b/imgui/main.cpp @@ -718,7 +718,7 @@ public: { // Vertex shader uboVS.projection = camera.matrices.perspective; - uboVS.modelview = camera.matrices.view * glm::mat4(); + uboVS.modelview = camera.matrices.view * glm::mat4(1.0f); // Light source if (uiSettings.animateLight) { diff --git a/instancing/instancing.cpp b/instancing/instancing.cpp index 76df86cf..4ba8e38d 100644 --- a/instancing/instancing.cpp +++ b/instancing/instancing.cpp @@ -545,7 +545,7 @@ public: if (viewChanged) { uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - uboVS.view = glm::translate(glm::mat4(), cameraPos + glm::vec3(0.0f, 0.0f, zoom)); + uboVS.view = glm::translate(glm::mat4(1.0f), cameraPos + glm::vec3(0.0f, 0.0f, zoom)); uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/mesh/mesh.cpp b/mesh/mesh.cpp index e085a48d..84263896 100644 --- a/mesh/mesh.cpp +++ b/mesh/mesh.cpp @@ -613,9 +613,9 @@ public: void updateUniformBuffers() { uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/multisampling/multisampling.cpp b/multisampling/multisampling.cpp index 40875797..7f6bd8fa 100644 --- a/multisampling/multisampling.cpp +++ b/multisampling/multisampling.cpp @@ -662,13 +662,13 @@ public: void updateUniformBuffers() { // Vertex shader - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, zoom)); float offset = 0.5f; int uboIndex = 1; - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = viewMatrix * glm::translate(uboVS.model, cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/multithreading/multithreading.cpp b/multithreading/multithreading.cpp index 0d229632..ffce24af 100644 --- a/multithreading/multithreading.cpp +++ b/multithreading/multithreading.cpp @@ -278,7 +278,7 @@ public: objectData->deltaT -= 1.0f; objectData->pos.y = sin(glm::radians(objectData->deltaT * 360.0f)) * 2.5f; - objectData->model = glm::translate(glm::mat4(), objectData->pos); + objectData->model = glm::translate(glm::mat4(1.0f), objectData->pos); objectData->model = glm::rotate(objectData->model, -sinf(glm::radians(objectData->deltaT * 360.0f)) * 0.25f, glm::vec3(objectData->rotationDir, 0.0f, 0.0f)); objectData->model = glm::rotate(objectData->model, glm::radians(objectData->rotation.y), glm::vec3(0.0f, objectData->rotationDir, 0.0f)); objectData->model = glm::rotate(objectData->model, glm::radians(objectData->deltaT * 360.0f), glm::vec3(0.0f, objectData->rotationDir, 0.0f)); @@ -321,7 +321,7 @@ public: vkCmdBindPipeline(secondaryCommandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.starsphere); - glm::mat4 view = glm::mat4(); + glm::mat4 view = glm::mat4(1.0f); view = glm::rotate(view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); view = glm::rotate(view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); view = glm::rotate(view, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -572,7 +572,7 @@ public: void updateMatrices() { matrices.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - matrices.view = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + matrices.view = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); matrices.view = glm::rotate(matrices.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); matrices.view = glm::rotate(matrices.view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); matrices.view = glm::rotate(matrices.view, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/occlusionquery/occlusionquery.cpp b/occlusionquery/occlusionquery.cpp index 733f90f2..693c1c01 100644 --- a/occlusionquery/occlusionquery.cpp +++ b/occlusionquery/occlusionquery.cpp @@ -218,7 +218,7 @@ public: VkDeviceSize offsets[1] = { 0 }; - glm::mat4 modelMatrix = glm::mat4(); + glm::mat4 modelMatrix = glm::mat4(1.0f); // Occlusion pass vkCmdBindPipeline(drawCmdBuffers[i], VK_PIPELINE_BIND_POINT_GRAPHICS, pipelines.simple); @@ -572,9 +572,9 @@ public: { // Vertex shader uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - glm::mat4 rotMatrix = glm::mat4(); + glm::mat4 rotMatrix = glm::mat4(1.0f); rotMatrix = glm::rotate(rotMatrix, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); rotMatrix = glm::rotate(rotMatrix, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); rotMatrix = glm::rotate(rotMatrix, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -590,13 +590,13 @@ public: // Teapot // Toggle color depending on visibility uboVS.visible = (passedSamples[0] > 0) ? 1.0f : 0.0f; - uboVS.model = viewMatrix * rotMatrix * glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, -10.0f)); + uboVS.model = viewMatrix * rotMatrix * glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -10.0f)); memcpy(uniformBuffers.teapot.mapped, &uboVS, sizeof(uboVS)); // Sphere // Toggle color depending on visibility uboVS.visible = (passedSamples[1] > 0) ? 1.0f : 0.0f; - uboVS.model = viewMatrix * rotMatrix * glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, 10.0f)); + uboVS.model = viewMatrix * rotMatrix * glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, 10.0f)); memcpy(uniformBuffers.sphere.mapped, &uboVS, sizeof(uboVS)); } diff --git a/offscreen/offscreen.cpp b/offscreen/offscreen.cpp index f3668153..e068677e 100644 --- a/offscreen/offscreen.cpp +++ b/offscreen/offscreen.cpp @@ -873,9 +873,9 @@ public: { // Mesh uboShared.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboShared.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboShared.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.y + meshRot.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -885,7 +885,7 @@ public: memcpy(uniformBuffers.vsShared.mapped, &uboShared, sizeof(uboShared)); // Mirror - uboShared.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboShared.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -894,7 +894,7 @@ public: // Debug quad uboShared.projection = glm::ortho(4.0f, 0.0f, 0.0f, 4.0f*(float)height / (float)width, -1.0f, 1.0f); - uboShared.model = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, 0.0f)); + uboShared.model = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, 0.0f)); memcpy(uniformBuffers.vsDebugQuad.mapped, &uboShared, sizeof(uboShared)); } @@ -902,9 +902,9 @@ public: void updateUniformBufferOffscreen() { uboShared.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboShared.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboShared.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.y + meshRot.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboShared.model = glm::rotate(uboShared.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/parallaxmapping/parallaxmapping.cpp b/parallaxmapping/parallaxmapping.cpp index 58ba8b20..a7680646 100644 --- a/parallaxmapping/parallaxmapping.cpp +++ b/parallaxmapping/parallaxmapping.cpp @@ -332,7 +332,7 @@ public: // Vertex shader ubos.vertexShader.projection = camera.matrices.perspective; ubos.vertexShader.view = camera.matrices.view; - ubos.vertexShader.model = glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f));; + ubos.vertexShader.model = glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f));; ubos.vertexShader.model = glm::rotate(ubos.vertexShader.model, glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f));; if (!paused) { diff --git a/particlefire/particlefire.cpp b/particlefire/particlefire.cpp index b09b7bd6..57714c27 100644 --- a/particlefire/particlefire.cpp +++ b/particlefire/particlefire.cpp @@ -688,11 +688,11 @@ public: void updateUniformBuffers() { // Vertex shader - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = viewMatrix * glm::translate(uboVS.model, glm::vec3(0.0f, 15.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/pbrbasic/pbrbasic.cpp b/pbrbasic/pbrbasic.cpp index f851b4e6..d646984c 100644 --- a/pbrbasic/pbrbasic.cpp +++ b/pbrbasic/pbrbasic.cpp @@ -391,7 +391,7 @@ public: // 3D object uboMatrices.projection = camera.matrices.perspective; uboMatrices.view = camera.matrices.view; - uboMatrices.model = glm::rotate(glm::mat4(), glm::radians(-90.0f + (models.objectIndex == 1 ? 45.0f : 0.0f)), glm::vec3(0.0f, 1.0f, 0.0f)); + uboMatrices.model = glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f + (models.objectIndex == 1 ? 45.0f : 0.0f)), glm::vec3(0.0f, 1.0f, 0.0f)); uboMatrices.camPos = camera.position * -1.0f; memcpy(uniformBuffers.object.mapped, &uboMatrices, sizeof(uboMatrices)); diff --git a/pbribl/pbribl.cpp b/pbribl/pbribl.cpp index 14f76467..e7c2501a 100644 --- a/pbribl/pbribl.cpp +++ b/pbribl/pbribl.cpp @@ -873,17 +873,17 @@ public: std::vector matrices = { // POSITIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Y - glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Y - glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), }; VkCommandBuffer cmdBuf = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); @@ -1267,17 +1267,17 @@ public: std::vector matrices = { // POSITIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Y - glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Y - glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), }; VkCommandBuffer cmdBuf = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); @@ -1436,7 +1436,7 @@ public: // 3D object uboMatrices.projection = camera.matrices.perspective; uboMatrices.view = camera.matrices.view; - uboMatrices.model = glm::rotate(glm::mat4(), glm::radians(90.0f + (models.objectIndex == 1 ? 45.0f : 0.0f)), glm::vec3(0.0f, 1.0f, 0.0f)); + uboMatrices.model = glm::rotate(glm::mat4(1.0f), glm::radians(90.0f + (models.objectIndex == 1 ? 45.0f : 0.0f)), glm::vec3(0.0f, 1.0f, 0.0f)); uboMatrices.camPos = camera.position * -1.0f; memcpy(uniformBuffers.object.mapped, &uboMatrices, sizeof(uboMatrices)); diff --git a/pbrtexture/main.cpp b/pbrtexture/main.cpp index e224fb5e..25fe1bcb 100644 --- a/pbrtexture/main.cpp +++ b/pbrtexture/main.cpp @@ -822,17 +822,17 @@ public: std::vector matrices = { // POSITIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Y - glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Y - glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), }; VkCommandBuffer cmdBuf = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); @@ -1216,17 +1216,17 @@ public: std::vector matrices = { // POSITIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_X - glm::rotate(glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Y - glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Y - glm::rotate(glm::mat4(), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // POSITIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(1.0f, 0.0f, 0.0f)), // NEGATIVE_Z - glm::rotate(glm::mat4(), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), + glm::rotate(glm::mat4(1.0f), glm::radians(180.0f), glm::vec3(0.0f, 0.0f, 1.0f)), }; VkCommandBuffer cmdBuf = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); @@ -1385,7 +1385,7 @@ public: // 3D object uboMatrices.projection = camera.matrices.perspective; uboMatrices.view = camera.matrices.view; - uboMatrices.model = glm::rotate(glm::mat4(), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)); + uboMatrices.model = glm::rotate(glm::mat4(1.0f), glm::radians(-90.0f), glm::vec3(0.0f, 1.0f, 0.0f)); uboMatrices.camPos = camera.position * -1.0f; memcpy(uniformBuffers.object.mapped, &uboMatrices, sizeof(uboMatrices)); diff --git a/pipelines/pipelines.cpp b/pipelines/pipelines.cpp index 4722d9b2..217eb5eb 100644 --- a/pipelines/pipelines.cpp +++ b/pipelines/pipelines.cpp @@ -379,9 +379,9 @@ public: { uboVS.projection = glm::perspective(glm::radians(60.0f), (float)(width / 3.0f) / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.modelView = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.modelView = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.modelView = glm::rotate(uboVS.modelView, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.modelView = glm::rotate(uboVS.modelView, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.modelView = glm::rotate(uboVS.modelView, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/pushconstants/pushconstants.cpp b/pushconstants/pushconstants.cpp index 7e25c5a8..699bf247 100644 --- a/pushconstants/pushconstants.cpp +++ b/pushconstants/pushconstants.cpp @@ -403,11 +403,11 @@ public: void updateUniformBuffers() { // Vertex shader - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 2.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), glm::vec3(0, 0, 0)); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), glm::vec3(0, 0, 0)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/radialblur/radialblur.cpp b/radialblur/radialblur.cpp index 60282b14..095b9440 100644 --- a/radialblur/radialblur.cpp +++ b/radialblur/radialblur.cpp @@ -756,9 +756,9 @@ public: void updateUniformBuffersScene() { uboScene.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, 1.0f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboScene.model = glm::mat4(); + uboScene.model = glm::mat4(1.0f); uboScene.model = viewMatrix * glm::translate(uboScene.model, cameraPos); uboScene.model = glm::rotate(uboScene.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboScene.model = glm::rotate(uboScene.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/renderheadless/renderheadless.cpp b/renderheadless/renderheadless.cpp index 4d3a9440..fb8734d8 100644 --- a/renderheadless/renderheadless.cpp +++ b/renderheadless/renderheadless.cpp @@ -637,7 +637,7 @@ public: }; for (auto v : pos) { - glm::mat4 mvpMatrix = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f) * glm::translate(glm::mat4(), v); + glm::mat4 mvpMatrix = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f) * glm::translate(glm::mat4(1.0f), v); vkCmdPushConstants(commandBuffer, pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(mvpMatrix), &mvpMatrix); vkCmdDrawIndexed(commandBuffer, 3, 1, 0, 0, 0); } diff --git a/scenerendering/scenerendering.cpp b/scenerendering/scenerendering.cpp index a9bd753f..c3b8e5a3 100644 --- a/scenerendering/scenerendering.cpp +++ b/scenerendering/scenerendering.cpp @@ -808,7 +808,7 @@ public: scene->uniformData.projection = camera.matrices.perspective; scene->uniformData.view = camera.matrices.view; - scene->uniformData.model = glm::mat4(); + scene->uniformData.model = glm::mat4(1.0f); memcpy(scene->uniformBuffer.mapped, &scene->uniformData, sizeof(scene->uniformData)); } diff --git a/screenshot/screenshot.cpp b/screenshot/screenshot.cpp index ac25d626..f75df884 100644 --- a/screenshot/screenshot.cpp +++ b/screenshot/screenshot.cpp @@ -292,7 +292,7 @@ public: { uboVS.projection = camera.matrices.perspective; uboVS.view = camera.matrices.view; - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); VK_CHECK_RESULT(uniformBuffer.map()); uniformBuffer.copyTo(&uboVS, sizeof(uboVS)); diff --git a/shadowmapping/shadowmapping.cpp b/shadowmapping/shadowmapping.cpp index a680015b..3470a6e1 100644 --- a/shadowmapping/shadowmapping.cpp +++ b/shadowmapping/shadowmapping.cpp @@ -816,19 +816,19 @@ public: float AR = (float)height / (float)width; uboVSquad.projection = glm::ortho(2.5f / AR, 0.0f, 0.0f, 2.5f, -1.0f, 1.0f); - uboVSquad.model = glm::mat4(); + uboVSquad.model = glm::mat4(1.0f); memcpy(uniformBuffers.debug.mapped, &uboVSquad, sizeof(uboVSquad)); // 3D scene uboVSscene.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, zNear, zFar); - uboVSscene.view = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + uboVSscene.view = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); uboVSscene.view = glm::rotate(uboVSscene.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVSscene.view = glm::rotate(uboVSscene.view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVSscene.view = glm::rotate(uboVSscene.view, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); - uboVSscene.model = glm::mat4(); + uboVSscene.model = glm::mat4(1.0f); uboVSscene.lightPos = lightPos; @@ -849,7 +849,7 @@ public: // Matrix from light's point of view glm::mat4 depthProjectionMatrix = glm::perspective(glm::radians(lightFOV), 1.0f, zNear, zFar); glm::mat4 depthViewMatrix = glm::lookAt(lightPos, glm::vec3(0.0f), glm::vec3(0, 1, 0)); - glm::mat4 depthModelMatrix = glm::mat4(); + glm::mat4 depthModelMatrix = glm::mat4(1.0f); uboOffscreenVS.depthMVP = depthProjectionMatrix * depthViewMatrix * depthModelMatrix; diff --git a/shadowmappingomni/shadowmappingomni.cpp b/shadowmappingomni/shadowmappingomni.cpp index 231d6e84..3782d24c 100644 --- a/shadowmappingomni/shadowmappingomni.cpp +++ b/shadowmappingomni/shadowmappingomni.cpp @@ -392,7 +392,7 @@ public: // Update view matrix via push constant - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); switch (faceIndex) { case 0: // POSITIVE_X @@ -955,9 +955,9 @@ public: void updateUniformBuffers() { uboVSscene.projection = glm::perspective(glm::radians(45.0f), (float)width / (float)height, zNear, zFar); - uboVSscene.view = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, displayCubeMap ? 0.0f : zoom)); + uboVSscene.view = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, displayCubeMap ? 0.0f : zoom)); - uboVSscene.model = glm::mat4(); + uboVSscene.model = glm::mat4(1.0f); uboVSscene.model = glm::rotate(uboVSscene.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVSscene.model = glm::rotate(uboVSscene.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVSscene.model = glm::rotate(uboVSscene.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -974,8 +974,8 @@ public: uboOffscreenVS.projection = glm::perspective((float)(M_PI / 2.0), 1.0f, zNear, zFar); - uboOffscreenVS.view = glm::mat4(); - uboOffscreenVS.model = glm::translate(glm::mat4(), glm::vec3(-lightPos.x, -lightPos.y, -lightPos.z)); + uboOffscreenVS.view = glm::mat4(1.0f); + uboOffscreenVS.model = glm::translate(glm::mat4(1.0f), glm::vec3(-lightPos.x, -lightPos.y, -lightPos.z)); uboOffscreenVS.lightPos = lightPos; diff --git a/skeletalanimation/skeletalanimation.cpp b/skeletalanimation/skeletalanimation.cpp index 872a6b27..b4411eee 100644 --- a/skeletalanimation/skeletalanimation.cpp +++ b/skeletalanimation/skeletalanimation.cpp @@ -933,11 +933,11 @@ public: { uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 1024.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); viewMatrix = glm::rotate(viewMatrix, glm::radians(90.0f), glm::vec3(1.0f, 0.0f, 0.0f)); viewMatrix = glm::scale(viewMatrix, glm::vec3(0.025f)); - uboVS.view = viewMatrix * glm::translate(glm::mat4(), glm::vec3(cameraPos.x, -cameraPos.z, cameraPos.y) * 100.0f); + uboVS.view = viewMatrix * glm::translate(glm::mat4(1.0f), glm::vec3(cameraPos.x, -cameraPos.z, cameraPos.y) * 100.0f); uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.view = glm::rotate(uboVS.view, glm::radians(rotation.z), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.view = glm::rotate(uboVS.view, glm::radians(-rotation.y), glm::vec3(0.0f, 0.0f, 1.0f)); @@ -946,7 +946,7 @@ public: uboFloor.projection = uboVS.projection; uboFloor.view = viewMatrix; - uboFloor.model = glm::translate(glm::mat4(), glm::vec3(cameraPos.x, -cameraPos.z, cameraPos.y) * 100.0f); + uboFloor.model = glm::translate(glm::mat4(1.0f), glm::vec3(cameraPos.x, -cameraPos.z, cameraPos.y) * 100.0f); uboFloor.model = glm::rotate(uboFloor.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboFloor.model = glm::rotate(uboFloor.model, glm::radians(rotation.z), glm::vec3(0.0f, 1.0f, 0.0f)); uboFloor.model = glm::rotate(uboFloor.model, glm::radians(-rotation.y), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/sphericalenvmapping/sphericalenvmapping.cpp b/sphericalenvmapping/sphericalenvmapping.cpp index 14dd9a34..0c15e691 100644 --- a/sphericalenvmapping/sphericalenvmapping.cpp +++ b/sphericalenvmapping/sphericalenvmapping.cpp @@ -377,7 +377,7 @@ public: glm::vec3(0, 1, 0) ); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/ssao/ssao.cpp b/ssao/ssao.cpp index 76bd5836..cc76a861 100644 --- a/ssao/ssao.cpp +++ b/ssao/ssao.cpp @@ -1047,7 +1047,7 @@ public: { uboSceneMatrices.projection = camera.matrices.perspective; uboSceneMatrices.view = camera.matrices.view; - uboSceneMatrices.model = glm::mat4(); + uboSceneMatrices.model = glm::mat4(1.0f); VK_CHECK_RESULT(uniformBuffers.sceneMatrices.map()); uniformBuffers.sceneMatrices.copyTo(&uboSceneMatrices, sizeof(uboSceneMatrices)); diff --git a/subpasses/subpasses.cpp b/subpasses/subpasses.cpp index e6e6b904..fa32d2db 100644 --- a/subpasses/subpasses.cpp +++ b/subpasses/subpasses.cpp @@ -958,7 +958,7 @@ public: { uboGBuffer.projection = camera.matrices.perspective; uboGBuffer.view = camera.matrices.view; - uboGBuffer.model = glm::mat4(); + uboGBuffer.model = glm::mat4(1.0f); VK_CHECK_RESULT(uniformBuffers.GBuffer.map()); memcpy(uniformBuffers.GBuffer.mapped, &uboGBuffer, sizeof(uboGBuffer)); diff --git a/terraintessellation/terraintessellation.cpp b/terraintessellation/terraintessellation.cpp index 22ae9b9b..cead91c9 100644 --- a/terraintessellation/terraintessellation.cpp +++ b/terraintessellation/terraintessellation.cpp @@ -877,7 +877,7 @@ public: // Tessellation uboTess.projection = camera.matrices.perspective; - uboTess.modelview = camera.matrices.view * glm::mat4(); + uboTess.modelview = camera.matrices.view * glm::mat4(1.0f); uboTess.lightPos.y = -0.5f - uboTess.displacementFactor; // todo: Not uesed yet uboTess.viewportDim = glm::vec2((float)width, (float)height); diff --git a/tessellation/tessellation.cpp b/tessellation/tessellation.cpp index e29f0e2e..bc2dbd0d 100644 --- a/tessellation/tessellation.cpp +++ b/tessellation/tessellation.cpp @@ -491,11 +491,11 @@ public: void updateUniformBuffers() { // Tessellation eval - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboTessEval.projection = glm::perspective(glm::radians(45.0f), (float)(width* ((splitScreen) ? 0.5f : 1.0f)) / (float)height, 0.1f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, zoom)); - uboTessEval.model = glm::mat4(); + uboTessEval.model = glm::mat4(1.0f); uboTessEval.model = viewMatrix * glm::translate(uboTessEval.model, cameraPos); uboTessEval.model = glm::rotate(uboTessEval.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboTessEval.model = glm::rotate(uboTessEval.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/textoverlay/textoverlay.cpp b/textoverlay/textoverlay.cpp index edcf30c4..ecc26814 100644 --- a/textoverlay/textoverlay.cpp +++ b/textoverlay/textoverlay.cpp @@ -1141,9 +1141,9 @@ public: // Vertex shader uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/texture/texture.cpp b/texture/texture.cpp index 3e6e4d2f..afd644f0 100644 --- a/texture/texture.cpp +++ b/texture/texture.cpp @@ -821,9 +821,9 @@ public: { // Vertex shader uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/texture3d/texture3d.cpp b/texture3d/texture3d.cpp index 8aa948c4..bf403e91 100644 --- a/texture3d/texture3d.cpp +++ b/texture3d/texture3d.cpp @@ -762,9 +762,9 @@ public: if (viewchanged) { uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/texturearray/texturearray.cpp b/texturearray/texturearray.cpp index 9a300ac2..382358eb 100644 --- a/texturearray/texturearray.cpp +++ b/texturearray/texturearray.cpp @@ -599,7 +599,7 @@ public: for (int32_t i = 0; i < layerCount; i++) { // Instance model matrix - uboVS.instance[i].model = glm::translate(glm::mat4(), glm::vec3(0.0f, i * offset - center, 0.0f)); + uboVS.instance[i].model = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, i * offset - center, 0.0f)); uboVS.instance[i].model = glm::rotate(uboVS.instance[i].model, glm::radians(60.0f), glm::vec3(1.0f, 0.0f, 0.0f)); // Instance texture array index uboVS.instance[i].arrayIndex.x = i; @@ -627,7 +627,7 @@ public: uboVS.matrices.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); // View - uboVS.matrices.view = glm::translate(glm::mat4(), glm::vec3(0.0f, -1.0f, zoom)); + uboVS.matrices.view = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, -1.0f, zoom)); uboVS.matrices.view = glm::rotate(uboVS.matrices.view, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.matrices.view = glm::rotate(uboVS.matrices.view, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.matrices.view = glm::rotate(uboVS.matrices.view, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/texturecubemap/texturecubemap.cpp b/texturecubemap/texturecubemap.cpp index 5243fc83..340f1a19 100644 --- a/texturecubemap/texturecubemap.cpp +++ b/texturecubemap/texturecubemap.cpp @@ -660,11 +660,11 @@ public: void updateUniformBuffers() { // 3D object - glm::mat4 viewMatrix = glm::mat4(); + glm::mat4 viewMatrix = glm::mat4(1.0f); uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); viewMatrix = glm::translate(viewMatrix, glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = viewMatrix * glm::translate(uboVS.model, cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); @@ -673,10 +673,10 @@ public: memcpy(uniformBuffers.object.mapped, &uboVS, sizeof(uboVS)); // Skybox - viewMatrix = glm::mat4(); + viewMatrix = glm::mat4(1.0f); uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = viewMatrix * glm::translate(uboVS.model, glm::vec3(0, 0, 0)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); diff --git a/texturemipmapgen/texturemipmapgen.cpp b/texturemipmapgen/texturemipmapgen.cpp index 7d5e92ba..08010a8a 100644 --- a/texturemipmapgen/texturemipmapgen.cpp +++ b/texturemipmapgen/texturemipmapgen.cpp @@ -674,7 +674,7 @@ public: { uboVS.projection = camera.matrices.perspective; uboVS.view = camera.matrices.view; - uboVS.model = glm::rotate(glm::mat4(), glm::radians(timer * 360.0f), glm::vec3(1.0f, 0.0f, 0.0f)); + uboVS.model = glm::rotate(glm::mat4(1.0f), glm::radians(timer * 360.0f), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.viewPos = glm::vec4(camera.position, 0.0f) * glm::vec4(-1.0f); VK_CHECK_RESULT(uniformBufferVS.map()); memcpy(uniformBufferVS.mapped, &uboVS, sizeof(uboVS)); diff --git a/texturesparseresidency/texturesparseresidency.cpp b/texturesparseresidency/texturesparseresidency.cpp index 671b325e..4977d790 100644 --- a/texturesparseresidency/texturesparseresidency.cpp +++ b/texturesparseresidency/texturesparseresidency.cpp @@ -892,16 +892,16 @@ public: { // Vertex shader uboVS.projection = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.001f, 256.0f); - glm::mat4 viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + glm::mat4 viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.model = viewMatrix * glm::translate(glm::mat4(), cameraPos); + uboVS.model = viewMatrix * glm::translate(glm::mat4(1.0f), cameraPos); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); uboVS.projection = camera.matrices.perspective; uboVS.model = camera.matrices.view; - //uboVS.model = glm::mat4(); + //uboVS.model = glm::mat4(1.0f); uboVS.viewPos = glm::vec4(0.0f, 0.0f, -zoom, 0.0f); diff --git a/triangle/triangle.cpp b/triangle/triangle.cpp index 93c0f6d5..b8c29279 100644 --- a/triangle/triangle.cpp +++ b/triangle/triangle.cpp @@ -1051,9 +1051,9 @@ public: // Update matrices uboVS.projectionMatrix = glm::perspective(glm::radians(60.0f), (float)width / (float)height, 0.1f, 256.0f); - uboVS.viewMatrix = glm::translate(glm::mat4(), glm::vec3(0.0f, 0.0f, zoom)); + uboVS.viewMatrix = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, zoom)); - uboVS.modelMatrix = glm::mat4(); + uboVS.modelMatrix = glm::mat4(1.0f); uboVS.modelMatrix = glm::rotate(uboVS.modelMatrix, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.modelMatrix = glm::rotate(uboVS.modelMatrix, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.modelMatrix = glm::rotate(uboVS.modelMatrix, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f)); diff --git a/viewportarray/viewportarray.cpp b/viewportarray/viewportarray.cpp index d47d9350..421b7c0c 100644 --- a/viewportarray/viewportarray.cpp +++ b/viewportarray/viewportarray.cpp @@ -316,7 +316,7 @@ public: camFront = glm::normalize(camFront); glm::vec3 camRight = glm::normalize(glm::cross(camFront, glm::vec3(0.0f, 1.0f, 0.0f))); - glm::mat4 rotM = glm::mat4(); + glm::mat4 rotM = glm::mat4(1.0f); glm::mat4 transM; rotM = glm::rotate(rotM, glm::radians(camera.rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); @@ -327,7 +327,7 @@ public: left = -aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl; right = aspectRatio * wd2 + 0.5f * eyeSeparation * ndfl; - transM = glm::translate(glm::mat4(), camera.position - camRight * (eyeSeparation / 2.0f)); + transM = glm::translate(glm::mat4(1.0f), camera.position - camRight * (eyeSeparation / 2.0f)); uboGS.projection[0] = glm::frustum(left, right, bottom, top, zNear, zFar); uboGS.modelview[0] = rotM * transM; @@ -336,7 +336,7 @@ public: left = -aspectRatio * wd2 - 0.5f * eyeSeparation * ndfl; right = aspectRatio * wd2 - 0.5f * eyeSeparation * ndfl; - transM = glm::translate(glm::mat4(), camera.position + camRight * (eyeSeparation / 2.0f)); + transM = glm::translate(glm::mat4(1.0f), camera.position + camRight * (eyeSeparation / 2.0f)); uboGS.projection[1] = glm::frustum(left, right, bottom, top, zNear, zFar); uboGS.modelview[1] = rotM * transM; diff --git a/vulkanscene/vulkanscene.cpp b/vulkanscene/vulkanscene.cpp index a7f5447a..ff987d84 100644 --- a/vulkanscene/vulkanscene.cpp +++ b/vulkanscene/vulkanscene.cpp @@ -394,7 +394,7 @@ public: glm::vec3(0, 1, 0) ); - uboVS.model = glm::mat4(); + uboVS.model = glm::mat4(1.0f); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.x), glm::vec3(1.0f, 0.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.y), glm::vec3(0.0f, 1.0f, 0.0f)); uboVS.model = glm::rotate(uboVS.model, glm::radians(rotation.z), glm::vec3(0.0f, 0.0f, 1.0f));