Jump to content
  • Advertisement
Sign in to follow this  
poigwym

Render comopnent

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

I'm going to implement render component , aiming to render model, skybox , billboard, decal...... in same render queue. Render queue holds RenderItem.

Everything   are inherit from RenderComponent.

 

 

struct RenderItem 
{

   Geometry *geo;

   Shader *shader;

   //cbuffers    ,,,,,,,   not sure  
};

 

struct Entity 
{

   RenderComponent *comp;

};

 

struct RenderComponent 
{

    virtual RenderItem  getRenderItem();   // specific render component know how to extract RenderItem

};

 

struct Skybox : public RenderComponent

{

  virtual RenderItem  getRenderItem();     

};

 

 

Here comes questions.

1) How to extract RenderComponent to RenderItem in a clean way ??  virtual  function seems not clean somewhat.

2) Since building render data is separate from rendering,  Every render item should has it's own cbuffers ??

  component itself doesn't know what the actual shader look like. how can it build cbuffer ?

 

 

 

 

 

 

 

 

 

 

   

 

 

Share this post


Link to post
Share on other sites
Advertisement
1) Could you elaborate why you think that virtual functions should not be used here. In my opinion it makes sense to have a unified interface for all rendercomponents when adding them to your queue.
2) The render component should know which shader it uses. Otherwise there is no point in having different components. For example for a skybox you know that it needs different shaders than a regular mesh. So the component should be responsible for initialising the item correctly.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!