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_VOLUME_SHAPE_H
00026 #define SO_VOLUME_SHAPE_H
00027
00028 #include <Inventor/nodes/SoShape.h>
00029
00030 #include <Inventor/fields/SoSFBool.h>
00031 #include <Inventor/fields/SoSFFloat.h>
00032 #include <Inventor/fields/SoSFEnum.h>
00033 #include <Inventor/fields/SoSFUInt32.h>
00034 #include <Inventor/fields/SoSFNode.h>
00035
00036 #include <Inventor/STL/vector>
00037
00038 #include <Inventor/sys/SoGLType.h>
00039
00040 #include <Inventor/SbViewportRegion.h>
00041
00042 #include <LDM/nodes/SoTransferFunction.h>
00043 #include <LDM/nodes/SoLdmShape.h>
00044
00045 class SoState;
00046 class SoVolumeData;
00047 class SoVolumeRenderingQuality;
00048 class SoVolumeShader;
00049 class SoVolumeShaderARB;
00050 class SoVolumeState;
00051
00052 #ifdef _WIN32
00053 #pragma warning( push )
00054 #pragma warning(disable:4251)
00055 #endif
00056
00057
00085 class SoVolumeShape : public SoLdmShape {
00086 SO_NODE_ABSTRACT_HEADER(SoVolumeShape);
00087
00088 public:
00089
00094 enum Interpolation {
00098 NEAREST,
00104 LINEAR,
00113 TRILINEAR,
00123 MULTISAMPLE_12,
00164 CUBIC
00165 };
00166
00173 SoSFEnum interpolation;
00174
00175 #if 1 SoDEPRECATED enum
00181 Composition {
00183 MAX_INTENSITY = 0,
00185 MIN_INTENSITY,
00187 SUM_INTENSITY,
00189 ALPHA_BLENDING,
00190 COMPOSITION_LAST
00191 };
00192 SoDEPRECATED
00219 SoSFEnum composition;
00220
00221 #endif
00223 private:
00224
00226 virtual void GLRender(SoGLRenderAction *action);
00227
00229 virtual void computeBBox(SoAction *action, SbBox3f &box, SbVec3f ¢er);
00230
00232 virtual void getBoundingBox(SoGetBoundingBoxAction *action);
00233
00234 private:
00235
00237 static void initClass();
00238
00240 static void exitClass();
00241
00242
00243
00244 virtual int32_t getRenderUnitID() const;
00245
00249 void setVVizUniforms( SoGLRenderAction* action,
00250 const float *sliceTangent, const float *sliceBinormal,
00251 int sliceAxis, float scale, float sliceSpacing,
00252 SbBool doMultiVolume, const SbVec3f& scaleFactor,
00253 const SbVec3f& lowResScaleFactor, SbBool doTexGen = TRUE,
00254 const SbMatrix* virtToPageTableMatrix = NULL, const SbMatrix* shapeToVirtMatrix = NULL);
00255
00259 void setVVizZAxis(const SbVec3f& zAxis);
00260
00266 virtual bool enableColorMap(SoState *state,
00267 SoTransferFunction::GLColorMapType colorMapInstalled,
00268 int &texType);
00269
00273 SoTransferFunction::GLColorMapType getInstalledColorMap() const;
00274
00278 int getGLInterpolation();
00279
00283 virtual void enableBlending(SoState *state);
00284
00288 virtual void onViewportChange(SoState*state);
00289
00293 virtual void onUserInteractionChange(SoState* state, bool stopMoving);
00294
00298 SoVolumeShape::Interpolation getInteractiveInterpolationValue(SoState* state) const;
00299
00300
00301 virtual SbBool shouldGLRender(SoGLRenderAction* action, SbBool isPointOrLine = FALSE);
00302
00303 private:
00304 SoVolumeState* m_volumeState;
00305
00306 SoVolumeShape();
00307 virtual ~SoVolumeShape();
00308
00312 virtual bool isTransparent(SoState *state);
00313
00317 virtual void delayRendering( SoGLRenderAction* action );
00318
00322 bool isDelayed();
00323
00327 SoVolumeShader* getVolumeShader(SoState *state);
00328
00333 void getVVizUniformLocation();
00334
00339 virtual void setVVizVertexGenUniforms();
00340
00345 void setGLAlphaBlendingFunc();
00346
00351 void useSeparateAlphaBlend(bool flag);
00352
00356 GLenum getDepthInternalFormat();
00357
00361 bool isMoving();
00362
00366 virtual void doRendering(SoGLRenderAction* action) = 0;
00367
00368 static void onViewportChangeCb(SoState* state, SoNode* node);
00369 static void onUserInteractionChangeCb(SoState* state, SoNode* node, bool moving);
00370
00371 #ifndef HIDDEN_FROM_DOC
00372 friend class SoSliceInterface;
00373 #endif
00374
00375 SoINTERNAL private:
00376
00378 virtual void ldmAction( SoLdmValuationAction* action );
00379 };
00380
00381 #if defined(_WIN32)
00382 #pragma warning( pop )
00383 #pragma warning(disable:4251)
00384 #endif
00385
00386 #endif
00387
00388
00389