diff --git a/src/MainManager.cpp b/src/main.cpp similarity index 98% rename from src/MainManager.cpp rename to src/main.cpp index 6d13135..4b26afc 100644 --- a/src/MainManager.cpp +++ b/src/main.cpp @@ -1,18 +1,16 @@ #include #include #include -#include #define STB_IMAGE_IMPLEMENTATION -#include - #include "stb_image.h" +#include #include "models/Model.h" #include "renderEngine/Loader.h" #include "renderEngine/ObjLoader.h" #include "renderEngine/Renderer.h" #include "shaders/StaticShader.h" -#include "toolbox/Toolbox.h" +#include "toolbox/math.h" #pragma comment(lib, "glfw3.lib") #pragma comment(lib, "glew32s.lib") diff --git a/src/renderEngine/Loader.cpp b/src/renderEngine/Loader.cpp index 0c8d8d4..7581b28 100644 --- a/src/renderEngine/Loader.cpp +++ b/src/renderEngine/Loader.cpp @@ -1,5 +1,4 @@ #include -#include #include "../stb_image.h" #include "Loader.h" diff --git a/src/renderEngine/Renderer.cpp b/src/renderEngine/Renderer.cpp index a26e76a..3660234 100644 --- a/src/renderEngine/Renderer.cpp +++ b/src/renderEngine/Renderer.cpp @@ -3,7 +3,7 @@ #include #include "../models/Model.h" #include "Renderer.h" -#include "../toolbox/Toolbox.h" +#include "../toolbox/math.h" namespace renderEngine { @@ -52,7 +52,7 @@ namespace renderEngine glEnableVertexAttribArray(1); // Load the transformation of the model into the shader - const glm::mat4 modelMatrix = toolbox::createModelMatrix(entity.getPosition(), entity.getRotation(), entity.getScale()); + const glm::mat4 modelMatrix = toolbox::CreateModelMatrix(entity.getPosition(), entity.getRotation(), entity.getScale()); shader.loadModelMatrix(modelMatrix); // Draw the model diff --git a/src/shaders/StaticShader.cpp b/src/shaders/StaticShader.cpp index 2921362..b04cb71 100644 --- a/src/shaders/StaticShader.cpp +++ b/src/shaders/StaticShader.cpp @@ -1,5 +1,5 @@ #include "StaticShader.h" -#include "../toolbox/Toolbox.h" +#include "../toolbox/math.h" namespace shaders { @@ -69,7 +69,7 @@ namespace shaders void StaticShader::loadViewMatrix(entities::Camera& camera) const { - const glm::mat4 viewMatrix = toolbox::createViewMatrix(camera); + const glm::mat4 viewMatrix = toolbox::CreateViewMatrix(camera); loadMatrix(location_viewMatrix, viewMatrix); } diff --git a/src/shaders/fragmentShader.glsl b/src/shaders/fragmentShader.glsl deleted file mode 100644 index de4fb13..0000000 --- a/src/shaders/fragmentShader.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#version 400 core -// The FragmentShader is run for each pixel in a face on the screen. - - -// Interpolated textureCoordinates of the vertex (relative to the distance to each vertex) -in vec2 passTextureCoords; - -// Final color of the pixel -out vec4 outColor; - -// The texture of the model -uniform sampler2D textureSampler; - -void main(void) -{ - outColor = texture(textureSampler, passTextureCoords); -} \ No newline at end of file diff --git a/src/shaders/vertexShader.glsl b/src/shaders/vertexShader.glsl deleted file mode 100644 index a2c020b..0000000 --- a/src/shaders/vertexShader.glsl +++ /dev/null @@ -1,25 +0,0 @@ -#version 400 core -// The VertexShader is run for each vertex on the screen. - - -// Position of the vertex -in vec3 position; -// Coordinates of the texture -in vec2 textureCoords; - -// Equal to the textureCoords -out vec2 passTextureCoords; - -uniform mat4 modelMatrix; -uniform mat4 projectionMatrix; -uniform mat4 viewMatrix; - - -void main(void) -{ - // Tell OpenGL where to render the vertex - gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.0); - - // Pass the textureCoords directly to the fragment shader - passTextureCoords = textureCoords; -} \ No newline at end of file diff --git a/src/toolbox/Toolbox.cpp b/src/toolbox/math.cpp similarity index 70% rename from src/toolbox/Toolbox.cpp rename to src/toolbox/math.cpp index a4a37d5..cfe2ea2 100644 --- a/src/toolbox/Toolbox.cpp +++ b/src/toolbox/math.cpp @@ -1,8 +1,8 @@ -#include "Toolbox.h" +#include "math.h" namespace toolbox { - glm::mat4 createModelMatrix(glm::vec3 translation, glm::vec3 rotation, float scale) + glm::mat4 CreateModelMatrix(glm::vec3 translation, glm::vec3 rotation, float scale) { glm::mat4 matrix(1.0f); matrix = glm::translate(matrix, translation); @@ -13,14 +13,14 @@ namespace toolbox return matrix; } - glm::mat4 createViewMatrix(entities::Camera& camera) + glm::mat4 CreateViewMatrix(entities::Camera& camera) { glm::mat4 matrix(1.0f); matrix = glm::rotate(matrix, glm::radians(camera.getRotation().x), glm::vec3(1, 0, 0)); matrix = glm::rotate(matrix, glm::radians(camera.getRotation().y), glm::vec3(0, 1, 0)); matrix = glm::rotate(matrix, glm::radians(camera.getRotation().z), glm::vec3(0, 0, 1)); - const glm::vec3 negativeCamPos = glm::vec3(-camera.getPosition().x, -camera.getPosition().y, -camera.getPosition().z); - matrix = glm::translate(matrix, negativeCamPos); + const glm::vec3 negative_cam_pos = glm::vec3(-camera.getPosition().x, -camera.getPosition().y, -camera.getPosition().z); + matrix = glm::translate(matrix, negative_cam_pos); return matrix; } } diff --git a/src/toolbox/Toolbox.h b/src/toolbox/math.h similarity index 61% rename from src/toolbox/Toolbox.h rename to src/toolbox/math.h index ddc1ffd..e38f164 100644 --- a/src/toolbox/Toolbox.h +++ b/src/toolbox/math.h @@ -8,7 +8,7 @@ namespace toolbox #define WINDOW_WIDTH 1400.0f #define WINDOW_HEIGT 800.0f - glm::mat4 createModelMatrix(glm::vec3 translation, glm::vec3 rotation, float scale); + glm::mat4 CreateModelMatrix(glm::vec3 translation, glm::vec3 rotation, float scale); - glm::mat4 createViewMatrix(entities::Camera& camera); + glm::mat4 CreateViewMatrix(entities::Camera& camera); } diff --git a/wk2_fps.vcxproj b/wk2_fps.vcxproj index 209d99f..97edc71 100644 --- a/wk2_fps.vcxproj +++ b/wk2_fps.vcxproj @@ -21,13 +21,13 @@ - + - + @@ -39,7 +39,7 @@ - + 16.0 diff --git a/wk2_fps.vcxproj.filters b/wk2_fps.vcxproj.filters index d831b87..d1be1c9 100644 --- a/wk2_fps.vcxproj.filters +++ b/wk2_fps.vcxproj.filters @@ -36,10 +36,10 @@ Source Files - + Source Files - + Source Files @@ -68,10 +68,10 @@ Header Files - + Header Files - + Header Files