Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoDepthOffsetElement.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-2018 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : Nicolas DAGUISE (Dec 2008)
22**=======================================================================*/
23
24#ifndef SO_DEPTH_OFFSET_ELEMENT_H
25#define SO_DEPTH_OFFSET_ELEMENT_H
26
27#include <Inventor/elements/SoFloatElement.h>
28
42SoEXTENDER_Documented class SoDepthOffsetElement : public SoFloatElement
43{
44
45 SO_ELEMENT_HEADER(SoDepthOffsetElement);
46
47public:
48
50 static void set(SoState *state, float offset);
51
53 static void set(SoState *state, SoNode *, float offset);
54
56 static void set(SoState *state, float, float, float);
57
59 static float get(SoState *state);
60
62 static void setMaxOffset(SoState *state, float offset);
63
65 static float getMaxOffset(SoState *state);
66
68 virtual void push( SoState* );
69
71 virtual void pop(SoState*, const SoElement*);
72
73private:
74
76 virtual void init(SoState *state);
77
78private:
79 // Initializes the class
80 static void initClass();
81 static void exitClass();
82
85 static void setNormalizationFactor(SoState *state, float value);
86
88 static float getNormalizationFactor(SoState *state);
89
92 static void setNDCadjustment(SoState *state, float value);
93
95 static float getNDCadjustment(SoState *state);
96
98 static void evalGlobalFactors(float offset, float& NDCadjustment, float &normFactor);
99
100 // Specify the version of depth offset used :
101 // V1 : Depth offset modifies camera projection matrix
102 // V2 : Depth offset modifies projection matrix only here
103 // To have the same behavior than V1, you have to add a DepthOffset node
104 // with an offset at 0 on the root of the scene graph.
105 enum DepthOffsetVersion
106 {
107 NONE = -1,
108 V1 = 1,
109 V2
110 };
111
116 static DepthOffsetVersion getDepthOffsetVersion();
117
121 static void copyDepthOffset( SoState* dstState, SoState* srcState );
122
123private:
124 virtual ~SoDepthOffsetElement();
125
126 float maxOffset;
127 float localdata;
128 float normalizationFactor;
129 float NDCadjustment;
130
131private :
132
133 static DepthOffsetVersion s_depthOffsetVersion;
134};
135
136#endif // SO_DEPTH_OFFSET_ELEMENT_H
137
138
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Manage SoDepthOf...
static void set(SoState *state, SoNode *, float offset)
Sets the current offset in the state.
static float getMaxOffset(SoState *state)
Returns current accumulated offset from the state.
static void set(SoState *state, float offset)
Sets the current offset in the state.
virtual void pop(SoState *, const SoElement *)
Pop the element from the state.
static void set(SoState *state, float, float, float)
Sets the current offset in the state.
static void setMaxOffset(SoState *state, float offset)
Sets the current offset in the state.
virtual void push(SoState *)
Push the element into the state.
static float get(SoState *state)
Returns current accumulated offset from the state.
Abstract base class for all state elements.
Definition SoElement.h:102
Element's subclasses store a single float, int, or enum value.
Abstract base class for all database nodes.
Definition SoNode.h:145
Traversal state.
Definition SoState.h:74