0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / OpenGl / OpenGl_ShaderStates.hxx
CommitLineData
30f0ad28 1// Created on: 2013-10-02
2// Created by: Denis BOGOLEPOV
3// Copyright (c) 2013 OPEN CASCADE SAS
4//
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.
9//
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.
12//
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.
19
20#ifndef _OpenGl_State_HeaderFile
21#define _OpenGl_State_HeaderFile
22
30f0ad28 23#include <InterfaceGraphic_tgl_all.hxx>
24
25#include <OpenGl_Element.hxx>
26#include <OpenGl_Light.hxx>
27
28//! Defines interface for OpenGL state.
29class OpenGl_StateInterface
30{
31public:
32
33 //! Creates new OCCT state.
34 OpenGl_StateInterface();
35
36 //! Returns current state index.
37 Standard_Size Index() const;
38
39 //! Updates current state.
40 void Update();
41
42 //! Reverts current state.
43 void Revert();
44
45protected:
46
47 Standard_Size myIndex; //!< Current state index
48
49};
50
51//! Defines state of OCCT projection transformation.
52class OpenGl_ProjectionState : public OpenGl_StateInterface
53{
54public:
55
56 //! Creates uninitialized projection state.
57 OpenGl_ProjectionState();
58
59 //! Sets new projection matrix.
60 void Set (const Tmatrix3& theProjectionMatrix);
61
62 //! Returns current projection matrix.
63 const Tmatrix3& ProjectionMatrix() const;
64
65 //! Returns inverse of current projection matrix.
66 const Tmatrix3& ProjectionMatrixInverse() const;
67
68private:
69
70 Tmatrix3 myProjectionMatrix; //!< OCCT projection matrix
71 mutable Tmatrix3 myProjectionMatrixInverse; //!< Inverse of OCCT projection matrix
72 bool myInverseNeedUpdate; //!< Is inversed matrix outdated?
73
74};
75
76//! Defines state of OCCT model-world transformation.
77class OpenGl_ModelWorldState : public OpenGl_StateInterface
78{
79public:
80
81 //! Creates uninitialized model-world state.
82 OpenGl_ModelWorldState();
83
84 //! Sets new model-world matrix.
85 void Set (const Tmatrix3& theModelWorldMatrix);
86
87 //! Returns current model-world matrix.
88 const Tmatrix3& ModelWorldMatrix() const;
89
90 //! Returns inverse of current model-world matrix.
91 const Tmatrix3& ModelWorldMatrixInverse() const;
92
93private:
94
95 Tmatrix3 myModelWorldMatrix; //!< OCCT model-world matrix
96 mutable Tmatrix3 myModelWorldMatrixInverse; //!< Inverse of OCCT model-world matrix
97 bool myInverseNeedUpdate; //!< Is inversed matrix outdated?
98
99};
100
101//! Defines state of OCCT world-view transformation.
102class OpenGl_WorldViewState : public OpenGl_StateInterface
103{
104public:
105
106 //! Creates uninitialized world-view state.
107 OpenGl_WorldViewState();
108
109 //! Sets new world-view matrix.
110 void Set (const Tmatrix3& theWorldViewMatrix);
111
112 //! Returns current world-view matrix.
113 const Tmatrix3& WorldViewMatrix() const;
114
115 //! Returns inverse of current world-view matrix.
116 const Tmatrix3& WorldViewMatrixInverse() const;
117
118private:
119
120 Tmatrix3 myWorldViewMatrix; //!< OCCT world-view matrix
121 mutable Tmatrix3 myWorldViewMatrixInverse; //!< Inverse of OCCT world-view matrix
122 bool myInverseNeedUpdate; //!< Is inversed matrix outdated?
123
124};
125
126//! Defines state of OCCT light sources.
127class OpenGl_LightSourceState : public OpenGl_StateInterface
128{
129public:
130
131 //! Creates uninitialized state of light sources.
132 OpenGl_LightSourceState();
133
134 //! Sets new light sources.
135 void Set (const OpenGl_ListOfLight* theLightSources);
136
137 //! Returns current list of light sources.
138 const OpenGl_ListOfLight* LightSources() const;
139
140private:
141
142 const OpenGl_ListOfLight* myLightSources; //!< List of OCCT light sources
143
144};
145
146//! Defines generic state of OCCT material properties.
147class OpenGl_MaterialState : public OpenGl_StateInterface
148{
149public:
150
151 //! Creates new material state.
152 OpenGl_MaterialState (const OpenGl_Element* theAspect = NULL);
153
154 //! Sets new material aspect.
155 void Set (const OpenGl_Element* theAspect);
156
157 //! Returns material aspect.
158 const OpenGl_Element* Aspect() const;
159
160private:
161
162 const OpenGl_Element* myAspect; //!< OCCT material aspect
163
164};
165
166//! Defines generic state of OCCT clipping state.
167class OpenGl_ClippingState : public OpenGl_StateInterface
168{
169public:
170
171 //! Creates new clipping state.
172 OpenGl_ClippingState();
173
174};
175
176#endif // _OpenGl_State_HeaderFile