diff --git a/engine/src/renderer/entities/Entity.cpp b/engine/src/renderer/entities/Entity.cpp deleted file mode 100644 index 548d799..0000000 --- a/engine/src/renderer/entities/Entity.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -// Created by sebastian on 29.07.26. -// - -#include "Entity.h" - - - -engine::Entity::Entity(std::shared_ptr model, glm::vec3 position, glm::vec3 rotation, - glm::vec3 scale) : m_model(std::move(model)), m_position(position), m_rotation(rotation), m_scale(scale) { -} - -glm::mat4 engine::Entity::getModelMatrix() const { - auto modelMatrix = glm::mat4(1.0f); - modelMatrix = glm::translate(modelMatrix, m_position); - modelMatrix = glm::rotate(modelMatrix, glm::radians(m_rotation.x), {1.0f, 0.0f, 0.0f}); - modelMatrix = glm::rotate(modelMatrix, glm::radians(m_rotation.y), {0.0f, 1.0f, 0.0f}); - modelMatrix = glm::rotate(modelMatrix, glm::radians(m_rotation.z), {0.0f, 0.0f, 1.0f}); - modelMatrix = glm::scale(modelMatrix, m_scale); - return modelMatrix; -} diff --git a/engine/src/renderer/entities/Entity.h b/engine/src/renderer/entities/Entity.h deleted file mode 100644 index a01c416..0000000 --- a/engine/src/renderer/entities/Entity.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Created by sebastian on 29.07.26. -// - -#ifndef COLORRACE_ENTITY_H -#define COLORRACE_ENTITY_H -#include - -#include "../model/RawModel.h" -#include -#include - -namespace engine { - class Entity { - public: - explicit Entity(std::shared_ptr model, - glm::vec3 position = {0.0f, 0.0f, 0.0f}, - glm::vec3 rotation = {0.0f, 0.0f, 0.0f}, - glm::vec3 scale = { 1.0f, 1.0f, 1.0f}); - - void setPosition(glm::vec3 position) { m_position = position; }; - void setRotation(glm::vec3 rotation) { m_rotation = rotation; }; - void setScale(glm::vec3 scale) {m_scale = scale; }; - - [[nodiscard]] const glm::vec3& getPosition() const { return m_position; }; - [[nodiscard]] const glm::vec3& getRotation() const { return m_rotation; }; - [[nodiscard]] const glm::vec3& getScale() const { return m_scale; }; - - glm::mat4 getModelMatrix() const; - RawModel& getModel() const { return *m_model; } - - void increasePosition(glm::vec3 offset) { m_position += offset; } - void increaseRotation(glm::vec3 offset) { m_rotation += offset; } - void increaseScale(glm::vec3 offset) { m_scale += offset; } - - private: - std::shared_ptr m_model; - glm::vec3 m_position; - glm::vec3 m_rotation; - glm::vec3 m_scale; - }; - -} - -#endif //COLORRACE_ENTITY_H diff --git a/engine/src/renderer/model/RawModel.cpp b/engine/src/renderer/model/RawModel.cpp deleted file mode 100644 index 313f1e3..0000000 --- a/engine/src/renderer/model/RawModel.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by sebastian on 29.07.26. -// - -#include "RawModel.h" -using namespace engine; - -RawModel::RawModel(std::unique_ptr vao, int vertexCount, bool isIndexed) : m_vao(std::move(vao)), m_vertexCount(vertexCount), m_isIndexed(isIndexed) {} - -RawModel::RawModel(std::unique_ptr vao, int vertexCount) : RawModel(std::move(vao), vertexCount, false) {} - -void RawModel::bind() const { - m_vao->bind(); -} - -void RawModel::unbind() const { - m_vao->unbind(); -} - -void RawModel::draw() const { - if (m_isIndexed) { - glDrawElements(GL_TRIANGLES, m_vertexCount, GL_UNSIGNED_INT, nullptr); - } else { - glDrawArrays(GL_TRIANGLES, 0, m_vertexCount); - } -} \ No newline at end of file diff --git a/engine/src/renderer/model/RawModel.h b/engine/src/renderer/model/RawModel.h deleted file mode 100644 index 3a39610..0000000 --- a/engine/src/renderer/model/RawModel.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by sebastian on 29.07.26. -// - -#ifndef COLORRACE_RAWMODEL_H -#define COLORRACE_RAWMODEL_H -#include - -#include "utils/openglWrapper/openglObjects/Vao.h" - -namespace engine { - class RawModel { - public: - RawModel(std::unique_ptr vao, int vertexCount, bool isIndexed); - RawModel(std::unique_ptr vao, int vertexCount); - - void bind() const; - void unbind() const; - void draw() const; - - int getVertexCount() const { return m_vertexCount; } - bool isIndexed() const { return m_isIndexed; } - private: - std::unique_ptr m_vao; - int m_vertexCount; - bool m_isIndexed; - }; - -} - - -#endif //COLORRACE_RAWMODEL_H diff --git a/engine/src/renderer/primitives/CubeFactory.cpp b/engine/src/renderer/primitives/CubeFactory.cpp deleted file mode 100644 index cb7469f..0000000 --- a/engine/src/renderer/primitives/CubeFactory.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by sebastian on 29.07.26. -// - -#include "CubeFactory.h" - -std::shared_ptr engine::CubeFactory::createCube() { - float vertices[] = { - -0.5f, -0.5f, 0.5f, // 0 - 0.5f, -0.5f, 0.5f, // 1 - 0.5f, 0.5f, 0.5f, // 2 - -0.5f, 0.5f, 0.5f, // 3 - -0.5f, -0.5f, -0.5f, // 4 - 0.5f, -0.5f, -0.5f, // 5 - 0.5f, 0.5f, -0.5f, // 6 - -0.5f, 0.5f, -0.5f, // 7 - }; - - unsigned int indices[] = { - 0, 1, 2, 2, 3, 0, // front - 1, 5, 6, 6, 2, 1, // right - 5, 4, 7, 7, 6, 5, // back - 4, 0, 3, 3, 7, 4, // left - 3, 2, 6, 6, 7, 3, // top - 4, 5, 1, 1, 0, 4, // bottom - }; - - auto vao = Vao::create(); - - std::vector> attribs; - attribs.push_back(std::make_unique(0)); - vao->initDataFeed(vertices, sizeof(vertices), GL_STATIC_DRAW, std::move(attribs)); - - vao->createIndexBuffer(indices, 36); - vao->unbind(); - - return std::make_shared(std::move(vao), 36, true); -} diff --git a/engine/src/renderer/primitives/CubeFactory.h b/engine/src/renderer/primitives/CubeFactory.h deleted file mode 100644 index b573c74..0000000 --- a/engine/src/renderer/primitives/CubeFactory.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// Created by sebastian on 29.07.26. -// - -#ifndef COLORRACE_CUBEFACTORY_H -#define COLORRACE_CUBEFACTORY_H -#include "renderer/model/RawModel.h" - - -namespace engine::CubeFactory { - std::shared_ptr createCube(); -} - - - -#endif //COLORRACE_CUBEFACTORY_H