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);