0029395: Visualization, V3d_View - Grid disappears forever after enabling RayTracing
[occt.git] / src / V3d / V3d_SpotLight.cxx
1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14 #include <V3d_SpotLight.hxx>
15
16 #include <V3d.hxx>
17
18 IMPLEMENT_STANDARD_RTTIEXT(V3d_SpotLight,V3d_PositionLight)
19
20 // =======================================================================
21 // function : V3d_SpotLight
22 // purpose  :
23 // =======================================================================
24 V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
25                               const V3d_TypeOfOrientation theDirection,
26                               const Quantity_Color& theColor)
27 : V3d_PositionLight (Graphic3d_TOLS_SPOT, Handle(V3d_Viewer)())
28 {
29   SetColor (theColor);
30   SetPosition (thePos);
31   SetDirection (V3d::GetProjAxis (theDirection));
32 }
33
34 // =======================================================================
35 // function : V3d_SpotLight
36 // purpose  :
37 // =======================================================================
38 V3d_SpotLight::V3d_SpotLight (const gp_Pnt& thePos,
39                               const gp_Dir& theDirection,
40                               const Quantity_Color& theColor)
41 : V3d_PositionLight (Graphic3d_TOLS_SPOT, Handle(V3d_Viewer)())
42 {
43   SetColor (theColor);
44   SetPosition (thePos);
45   SetDirection (theDirection);
46 }
47
48 // =======================================================================
49 // function : V3d_SpotLight
50 // purpose  :
51 // =======================================================================
52 V3d_SpotLight::V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
53                               const Standard_Real theX,
54                               const Standard_Real theY,
55                               const Standard_Real theZ,
56                               const V3d_TypeOfOrientation theDirection,
57                               const Quantity_Color& theColor,
58                               const Standard_Real theConstAttenuation,
59                               const Standard_Real theLinearAttenuation,
60                               const Standard_Real theConcentration,
61                               const Standard_Real theAngle)
62 : V3d_PositionLight (Graphic3d_TOLS_SPOT, theViewer)
63 {
64   SetColor (theColor);
65   SetPosition (theX, theY, theZ);
66   SetDirection (V3d::GetProjAxis (theDirection));
67   SetAttenuation ((float )theConstAttenuation, (float )theLinearAttenuation);
68   SetConcentration ((float )theConcentration);
69   SetAngle ((float )theAngle);
70 }
71
72 // =======================================================================
73 // function : V3d_SpotLight
74 // purpose  :
75 // =======================================================================
76 V3d_SpotLight::V3d_SpotLight (const Handle(V3d_Viewer)& theViewer,
77                               const Standard_Real theXt,
78                               const Standard_Real theYt,
79                               const Standard_Real theZt,
80                               const Standard_Real theXp,
81                               const Standard_Real theYp,
82                               const Standard_Real theZp,
83                               const Quantity_Color& theColor,
84                               const Standard_Real theConstAttenuation,
85                               const Standard_Real theLinearAttenuation,
86                               const Standard_Real theConcentration,
87                               const Standard_Real theAngle)
88 : V3d_PositionLight (Graphic3d_TOLS_SPOT, theViewer)
89 {
90   SetColor (theColor);
91   SetPosition (theXp, theYp, theZp);
92   SetDirection (theXt - theXp, theYt - theYp, theZt - theZp);
93   SetAttenuation ((float )theConstAttenuation, (float )theLinearAttenuation);
94   SetConcentration ((float )theConcentration);
95   SetAngle ((float )theAngle);
96 }
97
98 // =======================================================================
99 // function : SetDirection
100 // purpose  :
101 // =======================================================================
102 void V3d_SpotLight::SetDirection (V3d_TypeOfOrientation theDirection)
103 {
104   SetDirection (V3d::GetProjAxis (theDirection));
105 }