Introduce Math.hpp and use typedef to make replacing glm with something else in the future simpler

This commit is contained in:
2020-10-27 23:25:26 +01:00
parent c219fc3778
commit 78d24fbe41
16 changed files with 268 additions and 181 deletions

View File

@@ -25,7 +25,7 @@ namespace openVulkanoCpp::Scene
void Node::Init()
{
if (parent || scene || !children.empty() || !drawables.empty()) throw std::runtime_error("Node already initialized");
localMat = worldMat = glm::mat4x4(1);
localMat = worldMat = Math::Matrix4f(1);
enabled = true;
}
@@ -79,13 +79,13 @@ namespace openVulkanoCpp::Scene
Utils::Remove(drawables, drawable);
}
void Node::SetMatrix(glm::mat4x4 mat)
void Node::SetMatrix(const Math::Matrix4f& mat)
{
localMat = mat;
UpdateWorldMatrix(parent ? parent->GetWorldMatrix() : glm::mat4x4(1));
UpdateWorldMatrix(parent ? parent->GetWorldMatrix() : Math::Matrix4f(1));
}
void Node::UpdateWorldMatrix(const glm::mat4x4& parentWorldMat)
void Node::UpdateWorldMatrix(const Math::Matrix4f& parentWorldMat)
{
worldMat = parentWorldMat * localMat;
for (const auto& node : children)