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
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.
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.
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.
22 -- 1/08/97 ; PCT : Ajout texture mapping
23 -- 15/01/98 ; FMN : Suppression Hidden Line
25 class ContextView from Visual3d
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 :
35 -- The type of visualization.
41 SequenceOfAddress from TColStd,
42 ClipPlane from Visual3d,
44 HSetOfLight from Visual3d,
45 HSetOfClipPlane from Visual3d,
46 TypeOfModel from Visual3d,
47 TypeOfVisualization from Visual3d,
48 TypeOfSurfaceDetail from Visual3d,
49 TextureEnv from Graphic3d
53 ClipDefinitionError from Visual3d,
54 DepthCueingDefinitionError from Visual3d,
55 LightDefinitionError from Visual3d,
56 ZClippingDefinitionError from Visual3d
61 returns ContextView from Visual3d;
63 ---Purpose: Creates a context from default values
66 -- BackZClipping : OFF
67 -- FrontZClipping : OFF
71 -- Type Of Visualization : TOV_WIREFRAME
72 -- Type Of Model : TOM_NONE
73 -- Type Of SurfaceDetail : TOSD_NONE
76 SetSurfaceDetail(me : in out;
77 TOSD : TypeOfSurfaceDetail);
78 ---Purpose: Selects the kind of rendering
79 -- default to: TOSD_NONE
81 SetTextureEnv(me : in out;
82 ATexture : TextureEnv from Graphic3d);
83 ---Purpose: Sets the environment texture to use
84 -- no environment texture by default
87 ---------------------------------------------------
88 -- Category: Methods to modify the class definition
90 ---------------------------------------------------
92 SetAliasingOn ( me : in out )
95 ---Purpose: Activates antialiasing.
96 -- Antialiasing can be activated on all the structures
98 ---Category: Methods to modify the class definition
100 SetAliasingOff ( me : in out )
103 ---Purpose: Deactivates the antialiasing.
104 ---Category: Methods to modify the class definition
106 ---------------------------------------------------
107 -- Category: Methods to modify the class definition
109 ---------------------------------------------------
111 SetDepthCueingBackPlane ( me : in out;
112 ABack : Real from Standard )
114 ---Purpose: Modifies the back depth-cueing plane.
115 -- Category: Methods to modify the class definition
116 -- Warning: Raises DepthCueingDefinitionError if <BackPlane>
117 -- is front of <FrontPlane> and DepthCueing is ON.
118 raises DepthCueingDefinitionError is static;
120 SetDepthCueingFrontPlane ( me : in out;
121 ABack : Real from Standard )
123 ---Purpose: Modifies the front depth-cueing plane.
124 -- Category: Methods to modify the class definition
125 -- Warning: Raises DepthCueingDefinitionError if <BackPlane> is
126 -- front of <FrontPlane> and DepthCueing is ON.
127 raises DepthCueingDefinitionError is static;
129 SetDepthCueingOn ( me : in out )
131 ---Purpose: Activates the depth-cueing.
132 -- Depth-cueing can be activated on all structures
133 -- present in the view.
134 -- Category: Methods to modify the class definition
135 -- Warning: Raises DepthCueingDefinitionError if <BackPlane> is
136 -- front of <FrontPlane>.
137 raises DepthCueingDefinitionError is static;
139 SetDepthCueingOff ( me : in out )
142 ---Purpose: Deactivates the depth-cueing.
143 ---Category: Methods to modify the class definition
145 ---------------------------------------------------
146 -- Category: Methods to modify the class definition
148 ---------------------------------------------------
150 SetClipPlaneOn ( me : in out;
151 AClipPlane : ClipPlane from Visual3d )
154 ---Purpose: Activates the clipping plane <AClipPlane>
155 ---Category: Methods to modify the class definition
157 SetClipPlaneOff ( me : in out;
158 AClipPlane : ClipPlane from Visual3d )
161 ---Purpose: Deactivates the clipping plane <AClipPlane>
162 ---Category: Methods to modify the class definition
164 ---------------------------------------------------
165 -- Category: Methods to modify the class definition
167 ---------------------------------------------------
169 SetLightOn ( me : in out;
170 ALight : Light from Visual3d )
173 ---Purpose: Activates the light source <ALight>
174 ---Category: Methods to modify the class definition
176 SetLightOff ( me : in out;
177 ALight : Light from Visual3d )
180 ---Purpose: Deactivates the light source <ALight>
181 ---Category: Methods to modify the class definition
183 ---------------------------------------------------
184 -- Category: Methods to modify the class definition
185 -- Visualization and Shading
186 ---------------------------------------------------
188 SetModel ( me : in out;
189 AModel : TypeOfModel from Visual3d )
192 ---Purpose: Modifies the shading model when the type of
193 -- visualization is TOV_SHADING
195 -- TypeOfModel : TOM_NONE
200 ---Category: Methods to modify the class definition
202 SetVisualization ( me : in out;
203 AVisual : TypeOfVisualization from Visual3d )
206 ---Purpose: Modifies the mode of visualization.
208 -- TypeOfVisualization : TOV_WIREFRAME
211 ---Category: Methods to modify the class definition
213 ---------------------------------------------------
214 -- Category: Methods to modify the class definition
216 ---------------------------------------------------
218 SetZClippingBackPlane ( me : in out;
219 ABack : Real from Standard )
221 ---Purpose: Modifies the back Z-clipping plane.
222 -- Category: Methods to modify the class definition
223 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
224 -- front of <FrontPlane> and ZClipping is ON.
225 raises ZClippingDefinitionError is static;
227 SetZClippingFrontPlane ( me : in out;
228 AFront : Real from Standard )
230 ---Purpose: Modifies the front Z-clipping plane.
231 -- Category: Methods to modify the class definition
232 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
233 -- front of <FrontPlane> and ZClipping is ON.
234 raises ZClippingDefinitionError is static;
236 SetZClippingOn ( me : in out )
238 ---Purpose: Activates the Z-clipping planes defined by
239 -- SetZClippingFrontPlane and SetZClippingBackPlane.
240 -- Category: Methods to modify the class definition
241 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
242 -- front of <FrontPlane>.
243 raises ZClippingDefinitionError is static;
245 SetZClippingOff ( me : in out )
248 ---Purpose: Deactivates the Z-clipping planes defined by
249 -- SetFrontPlane and SetBackPlane.
250 ---Category: Methods to modify the class definition
252 SetFrontZClippingOn ( me: in out )
254 ---Purpose: Activates the front Z-clipping plane defined by
255 -- SetFrontPlane method.
256 ---Category: Methods to modify the class definition
258 raises ZClippingDefinitionError is static;
259 -- if <BackPlane> is front of <FrontPlane>.
261 SetFrontZClippingOff ( me: in out )
264 ---Purpose: Deactivates the front Z-clipping plane defined by
265 -- SetFrontPlane method.
266 ---Category: Methods to modify the class definition
268 SetBackZClippingOn ( me : in out )
270 ---Purpose: Activates the back Z-clipping plane defined by
271 -- SetBackPlane method.
272 -- Category: Methods to modify the class definition
273 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
274 -- front of <FrontPlane>.
275 raises ZClippingDefinitionError is static;
277 SetBackZClippingOff ( me : in out )
280 ---Purpose: Deactivates the back Z-clipping plane defined by
281 -- SetBackPlane method.
282 ---Category: Methods to modify the class definition
284 ----------------------------
285 -- Category: Inquire methods
286 ----------------------------
288 ActivatedClipPlanes ( me )
289 returns HSetOfClipPlane from Visual3d
292 ---Purpose: Returns the group of active clipping planes
293 -- in the view of context <me>.
294 ---Category: Inquire methods
296 NumberOfActivatedClipPlanes ( me )
297 returns Integer from Standard
300 ---Purpose: Returns the number of active clipping planes
301 -- in the view of context <me>.
302 ---Category: Inquire methods
304 ActivatedClipPlane ( me;
305 AnIndex : Integer from Standard )
306 returns ClipPlane from Visual3d
309 ---Category: Inquire methods
311 ActivatedLights ( me )
312 returns HSetOfLight from Visual3d
315 ---Purpose: Returns the group of active light sources
316 -- in the view of context <me>.
317 ---Category: Inquire methods
319 NumberOfActivatedLights ( me )
320 returns Integer from Standard
323 ---Purpose: Returns the number of active light sources
324 -- in the view of context <me>.
325 ---Category: Inquire methods
328 AnIndex : Integer from Standard )
329 returns Light from Visual3d
332 ---Category: Inquire methods
335 returns Boolean from Standard
338 ---Purpose: Returns the activity of the aliasing.
339 ---Category: Inquire methods
341 BackZClippingIsOn ( me )
342 returns Boolean from Standard
345 ---Purpose: Returns the activity of the ZClipping.
346 ---Category: Inquire methods
348 DepthCueingBackPlane ( me )
349 returns Real from Standard
352 ---Purpose: Returns the definition of the back depth-cueing plane.
353 ---Category: Inquire methods
355 DepthCueingFrontPlane ( me )
356 returns Real from Standard
359 ---Purpose: Returns the definition of the front depth-cueing plane.
360 ---Category: Inquire methods
362 DepthCueingIsOn ( me )
363 returns Boolean from Standard
366 ---Purpose: Returns the activity of the depth-cueing.
367 ---Category: Inquire methods
369 FrontZClippingIsOn ( me )
370 returns Boolean from Standard
373 ---Purpose: Returns the activity of the ZClipping.
374 ---Category: Inquire methods
377 returns TypeOfModel from Visual3d
380 ---Purpose: Returns the shading model.
381 ---Category: Inquire methods
384 returns TypeOfVisualization from Visual3d
387 ---Purpose: Returns the mode of visualization.
388 ---Category: Inquire methods
390 ZClippingBackPlane ( me )
391 returns Real from Standard
394 ---Purpose: Returns the definition of the back Z-clipping plane.
395 ---Category: Inquire methods
397 ZClippingFrontPlane ( me )
398 returns Real from Standard
401 ---Purpose: Returns the definition of the front Z-clipping plane.
402 ---Category: Inquire methods
406 returns TypeOfSurfaceDetail from Visual3d;
408 -- purpose: returns the current SurfaceDetail mode
411 TextureEnv(me) returns TextureEnv from Graphic3d;
413 -- purpose: return the current environment texture used
421 -- Class : Visual3d_ContextView
423 -- Purpose : Declaration of variables specific to view contexts.
426 -- Reminders : A view context is defined by :
427 -- - aliasing activity
428 -- - depth-cueing activity
429 -- - Z clipping activity
430 -- - activity of defined light sources
431 -- - the type of visualization
432 -- - the shading model if required
435 -- flag for aliasing activity
436 AliasingIsActive : Boolean from Standard;
438 -- flag for depth cueing activity
439 ZcueingIsActive : Boolean from Standard;
441 -- flag for Z clipping activity
442 FrontZclippingIsActive : Boolean from Standard;
444 -- flag for Z clipping activity
445 BackZclippingIsActive : Boolean from Standard;
447 -- Z clipping, front plane
448 MyZclippingFrontPlane : ShortReal from Standard;
450 -- Z clipping, back plane
451 MyZclippingBackPlane : ShortReal from Standard;
453 -- DepthCueing, front plane
454 MyDepthCueingFrontPlane : ShortReal from Standard;
456 -- DepthCueing, back plane
457 MyDepthCueingBackPlane : ShortReal from Standard;
459 -- the type of shading activated
460 MyModel : TypeOfModel from Visual3d;
462 -- the type of visualization activated
463 MyVisual : TypeOfVisualization from Visual3d;
465 -- the light sources activated
466 MyLights : SequenceOfAddress from TColStd;
468 -- the clipping planes activated
469 MyClipPlanes : SequenceOfAddress from TColStd;
472 MyTextureEnv : TextureEnv from Graphic3d;
473 MySurfaceDetail : TypeOfSurfaceDetail from Visual3d;