How to define new scenegraph
by Playware · in Torque Game Builder · 03/14/2007 (8:40 pm) · 3 replies
Hi,
How I can define new scenegraph for either level or Gui otherthan default t2dSceneGraph.
If any help is for me, it is appreciated.
thnx.
How I can define new scenegraph for either level or Gui otherthan default t2dSceneGraph.
If any help is for me, it is appreciated.
thnx.
About the author
#2
GUI Controls don't need a scenegraph to be rendered, they are rendered on the Canvas. t2dSceneWindow is a special GUI Control that renders a scene to the Canvas. The scene it renders is defined by a scenegraph object. When you call LoadLevel on a scene window it loads the specified level file, which itself contains the scenegraph definition for that level.
You can create a new scenegraph the same way you would create a new ScriptObject or SimSet:
You can then render the new scenegraph by either assigning it to the default scene window that's already on the Canvas, or creating a new scene window and pushing it to the Canvas.
03/15/2007 (7:01 pm)
I'm not really sure what the question is here. Are you asking how to create a derived type of scenegraph or how to create a new t2dSceneGraph instance? GUI Controls don't need a scenegraph to be rendered, they are rendered on the Canvas. t2dSceneWindow is a special GUI Control that renders a scene to the Canvas. The scene it renders is defined by a scenegraph object. When you call LoadLevel on a scene window it loads the specified level file, which itself contains the scenegraph definition for that level.
You can create a new scenegraph the same way you would create a new ScriptObject or SimSet:
// create an empty scene graph %myNewSceneGraph = new t2dSceneGraph(); // add an object to it %someObject = new t2dSceneObject(); %myNewSceneGraph.add( %someObject );
You can then render the new scenegraph by either assigning it to the default scene window that's already on the Canvas, or creating a new scene window and pushing it to the Canvas.
// replace the scenegraph on the default scene window (named SceneWindow2d) SceneWindow2D.setSceneGraph(%myNewSceneGraph); -or- // create a new scene window %myNewWindow = new t2dSceneWindow(); // assign the new scenegraph to the new scenewindow %myNewWindow.setSceneGraph(%myNewSceneGraph); // push the new window onto the GUI Canvas Canvas.pushDialog(%myNewSceneWindow);
#3
03/15/2007 (11:40 pm)
Thnx. a lot Thomas. It really helped me a lot. I wanted to define a nw scnegraph instance.
Associate David Higgins
DPHCoders.com