1 -- Created on: 1992-01-22
3 -- Copyright (c) 1992-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.
21 -- Update: FDA - Oct 15 1994,
25 class SpotLight from V3d
27 ---Purpose: Creation and modification of a spot.
31 inherits PositionLight from V3d
36 TypeOfOrientation from V3d,
37 TypeOfRepresentation from V3d,
39 NameOfColor from Quantity,
40 PlaneAngle from Quantity,
41 Coefficient from Quantity,
42 Parameter from Quantity,
44 Structure from Graphic3d,
45 Vertex from Graphic3d,
48 raises BadValue from Viewer
52 Create ( VM : mutable Viewer ; X,Y,Z : Coordinate ;
53 Direction : TypeOfOrientation = V3d_XnegYnegZpos ;
54 Color : NameOfColor = Quantity_NOC_WHITE ;
55 Attenuation1 : Coefficient = 1.0 ;
56 Attenuation2 : Coefficient = 0.0 ;
57 Concentration : Coefficient = 1.0 ;
58 Angle : PlaneAngle = 0.523599 )
59 returns mutable SpotLight
61 ---Purpose: Creates a light source of the Spot type in the viewer.
62 -- The attenuation factor F which determines
63 -- the illumination of a surface depends on the following formula :
64 -- F = 1/(A1 + A2*Length)
65 -- A1,A2 being the 2 factors of attenuation
66 -- Length is the distance from the source to the surface.
67 -- The default values (1.0,0.0) correspond to a minimum
69 -- The concentration factor determines the dispersion
70 -- of the light on the surface, the default value
71 -- (1.0) corresponds to a minimum of dispersion .
72 raises BadValue from Viewer;
73 ---Purpose: Warning! raises BadValue from Viewer -
74 -- If one of the coefficients is not between 0 and 1 .
75 -- If the lighting angle is <= 0 ou > PI .
77 Create ( VM : mutable Viewer ; Xt,Yt,Zt : Coordinate;
78 Xp,Yp,Zp : Coordinate;
79 Color : NameOfColor = Quantity_NOC_WHITE ;
80 Attenuation1 : Coefficient = 1.0 ;
81 Attenuation2 : Coefficient = 0.0 ;
82 Concentration : Coefficient = 1.0 ;
83 Angle : PlaneAngle = 0.523599 )
84 returns mutable SpotLight
86 ---Purpose: Creates a light source of the Spot type in the viewer.
87 -- Xt,Yt,Zt : Coordinate of light source Target.
88 -- Xp,Yp,Zp : Coordinate of light source Position.
89 -- The others parameters describe before.
90 raises BadValue from Viewer;
91 ---Purpose: Warning! raises BadValue from Viewer -
92 -- If one of the coefficients is not between 0 and 1 .
93 -- If the lighting angle is <= 0 ou > PI .
95 --------------------------------------------------------
96 ---Category: Methods to modify the Attributes of the light
97 --------------------------------------------------------
99 SetPosition ( me : mutable; X,Y,Z : Coordinate ) is redefined;
101 ---Purpose: Defines the position of the light source.
103 SetDirection ( me : mutable; Vx, Vy, Vz : Parameter ) raises BadValue from Viewer is static;
105 ---Purpose : Defines the direction of the light source.
106 -- If the normal vector is NULL.
108 SetDirection ( me : mutable; Orientation : TypeOfOrientation ) is static;
110 ---Purpose : Defines the direction of the light source
111 -- according to a predefined directional vector.
113 SetAttenuation( me : mutable; A1,A2 : Coefficient ) raises BadValue from Viewer is static;
115 ---Purpose: Defines the coefficients of attenuation.
116 -- Warning! raises BadValue from Viewer
117 -- if one of the coefficient is <0 ou >1 .
119 SetConcentration( me : mutable; C : Coefficient ) raises BadValue from Viewer is static;
121 ---Purpose: Defines the coefficient of concentration.
122 -- if the coefficient is <0 ou >1 .
124 SetAngle ( me : mutable; Angle : PlaneAngle ) raises BadValue from Viewer is static;
126 ---Purpose: Defines the spot angle in RADIANS.
127 -- Warning: raises BadValue from from Viewer
128 -- If the angle is <= 0 ou > PI .
130 ---------------------------------------------------
131 ---Category: display methods
132 ---------------------------------------------------
134 Display(me: mutable; aView: View from V3d;
135 Representation : TypeOfRepresentation)
138 ---Purpose: Display the graphic structure of light source
139 -- in the choosen view. We have three type of representation
140 -- - SIMPLE : Only the light source is displayed.
141 -- - PARTIAL : The light source and the light space are
143 -- - COMPLETE : The light source, the light space and the
144 -- radius of light space are displayed.
145 -- We can choose the "SAMELAST" as parameter of representation
146 -- In this case the graphic structure representation will be
147 -- the last displayed.
149 ---------------------------------------------------
150 ---Category: Inquire methods
151 ---------------------------------------------------
153 Direction ( me; Vx, Vy, Vz : out Parameter ) is static;
155 ---Purpose : Returns the direction of the light source defined by Vx,Vy,Vz.
157 Position ( me; X,Y,Z : out Coordinate ) is redefined static;
159 ---Purpose : Returns the position of the light source.
161 Attenuation ( me; A1,A2 : out Coefficient ) is static;
163 ---Purpose : Returns the attenuation factors A1,A2 of the light source.
165 Concentration( me ) returns Coefficient is static;
168 Angle ( me ) returns PlaneAngle is static;
170 ---Purpose: Returns the spot angle.
172 -----------------------------------------
173 ---Category: Private or Protected methods
174 -----------------------------------------
176 Symbol ( me ; gsymbol : mutable Group from Graphic3d ;
177 aView : View from V3d ) is redefined static private;
179 ---Purpose: Defines the representation of the spot light source.