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-2019 BY FEI S.A.S, *** 00017 *** BORDEAUX, FRANCE *** 00018 *** ALL RIGHTS RESERVED *** 00019 **=======================================================================*/ 00020 /*======================================================================= 00021 ** Author : R. ALBOU (Feb 1997) 00022 **=======================================================================*/ 00023 00024 #ifndef _SO_ENVIRONMENT_ELEMENT_ 00025 #define _SO_ENVIRONMENT_ELEMENT_ 00026 /* include files */ 00027 #include <Inventor/elements/SoReplacedElement.h> 00028 #include <Inventor/SbColor.h> 00029 00030 /*----------------------------------------------------------------------------*/ 00042 SoEXTENDER_Documented class SoEnvironmentElement : public SoReplacedElement { 00043 SO_ELEMENT_HEADER(SoEnvironmentElement) ; 00044 00045 public: 00046 00048 enum FogType { 00050 NONE, 00052 HAZE, 00054 FOG, 00056 SMOKE 00057 } ; 00058 00066 struct EnvironmentParameters { 00067 EnvironmentParameters(); 00068 00069 float ambientIntensity; 00070 SbColor ambientColor; 00071 SbVec3f attenuation; 00072 SbBool ambientOcclusion; 00073 FogType fogType; 00074 SbColor fogColor; 00075 float fogStart; 00076 float fogVisibility; 00077 }; 00078 00082 static void set(SoState *state, SoNode *node, const EnvironmentParameters& envParams) ; 00083 00087 static void get(SoState *state, EnvironmentParameters& envParams) ; 00088 00092 static float getAmbientIntensity(SoState *state) ; 00093 00097 static const SbColor& getAmbientColor(SoState *state) ; 00098 00102 static const SbVec3f& getLightAttenuation(SoState *state) ; 00103 00107 static const SbBool& getAmbientOcclusion(SoState *state); 00108 00109 // Push copies the values from the previous element 00110 virtual void push(SoState *state) ; 00111 00112 private: 00113 00115 virtual void init(SoState *state); 00116 00118 virtual SbBool matches(const SoElement* elt) const; 00119 00121 virtual SoElement* copyMatchInfo() const; 00122 00123 private: 00124 00125 // Initializes the SoEnvironmentElement class 00126 static void initClass() ; 00127 static void exitClass() ; 00128 00129 private: 00130 float m_ambientIntensity ; 00131 SbColor m_ambientColor ; 00132 SbVec3f m_attenuation ; 00133 SbBool m_ambientOcclusion; 00134 FogType m_fogType ; 00135 SbColor m_fogColor ; 00136 float m_fogStart ; 00137 float m_fogVisibility ; 00138 00139 virtual void setElt(const EnvironmentParameters& envParams) ; 00140 00141 virtual ~SoEnvironmentElement() ; 00142 00143 } ; 00144 00145 /*----------------------------------------------------------------------------*/ 00146 00147 #endif // _SO_ENVIRONMENT_ELEMENT_ 00148 00149 00150