Vertex & Index Buffer

Started by
1 comment, last by Nickie 11 years, 9 months ago
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)
Advertisement

So is direct3d checking if there are more then one buffers with same content and is there memory which is being waste?


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


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!

This topic is closed to new replies.

Advertisement