-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/22/2010 09:04 PM, Garrett Cope wrote:
> Hi,
>
> To Cedric - or anyone else well versed with MorphGeometry in
> osgAnimation:
>
> I'm attempting to implement a coordinate interpolator. Basically,
> animating a mesh with vertex-independent transforms. It seems to me
> that MorphGeometry should accomplish this, but after digging
> through the functionality either I am misunderstanding it or maybe
> trying to use it in an unintended way.
>
> It's easy enough to set up an initial MorphGeometry 'A' and a
> single morph target 'B'. But now let's say we want to morph from
> the new target 'B' to another target 'C'. I see how to set multiple
> morph targets for a single transition like A to .5B+.5C but how
> would I set it up to go from A to B to C?
>
> Thanks in advance, Jamie
>
> ------------------ Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=25984#25984
>
>
>
>
>
> _______________________________________________ osg-users mailing
> list [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
Hi
>
Jamie,

Looking in the source code seems that morph geometry is able to do
multiple target. I think you can add multiple shape then control the
contribution of each shape to the final result. I am not the original
author, so i let him to adjust my answer.

from MorphGeometry.cpp:

/            bool initialized = false;
            if (_method == NORMALIZED)
            {
                // base * 1 - (sum of weights) + sum of (weight * target)
                float baseWeight = 0;
                for (unsigned int i=0; i < _morphTargets.size(); i++)
                {
                    baseWeight += _morphTargets[i].getWeight();
                }
                baseWeight = 1 - baseWeight;

                if (baseWeight != 0)
                {
                    initialized = true;
                    for (unsigned int i=0; i < pos->size(); i++)
                    {
                        (*pos)[i] = _positionSource[i] * baseWeight;
                    }
                    if (_morphNormals)
                    {
                        for (unsigned int i=0; i < normal->size(); i++)
                        {
                            (*normal)[i] = _normalSource[i] * baseWeight;
                        }
                    }
                }
            }
            else //if (_method == RELATIVE)
            {
                // base + sum of (weight * target)
                initialized = true;
                for (unsigned int i=0; i < pos->size(); i++)
                {
                    (*pos)[i] = _positionSource[i];
                }
                if (_morphNormals)
                {
                    for (unsigned int i=0; i < normal->size(); i++)
                    {
                        (*normal)[i] = _normalSource[i];
                    }
                }
            }
/
Cheers,
Cedric

- -- 

Provide OpenGL services around OpenSceneGraph and more
+33 659 598 614 Cedric Pinson mailto:[email protected]
http://www.plopbyte.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkuookUACgkQs6ZHzVQN0Ijz6ACeKrPVf/E5ngSK2RtGEPkurK/g
aR0An21LG4hPes0zOclpdJVHRelhDnXX
=hI7t
-----END PGP SIGNATURE-----

<<attachment: cedric_pinson.vcf>>

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to