b311480e |
1 | -- Created on: 1991-11-04 |
2 | -- Created by: NW,JPB,CAL |
3 | -- Copyright (c) 1991-1999 Matra Datavision |
4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
7fd59977 |
5 | -- |
b311480e |
6 | -- The content of this file is subject to the Open CASCADE Technology Public |
7 | -- License Version 6.5 (the "License"). You may not use the content of this file |
8 | -- except in compliance with the License. Please obtain a copy of the License |
9 | -- at http://www.opencascade.org and read it completely before using this file. |
10 | -- |
11 | -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
12 | -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
13 | -- |
14 | -- The Original Code and all software distributed under the License is |
15 | -- distributed on an "AS IS" basis, without warranty of any kind, and the |
16 | -- Initial Developer hereby disclaims all such warranties, including without |
17 | -- limitation, any warranties of merchantability, fitness for a particular |
18 | -- purpose or non-infringement. Please see the License for the specific terms |
19 | -- and conditions governing the rights and limitations under the License. |
20 | |
7fd59977 |
21 | -- Modified: 1/08/97 ; PCT : Ajout texture mapping |
22 | -- 16/01/98 ; FMN : Ajout Hiddenline |
23 | -- 0312/99 ; GG : BUC60488 Why the field DistinguishModeActive |
24 | -- field is not accessible properly ? |
25 | -- workaround : Move the Material fields at end. |
26 | -- 26/01/00 ; EUG/GG degeneration management (G003) |
27 | -- Add SetDegenerateModel() and DegenerateModel() methods |
28 | -- 29/09/00 ; GG degeneration management (G003) |
29 | -- Add SetDefaultDegenerateModel() and DefaultDegenerateModel() methods |
30 | -- 22/03/04 ; OCC4895 SAN High-level interface for controlling polygon offsets |
7fd59977 |
31 | |
32 | class AspectFillArea3d from Graphic3d inherits AspectFillArea from Aspect |
33 | |
34 | ---Version: |
35 | |
36 | ---Purpose: This class permits the creation and updating of |
37 | -- a graphic attribute context for opaque 3d |
38 | -- primitives (polygons, triangles, quadrilaterals) |
39 | -- Keywords: Face, FillArea, Triangle, Quadrangle, Polygon, |
40 | -- TriangleMesh, QuadrangleMesh, Edge, Border, Interior, |
41 | -- Color, Type, Width, Style, Hatch, Material, |
42 | -- BackFaceRemoval, DistinguishMode |
43 | |
44 | ---Warning: |
45 | ---References: |
46 | |
47 | uses |
48 | |
49 | Color from Quantity, |
50 | Ratio from Quantity, |
51 | |
52 | TypeOfLine from Aspect, |
53 | InteriorStyle from Aspect, |
54 | TypeOfDegenerateModel from Aspect, |
55 | |
56 | MaterialAspect from Graphic3d, |
57 | TextureMap from Graphic3d |
58 | |
59 | is |
60 | |
61 | Create |
62 | returns mutable AspectFillArea3d from Graphic3d; |
63 | ---Level: Public |
64 | ---Purpose: Creates a context table for fill area primitives |
65 | -- defined with the following default values: |
66 | -- |
67 | -- InteriorStyle : IS_EMPTY |
68 | -- InteriorColor : NOC_CYAN1 |
69 | -- EdgeColor : NOC_WHITE |
70 | -- EdgeLineType : TOL_SOLID |
71 | -- EdgeWidth : 1.0 |
72 | -- FrontMaterial : NOM_BRASS |
73 | -- BackMaterial : NOM_BRASS |
74 | -- |
75 | -- Display of back-facing filled polygons. |
76 | -- No distinction between external and internal |
77 | -- faces of FillAreas. |
78 | -- The edges are not drawn. |
79 | -- Polygon offset parameters: mode = Aspect_POM_None, factor = 1., units = 0. |
80 | |
81 | |
82 | Create ( Interior : InteriorStyle from Aspect; |
83 | InteriorColor : Color from Quantity; |
84 | EdgeColor : Color from Quantity; |
85 | EdgeLineType : TypeOfLine from Aspect; |
86 | EdgeWidth : Real from Standard; |
87 | FrontMaterial : MaterialAspect from Graphic3d; |
88 | BackMaterial : MaterialAspect from Graphic3d ) |
89 | returns mutable AspectFillArea3d from Graphic3d; |
90 | |
91 | ---Level: Public |
92 | ---Purpose: Creates a context table for fill area primitives |
93 | -- defined with the specified values. |
94 | -- |
95 | -- Display of back-facing filled polygons. |
96 | -- No distinction between external and internal |
97 | -- faces of FillAreas. |
98 | -- The edges are not drawn. |
99 | -- Polygon offset parameters: mode = Aspect_POM_None, factor = 1., units = 0. |
100 | -- Warning |
101 | -- EdgeWidth is the "line width scale factor". The |
102 | -- nominal line width is 1 pixel. The width of the line is |
103 | -- determined by applying the line width scale factor to |
104 | -- this nominal line width. The supported line widths |
105 | -- vary by 1-pixel units. |
106 | |
107 | --------------------------------------------------- |
108 | -- Category: Methods to modify the class definition |
109 | --------------------------------------------------- |
110 | |
111 | AllowBackFace ( me : mutable ) |
112 | is static; |
113 | ---Purpose: Allows the display of back-facing filled |
114 | -- polygons. |
115 | |
116 | SetBackMaterial ( me : mutable; |
117 | AMaterial : MaterialAspect from Graphic3d ) |
118 | is static; |
119 | ---Level: Public |
120 | ---Purpose: Modifies the surface material of internal faces |
121 | ---Category: Methods to modify the class definition |
122 | |
123 | SetDistinguishOn ( me : mutable ) |
124 | is static; |
125 | ---Level: Public |
126 | ---Purpose: Allows distinction between external and internal |
127 | -- faces of FillAreas. |
128 | ---Category: Methods to modify the class definition |
129 | |
130 | SetDistinguishOff ( me : mutable ) |
131 | is static; |
132 | ---Level: Public |
133 | ---Purpose: Forbids distinction between external and internal |
134 | -- faces of FillAreas. |
135 | ---Category: Methods to modify the class definition |
136 | |
137 | SetEdgeOn ( me : mutable ) |
138 | is static; |
139 | ---Level: Public |
140 | ---Purpose: The edges of FillAreas are drawn. |
141 | ---Category: Methods to modify the class definition |
142 | |
143 | SetEdgeOff ( me : mutable ) |
144 | is static; |
145 | ---Level: Public |
146 | ---Purpose: The edges of FillAreas are not drawn. |
147 | ---Category: Methods to modify the class definition |
148 | |
149 | SetFrontMaterial ( me : mutable; |
150 | AMaterial : MaterialAspect from Graphic3d ) |
151 | is static; |
152 | ---Level: Public |
153 | ---Purpose: Modifies the surface material of external faces |
154 | ---Category: Methods to modify the class definition |
155 | |
156 | SuppressBackFace ( me : mutable ) |
157 | is static; |
158 | ---Level: Public |
159 | ---Purpose: Suppress the display of back-facing filled |
160 | -- polygons. |
161 | -- A back-facing polygon is defined as a polygon whose |
162 | -- vertices are in a clockwise order with respect |
163 | -- to screen coordinates. |
164 | ---Category: Methods to modify the class definition |
165 | |
166 | |
167 | SetTextureMap(me : mutable; |
168 | ATexture : TextureMap from Graphic3d); |
169 | |
170 | SetTextureMapOn(me : mutable); |
171 | SetTextureMapOff(me : mutable); |
172 | |
173 | SetDefaultDegenerateModel ( myclass; |
174 | aModel : TypeOfDegenerateModel from Aspect = |
175 | Aspect_TDM_WIREFRAME; |
176 | aRatio : Ratio from Quantity = 0.0); |
177 | ---Level: Public |
178 | ---Purpose: Sets the default model of degeneration for the polygons |
179 | -- which is taking in account at creation time of any |
180 | -- graphic structure until the model is change using |
181 | -- SetDegenerateModel() method. |
182 | ---Category: Methods to manage the structure degeneration |
183 | |
184 | SetDegenerateModel ( me : mutable; |
185 | aModel : TypeOfDegenerateModel from Aspect = |
186 | Aspect_TDM_WIREFRAME; |
187 | aRatio : Ratio from Quantity = 0.0); |
188 | ---Level: Public |
189 | ---Purpose: Sets the model of degeneration for the polygons |
190 | -- according to the degenerate ratio >= 0. & <= 1. where : |
191 | -- <aRatio> = 0. indicate that all polygons of the graphic structure |
192 | -- are displayed. |
193 | -- <aRatio> = 1. indicate that nothing is displayed in the graphic |
194 | -- structure. |
195 | -- When <ARatio> is > 0 & < 1. the corresponding amount |
196 | -- of polygons are displayed in the graphic structure with a |
197 | -- random method. |
198 | -- Warning: the degenerate structure is shown only when |
199 | -- the animation and degenerate flags are set to TRUE |
200 | -- in V3d_View::SetAnimationMode(..) |
201 | ---Category: Methods to manage the structure degeneration |
202 | |
203 | -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets |
204 | SetPolygonOffsets ( me : mutable; |
205 | aMode : Integer from Standard; |
60be1f9b |
206 | aFactor : ShortReal from Standard = 1.0; |
207 | aUnits : ShortReal from Standard = 0.0 ); |
7fd59977 |
208 | ---Level: Public |
209 | ---Purpose: Sets up OpenGL polygon offsets mechanism. |
210 | -- <aMode> parameter can contain various combinations of |
211 | -- Aspect_PolygonOffsetMode enumeration elements (Aspect_POM_None means |
212 | -- that polygon offsets are not changed). |
213 | -- If <aMode> is different from Aspect_POM_Off and Aspect_POM_None, then <aFactor> and <aUnits> |
214 | -- arguments are used by graphic renderer to calculate a depth offset value: |
215 | -- |
216 | -- offset = <aFactor> * m + <aUnits> * r, where |
217 | -- m - maximum depth slope for the polygon currently being displayed, |
218 | -- r - minimum window coordinates depth resolution (implementation-specific) |
219 | -- |
220 | -- Deafult settings for OCC 3D viewer: mode = Aspect_POM_Fill, factor = 1., units = 0. |
221 | -- |
222 | -- Negative offset values move polygons closer to the viewport, |
223 | -- while positive values shift polygons away. |
224 | -- Consult OpenGL reference for details (glPolygonOffset function description). |
225 | ---Category: Methods to modify the class definition |
226 | |
227 | ---------------------------- |
228 | -- Category: Inquire methods |
229 | ---------------------------- |
230 | |
231 | BackFace ( me ) |
232 | returns Boolean from Standard |
233 | is static; |
234 | ---Level: Public |
235 | ---Purpose: Returns the Back Face Removal status. |
236 | -- Standard_True if SuppressBackFace is activated. |
237 | ---Category: Inquire methods |
238 | |
239 | Distinguish ( me ) |
240 | returns Boolean from Standard |
241 | is static; |
242 | ---Level: Public |
243 | ---Purpose: Returns the Distinguish Mode status. |
244 | ---Category: Inquire methods |
245 | |
246 | Edge ( me ) |
247 | returns Boolean from Standard |
248 | is static; |
249 | ---Level: Public |
250 | ---Purpose: Returns Standard_True if the edges are drawn and |
251 | -- Standard_False if the edges are not drawn. |
252 | ---Category: Inquire methods |
253 | |
254 | BackMaterial ( me ) |
255 | returns MaterialAspect from Graphic3d |
256 | is static; |
257 | ---Level: Public |
258 | ---Purpose: Returns the surface material of internal faces |
259 | ---Category: Inquire methods |
260 | |
261 | FrontMaterial ( me ) |
262 | returns MaterialAspect from Graphic3d |
263 | is static; |
264 | ---Level: Public |
265 | ---Purpose: Returns the surface material of external faces |
266 | ---Category: Inquire methods |
267 | |
268 | |
269 | TextureMap(me) |
270 | returns TextureMap from Graphic3d; |
271 | |
272 | TextureMapState(me) |
273 | returns Boolean from Standard; |
274 | |
275 | DegenerateModel ( me ; |
276 | aRatio: out Ratio from Quantity ) |
277 | returns TypeOfDegenerateModel from Aspect; |
278 | ---Level: Public |
279 | ---Purpose: returns the current degeneration model and ratio |
280 | -- for the polygons |
281 | ---Category: Inquire methods |
282 | |
283 | DefaultDegenerateModel ( myclass ; |
284 | aRatio: out Ratio from Quantity ) |
285 | returns TypeOfDegenerateModel from Aspect; |
286 | ---Level: Public |
287 | ---Purpose: returns the default degeneration model and ratio |
288 | -- for the polygons |
289 | ---Category: Inquire methods |
290 | |
291 | -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets |
292 | PolygonOffsets ( me; |
293 | aMode : out Integer from Standard; |
60be1f9b |
294 | aFactor : out ShortReal from Standard; |
295 | aUnits : out ShortReal from Standard ); |
7fd59977 |
296 | ---Level: Public |
297 | ---Purpose: Returns current polygon offsets settings. |
298 | ---Category: Inquire methods |
299 | |
300 | |
301 | --\f |
302 | |
303 | fields |
304 | |
305 | -- |
306 | -- Class : Graphic3d_AspectFillArea3d |
307 | -- |
308 | -- Purpose : Declaration of variables specific to |
309 | -- the context of drawing 3d faces |
310 | -- |
311 | -- Reminder : A context for drawing 3d faces inherits a context |
312 | -- defined by : |
313 | -- - the interior style of the face |
314 | -- - the edge style of the face |
315 | -- - the colour |
316 | -- It also possesses a definition of the materials for the |
317 | -- internal and external faces. |
318 | -- |
319 | -- |
320 | |
321 | |
322 | -- flag to distinguish between internal and external faces |
323 | DistinguishModeActive : Boolean from Standard; |
324 | |
325 | -- flag to draw the edges or not |
326 | EdgeModeActive : Boolean from Standard; |
327 | |
328 | -- display flag for reversed polygons. |
329 | BackFaceRemovalActive : Boolean from Standard; |
330 | |
331 | MyTextureMap : TextureMap from Graphic3d; |
332 | MyTextureMapState : Boolean from Standard; |
333 | |
334 | -- the material |
335 | MyFrontMaterial : MaterialAspect from Graphic3d; |
336 | MyBackMaterial : MaterialAspect from Graphic3d; |
337 | |
338 | -- the degenate model |
339 | MyDegenerateModel : TypeOfDegenerateModel from Aspect; |
340 | MyDegenerateRatio : Ratio from Quantity; |
341 | |
342 | -- 22-03-04 OCC4895 SAN High-level interface for controlling polygon offsets |
343 | -- polygon offsets |
344 | MyPolygonOffsetMode : Integer from Standard; |
60be1f9b |
345 | MyPolygonOffsetFactor : ShortReal from Standard; |
346 | MyPolygonOffsetUnits : ShortReal from Standard; |
7fd59977 |
347 | |
348 | end AspectFillArea3d; |