b311480e |
1 | -- Created on: 1991-11-04 |
2 | -- Created by: NW,JPB,CAL |
3 | -- Copyright (c) 1991-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
7fd59977 |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
b311480e |
16 | |
7fd59977 |
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. |
7fd59977 |
22 | -- 22/03/04 ; OCC4895 SAN High-level interface for controlling polygon offsets |
7fd59977 |
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 | |
30f0ad28 |
41 | Color from Quantity, |
42 | Ratio from Quantity, |
7fd59977 |
43 | |
30f0ad28 |
44 | TypeOfLine from Aspect, |
45 | InteriorStyle from Aspect, |
7fd59977 |
46 | |
30f0ad28 |
47 | MaterialAspect from Graphic3d, |
48 | TextureMap from Graphic3d, |
49 | |
50 | ShaderProgram_Handle from Graphic3d |
7fd59977 |
51 | |
52 | is |
53 | |
54 | Create |
55 | returns mutable 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 mutable 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 | |
7fd59977 |
166 | -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets |
167 | SetPolygonOffsets ( me : mutable; |
168 | aMode : Integer from Standard; |
60be1f9b |
169 | aFactor : ShortReal from Standard = 1.0; |
170 | aUnits : ShortReal from Standard = 0.0 ); |
7fd59977 |
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 | |
30f0ad28 |
190 | SetShaderProgram ( me : mutable; |
191 | theProgram : ShaderProgram_Handle from Graphic3d ); |
192 | ---Level: Public |
193 | ---Purpose: Sets up OpenGL/GLSL shader program. |
194 | ---Category: Methods to modify the class definition |
195 | |
7fd59977 |
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 | ---Level: Public |
227 | ---Purpose: Returns the surface material of internal faces |
228 | ---Category: Inquire methods |
229 | |
230 | FrontMaterial ( me ) |
231 | returns MaterialAspect from Graphic3d |
232 | is static; |
233 | ---Level: Public |
234 | ---Purpose: Returns the surface material of external faces |
235 | ---Category: Inquire methods |
236 | |
237 | |
238 | TextureMap(me) |
239 | returns TextureMap from Graphic3d; |
240 | |
241 | TextureMapState(me) |
242 | returns Boolean from Standard; |
243 | |
7fd59977 |
244 | -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets |
245 | PolygonOffsets ( me; |
246 | aMode : out Integer from Standard; |
60be1f9b |
247 | aFactor : out ShortReal from Standard; |
248 | aUnits : out ShortReal from Standard ); |
7fd59977 |
249 | ---Level: Public |
250 | ---Purpose: Returns current polygon offsets settings. |
30f0ad28 |
251 | ---Category: Inquire methods |
252 | |
253 | ShaderProgram ( me ) |
254 | returns ShaderProgram_Handle from Graphic3d; |
255 | ---C++: return const & |
256 | |
de75ed09 |
257 | -- |
7fd59977 |
258 | |
259 | fields |
260 | |
261 | -- |
262 | -- Class : Graphic3d_AspectFillArea3d |
263 | -- |
264 | -- Purpose : Declaration of variables specific to |
265 | -- the context of drawing 3d faces |
266 | -- |
267 | -- Reminder : A context for drawing 3d faces inherits a context |
268 | -- defined by : |
269 | -- - the interior style of the face |
270 | -- - the edge style of the face |
271 | -- - the colour |
272 | -- It also possesses a definition of the materials for the |
273 | -- internal and external faces. |
274 | -- |
275 | -- |
276 | |
277 | |
278 | -- flag to distinguish between internal and external faces |
279 | DistinguishModeActive : Boolean from Standard; |
280 | |
281 | -- flag to draw the edges or not |
282 | EdgeModeActive : Boolean from Standard; |
283 | |
284 | -- display flag for reversed polygons. |
285 | BackFaceRemovalActive : Boolean from Standard; |
286 | |
287 | MyTextureMap : TextureMap from Graphic3d; |
288 | MyTextureMapState : Boolean from Standard; |
289 | |
290 | -- the material |
291 | MyFrontMaterial : MaterialAspect from Graphic3d; |
292 | MyBackMaterial : MaterialAspect from Graphic3d; |
293 | |
7fd59977 |
294 | -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets |
295 | -- polygon offsets |
296 | MyPolygonOffsetMode : Integer from Standard; |
60be1f9b |
297 | MyPolygonOffsetFactor : ShortReal from Standard; |
298 | MyPolygonOffsetUnits : ShortReal from Standard; |
7fd59977 |
299 | |
30f0ad28 |
300 | MyShaderProgram : ShaderProgram_Handle from Graphic3d; |
301 | |
7fd59977 |
302 | end AspectFillArea3d; |