Open Inventor Release 2024.1.1
 
Loading...
Searching...
No Matches
SoVolumeRender.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2024 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : P. ESTRADE (Mar 2000)
22**=======================================================================*/
23#ifndef _SO_VOLUME_RENDER_
24#define _SO_VOLUME_RENDER_
25
26#include <Inventor/caches/SoCache.h>
27#include <Inventor/nodes/SoShape.h>
28#include <Inventor/nodes/SoShaderParameter.h>
29#include <Inventor/nodes/SoGroup.h>
30#include <Inventor/nodes/SoTextureUnit.h>
31#include <Inventor/fields/SoSFBool.h>
32#include <Inventor/fields/SoSFBitMask.h>
33#include <Inventor/fields/SoSFEnum.h>
34#include <Inventor/fields/SoSFFloat.h>
35#include <Inventor/fields/SoSFVec3f.h>
36#include <Inventor/fields/SoSFInt32.h>
37#include <Inventor/SbBox.h>
38
39#include <Inventor/STL/vector>
40#include <Inventor/STL/map>
41
42#include <VolumeViz/nodes/SoVolumeShape.h>
43
44#include <VolumeViz/LDM/SoLDMTileID.h>
45
46class SbProjection;
47class SoFrameBufferObject;
48class SoGLProgramGLSL;
49class SoGLTexture;
50class SoVRImageSpaceEffects;
51class SoLDMTileID;
52class SoLdmSubDivisionIsosurfacePolicy;
53class SoLdmSubDivisionPolicy;
54class SoLdmSubDivisionTransferFunctionPolicy;
55class SoShaderProgram;
56class SoVolumeGroup;
58class SoVolumeRenderInterface;
59class SoVolumeRenderRaycast;
60class SoVolumeRenderLdm;
61class SoVolumeRenderLdm;
62class SoVolumeRenderPaging;
64class SoVolumeStateVr;
66class SoNodeSensor;
67class SoVolumeOffscreenImpl;
68
69#ifdef _WIN32
70#pragma warning( push )
71#pragma warning(disable:4251)
72#endif
73
766 SO_NODE_HEADER( SoVolumeRender );
767
768 public:
769
792
793
838
870
884
894
913
922
923
941
953
971
982
1054
1062
1096
1125
1143
1148
1167
1171 typedef AbortCode SoVolumeRenderAbortCB(int totalElems, int thisElem, void *userData);
1172
1192 void setAbortCallback( SoVolumeRenderAbortCB *func, void *userData = NULL);
1193
1194
1195#if 1 SoDEPRECATED
1216SoDEPRECATED
1223SoDEPRECATED
1230
1231#endif
1233#if 1 SoDEPRECATED
1243
1244#endif
1246/*****************************************************************************/
1247private:
1249 virtual void computeBBox(SoAction *, SbBox3f &box, SbVec3f &center);
1250
1252 virtual void rayPick(SoRayPickAction *action);
1253
1254/*****************************************************************************/
1255private:
1256
1258 static void initClass();
1259
1261 static void exitClass();
1262
1266 SoVolumeRenderingQuality* getVolumeRenderingQuality( SoState* state ) const;
1267
1271 SoVolumeOffscreenImpl* getVolumeOffscreenImpl() const;
1272
1273#if 1 SoDEPRECATED
1276
1277#endif
1281 bool needOivDepth(SoState* state);
1282
1287 bool needRttColor(SoState* state) const;
1288
1291 bool needRttEdgeDetect(SoState* state) const;
1292
1295 bool needRttBoundaryDepth(SoState* state) const;
1296
1299 bool needRttBoundaryColor(SoState* state) const;
1300
1302 SamplingAlignment getSamplingAlignment(SoState* state) const;
1303
1305 void removeDsFromRegList(SoDataSet* pDs);
1306
1308 virtual void notify(SoNotList *list);
1309
1313 void onUserInteractionChange(SoState*state, bool stopMoving);
1314
1315/*****************************************************************************/
1316 private:
1317 // Destructor
1318 virtual ~SoVolumeRender();
1319
1320 void createVolumeRender( SoState* state );
1321
1322 void generatePrimitives(SoAction *action);
1323
1324 void doRendering(SoGLRenderAction *action);
1325
1326 void setupVolumeRenderInterface(SoState* state);
1327
1328 SoDetail *createTriangleDetail(SoRayPickAction *,
1329 const SoPrimitiveVertex *v1,
1330 const SoPrimitiveVertex *,
1331 const SoPrimitiveVertex *,
1332 SoPickedPoint *);
1333
1338 void beginOffscreenRendering( SoGLRenderAction* action );
1339
1344 void endOffscreenRendering( SoGLRenderAction* action );
1345
1349 void setupFrontToBackGlState(SoState* state);
1350
1355 SbBool shouldGLRender(SoGLRenderAction *renderAction, SbBool isPointsOrLines);
1356
1357/*****************************************************************************/
1358SoINTERNAL private:
1359
1361 virtual void ldmAction(SoLdmValuationAction* action);
1362
1363/*****************************************************************************/
1364private:
1365
1366#if 1 SoDEPRECATED
1368 SoSFBool useEarlyZ;SoDEPRECATED
1370 SoSFInt32 numEarlyZPasses;SoDEPRECATED
1372 SoSFBool gpuVertexGen;
1373#endif
1376 void fillDetail(SoRayPickAction* rpa, SoVolumeRenderDetail* detail, const SoLDM::DataSetIdPair& idPair);
1377
1378 void genPrimDataSet(SoAction* action, const SoLDM::DataSetIdPair& idPair);
1379
1381 bool canSubdivideTiles(SoState* state);
1382
1384 bool isRaycastingEnabled(SoState* state) const;
1385
1386 SoVolumeRenderAbortCB *m_abortCBfunc;
1387 void *m_abortCBuserData;
1388 void GLRenderTex2D3D(SoGLRenderAction* action);
1389
1393 void useOffscreenRendering(SoGLRenderAction* action);
1394
1398 void initInternalShaders();
1399
1400 void setupDepthPeelingTextures(SoGLRenderAction *action);
1401
1402 void rayPickDataSet(SoRayPickAction* action, const SoLDM::DataSetIdPair& idPair);
1403
1405 SoVRImageSpaceEffects* m_imageSpaceEffects;
1406
1413 int m_vpScale;
1414
1417 int m_lowScreenResScale;
1418
1419 SoShaderParameter1i *m_opacityTex;
1420 SoGLProgramGLSL* m_binaryOpacityComposeShader;
1421
1422 SoShaderProgram* m_writeFragShader;
1423
1424 SoVolumeIsosurface* m_volumeIsosurface;
1425
1429 void deleteShadersFboTextures();
1430
1434 void updateLowResScale( SoState* state );
1435
1439 void registerCtxId(const SoLDM::DsVector &dsVector, int ctxId);
1440
1444 void unregisterCtxId(const SoLDM::DsVector &dsVector, int ctxId);
1445
1447 bool m_useLowResMove;
1448
1450 bool m_useLowNumSliceMove;
1451
1452 SoVolumeRenderLdm* m_vriLdm;
1453 SoVolumeRenderRaycast* m_vriRaycast;
1454 SoVolumeRenderInterface* m_vri;
1455
1456 bool m_frontToBackComposition;
1457
1458 // List of dataset gathered in previous valuation action
1459 SoLDM::DsVector m_prevDsList;
1460
1461 // Callback to manage deletion of dataset
1462 static void volDataDeleteCB(void* data, SoSensor *sensor);
1463
1464 // ctxId attached to this volumeRender. Set by ValuationAction.
1465 int m_prevRegisteredCtxId;
1466
1467 SoVolumeStateVr* m_vs;
1468
1469 SoVolumeOffscreenImpl* m_volumeOffscreenImpl;
1470
1471 // Associate a Node sensor to each DataSet managed
1472 std::map<SoDataSet*, SoNodeSensor*> m_mapDsSensor;
1473
1474 friend class SoVolumeRenderLdm;
1476
1477 SoRef<SoGroup> m_depthPeelingSG;
1478 SoRef<SoGroup> m_depthPeelingColorTexGroup;
1479 SoRef<SoTextureUnit> m_depthPeelingColorTexUnit;
1480 SoRef<SoGroup> m_depthPeelingDepthTexGroup;
1481 SoRef<SoTextureUnit> m_depthPeelingDepthTexUnit;
1482};
1483
1484#if defined(_WIN32)
1485#pragma warning( pop )
1486#endif
1487
1488#endif // _SO_VOLUME_RENDER_
1489
1490
3D box class.
Definition SbBox.h:649
Base class for coordinate projection classes.
3D vector class.
Definition SbVec.h:932
Abstract base class for all actions.
Definition SoAction.h:132
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Data set...
Definition SoDataSet.h:139
Base class for describing detail information about a shape node.
Definition SoDetail.h:99
Renders a scene graph using Open Inventor's Render Engine.
<a href="IconLegend.html"><img src="extLDM.gif" alt="Large Data Management" border="0"></a> Tile ID
Definition SoLDMTileID.h:63
friend class SoLdmValuationAction
Definition SoLdmShape.h:84
Multiple-value field containing any number of int32_t integers.
Definition SoMFInt32.h:88
Sensor class that can be attached to Open Inventor nodes.
Represents point on surface of picked object.
Represents a vertex of a generated primitive.
Intersects objects with a ray cast into scene.
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Single-value field containing a set of bit flags.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Field containing a three-dimensional vector.
Definition SoSFVec3f.h:80
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Uniform shader p...
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Shader program p...
Traversal state.
Definition SoState.h:74
Groups multiple volumes to be volume rendered in the same scene.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Isosurface property n...
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Stores detail informa...
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Renders data volumes ...
SoSFEnum renderMode
Specifies how the voxels along each sampling ray are combined to form the final image.
SoSFInt32 numSlices
Specifies the number of samples along each ray.
SoVolumeRender()
Constructor.
SoSFBool subdivideTile
If true, LDM tiles will be subdivided for rendering.
NumSlicesControl
Number of samples control mode.
@ MANUAL
Use the number of samples specified by the numSlices field.
@ MAIN_AXIS
Use a number of samples computed as follows: n = complexity * 2 * volumeDataDimension[mainVisibl...
@ AUTOMATIC
(Recommended) Use a number of samples computed as follows: If numSlices is greater than zero,...
@ ALL
Use all samples.
SoSFEnum samplingAlignment
Specifies which technique to use to align rayCast samples.
friend class SoVolumeRenderLdm
AbortCode
Abort code for callback.
@ SKIP
The current slice is not drawn.
@ ABORT
The render action of the SoVolumeRender node is aborted.
@ CONTINUE
Continue rendering as usual.
SoDEPRECATED SoSFBool lighting
Indicates if lighting is required.
SoSFBool fixedNumSlicesInRoi
When this field is set to FALSE (the default), the number of samples set by numSlices is the number o...
SoDEPRECATED SoSFFloat lightIntensity
Light intensity in the range [0-1].
SoSFFloat opacityThreshold
Specifies a threshold opacity (alpha) value that defines voxels considered to be "solid" (non-transpa...
SoDEPRECATED SoSFBool viewAlignedSlices
Indicates if samples should be computed in a view-aligned manner.
SamplingAlignment
Sampling alignment.
@ VIEW_ALIGNED
Samples are located on planes perpendicular to the view direction.
@ BOUNDARY_ALIGNED
Samples are located on shells aligned with the volume's internal "boundary".
@ DATA_ALIGNED
Samples are located on planes perpendicular to one axis of the volume.
@ SMOOTH_BOUNDARY_ALIGNED
Similar to BOUNDARY_ALIGNED but uses a cubic interpolation to compute the boundary,...
SoSFBitMask lowResMode
Sets the method to use when moving in low resolution.
SoSFBool opacityCorrection
Controls whether opacity correction is done.
SoSFEnum numSlicesControl
Controls how the number of samples along each ray is determined.
LowResMode
Method to use when moving in low resolution.
@ DECREASE_SCREEN_RESOLUTION
Downscale the screen resolution of the volume when moving by the factor defined in lowScreenResolutio...
@ DECREASE_NONE
No low resolution mode when moving.
@ DECREASE_SLICES
Decrease the number of samples according to SoComplexity::value when moving.
SoSFInt32 projectedTileSubdivision
When doing volume projection (see SoProjection), only the geometry (corner vertices) of the LDM tiles...
void setAbortCallback(SoVolumeRenderAbortCB *func, void *userData=NULL)
Sets callback to call during texture map rendering to test for an abort condition.
friend class SoVolumeRenderRaycast
RenderMode
Composition mode.
@ MAX_INTENSITY_PROJECTION
Maximum intensity projection (MIP).
@ MAX_INTENSITY_DIFFERENCE_ACCUMULATION
Maximum Intensity Difference Accumulation (MIDA).
@ INTENSITY_DIFFERENCE_ACCUMULATION
Intensity Difference Accumulation.
@ MIN_INTENSITY_PROJECTION
Minimum intensity projection (MinIP).
@ AVERAGE_INTENSITY_PROJECTION
Average Intensity projection (AIP).
@ VOLUME_RENDERING
Alpha compositing (Default).
@ MAX_GRADIENT_DIFFERENCE_ACCUMULATION
Maximum Gradient Difference Accumulation.
@ SUM_INTENSITY_PROJECTION
Ray sum intensity projection (RSP).
@ GRADIENT_DIFFERENCE_ACCUMULATION
Gradient Difference Accumulation.
SoSFInt32 lowScreenResolutionScale
If lowResMode is DECREASE_SCREEN_RESOLUTION, render the volume at a lower screen resolution.
AbortCode SoVolumeRenderAbortCB(int totalElems, int thisElem, void *userData)
SoDEPRECATED SoSFVec3f lightDirection
Light direction (relative to the volume).
SoMFInt32 dataSetIds
Specifies the list of volumes on which volume rendering is applied.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Volume rendering qual...
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Abstract base class f...
int SbBool
Boolean type.
Definition SbBase.h:87
std::pair< SoDataSet *, int > DataSetIdPair
Pair containing an SoDataset and its dataSetId.
Definition SoLDM.h:71
std::vector< SoDataSet * > DsVector
Vector of SoDataSet.
Definition SoLDM.h:56