Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Inventor API > Face set proble...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 494 of 504
Post > Topic >>

Face set problems! why so slow?

by alex <zl747.alex@[EMAIL PROTECTED] > Jun 25, 2008 at 05:48 AM

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




 1 Posts in Topic:
Face set problems! why so slow?
alex <zl747.alex@[EMAI  2008-06-25 05:48:54 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Nov 20 9:40:14 CST 2008.