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/SoLDMTileID.h>
00039 #include <LDM/actions/SoLdmValuationActionInterface.h>
00040
00041 class SoVertexShape;
00042 class SoVolumeGeometryVbo;
00043 class SoGLRenderAction;
00044 class SoAction;
00045 class SoState;
00046 class SoBoundingBoxCache;
00047 class SoPrimitiveVertex;
00048 class SoLdmValuationAction;
00049
00056 class SoVolumeGeometry : public SoLdmValuationActionInterface
00057 {
00058 public:
00059
00061 SoVolumeGeometry();
00062
00064 virtual ~SoVolumeGeometry();
00065
00066 private:
00067
00073 float intersectGeometry(const SoLDMTileID& tile) const;
00074
00076 virtual void triangleCB(SoAction* action,
00077 const SoPrimitiveVertex *v0,
00078 const SoPrimitiveVertex *v1,
00079 const SoPrimitiveVertex *v2 ) const ;
00080
00082 virtual void lineCB( SoAction* action,
00083 const SoPrimitiveVertex *v0,
00084 const SoPrimitiveVertex *v1 ) const ;
00085
00087 virtual void pointCB( SoAction* action, const SoPrimitiveVertex *v ) const ;
00088
00104 inline void setEnableBumMapping(bool flag);
00105
00107 inline bool isBumpMappingEnabled();
00108
00110 inline void setBumpScale(float scale);
00111
00113 inline float getBumScale();
00114
00116 inline void setAlphaUse (SoSlice::AlphaUse alphaUse);
00117
00119 inline SoSlice::AlphaUse getAlphaUse();
00120
00122 inline void setUseRGBA(bool flag);
00123
00125 inline bool isUsingRGBA();
00126
00127 #if 1 SoDEPRECATED
00135 virtual SoVolumeShape::Interpolation getInteractiveInterpolationValue(SoState* state) const = 0;
00136 #endif
00138 #if 1 SoDEPRECATED
00142 inline SoVolumeShape::Composition getComposition();
00143
00144 #endif
00146 private:
00147
00149 inline void setClipGeometry(bool flag);
00150
00152 virtual void GLRenderBoundingBox(SoGLRenderAction* action) = 0;
00153
00155 virtual void shapeRender(SoGLRenderAction* action) = 0;
00156
00158 virtual void shapeGeneratePrimitives(SoAction* action) = 0;
00159
00161 void createRenderInterfaces(SoShape* bindedShape);
00162
00164 virtual void getBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er) = 0;
00165
00167 virtual void getBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er) = 0;
00168
00170 void doRendering(SoGLRenderAction* action, float offset);
00171
00173 void computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er);
00174
00176 void computeBBox(SoAction *action, SbXfBox3d &box, SbVec3d ¢er);
00177
00179 virtual void ldmAction(SoLdmValuationAction* action);
00180
00183 virtual int getNumVertices(SoState* state) = 0;
00184
00186 virtual int getIndexCoord(int index) const = 0;
00187
00191 void invalidateBboxCache();
00192
00194 SoVolumeGeometryVbo* m_volVbo;
00195
00197 bool m_clipGeometry;
00198
00199 friend class SoLdmValuationAction;
00200 friend class SoVolumeGeometryVbo;
00201 friend class SoVolumeStateGeometry;
00202 friend class SoFenceSlice;
00203
00208 SoSlice::AlphaUse m_alphaUse;
00209
00221 bool m_enableBumpMapping;
00222
00229 float m_bumpScale;
00230
00231
00243 bool m_useRGBA;
00244
00245 private:
00246
00248 void renderVbo(SoGLRenderAction *action);
00249
00255 SoBoundingBoxCache* m_bboxCache[2];
00256
00257
00258
00259 };
00260
00261
00262 void
00263 SoVolumeGeometry::setClipGeometry(bool flag)
00264 {
00265 m_clipGeometry = flag;
00266 }
00267
00268 bool
00269 SoVolumeGeometry::isBumpMappingEnabled()
00270 {
00271 return m_enableBumpMapping;
00272 }
00273
00274 float
00275 SoVolumeGeometry::getBumScale()
00276 {
00277 return m_bumpScale;
00278 }
00279
00280 SoSlice::AlphaUse
00281 SoVolumeGeometry::getAlphaUse()
00282 {
00283 return m_alphaUse;
00284 }
00285
00286 void
00287 SoVolumeGeometry::setEnableBumMapping(bool flag)
00288 {
00289 m_enableBumpMapping = flag;
00290 }
00291
00292
00293 void
00294 SoVolumeGeometry::setBumpScale(float scale)
00295 {
00296 m_bumpScale = scale;
00297 }
00298
00299 void
00300 SoVolumeGeometry::setAlphaUse (SoSlice::AlphaUse alphaUse)
00301 {
00302 m_alphaUse = alphaUse;
00303 }
00304
00305 bool
00306 SoVolumeGeometry::isUsingRGBA()
00307 {
00308 return m_useRGBA;
00309 }
00310
00311 void
00312 SoVolumeGeometry::setUseRGBA(bool flag)
00313 {
00314 m_useRGBA = flag;
00315 }
00316
00317 #ifdef _MSC_VER
00318 #pragma warning(pop)
00319 #endif
00320
00321 #endif
00322
00323
00324