mirror of
https://github.com/JoeyDeVries/LearnOpenGL.git
synced 2026-01-02 04:37:54 +08:00
update merge request as requested by JoeyDeVries: no auto or GLtypes
This commit is contained in:
@@ -87,7 +87,7 @@ public:
|
||||
|
||||
// draw mesh
|
||||
glBindVertexArray(VAO);
|
||||
glDrawElements(GL_TRIANGLES, static_cast<GLsizei>(indices.size()), GL_UNSIGNED_INT, 0);
|
||||
glDrawElements(GL_TRIANGLES, static_cast<unsigned int>(indices.size()), GL_UNSIGNED_INT, 0);
|
||||
glBindVertexArray(0);
|
||||
|
||||
// always good practice to set everything back to defaults once configured.
|
||||
|
||||
@@ -146,8 +146,8 @@ int main()
|
||||
glUseProgram(shaderProgram);
|
||||
|
||||
// update shader uniform
|
||||
auto timeValue = glfwGetTime();
|
||||
auto greenValue = static_cast<GLfloat>(sin(timeValue) / 2.0 + 0.5);
|
||||
double timeValue = glfwGetTime();
|
||||
float greenValue = static_cast<float>(sin(timeValue) / 2.0 + 0.5);
|
||||
int vertexColorLocation = glGetUniformLocation(shaderProgram, "ourColor");
|
||||
glUniform4f(vertexColorLocation, 0.0f, greenValue, 0.0f, 1.0f);
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ int main()
|
||||
// ---------------------
|
||||
transform = glm::mat4(1.0f); // reset it to identity matrix
|
||||
transform = glm::translate(transform, glm::vec3(-0.5f, 0.5f, 0.0f));
|
||||
auto scaleAmount = static_cast<GLfloat>(sin(glfwGetTime()));
|
||||
float scaleAmount = static_cast<float>(sin(glfwGetTime()));
|
||||
transform = glm::scale(transform, glm::vec3(scaleAmount, scaleAmount, scaleAmount));
|
||||
glUniformMatrix4fv(transformLoc, 1, GL_FALSE, &transform[0][0]); // this time take the matrix value array's first element as its memory pointer value
|
||||
|
||||
|
||||
@@ -222,8 +222,8 @@ int main()
|
||||
// camera/view transformation
|
||||
glm::mat4 view = glm::mat4(1.0f); // make sure to initialize matrix to identity matrix first
|
||||
float radius = 10.0f;
|
||||
auto camX = static_cast<GLfloat>(sin(glfwGetTime()) * radius);
|
||||
auto camZ = static_cast<GLfloat>(cos(glfwGetTime()) * radius);
|
||||
float camX = static_cast<float>(sin(glfwGetTime()) * radius);
|
||||
float camZ = static_cast<float>(cos(glfwGetTime()) * radius);
|
||||
view = glm::lookAt(glm::vec3(camX, 0.0f, camZ), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));
|
||||
ourShader.setMat4("view", view);
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -276,7 +276,7 @@ void processInput(GLFWwindow *window)
|
||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, true);
|
||||
|
||||
auto cameraSpeed = static_cast<GLfloat>(2.5 * deltaTime);
|
||||
float cameraSpeed = static_cast<float>(2.5 * deltaTime);
|
||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||
cameraPos += cameraSpeed * cameraFront;
|
||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
||||
|
||||
@@ -221,7 +221,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -289,7 +289,7 @@ void processInput(GLFWwindow *window)
|
||||
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
|
||||
glfwSetWindowShouldClose(window, true);
|
||||
|
||||
auto cameraSpeed = static_cast<GLfloat>(2.5 * deltaTime);
|
||||
float cameraSpeed = static_cast<float>(2.5 * deltaTime);
|
||||
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
|
||||
cameraPos += cameraSpeed * cameraFront;
|
||||
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
|
||||
@@ -313,8 +313,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
|
||||
@@ -216,7 +216,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -308,8 +308,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -331,5 +331,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -252,8 +252,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -275,5 +275,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -256,8 +256,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -279,5 +279,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -257,8 +257,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -279,5 +279,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -180,9 +180,9 @@ int main()
|
||||
|
||||
// light properties
|
||||
glm::vec3 lightColor;
|
||||
lightColor.x = static_cast<GLfloat>(sin(glfwGetTime() * 2.0));
|
||||
lightColor.y = static_cast<GLfloat>(sin(glfwGetTime() * 0.7));
|
||||
lightColor.z = static_cast<GLfloat>(sin(glfwGetTime() * 1.3));
|
||||
lightColor.x = static_cast<float>(sin(glfwGetTime() * 2.0));
|
||||
lightColor.y = static_cast<float>(sin(glfwGetTime() * 0.7));
|
||||
lightColor.z = static_cast<float>(sin(glfwGetTime() * 1.3));
|
||||
glm::vec3 diffuseColor = lightColor * glm::vec3(0.5f); // decrease the influence
|
||||
glm::vec3 ambientColor = diffuseColor * glm::vec3(0.2f); // low influence
|
||||
lightingShader.setVec3("light.ambient", ambientColor);
|
||||
@@ -272,8 +272,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -295,5 +295,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
}
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -266,8 +266,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -288,5 +288,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -278,8 +278,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -172,7 +172,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -281,8 +281,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -174,7 +174,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -287,8 +287,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -310,7 +310,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -182,7 +182,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -306,8 +306,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -328,7 +328,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -185,7 +185,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -307,8 +307,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -330,7 +330,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -182,7 +182,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -308,8 +308,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -331,7 +331,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -182,7 +182,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -308,8 +308,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -331,7 +331,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -192,7 +192,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -361,8 +361,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -384,7 +384,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -94,7 +94,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -166,8 +166,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -189,5 +189,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -261,8 +261,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -177,7 +177,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -261,8 +261,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -284,7 +284,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -105,11 +105,11 @@ int main()
|
||||
model = glm::translate(model, glm::vec3(x, y, z));
|
||||
|
||||
// 2. scale: Scale between 0.05 and 0.25f
|
||||
float scale = static_cast<GLfloat>((rand() % 20) / 100.0 + 0.05);
|
||||
float scale = static_cast<float>((rand() % 20) / 100.0 + 0.05);
|
||||
model = glm::scale(model, glm::vec3(scale));
|
||||
|
||||
// 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector
|
||||
float rotAngle = static_cast<GLfloat>((rand() % 360));
|
||||
float rotAngle = static_cast<float>((rand() % 360));
|
||||
model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f));
|
||||
|
||||
// 4. now add to list of matrices
|
||||
@@ -122,7 +122,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -196,8 +196,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -219,5 +219,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -106,11 +106,11 @@ int main()
|
||||
model = glm::translate(model, glm::vec3(x, y, z));
|
||||
|
||||
// 2. scale: Scale between 0.05 and 0.25f
|
||||
auto scale = static_cast<GLfloat>((rand() % 20) / 100.0 + 0.05);
|
||||
float scale = static_cast<float>((rand() % 20) / 100.0 + 0.05);
|
||||
model = glm::scale(model, glm::vec3(scale));
|
||||
|
||||
// 3. rotation: add random rotation around a (semi)randomly picked rotation axis vector
|
||||
auto rotAngle = static_cast<GLfloat>((rand() % 360));
|
||||
float rotAngle = static_cast<float>((rand() % 360));
|
||||
model = glm::rotate(model, rotAngle, glm::vec3(0.4f, 0.6f, 0.8f));
|
||||
|
||||
// 4. now add to list of matrices
|
||||
@@ -156,7 +156,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -194,7 +194,7 @@ int main()
|
||||
for (unsigned int i = 0; i < rock.meshes.size(); i++)
|
||||
{
|
||||
glBindVertexArray(rock.meshes[i].VAO);
|
||||
glDrawElementsInstanced(GL_TRIANGLES, static_cast<GLsizei>(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount);
|
||||
glDrawElementsInstanced(GL_TRIANGLES, static_cast<unsigned int>(rock.meshes[i].indices.size()), GL_UNSIGNED_INT, 0, amount);
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
@@ -238,8 +238,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -261,5 +261,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -204,8 +204,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -226,5 +226,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -296,8 +296,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -318,5 +318,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -305,8 +305,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -328,7 +328,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -208,7 +208,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -304,8 +304,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -326,7 +326,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -210,7 +210,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -315,8 +315,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -337,7 +337,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -226,7 +226,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -331,8 +331,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -353,7 +353,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -226,7 +226,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -363,8 +363,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -385,7 +385,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -222,7 +222,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -311,8 +311,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -333,7 +333,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -220,7 +220,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
float currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -310,8 +310,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -332,7 +332,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -168,7 +168,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -259,8 +259,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
|
||||
@@ -88,7 +88,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -111,7 +111,7 @@ int main()
|
||||
shader.setMat4("model", model);
|
||||
|
||||
// add time component to geometry shader in the form of a uniform
|
||||
shader.setFloat("time", static_cast<GLfloat>(glfwGetTime()));
|
||||
shader.setFloat("time", static_cast<float>(glfwGetTime()));
|
||||
|
||||
// draw model
|
||||
nanosuit.Draw(shader);
|
||||
@@ -156,8 +156,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -178,5 +178,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -163,8 +163,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -185,5 +185,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -215,8 +215,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -237,7 +237,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -141,7 +141,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -228,8 +228,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -250,7 +250,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -154,7 +154,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -380,8 +380,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -403,7 +403,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -158,7 +158,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -404,8 +404,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -426,7 +426,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -160,7 +160,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -411,8 +411,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -433,7 +433,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -129,7 +129,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -138,7 +138,7 @@ int main()
|
||||
processInput(window);
|
||||
|
||||
// move light position over time
|
||||
lightPos.z = static_cast<GLfloat>(sin(glfwGetTime() * 0.5) * 3.0);
|
||||
lightPos.z = static_cast<float>(sin(glfwGetTime() * 0.5) * 3.0);
|
||||
|
||||
// render
|
||||
// ------
|
||||
@@ -358,8 +358,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -380,7 +380,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -129,7 +129,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -138,7 +138,7 @@ int main()
|
||||
processInput(window);
|
||||
|
||||
// move light position over time
|
||||
lightPos.z = static_cast<GLfloat>(sin(glfwGetTime() * 0.5) * 3.0);
|
||||
lightPos.z = static_cast<float>(sin(glfwGetTime() * 0.5) * 3.0);
|
||||
|
||||
// render
|
||||
// ------
|
||||
@@ -358,8 +358,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -380,7 +380,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -101,7 +101,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -271,8 +271,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -293,7 +293,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -107,7 +107,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -300,8 +300,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -322,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -107,7 +107,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -300,8 +300,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -322,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -107,7 +107,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -300,8 +300,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -322,7 +322,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -141,7 +141,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -361,8 +361,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -383,7 +383,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -177,7 +177,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -469,8 +469,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -491,7 +491,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// utility function for loading a 2D texture from file
|
||||
|
||||
@@ -150,14 +150,14 @@ int main()
|
||||
for (unsigned int i = 0; i < NR_LIGHTS; i++)
|
||||
{
|
||||
// calculate slightly random offsets
|
||||
float xPos = static_cast<GLfloat>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
float yPos = static_cast<GLfloat>(((rand() % 100) / 100.0) * 6.0 - 4.0);
|
||||
float zPos = static_cast<GLfloat>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
float xPos = static_cast<float>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
float yPos = static_cast<float>(((rand() % 100) / 100.0) * 6.0 - 4.0);
|
||||
float zPos = static_cast<float>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
lightPositions.push_back(glm::vec3(xPos, yPos, zPos));
|
||||
// also calculate random color
|
||||
float rColor = static_cast<GLfloat>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0
|
||||
float gColor = static_cast<GLfloat>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0
|
||||
float bColor = static_cast<GLfloat>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0
|
||||
float rColor = static_cast<float>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0
|
||||
float gColor = static_cast<float>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0
|
||||
float bColor = static_cast<float>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.0
|
||||
lightColors.push_back(glm::vec3(rColor, gColor, bColor));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
auto currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -405,8 +405,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -427,5 +427,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -150,14 +150,14 @@ int main()
|
||||
for (unsigned int i = 0; i < NR_LIGHTS; i++)
|
||||
{
|
||||
// calculate slightly random offsets
|
||||
float xPos = static_cast<GLfloat>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
float yPos = static_cast<GLfloat>(((rand() % 100) / 100.0) * 6.0 - 4.0);
|
||||
float zPos = static_cast<GLfloat>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
float xPos = static_cast<float>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
float yPos = static_cast<float>(((rand() % 100) / 100.0) * 6.0 - 4.0);
|
||||
float zPos = static_cast<float>(((rand() % 100) / 100.0) * 6.0 - 3.0);
|
||||
lightPositions.push_back(glm::vec3(xPos, yPos, zPos));
|
||||
// also calculate random color
|
||||
float rColor = static_cast<GLfloat>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)
|
||||
float gColor = static_cast<GLfloat>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)
|
||||
float bColor = static_cast<GLfloat>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)
|
||||
float rColor = static_cast<float>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)
|
||||
float gColor = static_cast<float>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)
|
||||
float bColor = static_cast<float>(((rand() % 100) / 200.0f) + 0.5); // between 0.5 and 1.)
|
||||
lightColors.push_back(glm::vec3(rColor, gColor, bColor));
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
auto currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -410,8 +410,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -432,5 +432,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -464,8 +464,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
if (firstMouse)
|
||||
{
|
||||
lastX = xpos;
|
||||
@@ -486,5 +486,5 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -215,8 +215,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -238,13 +238,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// renders (and builds at first invocation) a sphere
|
||||
// -------------------------------------------------
|
||||
unsigned int sphereVAO = 0;
|
||||
GLsizei indexCount;
|
||||
unsigned int indexCount;
|
||||
void renderSphere()
|
||||
{
|
||||
if (sphereVAO == 0)
|
||||
@@ -300,7 +300,7 @@ void renderSphere()
|
||||
}
|
||||
oddRow = !oddRow;
|
||||
}
|
||||
indexCount = static_cast<GLsizei>(indices.size());
|
||||
indexCount = static_cast<unsigned int>(indices.size());
|
||||
|
||||
std::vector<float> data;
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
|
||||
@@ -120,7 +120,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -226,8 +226,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -249,13 +249,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// renders (and builds at first invocation) a sphere
|
||||
// -------------------------------------------------
|
||||
unsigned int sphereVAO = 0;
|
||||
GLsizei indexCount;
|
||||
unsigned int indexCount;
|
||||
void renderSphere()
|
||||
{
|
||||
if (sphereVAO == 0)
|
||||
@@ -311,7 +311,7 @@ void renderSphere()
|
||||
}
|
||||
oddRow = !oddRow;
|
||||
}
|
||||
indexCount = static_cast<GLsizei>(indices.size());
|
||||
indexCount = static_cast<unsigned int>(indices.size());
|
||||
|
||||
std::vector<float> data;
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
|
||||
@@ -214,7 +214,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -331,8 +331,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -360,7 +360,7 @@ void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
// renders (and builds at first invocation) a sphere
|
||||
// -------------------------------------------------
|
||||
unsigned int sphereVAO = 0;
|
||||
GLsizei indexCount;
|
||||
unsigned int indexCount;
|
||||
void renderSphere()
|
||||
{
|
||||
if (sphereVAO == 0)
|
||||
@@ -416,7 +416,7 @@ void renderSphere()
|
||||
}
|
||||
oddRow = !oddRow;
|
||||
}
|
||||
indexCount = static_cast<GLsizei>(indices.size());
|
||||
indexCount = static_cast<unsigned int>(indices.size());
|
||||
|
||||
std::vector<float> data;
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
|
||||
@@ -255,7 +255,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -371,8 +371,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -394,13 +394,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// renders (and builds at first invocation) a sphere
|
||||
// -------------------------------------------------
|
||||
unsigned int sphereVAO = 0;
|
||||
GLsizei indexCount;
|
||||
unsigned int indexCount;
|
||||
void renderSphere()
|
||||
{
|
||||
if (sphereVAO == 0)
|
||||
@@ -456,7 +456,7 @@ void renderSphere()
|
||||
}
|
||||
oddRow = !oddRow;
|
||||
}
|
||||
indexCount = static_cast<GLsizei>(indices.size());
|
||||
indexCount = static_cast<unsigned int>(indices.size());
|
||||
|
||||
std::vector<float> data;
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
|
||||
@@ -343,7 +343,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -469,8 +469,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -492,13 +492,13 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// renders (and builds at first invocation) a sphere
|
||||
// -------------------------------------------------
|
||||
unsigned int sphereVAO = 0;
|
||||
GLsizei indexCount;
|
||||
unsigned int indexCount;
|
||||
void renderSphere()
|
||||
{
|
||||
if (sphereVAO == 0)
|
||||
@@ -554,7 +554,7 @@ void renderSphere()
|
||||
}
|
||||
oddRow = !oddRow;
|
||||
}
|
||||
indexCount = static_cast<GLsizei>(indices.size());
|
||||
indexCount = static_cast<unsigned int>(indices.size());
|
||||
|
||||
std::vector<float> data;
|
||||
for (unsigned int i = 0; i < positions.size(); ++i)
|
||||
|
||||
@@ -380,7 +380,7 @@ int main()
|
||||
{
|
||||
// per-frame time logic
|
||||
// --------------------
|
||||
auto currentFrame = static_cast<GLfloat>(glfwGetTime());
|
||||
float currentFrame = static_cast<float>(glfwGetTime());
|
||||
deltaTime = currentFrame - lastFrame;
|
||||
lastFrame = currentFrame;
|
||||
|
||||
@@ -569,8 +569,8 @@ void framebuffer_size_callback(GLFWwindow* window, int width, int height)
|
||||
// -------------------------------------------------------
|
||||
void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
{
|
||||
auto xpos = static_cast<GLfloat>(xposIn);
|
||||
auto ypos = static_cast<GLfloat>(yposIn);
|
||||
float xpos = static_cast<float>(xposIn);
|
||||
float ypos = static_cast<float>(yposIn);
|
||||
|
||||
if (firstMouse)
|
||||
{
|
||||
@@ -592,7 +592,7 @@ void mouse_callback(GLFWwindow* window, double xposIn, double yposIn)
|
||||
// ----------------------------------------------------------------------
|
||||
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset)
|
||||
{
|
||||
camera.ProcessMouseScroll(static_cast<GLfloat>(yoffset));
|
||||
camera.ProcessMouseScroll(static_cast<float>(yoffset));
|
||||
}
|
||||
|
||||
// renders (and builds at first invocation) a sphere
|
||||
|
||||
Reference in New Issue
Block a user