Jump to content
  • Advertisement
Sign in to follow this  
Endar

Scenegraphs

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

Here's one of the nodes in my fledging scenegraph.
class CGeometryNode
{
public:
	void render()
	{
		// render the geometry
	}


};

Now, just say I have an object of type "Character" with a nice model that goes with it. If I wanted to render an object of type character, would I have to have Character inherit from CGeometryNode ? Or would I have a pointer to a character object inside the CGeometryNode class?

Share this post


Link to post
Share on other sites
Advertisement
Deriving Character from CGeometryNode is definitely the better of the two. The other choice has problems with dependencies. Another possibility is for Character to contain or point to a CGeometryNode.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Containing a pointer, perhaps boost::shared_ptr, to a graphical representation could be a good idea. Then you can easily share, instantiated geometry, graphical representations with multiple entities in your scene. Just make them point to the same thing.


// ville

Share this post


Link to post
Share on other sites
Honestly, it's your choice. Personally, I keep the geometry data linked to the other data. Basically, I would have a Character class with AI data in it and AI functions. It would have a pointer to a CGeometryNode though, which is it's 3d data. It can load and delete that. Therefore, when my scenegraph runs around, it's more clear to determine what's what.

Share this post


Link to post
Share on other sites
In this case (entity that is represented by some geometry) I'd definetly use the pointer approach instead of the inheritance one.
This is because you'll later want to have various entities/characters that uses the same exact geometry, with different matrixes (sp?), different materials etc, if, in this case, you had used the inheritance approach imagine how many copies you'd have of the same geometry...

entity/character with pointer to geometry is definitely the way to go.

Share this post


Link to post
Share on other sites
In my opinion nowerdays' scenegraphs are overused and misused

here is an article i found on google a while back which explains why i am biased about todays scenegraph implementations

http://www.realityprime.com/scenegraph.php

i personally think people put too much effort into created a good scenegraph and forget the roots of those graphs

the generalization of scenegraph usage tends to make them computitional too expensive in my opinion


i prefer other structures to handle object managements

hierarchical trees for culling

n ary trees to represent relations between objects
e.g.: soldiers on a truck

geometry is keep seperated from the objects as already suggested above


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!