b311480e |
1 | -- Created on: 1991-09-05 |
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. |
7fd59977 |
10 | -- |
b311480e |
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 | -- Updated: |
22 | -- 1/08/97 ; PCT : Ajout texture mapping |
23 | -- 15/01/98 ; FMN : Suppression Hidden Line |
7fd59977 |
24 | |
25 | class ContextView from Visual3d |
26 | |
27 | ---Version: |
28 | |
29 | ---Purpose: This class manages the creation and update of |
30 | -- a visualization context for one view in the viewer. |
31 | -- A context is defined by : |
32 | -- Antialiasing. |
33 | -- ZClipping. |
34 | -- Depth-cueing. |
35 | -- The type of visualization. |
36 | -- The light sources. |
37 | |
38 | |
39 | uses |
40 | |
51b10cd4 |
41 | SequenceOfAddress from TColStd, |
42 | Light from Visual3d, |
43 | HSetOfLight from Visual3d, |
44 | TypeOfModel from Visual3d, |
45 | TypeOfVisualization from Visual3d, |
46 | TypeOfSurfaceDetail from Visual3d, |
47 | TextureEnv from Graphic3d, |
48 | SequenceOfHClipPlane from Graphic3d |
7fd59977 |
49 | |
50 | raises |
51 | |
52 | ClipDefinitionError from Visual3d, |
53 | DepthCueingDefinitionError from Visual3d, |
54 | LightDefinitionError from Visual3d, |
55 | ZClippingDefinitionError from Visual3d |
56 | |
57 | is |
58 | |
59 | Create |
60 | returns ContextView from Visual3d; |
61 | ---Level: Public |
62 | ---Purpose: Creates a context from default values |
63 | -- |
64 | -- Aliasing : OFF |
65 | -- BackZClipping : OFF |
66 | -- FrontZClipping : OFF |
67 | -- Depth-cueing : OFF |
68 | -- Light source : 0 |
69 | -- Clipping plane : 0 |
70 | -- Type Of Visualization : TOV_WIREFRAME |
71 | -- Type Of Model : TOM_NONE |
72 | -- Type Of SurfaceDetail : TOSD_NONE |
73 | |
74 | |
75 | SetSurfaceDetail(me : in out; |
76 | TOSD : TypeOfSurfaceDetail); |
77 | ---Purpose: Selects the kind of rendering |
78 | -- default to: TOSD_NONE |
79 | |
80 | SetTextureEnv(me : in out; |
81 | ATexture : TextureEnv from Graphic3d); |
82 | ---Purpose: Sets the environment texture to use |
83 | -- no environment texture by default |
84 | |
85 | |
86 | --------------------------------------------------- |
87 | -- Category: Methods to modify the class definition |
88 | -- Aliasing |
89 | --------------------------------------------------- |
90 | |
91 | SetAliasingOn ( me : in out ) |
92 | is static; |
93 | ---Level: Public |
94 | ---Purpose: Activates antialiasing. |
95 | -- Antialiasing can be activated on all the structures |
96 | -- in the view |
97 | ---Category: Methods to modify the class definition |
98 | |
99 | SetAliasingOff ( me : in out ) |
100 | is static; |
101 | ---Level: Public |
102 | ---Purpose: Deactivates the antialiasing. |
103 | ---Category: Methods to modify the class definition |
104 | |
105 | --------------------------------------------------- |
106 | -- Category: Methods to modify the class definition |
107 | -- Depth-Cueing |
108 | --------------------------------------------------- |
109 | |
110 | SetDepthCueingBackPlane ( me : in out; |
111 | ABack : Real from Standard ) |
112 | ---Level: Public |
113 | ---Purpose: Modifies the back depth-cueing plane. |
114 | -- Category: Methods to modify the class definition |
115 | -- Warning: Raises DepthCueingDefinitionError if <BackPlane> |
116 | -- is front of <FrontPlane> and DepthCueing is ON. |
117 | raises DepthCueingDefinitionError is static; |
118 | |
119 | SetDepthCueingFrontPlane ( me : in out; |
120 | ABack : Real from Standard ) |
121 | ---Level: Public |
122 | ---Purpose: Modifies the front depth-cueing plane. |
123 | -- Category: Methods to modify the class definition |
124 | -- Warning: Raises DepthCueingDefinitionError if <BackPlane> is |
125 | -- front of <FrontPlane> and DepthCueing is ON. |
126 | raises DepthCueingDefinitionError is static; |
127 | |
128 | SetDepthCueingOn ( me : in out ) |
129 | ---Level: Public |
130 | ---Purpose: Activates the depth-cueing. |
131 | -- Depth-cueing can be activated on all structures |
132 | -- present in the view. |
133 | -- Category: Methods to modify the class definition |
134 | -- Warning: Raises DepthCueingDefinitionError if <BackPlane> is |
135 | -- front of <FrontPlane>. |
136 | raises DepthCueingDefinitionError is static; |
137 | |
138 | SetDepthCueingOff ( me : in out ) |
139 | is static; |
140 | ---Level: Public |
141 | ---Purpose: Deactivates the depth-cueing. |
142 | ---Category: Methods to modify the class definition |
143 | |
144 | --------------------------------------------------- |
145 | -- Category: Methods to modify the class definition |
146 | -- Clip Plane |
147 | --------------------------------------------------- |
148 | |
51b10cd4 |
149 | ClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d; |
4269bd1b |
150 | ---C++: return const& |
51b10cd4 |
151 | ---Purpose: Returns sequence of clip planes. |
152 | -- @return sequence of clip planes. |
153 | |
154 | ChangeClipPlanes (me : in out) returns SequenceOfHClipPlane from Graphic3d; |
155 | ---C++: return& |
156 | ---Purpose: Change clip planes. |
4269bd1b |
157 | -- @return sequence of clip planes. |
7fd59977 |
158 | |
159 | --------------------------------------------------- |
160 | -- Category: Methods to modify the class definition |
161 | -- Lights |
162 | --------------------------------------------------- |
163 | |
164 | SetLightOn ( me : in out; |
165 | ALight : Light from Visual3d ) |
166 | is static; |
167 | ---Level: Public |
168 | ---Purpose: Activates the light source <ALight> |
169 | ---Category: Methods to modify the class definition |
170 | |
171 | SetLightOff ( me : in out; |
172 | ALight : Light from Visual3d ) |
173 | is static; |
174 | ---Level: Public |
175 | ---Purpose: Deactivates the light source <ALight> |
176 | ---Category: Methods to modify the class definition |
177 | |
178 | --------------------------------------------------- |
179 | -- Category: Methods to modify the class definition |
180 | -- Visualization and Shading |
181 | --------------------------------------------------- |
182 | |
183 | SetModel ( me : in out; |
184 | AModel : TypeOfModel from Visual3d ) |
185 | is static; |
186 | ---Level: Public |
187 | ---Purpose: Modifies the shading model when the type of |
188 | -- visualization is TOV_SHADING |
189 | -- |
190 | -- TypeOfModel : TOM_NONE |
191 | -- TOM_INTERP_COLOR |
192 | -- TOM_FACET |
193 | -- TOM_VERTEX |
194 | -- |
195 | ---Category: Methods to modify the class definition |
196 | |
197 | SetVisualization ( me : in out; |
198 | AVisual : TypeOfVisualization from Visual3d ) |
199 | is static; |
200 | ---Level: Public |
201 | ---Purpose: Modifies the mode of visualization. |
202 | -- |
203 | -- TypeOfVisualization : TOV_WIREFRAME |
204 | -- TOV_SHADING |
205 | -- |
206 | ---Category: Methods to modify the class definition |
207 | |
208 | --------------------------------------------------- |
209 | -- Category: Methods to modify the class definition |
210 | -- ZClipping |
211 | --------------------------------------------------- |
212 | |
213 | SetZClippingBackPlane ( me : in out; |
214 | ABack : Real from Standard ) |
215 | ---Level: Public |
216 | ---Purpose: Modifies the back Z-clipping plane. |
217 | -- Category: Methods to modify the class definition |
218 | -- Warning: Raises ZClippingDefinitionError if <BackPlane> is |
219 | -- front of <FrontPlane> and ZClipping is ON. |
220 | raises ZClippingDefinitionError is static; |
221 | |
222 | SetZClippingFrontPlane ( me : in out; |
223 | AFront : Real from Standard ) |
224 | ---Level: Public |
225 | ---Purpose: Modifies the front Z-clipping plane. |
226 | -- Category: Methods to modify the class definition |
227 | -- Warning: Raises ZClippingDefinitionError if <BackPlane> is |
228 | -- front of <FrontPlane> and ZClipping is ON. |
229 | raises ZClippingDefinitionError is static; |
230 | |
231 | SetZClippingOn ( me : in out ) |
232 | ---Level: Public |
233 | ---Purpose: Activates the Z-clipping planes defined by |
234 | -- SetZClippingFrontPlane and SetZClippingBackPlane. |
235 | -- Category: Methods to modify the class definition |
236 | -- Warning: Raises ZClippingDefinitionError if <BackPlane> is |
237 | -- front of <FrontPlane>. |
238 | raises ZClippingDefinitionError is static; |
239 | |
240 | SetZClippingOff ( me : in out ) |
241 | is static; |
242 | ---Level: Public |
243 | ---Purpose: Deactivates the Z-clipping planes defined by |
244 | -- SetFrontPlane and SetBackPlane. |
245 | ---Category: Methods to modify the class definition |
246 | |
247 | SetFrontZClippingOn ( me: in out ) |
248 | ---Level: Public |
249 | ---Purpose: Activates the front Z-clipping plane defined by |
250 | -- SetFrontPlane method. |
251 | ---Category: Methods to modify the class definition |
252 | -- |
253 | raises ZClippingDefinitionError is static; |
254 | -- if <BackPlane> is front of <FrontPlane>. |
255 | |
256 | SetFrontZClippingOff ( me: in out ) |
257 | is static; |
258 | ---Level: Public |
259 | ---Purpose: Deactivates the front Z-clipping plane defined by |
260 | -- SetFrontPlane method. |
261 | ---Category: Methods to modify the class definition |
262 | |
263 | SetBackZClippingOn ( me : in out ) |
264 | ---Level: Public |
265 | ---Purpose: Activates the back Z-clipping plane defined by |
266 | -- SetBackPlane method. |
267 | -- Category: Methods to modify the class definition |
268 | -- Warning: Raises ZClippingDefinitionError if <BackPlane> is |
269 | -- front of <FrontPlane>. |
270 | raises ZClippingDefinitionError is static; |
271 | |
272 | SetBackZClippingOff ( me : in out ) |
273 | is static; |
274 | ---Level: Public |
275 | ---Purpose: Deactivates the back Z-clipping plane defined by |
276 | -- SetBackPlane method. |
277 | ---Category: Methods to modify the class definition |
278 | |
279 | ---------------------------- |
280 | -- Category: Inquire methods |
281 | ---------------------------- |
282 | |
7fd59977 |
283 | ActivatedLights ( me ) |
284 | returns HSetOfLight from Visual3d |
285 | is static; |
286 | ---Level: Internal |
287 | ---Purpose: Returns the group of active light sources |
288 | -- in the view of context <me>. |
289 | ---Category: Inquire methods |
290 | |
291 | NumberOfActivatedLights ( me ) |
292 | returns Integer from Standard |
293 | is static; |
294 | ---Level: Internal |
295 | ---Purpose: Returns the number of active light sources |
296 | -- in the view of context <me>. |
297 | ---Category: Inquire methods |
298 | |
299 | ActivatedLight ( me; |
300 | AnIndex : Integer from Standard ) |
301 | returns Light from Visual3d |
302 | is static; |
303 | ---Level: Internal |
304 | ---Category: Inquire methods |
305 | |
306 | AliasingIsOn ( me ) |
307 | returns Boolean from Standard |
308 | is static; |
309 | ---Level: Public |
310 | ---Purpose: Returns the activity of the aliasing. |
311 | ---Category: Inquire methods |
312 | |
313 | BackZClippingIsOn ( me ) |
314 | returns Boolean from Standard |
315 | is static; |
316 | ---Level: Public |
317 | ---Purpose: Returns the activity of the ZClipping. |
318 | ---Category: Inquire methods |
319 | |
320 | DepthCueingBackPlane ( me ) |
321 | returns Real from Standard |
322 | is static; |
323 | ---Level: Public |
324 | ---Purpose: Returns the definition of the back depth-cueing plane. |
325 | ---Category: Inquire methods |
326 | |
327 | DepthCueingFrontPlane ( me ) |
328 | returns Real from Standard |
329 | is static; |
330 | ---Level: Public |
331 | ---Purpose: Returns the definition of the front depth-cueing plane. |
332 | ---Category: Inquire methods |
333 | |
334 | DepthCueingIsOn ( me ) |
335 | returns Boolean from Standard |
336 | is static; |
337 | ---Level: Public |
338 | ---Purpose: Returns the activity of the depth-cueing. |
339 | ---Category: Inquire methods |
340 | |
341 | FrontZClippingIsOn ( me ) |
342 | returns Boolean from Standard |
343 | is static; |
344 | ---Level: Public |
345 | ---Purpose: Returns the activity of the ZClipping. |
346 | ---Category: Inquire methods |
347 | |
348 | Model ( me ) |
349 | returns TypeOfModel from Visual3d |
350 | is static; |
351 | ---Level: Public |
352 | ---Purpose: Returns the shading model. |
353 | ---Category: Inquire methods |
354 | |
355 | Visualization ( me ) |
356 | returns TypeOfVisualization from Visual3d |
357 | is static; |
358 | ---Level: Public |
359 | ---Purpose: Returns the mode of visualization. |
360 | ---Category: Inquire methods |
361 | |
362 | ZClippingBackPlane ( me ) |
363 | returns Real from Standard |
364 | is static; |
365 | ---Level: Public |
366 | ---Purpose: Returns the definition of the back Z-clipping plane. |
367 | ---Category: Inquire methods |
368 | |
369 | ZClippingFrontPlane ( me ) |
370 | returns Real from Standard |
371 | is static; |
372 | ---Level: Public |
373 | ---Purpose: Returns the definition of the front Z-clipping plane. |
374 | ---Category: Inquire methods |
375 | |
376 | |
377 | SurfaceDetail(me) |
378 | returns TypeOfSurfaceDetail from Visual3d; |
379 | -- level: public |
380 | -- purpose: returns the current SurfaceDetail mode |
381 | |
382 | |
383 | TextureEnv(me) returns TextureEnv from Graphic3d; |
384 | -- level: public |
385 | -- purpose: return the current environment texture used |
386 | |
387 | |
388 | --\f |
389 | |
390 | fields |
391 | |
392 | -- |
393 | -- Class : Visual3d_ContextView |
394 | -- |
395 | -- Purpose : Declaration of variables specific to view contexts. |
396 | |
397 | -- |
398 | -- Reminders : A view context is defined by : |
399 | -- - aliasing activity |
400 | -- - depth-cueing activity |
401 | -- - Z clipping activity |
402 | -- - activity of defined light sources |
403 | -- - the type of visualization |
404 | -- - the shading model if required |
405 | -- |
406 | -- |
407 | -- flag for aliasing activity |
408 | AliasingIsActive : Boolean from Standard; |
409 | |
410 | -- flag for depth cueing activity |
411 | ZcueingIsActive : Boolean from Standard; |
412 | |
413 | -- flag for Z clipping activity |
414 | FrontZclippingIsActive : Boolean from Standard; |
415 | |
416 | -- flag for Z clipping activity |
417 | BackZclippingIsActive : Boolean from Standard; |
418 | |
419 | -- Z clipping, front plane |
420 | MyZclippingFrontPlane : ShortReal from Standard; |
421 | |
422 | -- Z clipping, back plane |
423 | MyZclippingBackPlane : ShortReal from Standard; |
424 | |
425 | -- DepthCueing, front plane |
426 | MyDepthCueingFrontPlane : ShortReal from Standard; |
427 | |
428 | -- DepthCueing, back plane |
429 | MyDepthCueingBackPlane : ShortReal from Standard; |
430 | |
431 | -- the type of shading activated |
432 | MyModel : TypeOfModel from Visual3d; |
433 | |
434 | -- the type of visualization activated |
435 | MyVisual : TypeOfVisualization from Visual3d; |
436 | |
437 | -- the light sources activated |
438 | MyLights : SequenceOfAddress from TColStd; |
439 | |
7fd59977 |
440 | MyTextureEnv : TextureEnv from Graphic3d; |
441 | MySurfaceDetail : TypeOfSurfaceDetail from Visual3d; |
442 | |
51b10cd4 |
443 | myClipPlanes : SequenceOfHClipPlane from Graphic3d; |
4269bd1b |
444 | |
7fd59977 |
445 | end ContextView; |