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