how to add nodes to the model?

20 views
Skip to first unread message

Kamil Dworakowski

unread,
Dec 4, 2011, 9:20:00 PM12/4/11
to SceneJS
Hi,

How do I add a geometry node to the graph and have it display. I tried
add('node', geometry) on the node selector pointing to a parent node,
but the geometry did not show up.

Kamil

Lindsay Kay

unread,
Dec 5, 2011, 10:11:58 AM12/5/11
to sce...@googlegroups.com
Can you post a code snippet showing the parent and child nodes? Hard
to know what's going wrong without more context..

Eric Brunet

unread,
Dec 5, 2011, 2:43:39 PM12/5/11
to sce...@googlegroups.com
I will also be verry happy If Someone could post a simple working exemple using messages to add and delete nodes...  :)

Tanks

Kamil Dworakowski

unread,
Dec 9, 2011, 10:46:36 PM12/9/11
to SceneJS
I made a minimal example and voila, it worked. It did not work in my
own code because i was erroneously passing an array of nodes rather
than just one geometry node.

Kamil Dworakowski

unread,
Dec 9, 2011, 10:49:06 PM12/9/11
to SceneJS
Eric, it is very simple:

var child = {
type: "geometry",
primitive:"triangles",
positions : [-5,0,0, 0,0,0, -5,5,0],
normals: [1,1,1, 1,1,1, 1,1,1],
indices: [0,1,2]
}

scene.findNode('parent-id').add('node', child);

The parent can be a material node.

Reply all
Reply to author
Forward
0 new messages