Matrix4x4f Matrix4x4f::translateMatrix(const Vec3f translation) { Matrix4x4f translateMatrix; translateMatrix.setIdentity(); translateMatrix.set(3, 0, translation.x); translateMatrix.set(3, 1, translation.y); translateMatrix.set(3, 2, translation.z); return translateMatrix; }
Matrix4x4f Matrix4x4f::scaleMatrix(const Vec3f &scale) { Matrix4x4f scaleMatrix; scaleMatrix.setIdentity(); scaleMatrix.set(0, 0, scale.x); scaleMatrix.set(1, 1, scale.y); scaleMatrix.set(2, 2, scale.z); return scaleMatrix; }
Matrix4x4f Matrix4x4f::rotateMatrixZ(float angle) { float cosOfAngle = std::cosf(angle); float sinOfAngle = std::sinf(angle); Matrix4x4f rotationMatrix; rotationMatrix.setIdentity(); rotationMatrix.set(0, 0, cosOfAngle); rotationMatrix.set(1, 0, sinOfAngle); rotationMatrix.set(0, 1, -sinOfAngle); rotationMatrix.set(1, 1, cosOfAngle); return rotationMatrix; }
Matrix4x4f Matrix4x4f::identityMatrix() { Matrix4x4f identity; identity.setIdentity(); return identity; }