Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Face set problems! why so slow?

0 views
Skip to first unread message

alex

unread,
Jun 25, 2008, 8:48:42 AM6/25/08
to
I try to use inventor to render a height mesh with set of faces(about
20,000 quads)

but the inventor initlizes about 2 mins, I think it should not be so
slow.
I post the code, and hope someone can help me. Thanks

SoSeparator *pHeightMapSep = new SoSeparator;
root->addChild(pHeightMapSep);

float x, y, z;

SoBaseColor *pHeightMapColor = new SoBaseColor;

SoCoordinate3 *pHeightMapCoord = new SoCoordinate3;
pHeightMapSep->addChild(pHeightMapCoord);

int numofx = 399;
int numofy = 499;

vector<int> iVecNum((numofx-1)*(numofy-1),4);
// allocate arrays {4,4,4,4,4,......}

int iIndex = 0;

for (int i = 0;i < numofy-1;i++)
{
for (int j = 0;j < numofx-1;j++)
{
x = rp[(j+i*numofx)*3];
y = rp[(j+i*numofx)*3+1];
z = rp[(j+i*numofx)*3+2];
pHeightMapColor->rgb.set1Value(iIndex,0.8,0.8,0.8);
pHeightMapCoord->point.set1Value(iIndex++,x,y,z);


x = rp[(j+i*numofx+1)*3];
y = rp[(j+i*numofx+1)*3+1];
z = rp[(j+i*numofx+1)*3+2];
pHeightMapColor->rgb.set1Value(iIndex,0.8,0.8,0.8);
pHeightMapCoord->point.set1Value(iIndex++,x,y,z);

x = rp[(j+(i+1)*numofx+1)*3];
y = rp[(j+(i+1)*numofx+1)*3+1];
z = rp[(j+(i+1)*numofx+1)*3+2];
pHeightMapColor->rgb.set1Value(iIndex,0.8,0.8,0.8);
pHeightMapCoord->point.set1Value(iIndex++,x,y,z);

x = rp[(j+(i+1)*numofx)*3];
y = rp[(j+(i+1)*numofx)*3+1];
z = rp[(j+(i+1)*numofx)*3+2];
pHeightMapColor->rgb.set1Value(iIndex,0.8,0.8,0.8);
pHeightMapCoord->point.set1Value(iIndex++,x,y,z);
}
}

SoFaceSet *pHeightMapFaceSet = new SoFaceSet;
pHeightMapFaceSet->numVertices.setValues(0,iIndex/4,(int
*)&iVecNum[0]);
pHeightMapSep->addChild(pHeightMapFaceSet);

alex

unread,
Jun 25, 2008, 8:48:54 AM6/25/08
to

alex

unread,
Jun 25, 2008, 9:39:16 AM6/25/08
to
0 new messages