Jump to content

No traditional DAG style scene graph?


BlackMojito
 Share

Recommended Posts

Hi Folks,

It seems that in Babylon we don't have any traditional scene graph. All the meshes are directly added to the scene? I know that  we can create a mesh which is attached to a Node. But it seems that there no API for adding/removing Nodes in the Scene? I am really confused...

Thanks

Link to comment
Share on other sites

Hi X.

First, what a great question you have.  I was looking around the web... seeing if there was a "universal" add-on scene graph.  Slim pickin's (not much found).

Do you think we would need multiple parent feature... to code-up a DAG? 

Anyway, I shouldn't even be commenting because this is a "big boy question"  :)

Definition:  Dag - The term for a 'dog' in Buck Rogers TV show.  :)

Link to comment
Share on other sites

1 hour ago, Wingnut said:

Hi X.

First, what a great question you have.  I was looking around the web... seeing if there was a "universal" add-on scene graph.  Slim pickin's (not much found).

Do you think we would need multiple parent feature... to code-up a DAG? 

Anyway, I shouldn't even be commenting because this is a "big boy question"  :)

Definition:  Dag - The term for a 'dog' in Buck Rogers TV show.  :)

Hum...but why there isn't a class like GroupNode? And why there aren't traditional member functions in Scene called root() which returns a Node? 

Link to comment
Share on other sites

26 minutes ago, fenomas said:

The scene object just keeps an array of all meshes in the scene. When you create a mesh it gets added automatically, but you can remove it by splicing it out of scene.meshes.

OK. If I understand correctly, Meshes are always direct children of Scene. There cannot be something like GroupNode between Scene (Root) and Meshes?

Basically the attached image is what I would like to have. The application needs to be able to import multiple models. I would like to have a Node which group all its Meshes so that it is easier to manage. Otherwise I need to use a array to track virtually all the meshes of a certain model. Isn't it possible with Babylon? It is really something very very basic...

Thanks

SceneGraph.png

Link to comment
Share on other sites

Hi, @xuchen_shadow 

I believe it is build up as it is now because not everyone has the same needs,
with the current set-up, it allows developers to manage their assets exactly how they'd like to without over-complicating things or adding un-needed steps (for some)

While i'm not 100% sure i understand exactly what you mean,

i hope this is it :)  See lines 42 -> 46
http://playground.babylonjs.com/#IS1X57
 

Link to comment
Share on other sites

3 minutes ago, aWeirdo said:

Hi, @xuchen_shadow 

I believe it is build up as it is now because not everyone has the same needs,
with the current set-up, it allows developers to manage their assets exactly how they'd like to without over-complicating things or adding un-needed steps (for some)

While i'm not 100% sure i understand exactly what you mean,

i hope this is it :)  See lines 42 -> 46
http://playground.babylonjs.com/#IS1X57
 

Hi aWeirdo,

This is all what I need. Thanks a lot!

Link to comment
Share on other sites

1 hour ago, Deltakosh said:

With our system you can even have multiple roots and hierarchy.

Oh man.  :)  Multiple hierarchies?  Ok, but, these hierarchies would be user-defined, and not (necessarily/automatically) use .parent or inherit transforms from parentNode.mesh, right?

In other words... the programmer determines IF transforms (position, rotation, scale) are passed-down through the programmer-coded hierarchy?

If a nodeMesh is a node/leaf on 2 or more "trees" at the same time... it COULD inherit transforms from 2 or more parentNodeMesh... IF the programmer decided to allow that (and process it)? 

Collections of collections of collections.  I wonder if we could "borrow" an htmlCollection... but fill it with BJS nodes instead of html nodes, and then we get all those fun commands like nextSibling, parentNode, firstChild, lastChild, etc... already coded FOR us.  hmmm. 

Oh wait... those are methods on a document-class obj, not on an htmlCollection class.  Crap.  hmm.

Ow!  My brain hurts.  heh

Link to comment
Share on other sites

Arte, you're always SO nice to me... God bless ya.  You love me even if/when I say stupid things.  :) 

I've been seeing you "out there" helping on forum Q&A too, and I don't know if I ever PM'd you to thank you for your help.  So, thank you for helping, Arte... and for your kindness.

Back on-subject, there's GOT TO BE a JS "treeManager" or something like that.  I'm going searching... just for fun.  Code stealing time!  JS NodeTree.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...