Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoVolumeGroup.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 : T. DUFOUR (Nov 2002)
22** Modified by : J. SALLANNE (Aug 2012)
23**=======================================================================*/
24#ifndef _SO_VOLUME_GROUP_
25#define _SO_VOLUME_GROUP_
26
27#include <VolumeViz/nodes/SoVolumeRender.h>
28#include <Inventor/nodes/SoSeparator.h>
29
30#if defined(_WIN32)
31#pragma warning(push)
32#pragma warning(disable: 4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
33#endif
34
35class SoGLObjectCache;
36class SoLDMVirtualTexture;
37class SoVolumeOffscreenImpl;
38
124
125 SO_NODE_HEADER( SoVolumeGroup );
126
127 public:
133
138
139 //------------------------------------------------------------------------------
140
141 private:
142
159 enum VGState
160 {
164 REGISTERING_VR,
168 COLLECTING_SLICE,
172 RENDERING,
173 };
174
180 virtual bool affectsPath() const;
181
182 static void initClass();
183 static void exitClass();
184
185 void addVolume(SoState* state, const SoVolumeRender* vr, SoLDMVirtualTexture* vt, SbVec3f planeNormal, int vpScale, float sliceDensity);
186 void addSlice(const SoVolumeRender* vr, int numVertices, SbVec3f* vertices);
187 VGState getVGState() const { return m_vgState; };
188
189 /* return edgeDetectfragDataId created by registerRTT */
190 int getEdgeDetectFragDataId() const;
191
192 float getSliceDensity(const SoVolumeRender* vr) const;
193
194 SoVolumeRenderingQuality* getVRQ(const SoVolumeRender* vr) const;
195
196 typedef std::pair< unsigned int, SoRef<SoShape> > IdShapePair;
197
198 const std::vector<IdShapePair>& getInternalShapeListForThisVr(const SoVolumeRender* vr) const;
199
200private:
202 virtual void GLRenderBelowPath(SoGLRenderAction* action);
204 virtual void GLRenderInPath(SoGLRenderAction* action);
205
206 private:
207 // Destructor
208 virtual ~SoVolumeGroup();
209
210 private:
211
212 struct Slice {
213 // slice distance from eye (affine component of slice plane), in view space.
214 // Note: in view space Z axis goes FROM screen TO viewer. A slice is IN FRONT OF another if its distance is greater.
215 float distance;
216 std::vector<SbVec3f> vertices;
217 const SoVolumeRender* vr;
218 Slice(float distance, int numVertices, SbVec3f* vertices, const SoVolumeRender* vr);
219 };
220
221
222 struct VRInfo {
223 SoPath* path;
225 SoLDMVirtualTexture* texID;
226 int vpScale;
227 float sliceDensity;
228 SbVec3f planeNormal;
229 SbMatrix viewingMatrix;
230 };
231
232 typedef std::map<const SoVolumeRender*, VRInfo> VRInfoMap;
233 typedef std::map< const SoVolumeRender*, std::vector< IdShapePair > > VRContinuousShapeMap;
234
235 std::map < const SoVolumeRender*, SoRef<SoVolumeRenderingQuality> > m_vrVrqMap;
236
237 VRContinuousShapeMap m_vrContinuousShapeMap;
238
239 SoVolumeOffscreenImpl* m_volumeOffscreenImpl;
240
242 SoVRImageSpaceEffects* m_imageSpaceEffects;
243
247 SoRef<SoShape> buildShapeSlices(const SoVolumeRender* vr, unsigned int orderedShapeId, unsigned int id, const std::vector<SbVec3f>& vertices);
248
249 VGState m_vgState;
250 VRInfoMap m_vrInfoMap;
251
255 std::vector<Slice*> m_slices;
256
257 void sortSlices();
258 void renderSlices(SoState *state);
259 static bool compareSlice(const Slice*s1, const Slice*s2);
260
267 bool preRender(SoGLRenderAction *action, int &numberOfVolume);
271 void postRender(SoGLRenderAction *action, int numberOfVolume);
272
277 void beginOffscreenRendering( SoGLRenderAction* action );
278
283 void endOffscreenRendering( SoGLRenderAction* action );
284
287 bool needRttEdgeDetect(SoState* state) const;
288
291 int getEdgeDetect2DMethod(SoState* state) const;
292
294 int getLowResolutionScale() const;
295
297 void updateVRQ(int bitmask, std::vector<int>& bitMaskVector);
298
300 void restoreVRQ(const std::vector<int>& bitMaskVector);
301};
302
303#if defined(_WIN32)
304#pragma warning(pop)
305#endif
306
307#endif // _SO_VOLUME_GROUP_
308
309
4x4 matrix class.
Definition SbMatrix.h:309
3D vector class.
Definition SbVec.h:932
Renders a scene graph using Open Inventor's Render Engine.
Path that points to a list of hierarchical nodes.
Definition SoPath.h:187
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Field containing a single Boolean value.
Definition SoSFBool.h:79
Group node that saves and restores traversal state.
Traversal state.
Definition SoState.h:74
Groups multiple volumes to be volume rendered in the same scene.
SoVolumeGroup()
Constructor.
SoSFBool multiVolumes
Activates the multi-volumes feature.
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Renders data volumes ...
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Volume rendering qual...