Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

vanillacoke

matrices

This topic is 5638 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

For those of you who code without the assistance of a graphics API, would you care to help me out a bit with matrices? I''m wondering how people usually implement matrices in their systems. I have a 4x4 matrix struct, and overloaded + and * operators right now. I think it works as I need it to, but I''m wondering how others have done it.

Share this post


Link to post
Share on other sites
Advertisement
I don''t know what you really want, but I designed my matrix class to work with DirectX, but I suspect you could talor it to mix with others as well. This is what I am currently using...

void scale( double a );
void scale( double sx= 1, double sy= 1, double sz= 1, double sw= 1 );
void rotate( double x, double y, double z );
void translate( double x, double y, double z );
void perspective( double v, double h, double near, double far );
void perspectiveFov( double fov, double aspect, double zn, double zf );
void perspectivePrism( double xmin, double xmax, double ymin, double ymax, double zn, double zf );
void viewport( Vector eye, Vector at, Vector up );
void ortho( double w, double h, double zn, double zf );
void orthoPrism( double xmin, double xmax, double ymin, double ymax, double zn, double zf );
Matrix identity( void );
Matrix inverse( void );

Matrix operator + (Matrix m);
Matrix operator - (Matrix m);
Matrix operator * (Matrix m);

This is for no reason all that you would need.

Share this post


Link to post
Share on other sites
You should take a look at how DirectX does it, and the "extra" part that takes advantage of C++ functions (I forgot its name)

Share this post


Link to post
Share on other sites
You can open the D3DX (the helper library) header files at your leasure.

I''ve checked once, and there wasn''t any particular trick. They just did the obvious, but didn''t overload the * operator, because the temporaries created would have slowed down the calculations, I think.

Cédric

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!