0024023: Revamp the OCCT Handle -- general
[occt.git] / src / Graphic3d / Graphic3d_AspectFillArea3d.cdl
1 -- Created on: 1991-11-04
2 -- Created by: NW,JPB,CAL
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
5 --
6 -- This file is part of Open CASCADE Technology software library.
7 --
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
13 --
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
16
17 -- Modified:    1/08/97 ; PCT : Ajout texture mapping
18 --              16/01/98 ; FMN : Ajout Hiddenline
19 --              0312/99  ; GG : BUC60488 Why the field DistinguishModeActive
20 --                      field is not accessible properly ?
21 --                      workaround : Move the Material fields at end.
22 --              22/03/04 ; OCC4895 SAN High-level interface for controlling polygon offsets
23
24 class AspectFillArea3d from Graphic3d inherits AspectFillArea from Aspect
25
26         ---Version:
27
28         ---Purpose: This class permits the creation and updating of
29         --          a graphic attribute context for opaque 3d
30         --          primitives (polygons, triangles, quadrilaterals)
31         --  Keywords: Face, FillArea, Triangle, Quadrangle, Polygon,
32         --           TriangleMesh, QuadrangleMesh, Edge, Border, Interior,
33         --           Color, Type, Width, Style, Hatch, Material,
34         --           BackFaceRemoval, DistinguishMode
35
36         ---Warning:
37         ---References:
38
39 uses
40
41         Color          from Quantity,
42         Ratio          from Quantity,
43
44         TypeOfLine     from Aspect,
45         InteriorStyle  from Aspect,
46
47         MaterialAspect from Graphic3d,
48         TextureMap     from Graphic3d,
49
50         ShaderProgram  from Graphic3d
51
52 is
53
54         Create
55                 returns AspectFillArea3d from Graphic3d;
56         ---Level: Public
57         ---Purpose: Creates a context table for fill area primitives
58         --          defined with the following default values:
59         --
60         --          InteriorStyle       : IS_EMPTY
61         --          InteriorColor       : NOC_CYAN1
62         --          EdgeColor           : NOC_WHITE
63         --          EdgeLineType        : TOL_SOLID
64         --          EdgeWidth           : 1.0
65         --          FrontMaterial       : NOM_BRASS
66         --          BackMaterial        : NOM_BRASS
67         --
68         --          Display of back-facing filled polygons.
69         --          No distinction between external and internal
70         --          faces of FillAreas.
71         --          The edges are not drawn.
72         --          Polygon offset parameters: mode = Aspect_POM_None, factor = 1., units = 0.
73
74
75         Create ( Interior       : InteriorStyle from Aspect;
76                  InteriorColor  : Color from Quantity;
77                  EdgeColor      : Color from Quantity;
78                  EdgeLineType   : TypeOfLine from Aspect;
79                  EdgeWidth      : Real from Standard;
80                  FrontMaterial  : MaterialAspect from Graphic3d;
81                  BackMaterial   : MaterialAspect from Graphic3d )
82                 returns AspectFillArea3d from Graphic3d;
83
84         ---Level: Public
85         ---Purpose: Creates a context table for fill area primitives
86         --          defined with the specified values.
87         --
88         --          Display of back-facing filled polygons.
89         --          No distinction between external and internal
90         --          faces of FillAreas.
91         --          The edges are not drawn.
92         --          Polygon offset parameters: mode = Aspect_POM_None, factor = 1., units = 0.
93         -- Warning
94         -- EdgeWidth is the "line width scale factor".   The
95         -- nominal line width is 1 pixel.   The width of the line is
96         -- determined by applying the line width scale factor to
97         -- this nominal line width.   The supported line widths
98         -- vary by 1-pixel units.
99
100         ---------------------------------------------------
101         -- Category: Methods to modify the class definition
102         ---------------------------------------------------
103
104         AllowBackFace ( me      : mutable )
105                 is static;
106         ---Purpose: Allows the display of back-facing filled
107         --          polygons.
108
109         SetBackMaterial ( me            : mutable;
110                           AMaterial     : MaterialAspect from Graphic3d )
111                 is static;
112         ---Level: Public
113         ---Purpose: Modifies the surface material of internal faces
114         ---Category: Methods to modify the class definition
115
116         SetDistinguishOn ( me   : mutable )
117                 is static;
118         ---Level: Public
119         ---Purpose: Allows distinction between external and internal
120         --          faces of FillAreas.
121         ---Category: Methods to modify the class definition
122
123         SetDistinguishOff ( me  : mutable )
124                 is static;
125         ---Level: Public
126         ---Purpose: Forbids distinction between external and internal
127         --          faces of FillAreas.
128         ---Category: Methods to modify the class definition
129
130         SetEdgeOn ( me  : mutable )
131                 is static;
132         ---Level: Public
133         ---Purpose: The edges of FillAreas are drawn.
134         ---Category: Methods to modify the class definition
135
136         SetEdgeOff ( me : mutable )
137                 is static;
138         ---Level: Public
139         ---Purpose: The edges of FillAreas are not drawn.
140         ---Category: Methods to modify the class definition
141
142         SetFrontMaterial ( me           : mutable;
143                            AMaterial    : MaterialAspect from Graphic3d )
144                 is static;
145         ---Level: Public
146         ---Purpose: Modifies the surface material of external faces
147         ---Category: Methods to modify the class definition
148
149         SuppressBackFace ( me   : mutable )
150                 is static;
151         ---Level: Public
152         ---Purpose: Suppress the display of back-facing filled
153         --          polygons.
154         --          A back-facing polygon is defined as a polygon whose
155         --          vertices are in a clockwise order with respect
156         --          to screen coordinates.
157         ---Category: Methods to modify the class definition
158
159  
160         SetTextureMap(me  :  mutable; 
161                       ATexture  :  TextureMap  from Graphic3d);
162  
163         SetTextureMapOn(me  :  mutable);
164         SetTextureMapOff(me :  mutable);
165
166         -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
167         SetPolygonOffsets ( me : mutable;
168                             aMode   : Integer from Standard;
169                             aFactor : ShortReal from Standard = 1.0;
170                             aUnits  : ShortReal from Standard = 0.0 );
171         ---Level: Public
172         ---Purpose: Sets up OpenGL polygon offsets mechanism.
173         --          <aMode> parameter can contain various combinations of 
174         --          Aspect_PolygonOffsetMode enumeration elements (Aspect_POM_None means
175         --          that polygon offsets are not changed).
176         --          If <aMode> is different from Aspect_POM_Off and Aspect_POM_None, then <aFactor> and <aUnits> 
177         --          arguments are used by graphic renderer to calculate a depth offset value:
178         --          
179         --          offset = <aFactor> * m + <aUnits> * r, where
180         --          m - maximum depth slope for the polygon currently being displayed,
181         --          r - minimum window coordinates depth resolution (implementation-specific)
182         --
183         --          Deafult settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0.
184         --
185         --          Negative offset values move polygons closer to the viewport,
186         --          while positive values shift polygons away.
187         --          Consult OpenGL reference for details (glPolygonOffset function description).
188         ---Category: Methods to modify the class definition
189
190         SetShaderProgram ( me  :  mutable; 
191                            theProgram  :  ShaderProgram from Graphic3d );
192         ---Level: Public
193         ---Purpose: Sets up OpenGL/GLSL shader program.
194         ---Category: Methods to modify the class definition
195
196         ----------------------------
197         -- Category: Inquire methods
198         ----------------------------
199
200         BackFace ( me )
201                 returns Boolean from Standard
202                 is static;
203         ---Level: Public
204         ---Purpose: Returns the Back Face Removal status.
205         --          Standard_True if SuppressBackFace is activated.
206         ---Category: Inquire methods
207
208         Distinguish ( me )
209                 returns Boolean from Standard
210                 is static;
211         ---Level: Public
212         ---Purpose: Returns the Distinguish Mode status.
213         ---Category: Inquire methods
214
215         Edge ( me )
216                 returns Boolean from Standard
217                 is static;
218         ---Level: Public
219         ---Purpose: Returns Standard_True if the edges are drawn and
220         --          Standard_False if the edges are not drawn.
221         ---Category: Inquire methods
222
223         BackMaterial ( me )
224                 returns MaterialAspect from Graphic3d
225                 is static;
226         ---C++: return const&
227         ---Level: Public
228         ---Purpose: Returns the surface material of internal faces
229         ---Category: Inquire methods
230
231         FrontMaterial ( me )
232                 returns MaterialAspect from Graphic3d
233                 is static;
234         ---C++: return const&
235         ---Level: Public
236         ---Purpose: Returns the surface material of external faces
237         ---Category: Inquire methods
238
239  
240         TextureMap(me) 
241             returns  TextureMap  from  Graphic3d; 
242              
243         TextureMapState(me) 
244             returns  Boolean  from  Standard;
245
246         -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
247         PolygonOffsets ( me;
248                          aMode   : out Integer from Standard;
249                          aFactor : out ShortReal from Standard;
250                          aUnits  : out ShortReal from Standard );
251         ---Level: Public
252         ---Purpose: Returns current polygon offsets settings.
253         ---Category: Inquire methods
254
255         ShaderProgram ( me )
256         returns ShaderProgram from Graphic3d;
257         ---C++: return const &
258
259 --
260
261 fields
262
263 --
264 -- Class        :       Graphic3d_AspectFillArea3d
265 --
266 -- Purpose      :       Declaration of variables specific to
267 --                      the context of drawing 3d faces
268 --
269 -- Reminder     :       A context for drawing 3d faces inherits a context
270 --                      defined by :
271 --                      - the interior style of the face
272 --                      - the edge style of the face
273 --                      - the colour
274 --                      It also possesses a definition of the materials for the
275 --                      internal and external faces.
276 --
277 --
278
279
280         -- flag to distinguish between internal and external faces
281         DistinguishModeActive   :       Boolean from Standard;
282
283         -- flag to draw the edges or not
284         EdgeModeActive          :       Boolean from Standard;
285
286         -- display flag for reversed polygons.
287         BackFaceRemovalActive   :       Boolean from Standard;
288
289         MyTextureMap            :       TextureMap  from  Graphic3d; 
290         MyTextureMapState       :       Boolean  from  Standard;
291
292         -- the material
293         MyFrontMaterial         :       MaterialAspect from Graphic3d;
294         MyBackMaterial          :       MaterialAspect from Graphic3d;
295
296         -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
297         -- polygon offsets
298         MyPolygonOffsetMode     :       Integer from Standard;
299         MyPolygonOffsetFactor   :       ShortReal from Standard;
300         MyPolygonOffsetUnits    :       ShortReal from Standard;
301
302         MyShaderProgram         :       ShaderProgram  from  Graphic3d;
303
304 end AspectFillArea3d;