00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef SO_VOLUME_GEOMETRY_H
00025 #define SO_VOLUME_GEOMETRY_H
00026
00027 #ifdef _MSC_VER
00028 #pragma warning(push)
00029 #pragma warning(disable:4251)
00030 #endif
00031
00032 #include <Inventor/SbBox.h>
00033 #include <Inventor/STL/vector>
00034
00035 #include <VolumeViz/nodes/SoVolumeShape.h>
00036 #include <VolumeViz/nodes/SoSlice.h>
00037
00038 #include <LDM/actions/SoLdmValuationActionInterface.h>
00039 #include <LDM/SoLDMTileID.h>
00040 #include <LDM/actions/SoLdmValuationActionInterface.h>
00041
00042 class SoVertexShape;
00043 class SoVolumeGeometryVbo;
00044 class SoGLRenderAction;
00045 class SoAction;
00046 class SoState;
00047 class SoBoundingBoxCache;
00048 class SoPrimitiveVertex;
00049 class SoLdmValuationAction;
00050
00052
00058 class SoVolumeGeometry : public SoLdmValuationActionInterface
00059 {
00060 public:
00061
00063 SoVolumeGeometry();
00064
00066 virtual ~SoVolumeGeometry();
00067
00068 private:
00069
00075 float intersectGeometry(const SoLDMTileID& tile) const;
00076
00078 virtual void triangleCB(SoAction* action,
00079 const SoPrimitiveVertex *v0,
00080 const SoPrimitiveVertex *v1,
00081 const SoPrimitiveVertex *v2 ) const ;
00082
00084 virtual void lineCB( SoAction* action,
00085 const SoPrimitiveVertex *v0,
00086 const SoPrimitiveVertex *v1 ) const ;
00087
00089 virtual void pointCB( SoAction* action, const SoPrimitiveVertex *v ) const ;
00090
00106 inline void setEnableBumMapping(bool flag);
00107
00109 inline bool isBumpMappingEnabled();
00110
00112 inline void setBumpScale(float scale);
00113
00115 inline float getBumScale();
00116
00118 inline void setAlphaUse (SoSlice::AlphaUse alphaUse);
00119
00121 inline SoSlice::AlphaUse getAlphaUse();
00122
00124 inline void setUseRGBA(bool flag);
00125
00127 inline bool isUsingRGBA();
00128
00129 #if 1 SoDEPRECATED
00137 virtual SoVolumeShape::Interpolation getInteractiveInterpolationValue(SoState* state) const = 0;
00138 #endif
00140 SoVolumeState* getVolumeState() const;
00141
00142 private:
00143
00145 inline void setClipGeometry(bool flag);
00146
00148 virtual void GLRenderBoundingBox(SoGLRenderAction* action) = 0;
00149
00151 virtual void shapeRender(SoGLRenderAction* action) = 0;
00152
00154 virtual void shapeGeneratePrimitives(SoAction* action) = 0;
00155
00157 void createRenderInterfaces(SoShape* bindedShape);
00158
00160 virtual void getBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er) = 0;
00161
00163 virtual void getBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er) = 0;
00164
00166 void doRendering(SoGLRenderAction* action, float offset);
00167
00169 void computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er);
00170
00172 void computeBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er);
00173
00176 virtual int getNumVertices(SoState* state) = 0;
00177
00179 virtual int getIndexCoord(int index) const = 0;
00180
00184 void invalidateBboxCache();
00185
00187 SoVolumeGeometryVbo* m_volVbo;
00188
00190 bool m_clipGeometry;
00191
00192 friend class SoLdmValuationAction;
00193 friend class SoVolumeGeometryVbo;
00194 friend class SoVolumeStateGeometry;
00195 friend class SoFenceSlice;
00196
00201 SoSlice::AlphaUse m_alphaUse;
00202
00214 bool m_enableBumpMapping;
00215
00222 float m_bumpScale;
00223
00224
00236 bool m_useRGBA;
00237
00238 SoINTERNAL private:
00240 virtual void ldmAction(SoLdmValuationAction* action);
00241
00242 private:
00243
00245 void renderVbo(SoGLRenderAction *action);
00246
00252 SoBoundingBoxCache* m_bboxCache[2];
00253
00254
00255
00256 };
00257
00258
00259 void
00260 SoVolumeGeometry::setClipGeometry(bool flag)
00261 {
00262 m_clipGeometry = flag;
00263 }
00264
00265 bool
00266 SoVolumeGeometry::isBumpMappingEnabled()
00267 {
00268 return m_enableBumpMapping;
00269 }
00270
00271 float
00272 SoVolumeGeometry::getBumScale()
00273 {
00274 return m_bumpScale;
00275 }
00276
00277 SoSlice::AlphaUse
00278 SoVolumeGeometry::getAlphaUse()
00279 {
00280 return m_alphaUse;
00281 }
00282
00283 void
00284 SoVolumeGeometry::setEnableBumMapping(bool flag)
00285 {
00286 m_enableBumpMapping = flag;
00287 }
00288
00289
00290 void
00291 SoVolumeGeometry::setBumpScale(float scale)
00292 {
00293 m_bumpScale = scale;
00294 }
00295
00296 void
00297 SoVolumeGeometry::setAlphaUse (SoSlice::AlphaUse alphaUse)
00298 {
00299 m_alphaUse = alphaUse;
00300 }
00301
00302 bool
00303 SoVolumeGeometry::isUsingRGBA()
00304 {
00305 return m_useRGBA;
00306 }
00307
00308 void
00309 SoVolumeGeometry::setUseRGBA(bool flag)
00310 {
00311 m_useRGBA = flag;
00312 }
00314
00315 #ifdef _MSC_VER
00316 #pragma warning(pop)
00317 #endif
00318
00319 #endif
00320
00321
00322