00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _SO_TRIANGLE_SET_
00026 #define _SO_TRIANGLE_SET_
00027
00028 #include <Inventor/SbLinear.h>
00029 #include <Inventor/fields/SoSFInt32.h>
00030 #include <Inventor/nodes/SoNonIndexedShape.h>
00031
00032
00033
00034 #define SO_TRIANGLE_SET_USE_REST_OF_VERTICES (-1)
00035
00036 class SoCoordinateElement;
00037 class SoNormalBundle;
00038 class SoState;
00039 class SoVolumeTriangleSet;
00040
00041
00123 class SoTriangleSet : public SoNonIndexedShape {
00124
00125 SO_NODE_HEADER(SoTriangleSet);
00126
00127 public:
00128
00134 SoSFInt32 numTriangles;
00135
00139 SoTriangleSet();
00140
00141 private:
00142
00143
00145 virtual void GLRender(SoGLRenderAction *action);
00146
00148 virtual void getPrimitiveCount(SoGetPrimitiveCountAction *action);
00149
00151 virtual void generateDefaultNormals(SoState *state,
00152 const SbVec3f *coords,
00153 int numCoords,
00154 SoNormalBundle *nb,
00155 SbBool storeRef = FALSE);
00156
00158 virtual SbMatrix3* computeVtxTangentSpaceMat(const float *bumpTexCoords, int &numMat) const ;
00159
00160 private:
00161
00162 inline int getNumParts(void) const { return numTris; }
00163
00164
00165 inline int getNumFaces(void) const { return numTris; }
00166
00167
00168 int getNumVerticesNeeded(void) const;
00169
00170
00171 bool check_RenderVectors( SoState *state, bool bUseTexCoordsAnyway );
00172
00174 static void initClass();
00175
00177 static void exitClass();
00178
00179 private:
00180
00181
00182 enum Binding {
00183 OVERALL, PER_FACE, PER_VERTEX
00184 };
00185
00186 virtual void callDEBUGGLRender(SoGLRenderAction *action,uint32_t useTexCoordsAnyway);
00187
00188
00189 virtual void exitRender(SoState *state,int stateFlag,
00190 SoTextureCoordinateBundle *tcb,
00191 SoTextureCoordinate3Bundle *tc3b);
00192
00193
00194 SbBool m_usingUSE_REST;
00195
00196 SbBool m_nvNotifyEnabled;
00197
00198 void setNvNotifyEnabled(SbBool _nvNotifyEnabled)
00199 {
00200 m_nvNotifyEnabled = _nvNotifyEnabled;
00201 }
00202
00203 SbBool getNvNotifyEnabled(){return m_nvNotifyEnabled;}
00204
00205 virtual int getMaxTestValueForAutoCache(){return totalNumVertices;}
00206
00207 virtual int getMinTestValueForAutoCache(){return totalNumVertices;}
00208
00209 virtual int getNumPrim(){return totalNumVertices;}
00210
00211 virtual int getNumVert();
00212
00213 virtual void countPrim(){setupNumTrisQuadsFaces();}
00214
00215 virtual SbBool numPrimInvalid(){return numTris < 0 ;}
00216
00217
00218 virtual void generatePrimitives(SoAction *action);
00219
00220
00221 void doRendering(SoGLRenderAction *action, const SoShapeStyleElement* shapeStyle);
00222
00223
00224 virtual SoDetail * createTriangleDetail(SoRayPickAction *action,
00225 const SoPrimitiveVertex *v1,
00226 const SoPrimitiveVertex *v2,
00227 const SoPrimitiveVertex *v3,
00228 SoPickedPoint *pp);
00229
00231 ~SoTriangleSet();
00232
00233 private:
00234
00235 virtual void notify(SoNotList *list);
00236
00237 private:
00238
00239
00240
00241 bool doRenderingVBO(SoGLRenderAction *action, const SoShapeStyleElement* shapeStyle);
00242
00243
00244 static Binding getMaterialBinding(SoAction *action);
00245 Binding getNormalBinding(SoAction *action, SoNormalBundle *nb);
00246
00247 virtual int getNumNeededNormals(SoState *state);
00248
00249
00250 void setupNumTrisQuadsFaces();
00251
00252
00253 int numTris, totalNumVertices;
00254
00255 friend class SoVolumeTriangleSetDl;
00256 };
00257
00258 #endif
00259
00260