Hi.. does this animation framework supports rotation/translation animation?
like moving an object through a path using splines possibly?
I don't want to animate meshes, but only position/rotation. can I do it with
your framework?
thanks
[]'s Pablo
On Thu, May 8, 2008 at 6:04 AM, Carlo Orru <[EMAIL PROTECTED]> wrote:
> Hi Dominik!
>
> Dominik Rau ha scritto:
> > Hi Carlo.
> >
> > First of all: thanks again. I guess you're doing quite hard work
> > with that code. Second: It compiles and works fine here.
> >
> > Some points and questions after looking (very shortly) at it:
> >
> > As I can see, you're using "using namespace std;" and
> > "OSG_USING_NAMESPACE" in your headers - that's generally a bad thing,
> > as I may not want to use that namespace (in fact I don't) but have to
> > if I include that header. Also, your classes are not in the OSG
> > namespace. That's something I would consider as a bug (but it should
> > be rather easy to fix) and is ok in the current stage...
> >
> Thanks for pointing these out... Now these bugs have been successfully
> fixed.
>
> > You rely on an object named AnimationController - is it possible to
> > use more than one of them (looks like, but I haven't tried)?
> Well, actually you can use as many AnimationControllers as you wish and
> your animations will still work... But doing so will prevent you from
> exporting your animations to an OSB file correctly, since the framework
> was not meant to be used with more than one AnimationController object.
> This means that if you export a scene to an OSB file and you have used
> multiple AnimationControllers in order to create your animation, when
> you reload your previously saved work the framework:
>
> 1 - Will not be able to know how many AnimationControllers have
> been used.
> 2 - Will put all the animations inside a single AnimationController
> (If you take a peek inside the example file named
> 'FileTest.cpp' you will easily figure out why...).
>
> Anyway I don't think it would be so difficult to add such feature to the
> framework, provided the fact that you don't want to use multiple
> AnimationController objects to animate different fields inside the same
> FieldContainer, for such thing will require my animation
> importing/exporting code to be rewritten almost from scratch. :(
> > Can I
> > have independent animations (for example two animated geometries that
> > can be started / stopped etc. independently)?
> >
> With a single AnimationController you can't, since it uses the same
> timer for every animation you stored inside it. With multiple
> AnimationControllers you could, but... (read above). Again, it wouldn't
> be so difficult to implement independent animations with a
> single AnimationController, it would just require some time...
> > About usability: I wonder how complicated it would be to make
> > something like a (basic) animation creation tool. For example I
> > (better: our company designer ;) ) create an object in 3DStudio and
> > export it as VRML, 3ds, whatever. Then we deform it (in a way that
> > the number of vertices / their indices etc. remains equal, that's
> > necessary of course) and export it again. If we feed both to our
> > hypothetic new tool, it asks us
> > what we want to interpolate and how and how long the animation should
> > take, assembles them into an osb file and we're ready to go. Do you
> > think that's possible? I fear that waiting for a full featured 3DS /
> > Maya / XSI whatever will take forever and that way we could get at
> > least some rudimentary pose to pose animation capabilities. Should
> > work with material properties too ideally. What do you / all other
> > readers think?
> >
> Well, actually my framework is already able to perform such a task: you
> have to feed it with the two models and then you tell it you want to
> interpolate the 'Positions' field of the main model's Geometry Core. See
> if the sample code below suits your needs...
>
> ...
> ...
>
> OSG_USING_NAMESPACE
>
> ...
> ...
>
> AnimationController ac ;
> SimpleSceneManager* mgr = NULL ;
>
> ...
> ...
>
> // Load your models containing a Geometry Core from files...
> // Note that "object1.obj" is loaded twice: this is needed,
> // as the model inside the graph gets modified by the animation,
> // while the model used as control point has to remain the same!
> // So, don't put a model inside a control point if it has already
> // been placed into the graph, or you will get unexpected behavior!
>
> // This model is to be put inside the graph.
> NodePtr rootNode = SceneFileHandler::the().read("object1.obj");
>
> // These are to be used as control points
> NodePtr originalObject = SceneFileHandler::the().read("object1.obj");
> NodePtr deformedObject = SceneFileHandler::the().read("object2.obj");
>
>
> // These calls are essential !
> createSingleIndex(GeometryPtr::dcast(rootNode->getCore()));
> createSingleIndex(GeometryPtr::dcast(originalObject->getCore()));
> createSingleIndex(GeometryPtr::dcast(deformedObject->getCore()));
>
>
> // Turn off display lists for performance reasons
> beginEditCP(GeometryPtr::dcast(rootNode->getCore()),
> Geometry::DlistCacheFieldMask);
> GeometryPtr::dcast(rootNode->getCore())->setDlistCache(false);
> endEditCP(GeometryPtr::dcast(rootNode->getCore()),
> Geometry::DlistCacheFieldMask);
>
>
>
> // Create ControlPointList object. INTERPOLATION_LINEAR is used here,
> // because INTERPOLATION_SPLINE runs VERY SLOW when interpolating
> MFields...
> ControlPointList<GeometryPtr>* geo_cpl = NULL ;
> geo_cpl = new
> ControlPointList<GeometryPtr>(Geometry::PositionsFieldMask,
> INTERPOLATION_LINEAR);
> geo_cpl->setDynamic(true);
>
>
> // Create ControlPoint objects using your models' Geometry Cores...
> ControlPoint<GeometryPtr>
> cp_geo0(GeometryPtr::dcast(originalObject->getCore()));
> ControlPoint<GeometryPtr>
> cp_geo1(GeometryPtr::dcast(deformedObject->getCore()));
>
>
> // Insert control points into the list
> geo_cpl->InsertControlPoint(0.0, cp_geo0);
> geo_cpl->InsertControlPoint(10.0, cp_geo1);
>
>
> // Insert all the stuff into the AnimationController
> ac.InsertFieldContainer(NullFC, rootNode->getCore(), geo_cpl,
> ANIMATION_FORWARD);
>
>
> // Setup SimpleSceneManager
> mgr = new SimpleSceneManager ;
>
> if ( mgr != NULL )
> {
> ...
> ...
> mgr->setRoot(rootNode);
> mgr->showAll();
>
> glutMainLoop();
> }
>
>
> ...
> ...
>
>
> // GLUT display function
> void display(void)
> {
> ac.Animate();
> mgr->redraw();
> return ;
> }
>
> ...
> ...
>
> //----------------------------------------------------------
>
> // These lines export the animation to an OSB file called "Scene.osb":
> ac.AttachControlPoints(mgr->getRoot());
> SceneFileHandler::the().write(mgr->getRoot(), "Scene.osb");
>
> //----------------------------------------------------------
>
> Thanks again for your feedback, I really appreciate it! But, since
> developing the framework was the purpose of my thesis, right now I'm
> very busy with writing it down! So don't expect any updates in the near
> future...
>
>
> Cheers,
> Carlo
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Don't miss this year's exciting event. There's still time to save $100.
> Use priority code J8TL2D2.
>
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> Opensg-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/opensg-users
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users