Huge refactoring v3
parent
8b37920713
commit
b7555431de
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
BIN
img/opengl.png
BIN
img/opengl.png
Binary file not shown.
Before Width: | Height: | Size: 811 KiB After Width: | Height: | Size: 805 KiB |
Loading…
Reference in New Issue