ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperLicht
Nesting scene nodes
Author Text

debuggeek
Registered User
Quote
2019-02-27 21:53:11

I'm trying to understand the pattern for nesting scene nodes such that you want a parent scene node to Visible all child nodes.

This appears to be the purpose of SceneNode, but it's not concrete so one wanted to create a new Node that extends SceneNode would it just need to override the scene node functions and iterate over it's children for any scene node call?

I'm working on coding this up now, but thought I'd ask unless I have a conceptual misunderstanding


debuggeek
Registered User
Quote
2019-03-01 18:40:35

Seemed to have found what I was doing wrong but don't claim to understand it.

I needed to add the Parent SceneNode to the Scene before adding children scene nodes to the parent. Otherwise I would get:

Uncaught TypeError: Cannot read property 'getCurrentRenderMode' of null

Anyone able to help explain to me why?


shoottheluck
Registered User
Quote
2019-03-11 20:16:02

Hi debuggeek,

Did you figure this one out already? I think I can answer, but someone else chime in if I'm off the mark.

Like you found, "parent" nodes and "children" nodes need to be added to the scene.RootNode in descending order because the .addChild method sets the this.scene property of the child node to be that of the parent.

The error you describe shows as "TypeError: this.scene is null" in FireFox and it's coming from trying to render a child node that was added to a parent that didn't have a "this.scene" property. The parent's was null when you added the child, so (unless you set it another way) it's null for the child now too.

Other than that, a parent SceneNode works as expected to set the visibility (or position, or scale, etc) of child nodes. And child nodes can be then be parent nodes for more child nodes...


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Forum Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   





Software: Ambiera Light Forum. © 2008-2019 Nikolaus Gebhardt, Ambiera e.U.