diff --git a/engine/Consts.h b/engine/Consts.h index 5b17d4f..b46af7c 100644 --- a/engine/Consts.h +++ b/engine/Consts.h @@ -13,7 +13,7 @@ namespace Consts { const sf::Color BACKGROUND_COLOR = sf::Color(255, 255, 255); const std::string PROJECT_NAME = "engine"; const bool USE_LOG_FILE = true; - const bool USE_OPEN_GL = false; + const bool USE_OPEN_GL = true; const bool SHOW_COORDINATES = true; const double PI = 3.14159265358979323846264338327950288; diff --git a/engine/Matrix4x4.cpp b/engine/Matrix4x4.cpp index 7ded573..0b1e8ee 100644 --- a/engine/Matrix4x4.cpp +++ b/engine/Matrix4x4.cpp @@ -188,16 +188,6 @@ Matrix4x4 Matrix4x4::ScreenSpace(int width, int height) { return s; } -Matrix4x4 Matrix4x4::Model(const Matrix4x4 &transformMatrix, const Vec3D &position) { - Matrix4x4 M(transformMatrix); - - M._arr[0][3] = position.x(); - M._arr[1][3] = position.y(); - M._arr[2][3] = position.z(); - - return M; -} - Matrix4x4 Matrix4x4::View(const Vec3D &left, const Vec3D &up, const Vec3D &lookAt, const Vec3D &eye) { Matrix4x4 V = Zero(); diff --git a/engine/Matrix4x4.h b/engine/Matrix4x4.h index 263b70d..43563fd 100644 --- a/engine/Matrix4x4.h +++ b/engine/Matrix4x4.h @@ -38,7 +38,6 @@ public: Matrix4x4 static RotationZ (double rz); Matrix4x4 static Rotation (const Vec3D& v, double rv); - Matrix4x4 static Model(const Matrix4x4& transformMatrix, const Vec3D &position); Matrix4x4 static View(const Vec3D &left, const Vec3D &up, const Vec3D &lookAt, const Vec3D &eye); Matrix4x4 static Projection (double fov = 90.0, double aspect = 1.0, double ZNear = 1.0, double ZFar = 10.0); Matrix4x4 static ScreenSpace (int width, int height); diff --git a/engine/Object.h b/engine/Object.h index 07c3b95..f3380aa 100644 --- a/engine/Object.h +++ b/engine/Object.h @@ -39,7 +39,7 @@ private: Vec3D _angleLeftUpLookAt{0, 0, 0}; public: explicit Object(ObjectNameTag nameTag) : _nameTag(std::move(nameTag)) {}; - explicit Object(const Object& object) : _nameTag(object.name()), _transformMatrix(object.model()) {}; + Object(const Object& object) : _nameTag(object.name()), _transformMatrix(object.model()) {}; // TODO: add transform(const Matrix4x4& t) // TODO: add transformRelativePoint(const Vec3D &point, const Matrix4x4& transform) @@ -71,7 +71,7 @@ public: [[nodiscard]] ObjectNameTag name() const { return _nameTag; } - [[nodiscard]] Matrix4x4 model() const { return Matrix4x4::Model(_transformMatrix, _position); } + [[nodiscard]] Matrix4x4 model() const { return Matrix4x4::Translation(_position) * _transformMatrix; } // OpenGL function [[nodiscard]] GLfloat* glModel() const; diff --git a/img/opengl.png b/img/opengl.png index 4269c34..fb4bee3 100644 Binary files a/img/opengl.png and b/img/opengl.png differ