mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-30 20:13:22 +08:00
fix narrowing conversions (eg double to float, size_t to GLsizei)
This commit is contained in:
@@ -173,7 +173,7 @@ int main()
|
||||
glm::vec3 sample(randomFloats(generator) * 2.0 - 1.0, randomFloats(generator) * 2.0 - 1.0, randomFloats(generator));
|
||||
sample = glm::normalize(sample);
|
||||
sample *= randomFloats(generator);
|
||||
float scale = float(i) / 64.0;
|
||||
float scale = float(i) / 64.0f;
|
||||
|
||||
// scale samples s.t. they're more aligned to center of kernel
|
||||
scale = lerp(0.1f, 1.0f, scale * scale);
|
||||
@@ -222,7 +222,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
float currentFrame = glfwGetTime();
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -302,8 +302,8 @@ int main()
|
||||
shaderLightingPass.setVec3("light.Position", lightPosView);
|
||||
shaderLightingPass.setVec3("light.Color", lightColor);
|
||||
// Update attenuation parameters
|
||||
const float linear = 0.09;
|
||||
const float quadratic = 0.032;
|
||||
const float linear = 0.09f;
|
||||
const float quadratic = 0.032f;
|
||||
shaderLightingPass.setFloat("light.Linear", linear);
|
||||
shaderLightingPass.setFloat("light.Quadratic", quadratic);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
@@ -462,8 +462,10 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
|
||||
// glfw: whenever the mouse moves, this callback is called
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -484,5 +486,5 @@ void mouse_callback(GLFWwindow* window, double xpos, double ypos)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(yoffset);
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user