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:
@@ -182,7 +182,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// render the cube
|
||||
@@ -194,7 +194,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -186,7 +186,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// render the cube
|
||||
@@ -198,7 +198,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -187,7 +187,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// render the cube
|
||||
@@ -199,7 +199,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -202,7 +202,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// render the cube
|
||||
@@ -214,7 +214,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -196,7 +196,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// render the cube
|
||||
@@ -208,7 +208,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -204,7 +204,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -220,7 +220,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -205,7 +205,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -224,7 +224,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -207,7 +207,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -229,7 +229,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -215,7 +215,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -234,7 +234,7 @@ int main()
|
||||
for (unsigned int i = 0; i < 10; i++)
|
||||
{
|
||||
// calculate the model matrix for each object and pass it to shader before drawing
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, cubePositions[i]);
|
||||
float angle = 20.0f * i;
|
||||
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
|
||||
@@ -248,7 +248,7 @@ int main()
|
||||
// lampShader.use();
|
||||
// lampShader.setMat4("projection", projection);
|
||||
// lampShader.setMat4("view", view);
|
||||
// model = glm::mat4();
|
||||
// model = glm::mat4(1.0f);
|
||||
// model = glm::translate(model, lightPos);
|
||||
// model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
// lampShader.setMat4("model", model);
|
||||
|
||||
@@ -221,7 +221,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -236,7 +236,7 @@ int main()
|
||||
for (unsigned int i = 0; i < 10; i++)
|
||||
{
|
||||
// calculate the model matrix for each object and pass it to shader before drawing
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, cubePositions[i]);
|
||||
float angle = 20.0f * i;
|
||||
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
|
||||
@@ -250,7 +250,7 @@ int main()
|
||||
lampShader.use();
|
||||
lampShader.setMat4("projection", projection);
|
||||
lampShader.setMat4("view", view);
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, lightPos);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
@@ -222,7 +222,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -237,7 +237,7 @@ int main()
|
||||
for (unsigned int i = 0; i < 10; i++)
|
||||
{
|
||||
// calculate the model matrix for each object and pass it to shader before drawing
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, cubePositions[i]);
|
||||
float angle = 20.0f * i;
|
||||
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
|
||||
@@ -251,7 +251,7 @@ int main()
|
||||
// lampShader.use();
|
||||
// lampShader.setMat4("projection", projection);
|
||||
// lampShader.setMat4("view", view);
|
||||
// model = glm::mat4();
|
||||
// model = glm::mat4(1.0f);
|
||||
// model = glm::translate(model, lightPos);
|
||||
// model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
// lampShader.setMat4("model", model);
|
||||
|
||||
@@ -223,7 +223,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -238,7 +238,7 @@ int main()
|
||||
for (unsigned int i = 0; i < 10; i++)
|
||||
{
|
||||
// calculate the model matrix for each object and pass it to shader before drawing
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, cubePositions[i]);
|
||||
float angle = 20.0f * i;
|
||||
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
|
||||
@@ -251,7 +251,7 @@ int main()
|
||||
// lampShader.use();
|
||||
// lampShader.setMat4("projection", projection);
|
||||
// lampShader.setMat4("view", view);
|
||||
// model = glm::mat4();
|
||||
// model = glm::mat4(1.0f);
|
||||
// model = glm::translate(model, lightPos);
|
||||
// model = glm::scale(model, glm::vec3(0.2f)); // a smaller cube
|
||||
// lampShader.setMat4("model", model);
|
||||
|
||||
@@ -272,7 +272,7 @@ int main()
|
||||
lightingShader.setMat4("view", view);
|
||||
|
||||
// world transformation
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
lightingShader.setMat4("model", model);
|
||||
|
||||
// bind diffuse map
|
||||
@@ -287,7 +287,7 @@ int main()
|
||||
for (unsigned int i = 0; i < 10; i++)
|
||||
{
|
||||
// calculate the model matrix for each object and pass it to shader before drawing
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, cubePositions[i]);
|
||||
float angle = 20.0f * i;
|
||||
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
|
||||
@@ -305,7 +305,7 @@ int main()
|
||||
glBindVertexArray(lightVAO);
|
||||
for (unsigned int i = 0; i < 4; i++)
|
||||
{
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, pointLightPositions[i]);
|
||||
model = glm::scale(model, glm::vec3(0.2f)); // Make it a smaller cube
|
||||
lampShader.setMat4("model", model);
|
||||
|
||||
Reference in New Issue
Block a user