Sign in to follow this  
Nickie

Vertex & Index Buffer

Recommended Posts

Hello,
So I've recently been writing my scene graph and one question came in my mind...
All books I have ever read use directly LPDIRECT3D.....BUFFER objects in the node. But what will happen if there are 2 node with the same mesh?
So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?
Shoud I create my own mesh manager? (I have already got resource cache which can load zip files and manage used memory for assets)

Share this post


Link to post
Share on other sites
[quote name='Nickie' timestamp='1343663114' post='4964521']
So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?
[/quote]

No. If you make the 2 vertex buffers with the same contents, you'll waste memory. It's up to you to somehow share the mesh data among the different objects in your scene. Having the objects reference a mesh and using a resource manager to make sure each mesh only gets loaded once is a pretty common way of solving this sort of problem.

Share this post


Link to post
Share on other sites
[quote name='MJP' timestamp='1343672497' post='4964571']
[quote name='Nickie' timestamp='1343663114' post='4964521']
So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?
[/quote]

No. If you make the 2 vertex buffers with the same contents, you'll waste memory. It's up to you to somehow share the mesh data among the different objects in your scene. Having the objects reference a mesh and using a resource manager to make sure each mesh only gets loaded once is a pretty common way of solving this sort of problem.
[/quote]

Thats what I needed. Thanks.
Now I just need to make a std::list of all meshes and link them with a string(the name of the file). My resource cache is optimized for getting resources from name so I can easily locate the original data and build when needed or just access. Thanks, again!

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