Horde3D

Next-Generation Graphics Engine
It is currently 29.09.2024, 02:28

All times are UTC + 1 hour




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: scene mgmt?
PostPosted: 26.01.2009, 23:18 
Offline

Joined: 01.01.2009, 21:09
Posts: 54
Quote:
So, if I understand you correctly, you want an example of how to directly load the .scn file as saved by the Scene Editor?
Not the scn file the "scene graph" file. The one that I talked about above..


Here is an example of what a main scene graph file looks like.

Code:
<!DOCTYPE HordeSceneGraph>
<Group name="MyScene" >
    <Camera pipeline="forward.pipeline.xml" topPlane="0.0414214" bottomPlane="-0.0414214" rx="-20"....
    <Light sy="1" lightingContext="LIGHTING" sz="1" col_B="1" name="Sun" col_G="1" tx="40" ty="40" ....
    <Reference tx="0" sx="6.13373" ty="-13.1884" sy="6.13373" tz="16.5886" rx="0" sceneGraph="../....
    <Reference tx="0" sx="100" ty="0" sy="100" tz="0" sceneGraph="../scene/skybox.scene.xml" ....
    <Terrain tx="-76.1167" sx="300" ty="-88.1834" sy="300" tz="-93.3721" sz="300" ....
</Group>

This files contains the data of where to put what in my scene. The knight example does not have this. From what I can tell this is created by the editor for the very same reason I want it.. It tells the editor where to put what ( it's position info ). All I want is the game to load that file and know where to "translate" everything.


Quote:
You can store an initial transformation for the model in the scene graph file but you are free to overwrite that in your application (we are doing that in the Knight sample). If you really want to do that depends on your application.
- I dont want to change the data in a scene graph file from the application, I want to load it.

like Volker said "you could add the scene file directly using addResource and addNodes. This way it would take the transformation of the root node." but I cant figure that out?


Top
 Profile  
Reply with quote  
 Post subject: Re: scene mgmt?
PostPosted: 27.01.2009, 02:50 
Offline

Joined: 08.11.2006, 03:10
Posts: 384
Location: Australia
ulao wrote:
like Volker said "you could add the scene file directly using addResource and addNodes. This way it would take the transformation of the root node." but I cant figure that out?
It works exactly the same as in the Knight sample, except you have to use findNodes to get handles to the objects within the scene.

First you use addResource/loadResourcesFromDisk to load your XML file into horde, then you use addNodes to actually create the nodes which are described within the XML file.

A "scene.xml" file can just load a model (like in the knight sample) but they can also load any other kind of scene-nodes (group, model, joint, light, camera, etc....). In your example file, the root XML tag is a "<Group>" tag, so when you call addNodes using that resource, then a group node will be created:
Code:
//add the scene file
   ResHandle mySceneRes = Horde3D::addResource( ResourceTypes::SceneGraph, "myScene.scene.xml", 0 );
//load it from disk
   Horde3DUtils::loadResourcesFromDisk( "content" );

//use the resource to create some scene nodes
   NodeHandle sceneRoot = Horde3D::addNodes( RootNode, mySceneRes );

sceneRoot should be a "group node" named "MyScene". It will have a camera node, light node, terrain node, etc as children.

To get handles to these child-nodes, you can search for them by name, like this:
Code:
//Starting at "sceneRoot", look through all children for a light node named "Sun"
int numResults = findNodes( sceneRoot, "Sun", SceneNodeTypes::Light );
assert( numResults == 1 )//there should be one result
NodeHandle lightNode = getNodeFindResult(0);//get the first result (i.e. 0th result)
assert( lightNode != 0 )//the result should be valid


Top
 Profile  
Reply with quote  
 Post subject: Re: scene mgmt?
PostPosted: 27.01.2009, 03:56 
Offline

Joined: 01.01.2009, 21:09
Posts: 54
I believe this is what I'm after, thx! I busted my code and will report back once I get a chance to test it.

UPDATE::

Marvelous!! Finally after a page and some... LOL


I think Volker was try to say the samething.. Why this is not in any examples I dont no?


Code:
   // create scene
   sceneManagement->createScene( "../../content", "myScene.scene.xml" );

   // create handels
   player = sceneManagement->create( "player ", SceneNodeTypes::Model );
   terrain= sceneManagement->create( "terrain", SceneNodeTypes::Undefined );
   sky = sceneManagement->create( "sky", SceneNodeTypes::Model );
   sun = sceneManagement->create( "Sun", SceneNodeTypes::Light );
   cam = sceneManagement->create( "cam", SceneNodeTypes::Camera );
See now, isn't the much better;


So , terrains... SceneNodeTypes::Undefined ??


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 22 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group