diff options
| author | Mel <einebeere@gmail.com> | 2023-08-06 04:27:07 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2023-08-06 04:27:07 +0200 |
| commit | 5a1b126f1f6d55226c2b5068d0c17c428fd29ba8 (patch) | |
| tree | 3acc0240cd8dedd0764eeae6df04e134b04584c8 /src/Transform.hpp | |
| parent | e6f5f9e03f673db796f1babb308609ca2576db2f (diff) | |
| download | meowcraft-5a1b126f1f6d55226c2b5068d0c17c428fd29ba8.tar.zst meowcraft-5a1b126f1f6d55226c2b5068d0c17c428fd29ba8.zip | |
Create separate Player entity and add bad collision system
Diffstat (limited to 'src/Transform.hpp')
| -rw-r--r-- | src/Transform.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Transform.hpp b/src/Transform.hpp new file mode 100644 index 0000000..ea7f9b3 --- /dev/null +++ b/src/Transform.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include "Math/Rotation.hpp" +#include "World/Position.hpp" + +namespace MC { + +class Transform { +public: + Transform() : m_scale(1) {} + explicit Transform(Position::World position) : m_position(position), m_scale(1) {} + Transform(Position::World position, Rotation rotation, Vector<3> scale) + : m_position(position), + m_rotation(rotation), + m_scale(scale) {} + + Vector<3> forward() const; + Vector<3> right() const; + Vector<3> up() const; + + Position::World& position() { return m_position; } + const Position::World& position() const { return m_position; } + + Rotation& rotation() { return m_rotation; } + const Rotation& rotation() const { return m_rotation; } + + Vector<3>& scale() { return m_scale; } + const Vector<3>& scale() const { return m_scale; } +private: + Vector<3> unit_vector(Vector<3> axis) const; + + // TODO: Use a non-MC::World position class. + // I don't want coupling between the game implementation + // and what is essentially engine code. + Position::World m_position; + Rotation m_rotation; + Vector<3> m_scale; +}; + +} |
