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
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #ifndef _SO_VRMLGEOMETRY_
00051 #define _SO_VRMLGEOMETRY_
00052
00053 #include <Inventor/nodes/SoNode.h>
00054 #include <Inventor/nodes/SoShape.h>
00055 #include <Inventor/fields/SoMFFloat.h>
00056 #include <Inventor/fields/SoSFNode.h>
00057 #include <Inventor/SbColor.h>
00058 #include <Inventor/elements/SoTextureCoordinateBindingElement.h>
00059 #include <Inventor/elements/SoMaterialBindingElement.h>
00060 #include <Inventor/elements/SoNormalBindingElement.h>
00061
00062
00063 #if defined(OIV_IGNORE_VRML_DEPRECATED)
00064 #include <SoDeprecationRules.h>
00065 #pragma push_macro("SoDEPRECATED_CLASS")
00066 #pragma push_macro("SoDEPRECATED_TYPEDEF")
00067 #undef SoDEPRECATED_CLASS
00068 #undef SoDEPRECATED_TYPEDEF
00069 #define SoDEPRECATED_CLASS(x,y)
00070 #define SoDEPRECATED_TYPEDEF(x,y)
00071 #endif
00072
00073 class SoColorPacker;
00074
00076
00077
00078
00079
00080
00081
00083 class SoDEPRECATED SoVRMLGeometry : public SoShape {
00115
00116 SO_NODE_ABSTRACT_HEADER(SoVRMLGeometry);
00117
00118 public:
00119
00120
00125 SoSFNode metadata;
00126
00127 private:
00128 static void initClass();
00129 static void exitClass();
00130
00131 private:
00132 virtual void generatePick(SoRayPickAction *action, SoNode *);
00133
00134
00135
00136
00137
00138 static void getScreenSize(SoState *state,
00139 const SbBox3f &boundingBox,
00140 SbVec2s &rectSize);
00141
00142 SbBool isTransparent() {return transparent;}
00143
00144 private:
00145
00146 SoVRMLGeometry();
00147
00148 SoColorPacker *colorPacker;
00149
00150 SbBool transparent;
00151
00152
00153
00154
00155 virtual SbBool shouldGLRender(SoGLRenderAction *action,
00156 SbBool isPointsOrLines = FALSE);
00157
00158 virtual ~SoVRMLGeometry();
00159
00160 void setupForTexture(SoAction *action);
00161
00162
00163 static SbColor *white_color;
00164 static SoMFFloat *transp_1;
00165
00166
00167 static int instanceCounter;
00168
00169
00170
00171 static int autoCacheMinValue;
00172 static int autoCacheMaxValue;
00173
00174
00175
00176
00177
00178 static SbBool s_textureModelSupport;
00179 };
00180 #ifndef HIDDEN_FROM_DOC
00181 #include <Inventor/elements/SoShapeStyleElement.h>
00182 typedef SoDEPRECATED WINGDIAPI void APIENTRY SoVPCacheFunc(const char *const);
00183
00187 SoVRMLVertexPropertyCache {
00188 public:
00189
00190
00191
00192 SbBool mightNeedSomethingFromState(const SoShapeStyleElement *sse) const
00193 { return needFromState & sse->getRenderCaseMask(); }
00194
00195 void fillInCache(SoNode *, SoNode *, SoNode *,
00196 SoNode *, SoNode *,const int32_t *,
00197 const int32_t *,const int32_t *,const int32_t *,
00198 SbBool , SbBool , SoState *);
00199
00200 SbBool shouldGenerateNormals(const SoShapeStyleElement *sse) const
00201 { return (generateNormals && sse->needNormals()); }
00202
00203 SbBool shouldGenerateTexCoords(const SoShapeStyleElement *sse) const
00204 { return (generateTexCoords && sse->needTexCoords()); }
00205
00206 int getRenderCase(const SoShapeStyleElement *sse) const
00207 { return renderCase & sse->getRenderCaseMask(); }
00208
00209 SbBool haveTexCoordsInVP()
00210 { return needFromState & TEXTURE_FUNCTION_BIT; }
00211
00212 void sendVertex(const char *vp) const
00213 { (*vertexFunc)(vp); }
00214 void sendNormal(const char *np) const
00215 { (*normalFunc)(np); }
00216 void sendColor(const char *cp) const
00217 { (*colorFunc)(cp); }
00218 void sendTexCoord(const char *tcp) const
00219 { (*texCoordFunc)(tcp); }
00220
00221 int getNumVertices() const { return numVerts; }
00222 int getNumNormals() const { return numNorms; }
00223 int getNumColors() const { return numColors; }
00224 int getNumTexCoords() const { return numTexCoords; }
00225
00226 const char *getVertices(int i) const
00227 { return vertexPtr + vertexStride*i; }
00228 const char *getNormals(int i) const
00229 { return normalPtr + normalStride*i; }
00230 const char *getColors(int i) const
00231 { return colorPtr + colorStride*i; }
00232 const char *getTexCoords(int i) const
00233 { return texCoordPtr + texCoordStride*i; }
00234
00235 SbBool colorIsInVtxProp() const {return colorIsInVP;}
00236
00237
00238 SbBool transpIsInVtxProp() const {return transpIsInVP;}
00239
00240 void setTranspIsInVP(SbBool flag){ transpIsInVP = flag;}
00241
00242 int getVertexStride() const { return vertexStride; }
00243 int getNormalStride() const { return normalStride; }
00244 int getColorStride() const { return colorStride; }
00245 int getTexCoordStride() const { return texCoordStride; }
00246
00247 SoNormalBindingElement::Binding getNormalBinding()
00248 { return (SoNormalBindingElement::Binding)normalBinding; }
00249
00250 SoMaterialBindingElement::Binding getMaterialBinding()
00251 { return (SoMaterialBindingElement::Binding)materialBinding; }
00252
00253
00254 SoTextureCoordinateBindingElement::Binding getTexCoordBinding()
00255 { return (SoTextureCoordinateBindingElement::Binding)texCoordBinding; }
00256
00257 void invalidate() { needFromState = ALL_FROM_STATE_BITS; }
00258
00259
00260 SoVRMLVertexPropertyCache();
00261
00262 public:
00263
00264
00265 SoVPCacheFunc *vertexFunc;
00266 const char *vertexPtr;
00267 int vertexStride, numVerts;
00268 SoVPCacheFunc *normalFunc;
00269 const char *normalPtr;
00270 int normalStride, numNorms;
00271 SoVPCacheFunc *colorFunc;
00272 const char *colorPtr;
00273 int colorStride, numColors;
00274 SoVPCacheFunc *texCoordFunc;
00275 const char *texCoordPtr;
00276 int texCoordStride, numTexCoords;
00277
00278 SbBool generateNormals;
00279 SbBool generateTexCoords;
00280
00281 unsigned char needFromState;
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296 private:
00297 enum {
00298 COLOR_BITS = 0x18,
00299 PART_COLOR = 0x8,
00300 FACE_COLOR = 0x10,
00301 VERTEX_COLOR = 0x18,
00302
00303 NORMAL_BITS = 0x6,
00304 PART_NORMAL = 0x2,
00305 FACE_NORMAL = 0x4,
00306 VERTEX_NORMAL = 0x6,
00307
00308 TEXCOORD_BIT = 0x1
00309 };
00310
00311
00312
00313
00314 enum {
00315 TEXTURE_FUNCTION_BIT = 0x80,
00316 OVERRIDE_FROM_STATE_BIT = 0x40,
00317 COORD_FROM_STATE_BIT = 0x20,
00318 COLOR_FROM_STATE_BITS = COLOR_BITS,
00319 NORMAL_FROM_STATE_BITS = NORMAL_BITS,
00320 TEXCOORD_FROM_STATE_BIT = TEXCOORD_BIT,
00321 ALL_FROM_STATE_BITS = 0xFF
00322 };
00323 private:
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339 unsigned char normalBinding;
00340 unsigned char materialBinding;
00341 unsigned char texCoordBinding;
00342 unsigned char renderCase;
00343 unsigned char colorIsInVP;
00344 SbBool transpIsInVP;
00345 };
00346
00347 #endif // HIDDEN_FROM_DOC
00348
00349
00350 #if defined(OIV_IGNORE_VRML_DEPRECATED)
00351 #pragma pop_macro("SoDEPRECATED_TYPEDEF")
00352 #pragma pop_macro("SoDEPRECATED_CLASS")
00353 #endif
00354
00355 #endif
00356