Open Inventor Release 2024.2.0
 
Loading...
Searching...
No Matches
SoShaderProgramElement.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-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23
24#ifndef _SO_SHADER_PROGRAM_ELEMENT_
25#define _SO_SHADER_PROGRAM_ELEMENT_
26
27#include <Inventor/elements/SoReplacedElement.h>
28#include <Inventor/misc/SoRef.h>
29#include <Inventor/nodes/SoShaderProgram.h>
30
31class SoGLShaderProgram ;
33
45SoEXTENDER_Documented class SoShaderProgramElement : public SoReplacedElement {
46
47 SO_ELEMENT_HEADER(SoShaderProgramElement);
48
49public:
50
51
55 static void set(SoState *state, SoNode *node);
56
60 static void get(SoState *state, SoShaderProgram *&);
61
65 virtual void push(SoState *) ;
66
70 virtual void pop(SoState *state, const SoElement *prevTopElement);
71
72private:
73
78 virtual void commonInit();
79
81 virtual void init(SoState *state);
82
83private:
84 // Initializes the classes.
85 static void initClass();
86 static void exitClass();
87
89 static const SoShaderProgramElement* get(SoState *state);
90
92 inline bool isEnabled() const { return m_enabled; }
93
95 inline bool isInternal() const { return m_internal; }
96
97 static SoShaderProgramElement * getCurrentElement(SoState *);
98
100 static SbBool generatesTransparency(SoState *state);
101
103 static bool hasTessellationShader(SoState *state);
104
105private:
106 // Destructor
107 virtual ~SoShaderProgramElement();
108
109 // Current shader storage
110 SoRef<SoShaderProgram> m_shaderProgram ;
111
113 bool m_enabled;
114
115 // describes if the shader program is set by the user (i.e. false) or by a
116 // shader-dependent node (i.e. true, such as SoShadowGroup or SoMultipleInstance).
117 bool m_internal;
118
119};
120#endif /* _SO_GL_SHADER_PROGRAM_ELEMENT_ */
121
122
Abstract base class for all state elements.
Definition SoElement.h:102
Renders a scene graph using Open Inventor's Render Engine.
Abstract base class for all database nodes.
Definition SoNode.h:145
Smart pointer for any class inheriting SoRefCounter.
Definition SoRef.h:90
Abstract base class for each state element whose value is replaced whenever it is set.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Stores the curre...
static void set(SoState *state, SoNode *node)
Sets the current shader program in the state.
static void get(SoState *state, SoShaderProgram *&)
Gets the current shader program in the state.
virtual void push(SoState *)
Overrides push() method so side effects can occur in GL.
virtual void pop(SoState *state, const SoElement *prevTopElement)
Overrides pop() method so side effects can occur in GL.
<a href="IconLegend.html"><img src="extTGS.gif" alt="VSG extension" border="0"></a> Shader program p...
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87