#include <buitre/math/math.hpp>#include <iostream>#include <iomanip>using namespace BuitreEngine::Math;void correct(BeMatrix4& matrix){ matrix(2,0) *= -1.0f; matrix(2,1) *= -1.0f; matrix(2,3) *= -1.0f; matrix(0,2) *= -1.0f; matrix(1,2) *= -1.0f; matrix(3,2) *= -1.0f;}void correct(BeVector3& v){ v.z() *= 1.0f;}int main(){ BeMatrix4 a = BeMatrix4::ZRot(4.2f) * BeMatrix4::Translation(BeVector3(3, 1, 5)); BeMatrix4 b = BeMatrix4::XRot(2.2f) * BeMatrix4::YRot(1.0f); BeMatrix4 scale = BeMatrix4::Scale(BeVector3(1,1,-1)); BeVector3 vertex(2.5f, -304.1f, 589.21f); BeMatrix4 c = a; BeMatrix4 d = b; BeVector3 vertex2 = vertex; correct(c); correct(d); correct(vertex2); std::cout << "vertex: \n" << vertex << std::endl; std::cout << "vertex * (a * b): \n" << vertex * (a * b) << std::endl; std::cout << "vertex2 * (c * d): \n" << vertex2 * (c * d) << std::endl;}
Which outputs:
vertex: 2.5 -304.1 589.21vertex * (a * b): -335.88 -567.46 97.207vertex2 * (c * d): 247.68 385.29 -471.91
operator*(BeVector3 const&, BeMatrix4 const&) just transforms the vector by the matrix.
Any idea?