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
6 -- This file is part of Open CASCADE Technology software library.
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
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
24 class AspectFillArea3d from Graphic3d inherits AspectFillArea from Aspect
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
44 TypeOfLine from Aspect,
45 InteriorStyle from Aspect,
47 MaterialAspect from Graphic3d,
48 TextureMap from Graphic3d,
50 ShaderProgram_Handle from Graphic3d
55 returns AspectFillArea3d from Graphic3d;
57 ---Purpose: Creates a context table for fill area primitives
58 -- defined with the following default values:
60 -- InteriorStyle : IS_EMPTY
61 -- InteriorColor : NOC_CYAN1
62 -- EdgeColor : NOC_WHITE
63 -- EdgeLineType : TOL_SOLID
65 -- FrontMaterial : NOM_BRASS
66 -- BackMaterial : NOM_BRASS
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.
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;
85 ---Purpose: Creates a context table for fill area primitives
86 -- defined with the specified values.
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.
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.
100 ---------------------------------------------------
101 -- Category: Methods to modify the class definition
102 ---------------------------------------------------
104 AllowBackFace ( me : mutable )
106 ---Purpose: Allows the display of back-facing filled
109 SetBackMaterial ( me : mutable;
110 AMaterial : MaterialAspect from Graphic3d )
113 ---Purpose: Modifies the surface material of internal faces
114 ---Category: Methods to modify the class definition
116 SetDistinguishOn ( me : mutable )
119 ---Purpose: Allows distinction between external and internal
120 -- faces of FillAreas.
121 ---Category: Methods to modify the class definition
123 SetDistinguishOff ( me : mutable )
126 ---Purpose: Forbids distinction between external and internal
127 -- faces of FillAreas.
128 ---Category: Methods to modify the class definition
130 SetEdgeOn ( me : mutable )
133 ---Purpose: The edges of FillAreas are drawn.
134 ---Category: Methods to modify the class definition
136 SetEdgeOff ( me : mutable )
139 ---Purpose: The edges of FillAreas are not drawn.
140 ---Category: Methods to modify the class definition
142 SetFrontMaterial ( me : mutable;
143 AMaterial : MaterialAspect from Graphic3d )
146 ---Purpose: Modifies the surface material of external faces
147 ---Category: Methods to modify the class definition
149 SuppressBackFace ( me : mutable )
152 ---Purpose: Suppress the display of back-facing filled
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
160 SetTextureMap(me : mutable;
161 ATexture : TextureMap from Graphic3d);
163 SetTextureMapOn(me : mutable);
164 SetTextureMapOff(me : mutable);
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 );
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:
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)
183 -- Deafult settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0.
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
190 SetShaderProgram ( me : mutable;
191 theProgram : ShaderProgram_Handle from Graphic3d );
193 ---Purpose: Sets up OpenGL/GLSL shader program.
194 ---Category: Methods to modify the class definition
196 ----------------------------
197 -- Category: Inquire methods
198 ----------------------------
201 returns Boolean from Standard
204 ---Purpose: Returns the Back Face Removal status.
205 -- Standard_True if SuppressBackFace is activated.
206 ---Category: Inquire methods
209 returns Boolean from Standard
212 ---Purpose: Returns the Distinguish Mode status.
213 ---Category: Inquire methods
216 returns Boolean from Standard
219 ---Purpose: Returns Standard_True if the edges are drawn and
220 -- Standard_False if the edges are not drawn.
221 ---Category: Inquire methods
224 returns MaterialAspect from Graphic3d
226 ---C++: return const&
228 ---Purpose: Returns the surface material of internal faces
229 ---Category: Inquire methods
232 returns MaterialAspect from Graphic3d
234 ---C++: return const&
236 ---Purpose: Returns the surface material of external faces
237 ---Category: Inquire methods
241 returns TextureMap from Graphic3d;
244 returns Boolean from Standard;
246 -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
248 aMode : out Integer from Standard;
249 aFactor : out ShortReal from Standard;
250 aUnits : out ShortReal from Standard );
252 ---Purpose: Returns current polygon offsets settings.
253 ---Category: Inquire methods
256 returns ShaderProgram_Handle from Graphic3d;
257 ---C++: return const &
264 -- Class : Graphic3d_AspectFillArea3d
266 -- Purpose : Declaration of variables specific to
267 -- the context of drawing 3d faces
269 -- Reminder : A context for drawing 3d faces inherits a context
271 -- - the interior style of the face
272 -- - the edge style of the face
274 -- It also possesses a definition of the materials for the
275 -- internal and external faces.
280 -- flag to distinguish between internal and external faces
281 DistinguishModeActive : Boolean from Standard;
283 -- flag to draw the edges or not
284 EdgeModeActive : Boolean from Standard;
286 -- display flag for reversed polygons.
287 BackFaceRemovalActive : Boolean from Standard;
289 MyTextureMap : TextureMap from Graphic3d;
290 MyTextureMapState : Boolean from Standard;
293 MyFrontMaterial : MaterialAspect from Graphic3d;
294 MyBackMaterial : MaterialAspect from Graphic3d;
296 -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets
298 MyPolygonOffsetMode : Integer from Standard;
299 MyPolygonOffsetFactor : ShortReal from Standard;
300 MyPolygonOffsetUnits : ShortReal from Standard;
302 MyShaderProgram : ShaderProgram_Handle from Graphic3d;
304 end AspectFillArea3d;