diff --git a/examples/dev_testing/src/main.cpp b/examples/dev_testing/src/main.cpp index 8bab303..313e618 100644 --- a/examples/dev_testing/src/main.cpp +++ b/examples/dev_testing/src/main.cpp @@ -1,6 +1,6 @@ #include "simpleengine/camera.h" #include "simpleengine/gfx/texture.h" -#include "simpleengine/shapes/2d/square.h" +#include "simpleengine/objects/2d/shapes/square.h" #include "simpleengine/vector.h" #include #include @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include @@ -21,37 +21,6 @@ CMRC_DECLARE(resource_shaders); #include -/* class Triangle3D : public simpleengine::shapes_2d::Triangle { -public: - glm::mat4 projection_matrix; - //glm::mat4 view_matrix; - - const float fov = 70; - const float near_plane = 0.1f; - const float far_plane = 1000.f; - - Triangle3D(simpleengine::gfx::Shader shader, std::vector vertices) : - simpleengine::shapes_2d::Triangle(shader, vertices) { - - projection_matrix = glm::perspective(glm::radians(fov), 640.f / 480.f, near_plane, far_plane); - - shader.use(); - shader.set_uniform_matrix_4f("projection_matrix", projection_matrix, false); - //shader.set_uniform_matrix_4f("view_matrix", view_matrix, false); - shader.unuse(); - } - - Triangle3D(std::shared_ptr shader_program, std::vector vertices) : - simpleengine::shapes_2d::Triangle(shader_program, vertices) { - - - } - - virtual void render(GLFWwindow* target) override { - - } -}; */ - std::string read_resource_shader(const std::string& path) { auto fs = cmrc::resource_shaders::get_filesystem(); cmrc::file vertex_file = fs.open(path); @@ -82,7 +51,7 @@ int main(int argc, char *argv[]) { { simpleengine::Vectorf(0.f, 0.5f, -1.f), glm::vec3(0.f, 0.f, 1.f), glm::vec2(0.5f, 1.0f) }, // top }; - auto tri = std::make_shared(base_shader_program, vertices); + auto tri = std::make_shared(base_shader_program, vertices); //tri->set_texture(wall_texture); game.add_event(tri); diff --git a/include/simpleengine/shapes/2d/square.h b/include/simpleengine/objects/2d/shapes/square.h similarity index 77% rename from include/simpleengine/shapes/2d/square.h rename to include/simpleengine/objects/2d/shapes/square.h index eb560cf..545192b 100644 --- a/include/simpleengine/shapes/2d/square.h +++ b/include/simpleengine/objects/2d/shapes/square.h @@ -12,20 +12,20 @@ #include -#include "../../renderable.h" -#include "../../vertex.h" -#include "../../transformable.h" -#include "../../optional.h" +#include "../../../renderable.h" +#include "../../../vertex.h" +#include "../../../transformable.h" +#include "../../../optional.h" -#include "../../gfx/vbo.h" -#include "../../gfx/vao.h" -#include "../../gfx/texture.h" -#include "../../gfx/shader.h" +#include "../../../gfx/vbo.h" +#include "../../../gfx/vao.h" +#include "../../../gfx/texture.h" +#include "../../../gfx/shader.h" #include #include -namespace simpleengine::shapes_2d { +namespace simpleengine::objects_2d::shapes { class Square : public simpleengine::Renderable, public simpleengine::Transformable { private: using super = simpleengine::Renderable; diff --git a/include/simpleengine/shapes/2d/triangle.h b/include/simpleengine/objects/2d/shapes/triangle.h similarity index 74% rename from include/simpleengine/shapes/2d/triangle.h rename to include/simpleengine/objects/2d/shapes/triangle.h index 49b5af6..423a7ab 100644 --- a/include/simpleengine/shapes/2d/triangle.h +++ b/include/simpleengine/objects/2d/shapes/triangle.h @@ -12,18 +12,18 @@ #include -#include "../../renderable.h" -#include "../../vertex.h" -#include "../../gfx/vbo.h" -#include "../../gfx/vao.h" -#include "../../gfx/shader.h" -#include "../../gfx/texture.h" -#include "../../optional.h" -#include "../../transformable.h" +#include "../../../renderable.h" +#include "../../../vertex.h" +#include "../../../gfx/vbo.h" +#include "../../../gfx/vao.h" +#include "../../../gfx/shader.h" +#include "../../../gfx/texture.h" +#include "../../../optional.h" +#include "../../../transformable.h" #include -namespace simpleengine::shapes_2d { +namespace simpleengine::objects_2d::shapes { class Triangle : public simpleengine::Renderable, public simpleengine::Transformable { private: gfx::Shader shader; // This only stores the shader program diff --git a/src/shapes/2d/square.cpp b/src/objects/2d/square.cpp similarity index 95% rename from src/shapes/2d/square.cpp rename to src/objects/2d/square.cpp index e12b887..ee4713a 100644 --- a/src/shapes/2d/square.cpp +++ b/src/objects/2d/square.cpp @@ -1,6 +1,6 @@ -#include "shapes/2d/square.h" +#include "objects/2d/shapes/square.h" -namespace simpleengine::shapes_2d { +namespace simpleengine::objects_2d::shapes { Square::Square(gfx::Shader shader, std::vector vertices, std::vector indicies) : super(nullptr), shader(shader), vertices(vertices), indicies(indicies), ebo(gfx::VBO(GL_ELEMENT_ARRAY_BUFFER, false)), vbo(gfx::VBO(GL_ARRAY_BUFFER, false)), diff --git a/src/shapes/2d/triangle.cpp b/src/objects/2d/triangle.cpp similarity index 95% rename from src/shapes/2d/triangle.cpp rename to src/objects/2d/triangle.cpp index 29da70b..549c61c 100644 --- a/src/shapes/2d/triangle.cpp +++ b/src/objects/2d/triangle.cpp @@ -1,6 +1,6 @@ -#include "shapes/2d/triangle.h" +#include "objects/2d/shapes/triangle.h" -namespace simpleengine::shapes_2d { +namespace simpleengine::objects_2d::shapes { Triangle::Triangle(gfx::Shader shader, std::vector vertices) : simpleengine::Renderable(nullptr), simpleengine::Transformable(glm::mat4(1.f)), shader(shader), vertices(vertices), vbo(gfx::VBO(GL_ARRAY_BUFFER, false)), texture(nonstd::nullopt) {