Archived

This topic is now archived and is closed to further replies.

Storing Object Hierarchies?

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

Okay, I was just wondering the best way to go about storing massive amounts of geometry data on an object by object level, with each object having its specified vertices. Should I use a linked list so that I can be dynamic and memory efficent, or will the traverses slow down performance? Should it be just a simple list of structs? Any ideas? (this is a 3d engine by the way )

Share this post


Link to post
Share on other sites
A linked-list transversal at the vertex level would absolutely wreck performance.
A vertex buffer (which is an array) or a section of a larger vertex buffer for all the geometry, and a heirarchy of structures with index pointers into that vb for various components would get you on your way. You could consider some sort of collection-like list/map for the IndexBuffers for enhanced flexiblity (at the cost of performance).

This is how I would start at it...
  
struct IndexBuffer
{
int iBegin; //Starting VertexBuffer index

int iEnd; //Ending VertexBuffer index

};

struct BiPed
{
IndexBuffer LeftUpperArm;
IndexBuffer LeftLowerArm;
IndexBuffer Head;
IndexBuffer UpperTorso;
//...

};


Magmai Kai Holmlor

"Oh, like you''ve never written buggy code" - Lee

"What I see is a system that _could do anything - but currently does nothing !" - Anonymous CEO

Share this post


Link to post
Share on other sites
Yes I agree with you, a linked list at the vertex level would be insane; however, I meant a linked list where all the nodes stood for one object and under the node would be a vertex buffer (or maybe indice pointers?), average z value, average radius, etc... Would this be an acceptable means of storing geometry data?
Thanks,
-Jesse

Share this post


Link to post
Share on other sites
Oh sure, that would be a trivial quadtree (only one quad for the whole world). At some point you have to do that - where is the question.
I'd recommend that max radius from the center as well (for collision detection).

BTW, collision dectection runs a 3D engine - nearly everything you need to do will require a tranversal of the world to detect a collision (or lack there-of). So making that transversal fast is important - which is way people use things like quad/oct-trees and bsp-trees(when appro.) instead of simple list.

A list of objects will get you started though.

Edited by - Magmai Kai Holmlor on December 9, 2001 4:05:16 PM

Share this post


Link to post
Share on other sites