42cf5bc1 |
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_DirectionalLight_HeaderFile |
18 | #define _V3d_DirectionalLight_HeaderFile |
19 | |
42cf5bc1 |
20 | #include <V3d_PositionLight.hxx> |
21 | #include <V3d_TypeOfOrientation.hxx> |
42cf5bc1 |
22 | |
c357e426 |
23 | class V3d_Viewer; |
42cf5bc1 |
24 | class V3d_DirectionalLight; |
25 | DEFINE_STANDARD_HANDLE(V3d_DirectionalLight, V3d_PositionLight) |
26 | |
c357e426 |
27 | //! Directional light source for a viewer. |
42cf5bc1 |
28 | class V3d_DirectionalLight : public V3d_PositionLight |
29 | { |
42cf5bc1 |
30 | public: |
31 | |
42cf5bc1 |
32 | //! Creates a directional light source in the viewer. |
c357e426 |
33 | Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer, |
34 | const V3d_TypeOfOrientation theDirection = V3d_XposYposZpos, |
35 | const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, |
36 | const Standard_Boolean theIsHeadlight = Standard_False); |
37 | |
42cf5bc1 |
38 | //! Creates a directional light source in the viewer. |
c357e426 |
39 | //! theXt, theYt, theZt : Coordinate of light source Target. |
40 | //! theXp, theYp, theZp : Coordinate of light source Position. |
42cf5bc1 |
41 | //! The others parameters describe before. |
c357e426 |
42 | Standard_EXPORT V3d_DirectionalLight (const Handle(V3d_Viewer)& theViewer, |
43 | const V3d_Coordinate theXt, |
44 | const V3d_Coordinate theYt, |
45 | const V3d_Coordinate theZt, |
46 | const V3d_Coordinate theXp, |
47 | const V3d_Coordinate theYp, |
48 | const V3d_Coordinate theZp, |
49 | const Quantity_NameOfColor theColor = Quantity_NOC_WHITE, |
50 | const Standard_Boolean theIsHeadlight = Standard_False); |
51 | |
52 | //! Defines the direction of the light source by a predefined orientation. |
53 | Standard_EXPORT void SetDirection (const V3d_TypeOfOrientation theDirection); |
54 | |
55 | //! Defines the direction of the light source by the predefined vector theXm, theYm, theZm. |
42cf5bc1 |
56 | //! Warning: raises BadValue from V3d if the vector is null. |
c357e426 |
57 | Standard_EXPORT void SetDirection (const Quantity_Parameter theXm, |
58 | const Quantity_Parameter theYm, |
59 | const Quantity_Parameter theZm); |
60 | |
42cf5bc1 |
61 | //! Defines the point of light source representation. |
c357e426 |
62 | Standard_EXPORT void SetDisplayPosition (const V3d_Coordinate theX, |
63 | const V3d_Coordinate theY, |
64 | const V3d_Coordinate theZ); |
65 | |
42cf5bc1 |
66 | //! Calls SetDisplayPosition method. |
c357e426 |
67 | Standard_EXPORT virtual void SetPosition (const V3d_Coordinate theXp, |
68 | const V3d_Coordinate theYp, |
69 | const V3d_Coordinate theZp) Standard_OVERRIDE; |
70 | |
42cf5bc1 |
71 | //! Modifies the smoothing angle (in radians) |
72 | Standard_EXPORT void SetSmoothAngle (const Standard_Real theValue); |
c357e426 |
73 | |
42cf5bc1 |
74 | //! Display the graphic structure of light source |
c357e426 |
75 | //! in the chosen view. We have three type of representation |
42cf5bc1 |
76 | //! - SIMPLE : Only the light source is displayed. |
77 | //! - PARTIAL : The light source and the light space are |
78 | //! displayed. |
79 | //! - COMPLETE : The same representation as PARTIAL. |
80 | //! We can choose the "SAMELAST" as parameter of representation |
81 | //! In this case the graphic structure representation will be |
82 | //! the last displayed. |
c357e426 |
83 | Standard_EXPORT void Display (const Handle(V3d_View)& theView, |
84 | const V3d_TypeOfRepresentation theRepresentation) Standard_OVERRIDE; |
42cf5bc1 |
85 | |
c357e426 |
86 | //! Calls DisplayPosition method. |
87 | Standard_EXPORT virtual void Position (V3d_Coordinate& theX, |
88 | V3d_Coordinate& theY, |
89 | V3d_Coordinate& theZ) const Standard_OVERRIDE; |
42cf5bc1 |
90 | |
c357e426 |
91 | //! Returns the chosen position to represent the light source. |
92 | Standard_EXPORT void DisplayPosition (V3d_Coordinate& theX, |
93 | V3d_Coordinate& theY, |
94 | V3d_Coordinate& theZ) const; |
42cf5bc1 |
95 | |
c357e426 |
96 | //! Returns the theVx, theVy, theVz direction of the light source. |
97 | Standard_EXPORT void Direction (Quantity_Parameter& theVx, |
98 | Quantity_Parameter& theVy, |
99 | Quantity_Parameter& theVz) const; |
42cf5bc1 |
100 | |
92efcf78 |
101 | DEFINE_STANDARD_RTTIEXT(V3d_DirectionalLight,V3d_PositionLight) |
42cf5bc1 |
102 | |
42cf5bc1 |
103 | private: |
104 | |
42cf5bc1 |
105 | //! Defines the representation of the directional light source. |
c357e426 |
106 | Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& theSymbol, |
107 | const Handle(V3d_View)& theView) const Standard_OVERRIDE; |
42cf5bc1 |
108 | |
c357e426 |
109 | private: |
42cf5bc1 |
110 | |
c357e426 |
111 | Graphic3d_Vertex myDisplayPosition; |
42cf5bc1 |
112 | }; |
113 | |
42cf5bc1 |
114 | #endif // _V3d_DirectionalLight_HeaderFile |