Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoVolumeGroup.h
Go to the documentation of this file.
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-2023 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
30
31#if defined(_WIN32)
32#pragma warning(push)
33#pragma warning(disable: 4251) // 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
34#endif
35
36class SoGLObjectCache;
37class SoLDMVirtualTexture;
38class SoVolumeOffscreenImpl;
39
125
127
128 public:
134
139
140 //------------------------------------------------------------------------------
141
142 private:
143
160 enum VGState
161 {
165 REGISTERING_VR,
169 COLLECTING_SLICE,
173 RENDERING,
174 };
175
176 struct VGSlice {
177 // slice distance from eye (affine component of slice plane), in view space.
178 // Note: in view space Z axis goes FROM screen TO viewer. A slice is IN FRONT OF another if its distance is greater.
179 float distance;
180 SoLDMVirtualTexture* texID;
181 int numVertices;
182 SbVec3f vertices[6];
183 const SoVolumeRender* vr;
184 SoRef<SoFaceSet> faceSet;
185 };
186
187 struct VRInfo {
188 SoPath* path;
190 /* Render at floor(1/vpScale of the viewport size). */
191 int vpScale;
192
193 float sliceDensity;
194 };
195
201 virtual bool affectsPath() const;
202
203 static void initClass();
204 static void exitClass();
205
206 void addVolume( SoState* state, const SbVec3f& planeNormal, const float sliceSpacing, const SoPath* vrPath, const SoVolumeRender* vr, SoVolumeRenderingQuality* vrq, int vpScale, float sliceDensity );
207 void addSlice( SoLDMVirtualTexture* vt, int numVertices, SbVec3f* vertices, const SoVolumeRender* vr );
208 VGState getVGState() const { return m_vgState; };
209
210 /* return edgeDetectfragDataId created by registerRTT */
211 int getEdgeDetectFragDataId() const;
212
213 const VRInfo* getVrInfo( const SoVolumeRender* vr );
214 const VGSlice* getVgSlice( const size_t index );
215 const VGSlice* getCurrentVgSlice();
216
217private:
219 virtual void GLRenderBelowPath(SoGLRenderAction *action);
221 virtual void GLRenderInPath(SoGLRenderAction *action);
222
223 private:
224 // Destructor
225 virtual ~SoVolumeGroup();
226
227 private:
228
229 typedef std::map<const SoVolumeRender*, VRInfo> VRInfoMap;
230
231 SoVolumeOffscreenImpl* m_volumeOffscreenImpl;
232
234 SoVRImageSpaceEffects* m_imageSpaceEffects;
235
239 static void clearVRInfoStruct(const VRInfoMap::value_type& p);
240
244 SoRef<SoFaceSet> buildFaceSet( const std::vector<int>& numVertices, const std::vector<SbVec3f>& vertices );
245
246 VGState m_vgState;
247 VRInfoMap m_vrInfoMap;
248
252 std::vector<VGSlice*> m_slices;
253 size_t m_currentSlice;
254
259 int m_currentVolume;
260
261 SbMatrix m_currentMatrix, m_currentMatrixInv;
262 SbVec3f m_currentPlane;
263
264 SoRef<SoFaceSet> m_currentFaceSet;
265 SoRef<SoVertexProperty> m_currentVp;
266
267 void sortSlices();
268 void renderSlices(SoState *state);
269 static bool compareSlice(const VGSlice *s1, const VGSlice *s2);
270
277 bool preRender(SoGLRenderAction *action, int &numberOfVolume);
281 void postRender(SoGLRenderAction *action, int numberOfVolume);
282
283 void setVGSlice(VGSlice* slice, float distance, SoLDMVirtualTexture* vt, int numVertices, SbVec3f vertices[], const SoVolumeRender* vr);
284
289 void beginOffscreenRendering( SoGLRenderAction* action );
290
295 void endOffscreenRendering( SoGLRenderAction* action );
296
301 bool needRttColor(SoState* state) const;
302
305 bool needRttEdgeDetect(SoState* state) const;
306
309 int getEdgeDetect2DMethod(SoState* state) const;
310
312 int getLowResolutionScale(SoState* state) const;
313
315 void updateVRQ(int bitmask, std::vector<int>& bitMaskVector);
316
318 void restoreVRQ(const std::vector<int>& bitMaskVector);
319
320};
321
322#if defined(_WIN32)
323#pragma warning(pop)
324#endif
325
326#endif // _SO_VOLUME_GROUP_
327
328
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
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...