Hi,
I'm actually in my second year for a diploma in IT. We curreently work on a
group project using OpenSceneGraph.
We're making a turn by turn tactical game. On our map, we want to load some
trees. We have a .obj model (soon .osg) and use osgDB::ReadNodeFile to load it,
and put it in a PositionAttituteTransform with the good pos.
The problem is that it took some time to load the model (around a second)...I
try to avoid it by copying the already loaded model, using the clone function
of osg::Node in a for loop, and puting the cloned node inside a newly created
PositionAttituteTransform ...
But only one tree apears on the map.
If i use each time osgDB::ReadNodeFile in the loop, it works, i've got my tree,
but it took ~ 5 second for 5 trees
Here's my code, maybe more clear than my english...
Code:
//Loading of the model
osg::ref_ptrosg::Node Arbre = osgDB::readNodeFile(modeles/arbre.obj);
osg::ref_ptrosg::PositionAttitudeTransform temp;
for(int i = 0 ; i 5; i++)
{
temp = new osg::PositionAttitudeTransform;
osg::Node* copy = dynamic_castosg::Node*(Arbre-clone(osg::CopyOp()));
temp-addChild(copy);
temp-setPosition(myPos);
this-addChild(temp.get());
}
this is my class which inherit from osg::Group.
Did i use it wrong? Is it not possible to copy a node loaded byt
osg::ReadNodeFile?
Thank you![/code]
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=22933#22933
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org