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-2020 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_LIGHT_ELEMENT_ 00025 #define _SO_LIGHT_ELEMENT_ 00026 00027 /* include files */ 00028 #include <Inventor/SoLists.h> 00029 #include <Inventor/elements/SoAccumulatedElement.h> 00030 #include <Inventor/SbMatrix.h> 00031 00032 #include <Inventor/STL/vector> 00033 00034 class SoLight; 00035 00048 SoEXTENDER_Documented class SoLightElement : public SoAccumulatedElement { 00049 SO_ELEMENT_HEADER(SoLightElement) ; 00050 00051 public: 00055 static void add(SoState *state, SoLight *light, const SbMatrix &WCToVRCMatrix) ; 00056 00060 virtual void push(SoState *state) ; 00061 00065 virtual void pop(SoState *, const SoElement *prevTopElement) ; 00066 00070 static const SoNodeList& getLights(SoState *state) ; 00071 00076 static const SbMatrix& getMatrix(SoState *state, int index) ; 00077 00078 private: 00079 00081 virtual void init(SoState *state); 00082 00083 private: 00084 typedef std::vector<SoLight*> LightList; 00085 00086 // Initializes the SoLightElement class 00087 static void initClass() ; 00088 static void exitClass() ; 00089 00093 static void getLights(SoState *state, LightList& lightList); 00094 00096 static void getMatrix(SoState *state, SoLight* light, SbMatrix& model, SbMatrix& view); 00097 00098 private: 00099 // list of light nodes 00100 SoNodeList m_lights ; 00101 00102 // List of transform matrix from world coordinates to view reference coordinates 00103 std::vector<SbMatrix*> m_WCToVRCMatrix; 00104 int m_startIndex; 00105 00107 std::vector<SbMatrix> m_viewMatrix; 00108 00109 virtual ~SoLightElement() ; 00110 } ; 00111 /*----------------------------------------------------------------------------*/ 00112 00113 #endif // _SO_LIGHT_ELEMENT_ 00114 00115 00116