Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoVolumeClippingGroup.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-2019 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Benjamin GRANGE (Aug 2006)
22** Modified : David BEILLOIN (Mar 2011)
23**=======================================================================*/
24#ifndef _SO_VOLUME_CLIPPING_GROUP_
25#define _SO_VOLUME_CLIPPING_GROUP_
26
30#include <Inventor/SbBox.h>
31
32class SoGLDepthPeeling;
33class SoState;
34
171
172 public:
173
178
184
192
196 static unsigned int getMaxNumPasses();
197
199 typedef void SoVolumeClippingGroupCB( SoVolumeClippingGroup* mgr, void* userData );
200
206
207 private:
208 virtual void GLRender(SoGLRenderAction* action);
209 virtual void doAction(SoAction* action);
210 virtual void getBoundingBox(SoGetBoundingBoxAction* action);
211
213 virtual void rayPick(SoRayPickAction* action);
214
215 private:
216 static void initClass();
217 static void exitClass();
218
219 //Get the texture unit number where the first depth layer is binded
220 int getFirstDepthTextureUnit( SoGLRenderAction* action ) const;
221
222 //Return the number of depth textures pairs
223 int getNumPairs() const;
224
225 //Return the real number of depth layer passes used
226 int getNumPassUsed() const;
227
228 //TRUE if box is not into the clipping volume
229 SbBool isCulled(const SbBox3f& box);
230
231 // This is used by SoVolumeGroupElement just to ensure that
232 // the resources won't be allocated-computed-release for each path
233 // collected by the SoVolumeGroup node.
234 //
235 // This method is called by SoVolumeClippingGroup itself. The SoVolumeGroupElement calls the unlock
236 // in order to allow releaseResources to do the job.
237 void lockResources();
238
239 // Release previously locked resources.
240 void unlockResources();
241
242 // Indicates if the resources are locked or not.
243 bool areResourcesLocked() const;
244
245 // Release the depth peeling resources if they are not locked.
246 // Most of the time it is called by SoVolumeClippingGroupElement, except when we do multi volume
247 // the release is done by SoVolumeGroupElement.
248 void releaseResources();
249
250 // Set depth texture in SoVolumeRender
251 void setDepthPeelingTextureOnState(SoGLRenderAction* action);
252
255 inline const SbXfBox3f& getWorldBbox() const { return m_worldBbox; }
256
258 virtual void notify(SoNotList* list);
259
260private:
261 virtual ~SoVolumeClippingGroup();
262
263private:
264
265 enum LayersState
266 {
267 NOT_COMPUTED,
268 COMPUTED,
269 };
270
271 LayersState m_layersState;
272
273 bool m_isLocked;
274
276 struct NotEnoughLayerCBData {
277 NotEnoughLayerCBData() : m_notEnoughPassCB(NULL), m_notEnoughPassCBData(NULL), that(NULL) {}
279 SoVolumeClippingGroupCB* m_notEnoughPassCB;
281 void* m_notEnoughPassCBData;
284 };
286 NotEnoughLayerCBData m_notEnoughLayerCBData;
287
297 static void notEnoughLayerCB(void* userData, SoGLDepthPeeling* mgr);
298
299 void commonInit();
300
301 SbBool initDepthPeeling(SoGLRenderAction* action, const SbVec2s& vpSize);
302
303 SoGLDepthPeeling* m_glDepthPeeling;
304
305 SbVec2s m_previousViewportSize;
306
307 SbBool m_needViewportSizeUpdate;
308
309 // update bbox of the clipping volume
310 void updateChildBBox();
311
312 // get bbox of the clipping volume
313 const SbXfBox3f& getBBox(SoAction*);
314
315 bool m_applyTochild;
316 SbXfBox3f m_bbox;
317 bool m_bboxCacheClean;
318
319 SbXfBox3f m_worldBbox;
320
321 struct SoVolumeClippingInfos {
324 } m_clippingInfos;
325 static void renderCB(void* userData, SoGLDepthPeeling* );
326
329 SbBool m_depthPeelingPass;
330
331 SbBool m_releaseResources;
332};
333/*----------------------------------------------------------------------------*/
334#endif
335
336
#define SO_NODE_HEADER(className)
Definition SoSubNode.h:151
3D box class.
Definition SbBox.h:649
2D vector class.
Definition SbVec.h:700
3D box with an associated transformation matrix.
Definition SbBox.h:1250
Abstract base class for all actions.
Definition SoAction.h:132
Renders a scene graph using Open Inventor's Render Engine.
Computes bounding box of a scene.
Base class for all group nodes.
Definition SoGroup.h:122
Intersects objects with a ray cast into scene.
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing a int32_t integer.
Definition SoSFInt32.h:80
Traversal state.
Definition SoState.h:74
<a href="IconLegend.html"><img src="extVR.gif" alt="VolumeViz" border="0"></a> Clipping a volume wit...
SoSFBool clipOutside
If TRUE, voxels inside the clipping object will be drawn, voxels outside will be clipped.
void SoVolumeClippingGroupCB(SoVolumeClippingGroup *mgr, void *userData)
Callback prototype.
static unsigned int getMaxNumPasses()
Returns the maximum number of passes supported by the hardware.
SoSFInt32 numPasses
Number of passes used to do the clipping.
SoVolumeClippingGroup()
Default constructor.
void setNotEnoughPassCallback(SoVolumeClippingGroupCB *f, void *userData)
Set a callback to be called when there are not enough passes (see numPasses) to properly apply the cl...
int SbBool
Boolean type.
Definition SbBase.h:87