00001 /*======================================================================= 00002 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00003 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00004 *** *** 00005 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00006 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00007 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00008 *** *** 00009 *** RESTRICTED RIGHTS LEGEND *** 00010 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00011 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00012 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00013 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00014 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00015 *** *** 00016 *** COPYRIGHT (C) 1996-2017 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : VSG (MMM YYYY) 00022 **=======================================================================*/ 00023 00024 #ifndef _SO_SHADER_PROGRAM_ELEMENT_ 00025 #define _SO_SHADER_PROGRAM_ELEMENT_ 00026 00027 #include <Inventor/elements/SoReplacedElement.h> 00028 #include <Inventor/misc/SoRef.h> 00029 #include <Inventor/nodes/SoShaderProgram.h> 00030 00031 class SoGLShaderProgram ; 00032 class SoGLRenderAction; 00033 00045 SoEXTENDER_Documented class SoShaderProgramElement : public SoReplacedElement { 00046 00047 SO_ELEMENT_HEADER(SoShaderProgramElement); 00048 00049 public: 00050 00051 00055 static void set(SoState *state, SoNode *node); 00056 00060 static void get(SoState *state, SoShaderProgram *&); 00061 00065 virtual void push(SoState *) ; 00066 00070 virtual void pop(SoState *state, const SoElement *prevTopElement); 00071 00072 private: 00073 00078 virtual void commonInit(); 00079 00081 virtual void init(SoState *state); 00082 00083 private: 00084 // Initializes the classes. 00085 static void initClass(); 00086 static void exitClass(); 00087 00089 static const SoShaderProgramElement* get(SoState *state); 00090 00092 inline bool isEnabled() const { return m_enabled; } 00093 00095 inline bool isInternal() const { return m_internal; } 00096 00097 static SoShaderProgramElement * getCurrentElement(SoState *); 00098 00100 static SbBool generatesTransparency(SoState *state); 00101 00103 static bool hasTessellationShader(SoState *state); 00104 00105 private: 00106 // Destructor 00107 virtual ~SoShaderProgramElement(); 00108 00109 // Current shader storage 00110 SoRef<SoShaderProgram> m_shaderProgram ; 00111 00113 bool m_enabled; 00114 00115 // describes if the shader program is set by the user (i.e. false) or by a 00116 // shader-dependent node (i.e. true, such as SoShadowGroup or SoMultipleInstance). 00117 bool m_internal; 00118 00119 }; 00120 #endif /* _SO_GL_SHADER_PROGRAM_ELEMENT_ */ 00121 00122 00123