1 -- Created on: 1991-09-05
2 -- Created by: NW,JPB,CAL
3 -- Copyright (c) 1991-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
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
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.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
18 -- 1/08/97 ; PCT : Ajout texture mapping
19 -- 15/01/98 ; FMN : Suppression Hidden Line
21 class ContextView from Visual3d
25 ---Purpose: This class manages the creation and update of
26 -- a visualization context for one view in the viewer.
27 -- A context is defined by :
31 -- The type of visualization.
37 SequenceOfAddress from TColStd,
39 HSequenceOfLight from Visual3d,
40 TypeOfModel from Visual3d,
41 TypeOfVisualization from Visual3d,
42 TypeOfSurfaceDetail from Visual3d,
43 TextureEnv from Graphic3d,
44 SequenceOfHClipPlane from Graphic3d
48 ClipDefinitionError from Visual3d,
49 DepthCueingDefinitionError from Visual3d,
50 LightDefinitionError from Visual3d,
51 ZClippingDefinitionError from Visual3d
56 returns ContextView from Visual3d;
58 ---Purpose: Creates a context from default values
61 -- BackZClipping : OFF
62 -- FrontZClipping : OFF
66 -- Type Of Visualization : TOV_WIREFRAME
67 -- Type Of Model : TOM_NONE
68 -- Type Of SurfaceDetail : TOSD_NONE
71 SetSurfaceDetail(me : in out;
72 TOSD : TypeOfSurfaceDetail);
73 ---Purpose: Selects the kind of rendering
74 -- default to: TOSD_NONE
76 SetTextureEnv(me : in out;
77 ATexture : TextureEnv from Graphic3d);
78 ---Purpose: Sets the environment texture to use
79 -- no environment texture by default
82 ---------------------------------------------------
83 -- Category: Methods to modify the class definition
85 ---------------------------------------------------
87 SetAliasingOn ( me : in out )
90 ---Purpose: Activates antialiasing.
91 -- Antialiasing can be activated on all the structures
93 ---Category: Methods to modify the class definition
95 SetAliasingOff ( me : in out )
98 ---Purpose: Deactivates the antialiasing.
99 ---Category: Methods to modify the class definition
101 ---------------------------------------------------
102 -- Category: Methods to modify the class definition
104 ---------------------------------------------------
106 SetDepthCueingBackPlane ( me : in out;
107 ABack : Real from Standard )
109 ---Purpose: Modifies the back depth-cueing plane.
110 -- Category: Methods to modify the class definition
111 -- Warning: Raises DepthCueingDefinitionError if <BackPlane>
112 -- is front of <FrontPlane> and DepthCueing is ON.
113 raises DepthCueingDefinitionError is static;
115 SetDepthCueingFrontPlane ( me : in out;
116 ABack : Real from Standard )
118 ---Purpose: Modifies the front depth-cueing plane.
119 -- Category: Methods to modify the class definition
120 -- Warning: Raises DepthCueingDefinitionError if <BackPlane> is
121 -- front of <FrontPlane> and DepthCueing is ON.
122 raises DepthCueingDefinitionError is static;
124 SetDepthCueingOn ( me : in out )
126 ---Purpose: Activates the depth-cueing.
127 -- Depth-cueing can be activated on all structures
128 -- present in the view.
129 -- Category: Methods to modify the class definition
130 -- Warning: Raises DepthCueingDefinitionError if <BackPlane> is
131 -- front of <FrontPlane>.
132 raises DepthCueingDefinitionError is static;
134 SetDepthCueingOff ( me : in out )
137 ---Purpose: Deactivates the depth-cueing.
138 ---Category: Methods to modify the class definition
140 ---------------------------------------------------
141 -- Category: Methods to modify the class definition
143 ---------------------------------------------------
145 ClipPlanes (me) returns SequenceOfHClipPlane from Graphic3d;
146 ---C++: return const&
147 ---Purpose: Returns sequence of clip planes.
148 -- @return sequence of clip planes.
150 ChangeClipPlanes (me : in out) returns SequenceOfHClipPlane from Graphic3d;
152 ---Purpose: Change clip planes.
153 -- @return sequence of clip planes.
155 ---------------------------------------------------
156 -- Category: Methods to modify the class definition
158 ---------------------------------------------------
160 SetLightOn ( me : in out;
161 ALight : Light from Visual3d )
164 ---Purpose: Activates the light source <ALight>
165 ---Category: Methods to modify the class definition
167 SetLightOff ( me : in out;
168 ALight : Light from Visual3d )
171 ---Purpose: Deactivates the light source <ALight>
172 ---Category: Methods to modify the class definition
174 ---------------------------------------------------
175 -- Category: Methods to modify the class definition
176 -- Visualization and Shading
177 ---------------------------------------------------
179 SetModel ( me : in out;
180 AModel : TypeOfModel from Visual3d )
183 ---Purpose: Modifies the shading model when the type of
184 -- visualization is TOV_SHADING
186 -- TypeOfModel : TOM_NONE
191 ---Category: Methods to modify the class definition
193 SetVisualization ( me : in out;
194 AVisual : TypeOfVisualization from Visual3d )
197 ---Purpose: Modifies the mode of visualization.
199 -- TypeOfVisualization : TOV_WIREFRAME
202 ---Category: Methods to modify the class definition
204 ---------------------------------------------------
205 -- Category: Methods to modify the class definition
207 ---------------------------------------------------
209 SetZClippingBackPlane ( me : in out;
210 ABack : Real from Standard )
212 ---Purpose: Modifies the back Z-clipping plane.
213 -- Category: Methods to modify the class definition
214 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
215 -- front of <FrontPlane> and ZClipping is ON.
216 raises ZClippingDefinitionError is static;
218 SetZClippingFrontPlane ( me : in out;
219 AFront : Real from Standard )
221 ---Purpose: Modifies the front 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 SetZClippingOn ( me : in out )
229 ---Purpose: Activates the Z-clipping planes defined by
230 -- SetZClippingFrontPlane and SetZClippingBackPlane.
231 -- Category: Methods to modify the class definition
232 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
233 -- front of <FrontPlane>.
234 raises ZClippingDefinitionError is static;
236 SetZClippingOff ( me : in out )
239 ---Purpose: Deactivates the Z-clipping planes defined by
240 -- SetFrontPlane and SetBackPlane.
241 ---Category: Methods to modify the class definition
243 SetFrontZClippingOn ( me: in out )
245 ---Purpose: Activates the front Z-clipping plane defined by
246 -- SetFrontPlane method.
247 ---Category: Methods to modify the class definition
249 raises ZClippingDefinitionError is static;
250 -- if <BackPlane> is front of <FrontPlane>.
252 SetFrontZClippingOff ( me: in out )
255 ---Purpose: Deactivates the front Z-clipping plane defined by
256 -- SetFrontPlane method.
257 ---Category: Methods to modify the class definition
259 SetBackZClippingOn ( me : in out )
261 ---Purpose: Activates the back Z-clipping plane defined by
262 -- SetBackPlane method.
263 -- Category: Methods to modify the class definition
264 -- Warning: Raises ZClippingDefinitionError if <BackPlane> is
265 -- front of <FrontPlane>.
266 raises ZClippingDefinitionError is static;
268 SetBackZClippingOff ( me : in out )
271 ---Purpose: Deactivates the back Z-clipping plane defined by
272 -- SetBackPlane method.
273 ---Category: Methods to modify the class definition
275 ----------------------------
276 -- Category: Inquire methods
277 ----------------------------
279 ActivatedLights ( me )
280 returns HSequenceOfLight from Visual3d
283 ---Purpose: Returns the group of active light sources
284 -- in the view of context <me>.
285 ---Category: Inquire methods
287 NumberOfActivatedLights ( me )
288 returns Integer from Standard
291 ---Purpose: Returns the number of active light sources
292 -- in the view of context <me>.
293 ---Category: Inquire methods
296 AnIndex : Integer from Standard )
297 returns Light from Visual3d
300 ---Category: Inquire methods
303 returns Boolean from Standard
306 ---Purpose: Returns the activity of the aliasing.
307 ---Category: Inquire methods
309 BackZClippingIsOn ( me )
310 returns Boolean from Standard
313 ---Purpose: Returns the activity of the ZClipping.
314 ---Category: Inquire methods
316 DepthCueingBackPlane ( me )
317 returns Real from Standard
320 ---Purpose: Returns the definition of the back depth-cueing plane.
321 ---Category: Inquire methods
323 DepthCueingFrontPlane ( me )
324 returns Real from Standard
327 ---Purpose: Returns the definition of the front depth-cueing plane.
328 ---Category: Inquire methods
330 DepthCueingIsOn ( me )
331 returns Boolean from Standard
334 ---Purpose: Returns the activity of the depth-cueing.
335 ---Category: Inquire methods
337 FrontZClippingIsOn ( me )
338 returns Boolean from Standard
341 ---Purpose: Returns the activity of the ZClipping.
342 ---Category: Inquire methods
345 returns TypeOfModel from Visual3d
348 ---Purpose: Returns the shading model.
349 ---Category: Inquire methods
352 returns TypeOfVisualization from Visual3d
355 ---Purpose: Returns the mode of visualization.
356 ---Category: Inquire methods
358 ZClippingBackPlane ( me )
359 returns Real from Standard
362 ---Purpose: Returns the definition of the back Z-clipping plane.
363 ---Category: Inquire methods
365 ZClippingFrontPlane ( me )
366 returns Real from Standard
369 ---Purpose: Returns the definition of the front Z-clipping plane.
370 ---Category: Inquire methods
374 returns TypeOfSurfaceDetail from Visual3d;
376 -- purpose: returns the current SurfaceDetail mode
379 TextureEnv(me) returns TextureEnv from Graphic3d;
381 -- purpose: return the current environment texture used
389 -- Class : Visual3d_ContextView
391 -- Purpose : Declaration of variables specific to view contexts.
394 -- Reminders : A view context is defined by :
395 -- - aliasing activity
396 -- - depth-cueing activity
397 -- - Z clipping activity
398 -- - activity of defined light sources
399 -- - the type of visualization
400 -- - the shading model if required
403 -- flag for aliasing activity
404 AliasingIsActive : Boolean from Standard;
406 -- flag for depth cueing activity
407 ZcueingIsActive : Boolean from Standard;
409 -- flag for Z clipping activity
410 FrontZclippingIsActive : Boolean from Standard;
412 -- flag for Z clipping activity
413 BackZclippingIsActive : Boolean from Standard;
415 -- Z clipping, front plane
416 MyZclippingFrontPlane : ShortReal from Standard;
418 -- Z clipping, back plane
419 MyZclippingBackPlane : ShortReal from Standard;
421 -- DepthCueing, front plane
422 MyDepthCueingFrontPlane : ShortReal from Standard;
424 -- DepthCueing, back plane
425 MyDepthCueingBackPlane : ShortReal from Standard;
427 -- the type of shading activated
428 MyModel : TypeOfModel from Visual3d;
430 -- the type of visualization activated
431 MyVisual : TypeOfVisualization from Visual3d;
433 -- the light sources activated
434 MyLights : SequenceOfAddress from TColStd;
436 MyTextureEnv : TextureEnv from Graphic3d;
437 MySurfaceDetail : TypeOfSurfaceDetail from Visual3d;
439 myClipPlanes : SequenceOfHClipPlane from Graphic3d;