Graphics Reference
In-Depth Information
Matrix4& Scalef( float, float, float );
Matrix4& Translatef( float, float, float );
The default constructor sets the matrix to identity, but you can also
explicitly do that with the LoadIdentity( ) method.
There are many operator overloads, so that you can use matrices in
expressions, such as
Matrix4 R;
R.Rotatef( 30., 1., 0., 0. );
Matrix4 T;
T.Translatef( 2., 3., 4. );
Matrix4 P = R * T;
Many of these methods return a reference to the result so that they can be
chained together, like this:
Matrix4 Comp;
Comp.LoadIdentity( ).Translatef(-A,-B,-C).Scalef(3.,4.,1.).
Translatef(A,B,C).Print(“Composite = “);
These operations are evaluated left-to-right.
Here are some examples of using the Matrix4 class:
#include “matrix4.h”
Matrix4 I;
I.Print( “I = “ );
Matrix4 R;
R.Rotatef( 30., 1., 0., 0. );
R.Print( “R = “ );
Ovals->SetUniform( “uModelMatrix”, R );
Matrix4 T;
T.Translatef( 2., 3., 4. );
T.Print ( “T = “ );
Matrix4 P = R * T;
P.Print( “P1 = “ );
P = T * R;
P.Print( “P2 = “ );
Matrix4 RI = R;
Search WWH ::




Custom Search