Re: morphing nodes

New Message Reply Date view Thread view Subject view Author view

John Rohlf (jrohlf++at++tubes)
Wed, 13 Mar 96 11:29:35 PST


>
> Hello,
> I ve a problem with the use of morphing nodes.
> The following source is a variation around morph.c.
> My goal was to load two object ( iv file format ) with the same geometry (
> polygons, normal, material, color)
> but with two differents shapes. To check this, I planed to use the following
> code but it bombs even if I try to morph one model to itself !
> Strangely, the following is working if instead of loading external object, I
> try internal primitive as
> going from a sphere to an arrow !!
>
> So if anybody could send me a sample to morph two iv objects or just tell me
> what is wrong in the following
> I will appreciate a lot ..
>
> *******************************************************************
>
> #include <stdlib.h>
> #include <math.h>
> #include <Performer/pf.h>
> #include <Performer/pfdu.h>
>
> int nSph;
>
>
> static void breatheMorph(pfMorph *morph, double t)
> {
> float s = (sinf(t) + 1.0f) / 2.0f;
> float weights[2];
>
> weights[0] = s;
> weights[1] = 1.0f - s;
>
> pfMorphWeights(morph, 0, weights);
> pfMorphWeights(morph, 1, weights);
> }
>
>
> static pfMorph* initMorph(char *namesource, char *namecible)
> {
> pfGeoSet *cible;
> pfGeoSet *source;
> pfGeode *geode;
> pfGeoState *gstate;
> pfMaterial *mtl;
> pfMorph *morph;
> ushort *icoords, *inorms;
> pfVec3 *coords, *obcoords, *norms, *obnorms;
> pfVec4 *colors;
> float *srcs[2];
> int i;
> void *arena = pfGetSharedArena();
>
> morph = pfNewMorph();
> geode = pfNewGeode();
> source = (pfGeoSet*)pfdLoadFile(namesource);
> /*source = pfdNewSphere(400, arena);*/
> if(source==NULL)
> {
> pfNotify(PFNFY_NOTICE, PFNFY_PRINT,"WARNING: could not load
> \"%s\"",namesource);
> exit(0);
> }
>
> cible = (pfGeoSet*)pfdLoadFile(namecible);
> /*cible = pfdNewArrow(400, arena);*/
> if(cible==NULL)
> {
> pfNotify(PFNFY_NOTICE, PFNFY_PRINT,"WARNING: could not load
> \"%s\"",namecible);
> exit(0);
> }
>

        pfdLoadFile returns a pfNode*, not a pfGeoSet*. You'll have to
traverse the returned subgraph to find the geosets. See pfuTraverser.


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:52:32 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.