Sign in to follow this  
ShahzadAli

view Matrix as static class , is it possible?

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this