0030364: Visualization, TKOpenGl - allow initializing a Surface-less EGL context
[occt.git] / src / V3d / V3d_DirectionalLight.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_DirectionalLight.hxx>
15
16 #include <V3d.hxx>
17
18 IMPLEMENT_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight)
19
20 // =======================================================================
21 // function : V3d_DirectionalLight
22 // purpose  :
23 // =======================================================================
24 V3d_DirectionalLight::V3d_DirectionalLight (const V3d_TypeOfOrientation theDirection,
25                                             const Quantity_Color& theColor,
26                                             const Standard_Boolean theIsHeadlight)
27 : V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, Handle(V3d_Viewer)())
28 {
29   SetColor (theColor);
30   SetHeadlight (theIsHeadlight);
31   SetDirection (V3d::GetProjAxis (theDirection));
32 }
33
34 // =======================================================================
35 // function : V3d_DirectionalLight
36 // purpose  :
37 // =======================================================================
38 V3d_DirectionalLight::V3d_DirectionalLight (const gp_Dir& theDirection,
39                                             const Quantity_Color& theColor,
40                                             const Standard_Boolean theIsHeadlight)
41 : V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, Handle(V3d_Viewer)())
42 {
43   SetColor (theColor);
44   SetHeadlight (theIsHeadlight);
45   SetDirection (theDirection);
46 }
47
48 // =======================================================================
49 // function : V3d_DirectionalLight
50 // purpose  :
51 // =======================================================================
52 V3d_DirectionalLight::V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
53                                             const V3d_TypeOfOrientation theDirection,
54                                             const Quantity_Color& theColor,
55                                             const Standard_Boolean theIsHeadlight)
56 : V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, theViewer)
57 {
58   SetColor (theColor);
59   SetHeadlight (theIsHeadlight);
60   SetDirection (V3d::GetProjAxis (theDirection));
61 }
62
63 // =======================================================================
64 // function : V3d_DirectionalLight
65 // purpose  :
66 // =======================================================================
67 V3d_DirectionalLight::V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer,
68                                             const Standard_Real theXt,
69                                             const Standard_Real theYt,
70                                             const Standard_Real theZt,
71                                             const Standard_Real theXp,
72                                             const Standard_Real theYp,
73                                             const Standard_Real theZp,
74                                             const Quantity_Color& theColor,
75                                             const Standard_Boolean theIsHeadlight)
76 : V3d_PositionLight (Graphic3d_TOLS_DIRECTIONAL, theViewer)
77 {
78   SetColor (theColor);
79   SetHeadlight (theIsHeadlight);
80   SetDirection (gp_Dir (gp_XYZ (theXt, theYt, theZt) - gp_XYZ(theXp, theYp, theZp)));
81 }
82
83 // =======================================================================
84 // function : SetDirection
85 // purpose  :
86 // =======================================================================
87 void V3d_DirectionalLight::SetDirection (V3d_TypeOfOrientation theDirection)
88 {
89   SetDirection (V3d::GetProjAxis (theDirection));
90 }