• Advertisement
Sign in to follow this  

Looking for advice to construct class structure for efficiency

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

So I have a base class of "actors" that will be drawn to the screen,which includes basic stuff like vertex,index buffers,some data types,information about geometry(index vertex count etc.). So here's my question:

 

Should I pass ID3D11Device* and ID3D11DeviceContext* to classes derived from base class and simply let this classes handle all rendering by themselves in a method such as virtual void Render( ID3D11DeviceContext* ),

 

or

 

Should I create a renderer class which takes this derived classes and their data and implement their rendering logic?

 

or better suggestions? I am building a huge project and I have never been worried about efficiency so I need your help.

Edited by arkenthe

Share this post


Link to post
Share on other sites
Advertisement

I am with L. Spiro here, the renderer should not have to know anything about how a model will be rendered, instead he will know about how are all the stuff in the world rendered:

 

1. Order of the models and the type being rendered ( fe: First the non alpha. then alpha models )

2. which effects are being applied and in which order.

3. Post effects applied

 

It is like a mix of multiplexor, manager and organizer system.

 

Hope it helps.

Share this post


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

  • Advertisement