Jump to content
  • Advertisement
Sign in to follow this  
ShahzadAli

view Matrix as static class , is it possible?

This topic is 2245 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

Is it possible?
we have a class name ViewMatrix suppose and it have got a Matrix as member and some other functions. I want to make it static , I will update this matrix member using it's function update and will get it's value using get function or simply viewMatrix.matrix ...
I don't have to keep a seperate copy of view matrix for each point I am rendering on screen ( Actually I will be rendering thousands of points at same time ) .. no object will be created for this class this way too ...

Share this post


Link to post
Share on other sites
Advertisement
I think that view matrix makes more sense as a member of a Camera class, together with projection matrix. This class then can have methods to build these two matrices, depending on type of the camera.
You can have a hierarchy of camera types, for example an abstract class Camera having view and proj matrices as members and pure virtual methods BuildProj() and BuildView(). Then two abstract subclasses OrthoCamera and PerspectiveCamera, each of them with its own implementation of BuildProj().
And finaly subclasses like for example OrbitCamera, FPSCamera etc etc, each with its own implemenation of BuildView().

But of course it depends all on you, it's your code. That's just my suggestion. Btw I hope the suggestion makes sense, I pulled it out of my head :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!