1 // Created on: 2013-10-02
2 // Created by: Denis BOGOLEPOV
3 // Copyright (c) 2013 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #ifndef _OpenGl_State_HeaderFile
21 #define _OpenGl_State_HeaderFile
23 #include <Graphic3d_SetOfHClipPlane.hxx>
25 #include <InterfaceGraphic_tgl_all.hxx>
27 #include <OpenGl_Element.hxx>
28 #include <OpenGl_Light.hxx>
30 //! Defines interface for OpenGL state.
31 class OpenGl_StateInterface
35 //! Creates new OCCT state.
36 OpenGl_StateInterface();
38 //! Returns current state index.
39 Standard_Size Index() const;
41 //! Updates current state.
44 //! Reverts current state.
49 Standard_Size myIndex; //!< Current state index
53 //! Defines state of OCCT projection transformation.
54 class OpenGl_ProjectionState : public OpenGl_StateInterface
58 //! Creates uninitialized projection state.
59 OpenGl_ProjectionState();
61 //! Sets new projection matrix.
62 void Set (const Tmatrix3& theProjectionMatrix);
64 //! Returns current projection matrix.
65 const Tmatrix3& ProjectionMatrix() const;
67 //! Returns inverse of current projection matrix.
68 const Tmatrix3& ProjectionMatrixInverse() const;
72 Tmatrix3 myProjectionMatrix; //!< OCCT projection matrix
73 mutable Tmatrix3 myProjectionMatrixInverse; //!< Inverse of OCCT projection matrix
74 bool myInverseNeedUpdate; //!< Is inversed matrix outdated?
78 //! Defines state of OCCT model-world transformation.
79 class OpenGl_ModelWorldState : public OpenGl_StateInterface
83 //! Creates uninitialized model-world state.
84 OpenGl_ModelWorldState();
86 //! Sets new model-world matrix.
87 void Set (const Tmatrix3& theModelWorldMatrix);
89 //! Returns current model-world matrix.
90 const Tmatrix3& ModelWorldMatrix() const;
92 //! Returns inverse of current model-world matrix.
93 const Tmatrix3& ModelWorldMatrixInverse() const;
97 Tmatrix3 myModelWorldMatrix; //!< OCCT model-world matrix
98 mutable Tmatrix3 myModelWorldMatrixInverse; //!< Inverse of OCCT model-world matrix
99 bool myInverseNeedUpdate; //!< Is inversed matrix outdated?
103 //! Defines state of OCCT world-view transformation.
104 class OpenGl_WorldViewState : public OpenGl_StateInterface
108 //! Creates uninitialized world-view state.
109 OpenGl_WorldViewState();
111 //! Sets new world-view matrix.
112 void Set (const Tmatrix3& theWorldViewMatrix);
114 //! Returns current world-view matrix.
115 const Tmatrix3& WorldViewMatrix() const;
117 //! Returns inverse of current world-view matrix.
118 const Tmatrix3& WorldViewMatrixInverse() const;
122 Tmatrix3 myWorldViewMatrix; //!< OCCT world-view matrix
123 mutable Tmatrix3 myWorldViewMatrixInverse; //!< Inverse of OCCT world-view matrix
124 bool myInverseNeedUpdate; //!< Is inversed matrix outdated?
128 //! Defines state of OCCT light sources.
129 class OpenGl_LightSourceState : public OpenGl_StateInterface
133 //! Creates uninitialized state of light sources.
134 OpenGl_LightSourceState();
136 //! Sets new light sources.
137 void Set (const OpenGl_ListOfLight* theLightSources);
139 //! Returns current list of light sources.
140 const OpenGl_ListOfLight* LightSources() const;
144 const OpenGl_ListOfLight* myLightSources; //!< List of OCCT light sources
148 //! Defines generic state of OCCT material properties.
149 class OpenGl_MaterialState : public OpenGl_StateInterface
153 //! Creates new material state.
154 OpenGl_MaterialState (const OpenGl_Element* theAspect = NULL);
156 //! Sets new material aspect.
157 void Set (const OpenGl_Element* theAspect);
159 //! Returns material aspect.
160 const OpenGl_Element* Aspect() const;
164 const OpenGl_Element* myAspect; //!< OCCT material aspect
168 //! Defines generic state of OCCT clipping state.
169 class OpenGl_ClippingState : public OpenGl_StateInterface
173 //! Creates new clipping state.
174 OpenGl_ClippingState();
178 #endif // _OpenGl_State_HeaderFile