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:
@@ -206,7 +206,7 @@ int main()
|
||||
void renderScene(const Shader &shader)
|
||||
{
|
||||
// room cube
|
||||
glm::mat4 model;
|
||||
glm::mat4 model = glm::mat4(1.0f);
|
||||
model = glm::scale(model, glm::vec3(5.0f));
|
||||
shader.setMat4("model", model);
|
||||
glDisable(GL_CULL_FACE); // note that we disable culling here since we render 'inside' the cube instead of the usual 'outside' which throws off the normal culling methods.
|
||||
@@ -215,27 +215,27 @@ void renderScene(const Shader &shader)
|
||||
shader.setInt("reverse_normals", 0); // and of course disable it
|
||||
glEnable(GL_CULL_FACE);
|
||||
// cubes
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(4.0f, -3.5f, 0.0));
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
shader.setMat4("model", model);
|
||||
renderCube();
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(2.0f, 3.0f, 1.0));
|
||||
model = glm::scale(model, glm::vec3(0.75f));
|
||||
shader.setMat4("model", model);
|
||||
renderCube();
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(-3.0f, -1.0f, 0.0));
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
shader.setMat4("model", model);
|
||||
renderCube();
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(-1.5f, 1.0f, 1.5));
|
||||
model = glm::scale(model, glm::vec3(0.5f));
|
||||
shader.setMat4("model", model);
|
||||
renderCube();
|
||||
model = glm::mat4();
|
||||
model = glm::mat4(1.0f);
|
||||
model = glm::translate(model, glm::vec3(-1.5f, 2.0f, -3.0));
|
||||
model = glm::rotate(model, glm::radians(60.0f), glm::normalize(glm::vec3(1.0, 0.0, 1.0)));
|
||||
model = glm::scale(model, glm::vec3(0.75f));
|
||||
|
||||
Reference in New Issue
Block a user