PDA

View Full Version : tesselation?



ravishashi
05-21-2003, 04:29 PM
How do I tesselate polygons with optimizer/performer. I tried to use the opTessAction class but was unsuccessful. My problem is that I am unable to render concave polygons corectly with both optimizer and performer and hence I wanted to tesselate the polygon. In performer I tried to use the pfdTriangulatePoly in the pfdUtil library which is supplied as unsupported code. The program crashes. Can anybody please advice me on how I can tesselate polygons (concave specifically) with optimizer/performer.

shashi

Coconut
05-22-2003, 04:42 AM
We use opTessAction for trimmed surfaces without any big problem. If you can post your code or/and how you are using it, I may be able to give you more advice.

ravishashi
05-23-2003, 01:03 AM
Originally posted by Coconut:
We use opTessAction for trimmed surfaces without any big problem. If you can post your code or/and how you are using it, I may be able to give you more advice.

Here is the polygon (concave) I want to tesselate and render.
static float cubeCoords[4][3] =
{
{ -1.0, -1.0, 1.0 },
{ 0.0, -0.5, 1.0 },
{ 1.0, -1.0, 1.0 },
{ 0.0, 1.0, 1.0 }
};
(just modified some pre-existing code, cubecoords is a bit out of place. but here it is the array of coords of my polygon)

csPolySet *gset = new csPolySet;
csCoordSet3f *cset = new csCoordSet3f;
cset->point()->edit();
cset->point()->setRange(0, numCubeCoords, (csVec3f *)cubeCoords);
cset->point()->editDone();
gset->setCoordSet(cset);
csIndexSet *iset=new csIndexSet;
iset->index()->edit();
for( unsigned int i=0;i<cset->point()->getCount();i++)
{
iset->index()->set(i,i);
}
iset->index()->editDone();
gset->setCoordIndexSet(iset);

gset->setPrimCount(1);


// the tesselation part
opTessellateAction *tessAct;
csShape *greenShape = new csShape;
greenShape->setAppearance(greenAppearance);
greenShape->setGeometry(0, gset);

tessAct = new opTessellateAction;
tessAct -> apply( greenShape ); // this did not work so I tried this

tessAct -> apply( root ); // even this did not

Warm regards
shashi

Coconut
05-27-2003, 05:43 AM
Sorry but I was out of town for several days. To make it work, you need opTessParaSurfaceAction. Use opPlane, and define a concave trimming curve on the plane.