Dear Users,
Please i'd like to know the best way to build a 3D shape starting from a 3D point (x, y, z) array and a face array;
if "pointList" and "faceList" are the above mentioned arrays, i was thinking to use the following pseudo-code:
Please can i do better (intended as optimized GPU 3D shape) , using faceList array, too?
Thank You for Your help in advance.
Regards,
Vincenzo
Please i'd like to know the best way to build a 3D shape starting from a 3D point (x, y, z) array and a face array;
if "pointList" and "faceList" are the above mentioned arrays, i was thinking to use the following pseudo-code:
Code:
std::vector<SbVec3f> vTriangleVertex; //the pointList array SoVertexProperty* pVertexProperty = new SoVertexProperty; pVertexProperty->vertex.setValuesPointer((int)vTriangleVertex.size(), &vTriangleVertex[0]); SoTriangleSet* pGeneratedPrimitivesShape = new SoTriangleSet; pGeneratedPrimitivesShape->numTriangles.setValue(count); pGeneratedPrimitivesShape->vertexProperty.setValue(pVertexProperty); pSep = new SoSeparator; SoShapeHints* sh = new SoShapeHints; sh->faceType = SoShapeHints::SOLID; sh->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE; sh->faceType = SoShapeHints::CONVEX; pSep->addChild(sh); pSep->addChild(pGeneratedPrimitivesShape);
Thank You for Your help in advance.
Regards,
Vincenzo
Comment