0024070: OpenGL capped object-level clipping planes
[occt.git] / src / Visual3d / Visual3d_ContextView.cdl
CommitLineData
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
25class 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
39uses
40
41 SequenceOfAddress from TColStd,
7fd59977 42 Light from Visual3d,
43 HSetOfLight from Visual3d,
4269bd1b 44
7fd59977 45 TypeOfModel from Visual3d,
46 TypeOfVisualization from Visual3d,
47 TypeOfSurfaceDetail from Visual3d,
4269bd1b 48 TextureEnv from Graphic3d,
49 SetOfHClipPlane from Graphic3d
7fd59977 50
51raises
52
53 ClipDefinitionError from Visual3d,
54 DepthCueingDefinitionError from Visual3d,
55 LightDefinitionError from Visual3d,
56 ZClippingDefinitionError from Visual3d
57
58is
59
60 Create
61 returns ContextView from Visual3d;
62 ---Level: Public
63 ---Purpose: Creates a context from default values
64 --
65 -- Aliasing : OFF
66 -- BackZClipping : OFF
67 -- FrontZClipping : OFF
68 -- Depth-cueing : OFF
69 -- Light source : 0
70 -- Clipping plane : 0
71 -- Type Of Visualization : TOV_WIREFRAME
72 -- Type Of Model : TOM_NONE
73 -- Type Of SurfaceDetail : TOSD_NONE
74
75
76 SetSurfaceDetail(me : in out;
77 TOSD : TypeOfSurfaceDetail);
78 ---Purpose: Selects the kind of rendering
79 -- default to: TOSD_NONE
80
81 SetTextureEnv(me : in out;
82 ATexture : TextureEnv from Graphic3d);
83 ---Purpose: Sets the environment texture to use
84 -- no environment texture by default
85
86
87 ---------------------------------------------------
88 -- Category: Methods to modify the class definition
89 -- Aliasing
90 ---------------------------------------------------
91
92 SetAliasingOn ( me : in out )
93 is static;
94 ---Level: Public
95 ---Purpose: Activates antialiasing.
96 -- Antialiasing can be activated on all the structures
97 -- in the view
98 ---Category: Methods to modify the class definition
99
100 SetAliasingOff ( me : in out )
101 is static;
102 ---Level: Public
103 ---Purpose: Deactivates the antialiasing.
104 ---Category: Methods to modify the class definition
105
106 ---------------------------------------------------
107 -- Category: Methods to modify the class definition
108 -- Depth-Cueing
109 ---------------------------------------------------
110
111 SetDepthCueingBackPlane ( me : in out;
112 ABack : Real from Standard )
113 ---Level: Public
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;
119
120 SetDepthCueingFrontPlane ( me : in out;
121 ABack : Real from Standard )
122 ---Level: Public
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;
128
129 SetDepthCueingOn ( me : in out )
130 ---Level: Public
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;
138
139 SetDepthCueingOff ( me : in out )
140 is static;
141 ---Level: Public
142 ---Purpose: Deactivates the depth-cueing.
143 ---Category: Methods to modify the class definition
144
145 ---------------------------------------------------
146 -- Category: Methods to modify the class definition
147 -- Clip Plane
148 ---------------------------------------------------
149
4269bd1b 150 SetClipPlanes (me : in out; thePlanes : SetOfHClipPlane from Graphic3d);
151 ---Purpose: Set list of clip planes to the view context.
152 -- @param thePlanes [in] the clip planes to set.
7fd59977 153
4269bd1b 154 GetClipPlanes (me) returns SetOfHClipPlane from Graphic3d;
155 ---C++: return const&
156 ---Purpose: Get clip planes.
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
390fields
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
4269bd1b 443 myClipPlanes : SetOfHClipPlane from Graphic3d;
444
7fd59977 445end ContextView;