Hi list,

I have a question about the Cal3D wrapper for OSG, osgCal2; this list
is not exactly for that project, but someone pointed me to this list
in case I had trouble.

I can't seem to be able to properly blend animations. Check this code:

#include <osg/PositionAttitudeTransform>
#include <osgViewer/Viewer>

#include <osgCal/CoreModel>
#include <osgCal/Model>

int main( int, char **)
{
   osgViewer::Viewer viewer;
   osg::Group* root = new osg::Group;

   osgCal::CoreModel* core_model = new osgCal::CoreModel;
   osg::ref_ptr< osgCal::MeshParameters > params ( new
osgCal::MeshParameters );

   params->software = true;
   core_model->load( "model/cally.cfg", params.get() );

   osgCal::Model* model = new osgCal::Model;
   model->load( core_model );

   root->addChild( model );

   osg::PositionAttitudeTransform* t = new osg::PositionAttitudeTransform;

   t->setPosition( osg::Vec3( 0, 0, -400 ) );
   t->addChild(root);
   viewer.setSceneData( t );

   viewer.realize();

   //The important part
   model->blendCycle( 4, 1.0f, 1000.0f, 10.0f );

   while( !viewer.done() ) viewer.frame();

   return 0;
}

I'm using the cally model that is in Cal3D's code repository, in the
cal3d/cal3d/data/ directory.

If I understand correctly, the 3rd argument of blendCycle(), delay,
should make sure that the influence the animation has over the model
starts at 0.0f, and gradually grows to 1.0f over 1000 seconds, and the
4th argument should complete one animation in 10 seconds; none of the
two happen, and using negative values on
those files animates the model just the same!

On the other hand, I tested the 2nd argument, weight, with two
animations using blendCycle() inside a loop and changing the values
progressively, and it works fine.

 -Coz
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to