Original Post
Hello,
in my 3D Engine I have a class SceneObject for scene objects. Now I wonder whats a good solution to handle the positioning/orientation of such objects.
Currently the class has three Vector3 members: mScale, mRotate, mTranslate with according setters/getters like setScale(), setRotate() etc.
It also has a method getWorldMatrix(), with computes the final world matrix (if dirty) like this:
Matrix4 worldMat = scaleMat * xRotationMat * yRotationMat * zRotationMat * translationMat;
The 5 matrices are build from the data vectors mScale, mRotate and mTranslate and as you can see the order is always S*R*T.
Do you think this design is good? Should I stick with this fixed S*R*T order or should I switch to a more general interface like setWorldMatrix(const Matrix& m) to let the user set an arbitrary matrix?
in my 3D Engine I have a class SceneObject for scene objects. Now I wonder whats a good solution to handle the positioning/orientation of such objects.
Currently the class has three Vector3 members: mScale, mRotate, mTranslate with according setters/getters like setScale(), setRotate() etc.
It also has a method getWorldMatrix(), with computes the final world matrix (if dirty) like this:
Matrix4 worldMat = scaleMat * xRotationMat * yRotationMat * zRotationMat * translationMat;
The 5 matrices are build from the data vectors mScale, mRotate and mTranslate and as you can see the order is always S*R*T.
Do you think this design is good? Should I stick with this fixed S*R*T order or should I switch to a more general interface like setWorldMatrix(const Matrix& m) to let the user set an arbitrary matrix?