23 #include <Inventor/SbBox.h>
24 #include <Inventor/actions/SoAction.h>
25 #include <Inventor/actions/SoPickAction.h>
26 #include <Inventor/SoPrimitiveVertex.h>
27 #include <Inventor/elements/SoTextureCoordinateElement.h>
28 #include <Inventor/elements/SoGLCacheContextElement.h>
30 #include <Inventor/nodes/SoSeparator.h>
31 #include <Inventor/nodes/SoIndexedFaceSet.h>
32 #include <Inventor/nodes/SoVertexProperty.h>
34 #include <Inventor/C/glue/gl.h>
49 [[maybe_unused]]
static const bool didInit = [&]() {
58 :m_polyhedron(0), m_vertices(0), m_indices(0), m_vcount(0), m_icount(0)
66 setNodeType(EXTENSION);
72 :m_polyhedron(0), m_vertices(0), m_indices(0), m_vcount(0), m_icount(0)
82 setNodeType(EXTENSION);
89 :m_polyhedron(0), m_vertices(0), m_indices(0), m_vcount(0), m_icount(0)
99 setNodeType(EXTENSION);
124 SoState *state = aAction->getState();
127 SbBool useTexFunction =
129 SoTextureCoordinateElement::FUNCTION);
130 const SoTextureCoordinateElement *tce = NULL;
132 if (useTexFunction) {
133 tce = SoTextureCoordinateElement::getInstance(state);
141 SoPrimitiveVertex
pv;
142 SbVec3f point, normal;
145 #define GEN_VERTEX(pv,x,y,z,s,t,nx,ny,nz) \
146 point.setValue(x,y,z); \
147 normal.setValue(nx,ny,nz); \
148 if (useTexFunction) { \
149 texCoord=tce->get(point,normal); \
154 pv.setPoint(point); \
155 pv.setNormal(normal); \
156 pv.setTextureCoords(texCoord); \
163 if ( aAction->getTypeId().isDerivedFrom(SoPickAction::getClassTypeId()) ){
170 beginShape(aAction,POLYGON);
184 }
while (notLastEdge);
186 }
while (notLastFace);
191 glEnableClientState(GL_VERTEX_ARRAY);
193 glEnableClientState(GL_NORMAL_ARRAY);
202 glDrawArrays(GL_TRIANGLES, 0,
m_vcount);
203 glDisableClientState(GL_VERTEX_ARRAY);
204 glDisableClientState(GL_NORMAL_ARRAY);
280 if (state&&state->isElementEnabled(SoGLCacheContextElement::getClassStackIndex())) {
282 SoGLCacheContextElement::shouldAutoCache(state, SoGLCacheContextElement::DO_AUTO_CACHE);
283 #if ((COIN_MAJOR_VERSION>=3)||((COIN_MAJOR_VERSION==2)&&(COIN_MINOR_VERSION>=5)))
284 SoGLCacheContextElement::incNumShapes(state);
299 SbVec3f
vmin(-1,-1,-1);
300 SbVec3f
vmax( 1, 1, 1);
302 aCenter.setValue(0,0,0);
307 float xmn = 0,ymn = 0,zmn = 0;
308 float xmx = 0,ymx = 0,zmx = 0;
309 float xct = 0,yct = 0,zct = 0;
325 xct = xmx = xmn = point[0];
326 yct = ymx = ymn = point[1];
327 zct = zmx = zmn = point[2];
345 }
while (notLastEdge);
346 }
while (notLastFace);
347 SbVec3f
vmin(xmn,ymn,zmn);
348 SbVec3f
vmax(xmx,ymx,zmx);
352 aCenter.setValue(0,0,0);
383 SoVertexProperty *vertices =
new SoVertexProperty();
387 for(
int i = 0;
i < vno;
i++){
395 int* aface =
new int[8 * fno];
396 for(
int i = 0;
i < fno;
i++){
401 aface[fcr] = (inodes[0] <= vno) ? (inodes[0] - 1) : (0); fcr++;
402 aface[fcr] = (inodes[1] <= vno) ? (inodes[1] - 1) : (0); fcr++;
403 aface[fcr] = (inodes[2] <= vno) ? (inodes[2] - 1) : (0); fcr++;
404 if(
n == 4) { aface[fcr] = (inodes[3] <= vno) ? (inodes[3] - 1) : (0); fcr++; }
405 aface[fcr] = -1; fcr++;
407 SoIndexedFaceSet * faceset =
new SoIndexedFaceSet;
408 faceset->coordIndex.setValues(0, fcr, aface);
410 faceset->vertexProperty = vertices;
429 for(
long i = 0;
i < len;
i++){
430 if((
v.pos[0] == vertices[
i].
pos[0]) && (
v.pos[1] == vertices[
i].
pos[1]) && (
v.pos[2] == vertices[
i].
pos[2]) &&
431 (
v.nor[0] == vertices[
i].
nor[0]) && (
v.nor[1] == vertices[
i].
nor[1]) && (
v.nor[2] == vertices[
i].
nor[2]))
540 for(
int i = 0;
i < fno;
i++){
556 for(
int i = 0;
i < fno;
i++){