[info-performer] Re: pfFluxes with dynamic amount of data

New Message Reply Date view Thread view Subject view Author view

From: Dirk Scheffter (scheff++at++appss.de)
Date: 11/18/2002 02:37:56


Hi Chris,

> I have looked a little bit at pfFluxes but from the
> samples that I have seen the size of the data is
> static. Is it possible to resize the data from frame
> to frame? For example I have geometry where the number
> of vertices changes from frame to frame.

It's possible, indeed.
For this you have to flux the complete geoset.
Procedure you have to do every frame could look like:

...
// get current slot of flux buffer
pfGeoSet *pPfGSet = (pfGeoSet*)pPfFluxGSet->getWriteableData();

// realloc coordinate arrays (if necessary)
pfVec3 *coords; ushort *iCoords;
pPfGSet->getAttrLists(PFGS_COORD3, (void**)&coords, &iCoords);
pfVec3 *coordsNew = (pfVec3*)pfRealloc(nCoordsNew * sizeof (pfVec3),
  pfGetSharedArena());
ushort *iCoordsNew = (ushort*)pfRealloc(nCoordsNew * sizeof (ushort),
  pfGetSharedArena());

// refill coordinate arrays
int i;
for (i = 0; i < nCoordsNew; ++i) {
  coordsNew[i]; // set new coordinates
  iCoordsNew[i]; // set new coordinate index
}

// set new coordinate arrays
pPfGSet->setAttr(PFGS_COORD3, PFGS_PER_VERTEX, coordsNew, iCoordsNew);

// complete writing
pPfGSet->setBound(0, PFBOUND_DYNAMIC);
// due to an error in Performer it's clever to recompute bounding of parent
// geode, also.
pPfGeode->setBound(0, PFBOUND_DYNAMIC);
pPfFluxGSet->writeComplete();

// ready
...

In this manner you can change each attribute of geoset. (even changing of
primitive type.)
The only important fact: If you call writeComplete() the geoset must be
consistent.

Additional help you can find in the sample
/usr/share/Performer/src/pguide/libpf/C++/fluxed_gset.C
which is provided as Performer sample code.

Guess this helps,
best regards,
Dirk.

====================================================================
Dirk Scheffter

applied software solutions (appss) GmbH
Sandtorstr. 23
D-39106 Magdeburg
Germany

Phone: +49-(0)391-54486-19387
Fax: +49-(0)391-54486-19222
E-mail: scheffter++at++appss.de
URL: http://www.appss.de

Managing Director: Uwe Hess, Dietmar Schäfer
Register: HRB12386, AG Mageburg

"Virtual business becomes reality!"

This e-mail may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this e-mail
in error) please notify the sender immediately and destroy this
e-mail. Any unauthorised copying, disclosure or distribution of the
material in this e-mail is strictly forbidden.
===================================================================


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Mon Nov 18 2002 - 02:42:15 PST

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