< Graphics | UserGuide


Scenenmanagement

There are two distinct scenemanagement systems in luxinia:

  • Actornodes ((:api:actornode::see api:))
  • Scenenodes ((:api:scenenode::see api:))

Both systems provide nodes that are just representations for the location and orientation in space, which can later be used by visual objects to determine their position where it should be drawn. This means that every node has its own matrix which holds the information on the position and rotation of the node.

Actornodes are used for dynamic objects and can be linked at physical simulated objects, so the node directly inherits the position of the physical object.

---% Code tested with Luxinia 0.98 build Jan 13 2008
---% at 01/14/08 19:46:23
---%  y

  -- create a new actor (will be in 0,0,0)
actor = actornode.new("actor")

  -- create a sphere primitive and link it 
  -- against the actor. The sphere will be 
  -- visible at the place of the actor
  -- We can store variables in actors etc.
actor.l3d = l3dprimitive.newsphere("sphere",1)
actor.l3d:linkinterface(actor)

  -- move actor (if camera is at 0,0,0 (default) 
  -- we should see the sphere then
actor:pos(0,200,0)

On the contrary, the scenenodes are used for static information and can have a hierarchy. This means, that nodes can be attached at other nodes and will be translated relative to the position of the parent node.


A hierarchical structure - each node inherits the position of the parent as its origin.

---% Code tested with Luxinia 0.95 build Nov 15 2006
---% at 11/16/06 22:48:14

  -- create a node at 0,100,0 
node = scenenode.new("scenenode",0,100,0)
child = scenenode.new("achild",0,0,10)
child:link(false,node) -- link against the parent

node:localrotdeg(45,30,0)

  -- create a sphere and link it agains the node 
  -- and store it in a variable of this scenenode
node.l3d = l3dprimitive.newsphere("sphere",1)
node.l3d:linkinterface(node)

child.l3d = l3dprimitive.newsphere("sphere",1)
child.l3d:linkinterface(child)

It is recommended to use the scenenodes for static geometry, since the frustum culling for static geometry is more accurate and cheaper.