0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / V3d / V3d_SpotLight.hxx
1 // Created on: 1992-01-22
2 // Created by: GG 
3 // Copyright (c) 1992-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 #ifndef _V3d_SpotLight_HeaderFile
18 #define _V3d_SpotLight_HeaderFile
19
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
22
23 #include <V3d_PositionLight.hxx>
24 #include <V3d_Coordinate.hxx>
25 #include <V3d_TypeOfOrientation.hxx>
26 #include <Quantity_NameOfColor.hxx>
27 #include <Quantity_Coefficient.hxx>
28 #include <Quantity_PlaneAngle.hxx>
29 #include <Quantity_Parameter.hxx>
30 #include <V3d_TypeOfRepresentation.hxx>
31 class V3d_BadValue;
32 class V3d_Viewer;
33 class V3d_View;
34 class Graphic3d_Group;
35
36
37 class V3d_SpotLight;
38 DEFINE_STANDARD_HANDLE(V3d_SpotLight, V3d_PositionLight)
39
40 //! Creation and modification of a spot.
41 class V3d_SpotLight : public V3d_PositionLight
42 {
43
44 public:
45
46   
47   //! Creates a light source of the Spot type in the viewer.
48   //! The attenuation factor F which determines
49   //! the illumination of a surface depends on the following formula :
50   //! F = 1/(A1 + A2*Length)
51   //! A1,A2 being the 2 factors of attenuation
52   //! Length is the distance from the source to the surface.
53   //! The default values (1.0,0.0) correspond to a minimum
54   //! of attenuation .
55   //! The concentration factor determines the dispersion
56   //! of the light on the surface, the default value
57   //! (1.0) corresponds to a minimum of dispersion .
58   //! Warning! raises BadValue from V3d  -
59   //! If one of the coefficients is not between 0 and 1 .
60   //! If the lighting angle is <= 0 ou > PI .
61   Standard_EXPORT V3d_SpotLight(const Handle(V3d_Viewer)& VM, const V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z, const V3d_TypeOfOrientation Direction = V3d_XnegYnegZpos, const Quantity_NameOfColor Color = Quantity_NOC_WHITE, const Quantity_Coefficient Attenuation1 = 1.0, const Quantity_Coefficient Attenuation2 = 0.0, const Quantity_Coefficient Concentration = 1.0, const Quantity_PlaneAngle Angle = 0.523599);
62   
63   //! Creates a light source of the Spot type in the viewer.
64   //! Xt,Yt,Zt : Coordinate of light source Target.
65   //! Xp,Yp,Zp : Coordinate of light source Position.
66   //! The others parameters describe before.
67   //! Warning! raises BadValue from V3d  -
68   //! If one of the coefficients is not between 0 and 1 .
69   //! If the lighting angle is <= 0 ou > PI .
70   Standard_EXPORT V3d_SpotLight(const Handle(V3d_Viewer)& VM, const V3d_Coordinate Xt, const V3d_Coordinate Yt, const V3d_Coordinate Zt, const V3d_Coordinate Xp, const V3d_Coordinate Yp, const V3d_Coordinate Zp, const Quantity_NameOfColor Color = Quantity_NOC_WHITE, const Quantity_Coefficient Attenuation1 = 1.0, const Quantity_Coefficient Attenuation2 = 0.0, const Quantity_Coefficient Concentration = 1.0, const Quantity_PlaneAngle Angle = 0.523599);
71   
72   //! Defines the position of the light source.
73   Standard_EXPORT virtual void SetPosition (const V3d_Coordinate X, const V3d_Coordinate Y, const V3d_Coordinate Z) Standard_OVERRIDE;
74   
75   //! Defines the direction of the light source.
76   //! If the normal vector is NULL.
77   Standard_EXPORT void SetDirection (const Quantity_Parameter Vx, const Quantity_Parameter Vy, const Quantity_Parameter Vz);
78   
79   //! Defines the direction of the light source
80   //! according to a predefined directional vector.
81   Standard_EXPORT void SetDirection (const V3d_TypeOfOrientation Orientation);
82   
83   //! Defines the coefficients of attenuation.
84   //! Warning! raises BadValue from V3d
85   //! if one of the coefficient is <0 ou >1 .
86   Standard_EXPORT void SetAttenuation (const Quantity_Coefficient A1, const Quantity_Coefficient A2);
87   
88   //! Defines the coefficient of concentration.
89   //! if the coefficient is <0 ou >1 .
90   Standard_EXPORT void SetConcentration (const Quantity_Coefficient C);
91   
92   //! Defines the spot angle in RADIANS.
93   //! Warning: raises BadValue from from V3d
94   //! If the angle is <= 0 ou > PI .
95   Standard_EXPORT void SetAngle (const Quantity_PlaneAngle Angle);
96   
97   //! Display the graphic structure of light source
98   //! in the choosen view. We have three type of representation
99   //! - SIMPLE   : Only the light source is displayed.
100   //! - PARTIAL  : The light source and the light space are
101   //! displayed.
102   //! - COMPLETE : The light source, the light space and the
103   //! radius of light space are displayed.
104   //! We can choose the "SAMELAST" as parameter of representation
105   //! In this case the graphic structure representation will be
106   //! the last displayed.
107   Standard_EXPORT void Display (const Handle(V3d_View)& aView, const V3d_TypeOfRepresentation Representation) Standard_OVERRIDE;
108   
109   //! Returns the direction of the light source defined by Vx,Vy,Vz.
110   Standard_EXPORT void Direction (Quantity_Parameter& Vx, Quantity_Parameter& Vy, Quantity_Parameter& Vz) const;
111   
112   //! Returns the position of the light source.
113   Standard_EXPORT void Position (V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z) const Standard_OVERRIDE;
114   
115   //! Returns the attenuation factors A1,A2 of the light source.
116   Standard_EXPORT void Attenuation (Quantity_Coefficient& A1, Quantity_Coefficient& A2) const;
117   
118   Standard_EXPORT Quantity_Coefficient Concentration() const;
119   
120   //! Returns the spot angle.
121   Standard_EXPORT Quantity_PlaneAngle Angle() const;
122
123
124
125
126   DEFINE_STANDARD_RTTI(V3d_SpotLight,V3d_PositionLight)
127
128 protected:
129
130
131
132
133 private:
134
135   
136   //! Defines the representation of the spot light source.
137   Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& gsymbol, const Handle(V3d_View)& aView) const Standard_OVERRIDE;
138
139
140
141 };
142
143
144
145
146
147
148
149 #endif // _V3d_SpotLight_HeaderFile