mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
Merge branch 'master' of https://github.com/JoeyDeVries/LearnOpenGL
# Conflicts: # src/6.pbr/1.1.lighting/1.1.pbr.fs # src/6.pbr/1.2.lighting_textured/1.2.pbr.fs # src/6.pbr/2.1.1.ibl_irradiance_conversion/2.1.1.pbr.fs # src/6.pbr/2.1.2.ibl_irradiance/2.1.2.pbr.fs # src/6.pbr/2.2.1.ibl_specular/2.2.1.pbr.fs # src/6.pbr/2.2.2.ibl_specular_textured/2.2.2.pbr.fs
This commit is contained in:
@@ -97,7 +97,7 @@ int main()
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // set texture wrapping to GL_REPEAT (default wrapping method)
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); // set texture wrapping to GL_REPEAT (default wrapping method)
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
|
||||||
// set texture filtering parameters
|
// set texture filtering parameters
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
// load image, create texture and generate mipmaps
|
// load image, create texture and generate mipmaps
|
||||||
int width, height, nrChannels;
|
int width, height, nrChannels;
|
||||||
@@ -169,4 +169,4 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
|||||||
// make sure the viewport matches the new window dimensions; note that width and
|
// make sure the viewport matches the new window dimensions; note that width and
|
||||||
// height will be significantly larger than specified on retina displays.
|
// height will be significantly larger than specified on retina displays.
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,11 +250,9 @@ int main()
|
|||||||
shader.use();
|
shader.use();
|
||||||
glm::mat4 model = glm::mat4(1.0f);
|
glm::mat4 model = glm::mat4(1.0f);
|
||||||
camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around
|
camera.Yaw += 180.0f; // rotate the camera's yaw 180 degrees around
|
||||||
camera.Pitch += 180.0f; // rotate the camera's pitch 180 degrees around
|
|
||||||
camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values)
|
camera.ProcessMouseMovement(0, 0, false); // call this to make sure it updates its camera vectors, note that we disable pitch constrains for this specific case (otherwise we can't reverse camera's pitch values)
|
||||||
glm::mat4 view = camera.GetViewMatrix();
|
glm::mat4 view = camera.GetViewMatrix();
|
||||||
camera.Yaw -= 180.0f; // reset it back to its original orientation
|
camera.Yaw -= 180.0f; // reset it back to its original orientation
|
||||||
camera.Pitch -= 180.0f;
|
|
||||||
camera.ProcessMouseMovement(0, 0, true);
|
camera.ProcessMouseMovement(0, 0, true);
|
||||||
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);
|
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);
|
||||||
shader.setMat4("view", view);
|
shader.setMat4("view", view);
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ int main(int argc, char* argv[])
|
|||||||
// -----
|
// -----
|
||||||
|
|
||||||
// set render states
|
// set render states
|
||||||
glDisable(GL_DEPTH);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDepthMask(GL_TRUE); // enable depth writes so glClear won't ignore clearing the depth buffer
|
glDepthMask(GL_TRUE); // enable depth writes so glClear won't ignore clearing the depth buffer
|
||||||
glDisable(GL_BLEND);
|
glDisable(GL_BLEND);
|
||||||
|
|
||||||
@@ -379,4 +379,4 @@ glm::mat4 calculate_model_matrix(const glm::vec3& position, const glm::vec3& rot
|
|||||||
trans = glm::scale(trans, scale);
|
trans = glm::scale(trans, scale);
|
||||||
|
|
||||||
return trans;
|
return trans;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user