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