mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Update GLM to latest version (0.9.9.3). This includes GLM's change of matrices no longer default initializing to the identity matrix. This commit thus also includes the update of all of LearnOpenGL's code to reflect this: all matrices are now constructor-initialized to the identity matrix where relevant.
This commit is contained in:
@@ -134,7 +134,7 @@ int main()
|
||||
shader.setVec3("camPos", camera.Position);
|
||||
|
||||
// render rows*column number of spheres with varying metallic/roughness values scaled by rows and columns respectively
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
for (int row = 0; row < nrRows; ++row)
|
||||
{
|
||||
shader.setFloat("metallic", (float)row / (float)nrRows);
|
||||
@@ -144,7 +144,7 @@ int main()
|
||||
// on direct lighting.
|
||||
shader.setFloat("roughness", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(
|
||||
(col - (nrColumns / 2)) * spacing,
|
||||
(row - (nrRows / 2)) * spacing,
|
||||
@@ -165,7 +165,7 @@ int main()
|
||||
shader.setVec3("lightPositions[" + std::to_string(i) + "]", newPos);
|
||||
shader.setVec3("lightColors[" + std::to_string(i) + "]", lightColors[i]);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, newPos);
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
shader.setMat4("model", model);
|
||||
|
||||
@@ -150,12 +150,12 @@ int main()
|
||||
glBindTexture(GL_TEXTURE_2D, ao);
|
||||
|
||||
// render rows*column number of spheres with material properties defined by textures (they all have the same material properties)
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
for (int row = 0; row < nrRows; ++row)
|
||||
{
|
||||
for (int col = 0; col < nrColumns; ++col)
|
||||
{
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(
|
||||
(float)(col - (nrColumns / 2)) * spacing,
|
||||
(float)(row - (nrRows / 2)) * spacing,
|
||||
@@ -176,7 +176,7 @@ int main()
|
||||
shader.setVec3("lightPositions[" + std::to_string(i) + "]", newPos);
|
||||
shader.setVec3("lightColors[" + std::to_string(i) + "]", lightColors[i]);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, newPos);
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
shader.setMat4("model", model);
|
||||
|
||||
@@ -235,7 +235,7 @@ int main()
|
||||
pbrShader.setVec3("camPos", camera.Position);
|
||||
|
||||
// render rows*column number of spheres with material properties defined by textures (they all have the same material properties)
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
for (int row = 0; row < nrRows; ++row)
|
||||
{
|
||||
pbrShader.setFloat("metallic", (float)row / (float)nrRows);
|
||||
@@ -245,7 +245,7 @@ int main()
|
||||
// on direct lighting.
|
||||
pbrShader.setFloat("roughness", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(
|
||||
(float)(col - (nrColumns / 2)) * spacing,
|
||||
(float)(row - (nrRows / 2)) * spacing,
|
||||
@@ -267,7 +267,7 @@ int main()
|
||||
pbrShader.setVec3("lightPositions[" + std::to_string(i) + "]", newPos);
|
||||
pbrShader.setVec3("lightColors[" + std::to_string(i) + "]", lightColors[i]);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, newPos);
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
pbrShader.setMat4("model", model);
|
||||
|
||||
@@ -280,7 +280,7 @@ int main()
|
||||
glBindTexture(GL_TEXTURE_CUBE_MAP, irradianceMap);
|
||||
|
||||
// render rows*column number of spheres with material properties defined by textures (they all have the same material properties)
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
for (int row = 0; row < nrRows; ++row)
|
||||
{
|
||||
pbrShader.setFloat("metallic", (float)row / (float)nrRows);
|
||||
@@ -290,7 +290,7 @@ int main()
|
||||
// on direct lighting.
|
||||
pbrShader.setFloat("roughness", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(
|
||||
(float)(col - (nrColumns / 2)) * spacing,
|
||||
(float)(row - (nrRows / 2)) * spacing,
|
||||
@@ -312,7 +312,7 @@ int main()
|
||||
pbrShader.setVec3("lightPositions[" + std::to_string(i) + "]", newPos);
|
||||
pbrShader.setVec3("lightColors[" + std::to_string(i) + "]", lightColors[i]);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, newPos);
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
pbrShader.setMat4("model", model);
|
||||
|
||||
@@ -372,7 +372,7 @@ int main()
|
||||
glBindTexture(GL_TEXTURE_2D, brdfLUTTexture);
|
||||
|
||||
// render rows*column number of spheres with material properties defined by textures (they all have the same material properties)
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
for (int row = 0; row < nrRows; ++row)
|
||||
{
|
||||
pbrShader.setFloat("metallic", (float)row / (float)nrRows);
|
||||
@@ -382,7 +382,7 @@ int main()
|
||||
// on direct lighting.
|
||||
pbrShader.setFloat("roughness", glm::clamp((float)col / (float)nrColumns, 0.05f, 1.0f));
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(
|
||||
(float)(col - (nrColumns / 2)) * spacing,
|
||||
(float)(row - (nrRows / 2)) * spacing,
|
||||
@@ -404,7 +404,7 @@ int main()
|
||||
pbrShader.setVec3("lightPositions[" + std::to_string(i) + "]", newPos);
|
||||
pbrShader.setVec3("lightColors[" + std::to_string(i) + "]", lightColors[i]);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, newPos);
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
pbrShader.setMat4("model", model);
|
||||
|
||||
@@ -399,7 +399,7 @@ int main()
|
||||
// render scene, supplying the convoluted irradiance map to the final shader.
|
||||
// ------------------------------------------------------------------------------------------
|
||||
pbrShader.use();
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
glm::mat4 view = camera.GetViewMatrix();
|
||||
pbrShader.setMat4("view", view);
|
||||
pbrShader.setVec3("camPos", camera.Position);
|
||||
@@ -424,7 +424,7 @@ int main()
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glBindTexture(GL_TEXTURE_2D, ironAOMap);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(-5.0, 0.0, 2.0));
|
||||
pbrShader.setMat4("model", model);
|
||||
renderSphere();
|
||||
@@ -441,7 +441,7 @@ int main()
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glBindTexture(GL_TEXTURE_2D, goldAOMap);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(-3.0, 0.0, 2.0));
|
||||
pbrShader.setMat4("model", model);
|
||||
renderSphere();
|
||||
@@ -458,7 +458,7 @@ int main()
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glBindTexture(GL_TEXTURE_2D, grassAOMap);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(-1.0, 0.0, 2.0));
|
||||
pbrShader.setMat4("model", model);
|
||||
renderSphere();
|
||||
@@ -475,7 +475,7 @@ int main()
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glBindTexture(GL_TEXTURE_2D, plasticAOMap);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(1.0, 0.0, 2.0));
|
||||
pbrShader.setMat4("model", model);
|
||||
renderSphere();
|
||||
@@ -492,7 +492,7 @@ int main()
|
||||
glActiveTexture(GL_TEXTURE7);
|
||||
glBindTexture(GL_TEXTURE_2D, wallAOMap);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(3.0, 0.0, 2.0));
|
||||
pbrShader.setMat4("model", model);
|
||||
renderSphere();
|
||||
@@ -507,7 +507,7 @@ int main()
|
||||
pbrShader.setVec3("lightPositions[" + std::to_string(i) + "]", newPos);
|
||||
pbrShader.setVec3("lightColors[" + std::to_string(i) + "]", lightColors[i]);
|
||||
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, newPos);
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
pbrShader.setMat4("model", model);
|
||||
|
||||
Reference in New Issue
Block a user