0026936: Drawbacks of inlining in new type system in OCCT 7.0 -- 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 <V3d_PositionLight.hxx>
21 #include <V3d_TypeOfOrientation.hxx>
22
23 class V3d_Viewer;
24 class V3d_SpotLight;
25 DEFINE_STANDARD_HANDLE(V3d_SpotLight, V3d_PositionLight)
26
27 //! Creation and modification of a spot.
28 class V3d_SpotLight : public V3d_PositionLight
29 {
30 public:
31
32   //! Creates a light source of the Spot type in the viewer.
33   //! The attenuation factor F which determines
34   //! the illumination of a surface depends on the following formula :
35   //! F = 1/(theConstAttenuation + theLinearAttenuation*Length)
36   //! Length is the distance from the source to the surface.
37   //! The default values (1.0,0.0) correspond to a minimum
38   //! of attenuation.
39   //! The concentration factor determines the dispersion
40   //! of the light on the surface, the default value
41   //! (1.0) corresponds to a minimum of dispersion.
42   //! Warning! raises BadValue from V3d  -
43   //! If one of the coefficients is not between 0 and 1.
44   //! If the lighting angle is <= 0 or > PI.
45   Standard_EXPORT V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
46                                  const V3d_Coordinate theX,
47                                  const V3d_Coordinate theY,
48                                  const V3d_Coordinate theZ,
49                                  const V3d_TypeOfOrientation theDirection = V3d_XnegYnegZpos,
50                                  const Quantity_NameOfColor theColor = Quantity_NOC_WHITE,
51                                  const Quantity_Coefficient theConstAttenuation = 1.0,
52                                  const Quantity_Coefficient theLinearAttenuation = 0.0,
53                                  const Quantity_Coefficient theConcentration = 1.0,
54                                  const Quantity_PlaneAngle theAngle = 0.523599);
55   
56   //! Creates a light source of the Spot type in the viewer.
57   //! theXt, theYt, theZt : Coordinate of light source Target.
58   //! theXp, theYp, theZp : Coordinate of light source Position.
59   //! The others parameters describe before.
60   //! Warning! raises BadValue from V3d  -
61   //! If one of the coefficients is not between 0 and 1.
62   //! If the lighting angle is <= 0 or > PI.
63   Standard_EXPORT V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
64                                  const V3d_Coordinate theXt,
65                                  const V3d_Coordinate theYt,
66                                  const V3d_Coordinate theZt,
67                                  const V3d_Coordinate theXp,
68                                  const V3d_Coordinate theYp,
69                                  const V3d_Coordinate theZp,
70                                  const Quantity_NameOfColor theColor = Quantity_NOC_WHITE,
71                                  const Quantity_Coefficient theConstAttenuation = 1.0,
72                                  const Quantity_Coefficient theLinearAttenuation = 0.0,
73                                  const Quantity_Coefficient theConcentration = 1.0,
74                                  const Quantity_PlaneAngle theAngle = 0.523599);
75
76   //! Defines the position of the light source.
77   Standard_EXPORT virtual void SetPosition (const V3d_Coordinate theX,
78                                             const V3d_Coordinate theY,
79                                             const V3d_Coordinate theZ) Standard_OVERRIDE;
80
81   //! Defines the direction of the light source.
82   //! If the normal vector is NULL.
83   Standard_EXPORT void SetDirection (const Quantity_Parameter theVx,
84                                      const Quantity_Parameter theVy,
85                                      const Quantity_Parameter theVz);
86
87   //! Defines the direction of the light source
88   //! according to a predefined directional vector.
89   Standard_EXPORT void SetDirection (const V3d_TypeOfOrientation theOrientation);
90
91   //! Defines the coefficients of attenuation.
92   //! Warning! raises BadValue from V3d
93   //! if one of the coefficient is < 0 or > 1.
94   Standard_EXPORT void SetAttenuation (const Quantity_Coefficient theConstAttenuation,
95                                        const Quantity_Coefficient theLinearAttenuation);
96
97   //! Defines the coefficient of concentration.
98   //! if the coefficient is < 0 or > 1.
99   Standard_EXPORT void SetConcentration (const Quantity_Coefficient theConcentration);
100
101   //! Defines the spot angle in RADIANS.
102   //! Warning: raises BadValue from from V3d
103   //! If the angle is <= 0 or > PI.
104   Standard_EXPORT void SetAngle (const Quantity_PlaneAngle theAngle);
105
106   //! Display the graphic structure of light source
107   //! in the chosen view. We have three type of representation
108   //! - SIMPLE   : Only the light source is displayed.
109   //! - PARTIAL  : The light source and the light space are
110   //! displayed.
111   //! - COMPLETE : The light source, the light space and the
112   //! radius of light space are displayed.
113   //! We can choose the "SAMELAST" as parameter of representation
114   //! In this case the graphic structure representation will be
115   //! the last displayed.
116   Standard_EXPORT void Display (const Handle(V3d_View)& theView,
117                                 const V3d_TypeOfRepresentation theRepresentation) Standard_OVERRIDE;
118
119   //! Returns the direction of the light source defined by theVx, theVy, theVz.
120   Standard_EXPORT void Direction (Quantity_Parameter& theVx,
121                                   Quantity_Parameter& theVy,
122                                   Quantity_Parameter& theVz) const;
123
124   //! Returns the position of the light source.
125   Standard_EXPORT void Position (V3d_Coordinate& theX,
126                                  V3d_Coordinate& theY,
127                                  V3d_Coordinate& theZ) const Standard_OVERRIDE;
128
129   //! Returns the attenuation factors A1,A2 of the light source.
130   Standard_EXPORT void Attenuation (Quantity_Coefficient& theConstAttentuation,
131                                     Quantity_Coefficient& theLinearAttentuation) const;
132
133   Standard_EXPORT Quantity_Coefficient Concentration() const;
134
135   //! Returns the spot angle.
136   Standard_EXPORT Quantity_PlaneAngle Angle() const;
137
138   DEFINE_STANDARD_RTTIEXT(V3d_SpotLight,V3d_PositionLight)
139
140 private:
141
142   //! Defines the representation of the spot light source.
143   Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& theSymbol,
144                                const Handle(V3d_View)& theView) const Standard_OVERRIDE;
145 };
146
147 #endif // _V3d_SpotLight_HeaderFile