42cf5bc1 |
1 | // Created on: 1992-01-17 |
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_Light_HeaderFile |
18 | #define _V3d_Light_HeaderFile |
19 | |
c357e426 |
20 | #include <Graphic3d_CLight.hxx> |
21 | #include <Graphic3d_Vertex.hxx> |
42cf5bc1 |
22 | #include <MMgt_TShared.hxx> |
87432b82 |
23 | #include <Quantity_Color.hxx> |
c357e426 |
24 | #include <Standard.hxx> |
42cf5bc1 |
25 | #include <Standard_Boolean.hxx> |
26 | #include <Standard_Real.hxx> |
c357e426 |
27 | #include <Standard_Type.hxx> |
c357e426 |
28 | #include <V3d_TypeOfLight.hxx> |
29 | #include <V3d_View.hxx> |
30 | |
42cf5bc1 |
31 | class Graphic3d_Structure; |
c357e426 |
32 | class V3d_Viewer; |
42cf5bc1 |
33 | |
34 | class V3d_Light; |
35 | DEFINE_STANDARD_HANDLE(V3d_Light, MMgt_TShared) |
36 | |
37 | //! Defines services on Light type objects.. |
38 | //! (base class for AmbientLight and PositionLight) |
39 | class V3d_Light : public MMgt_TShared |
40 | { |
42cf5bc1 |
41 | public: |
42 | |
c357e426 |
43 | //! Defines the color of a light source by giving the basic color. |
44 | Standard_EXPORT void SetColor (const Quantity_Color& theColor); |
45 | |
c357e426 |
46 | //! Returns the color of the light source. |
87432b82 |
47 | Quantity_Color Color() const { return Quantity_Color (myLight.Color.rgb()); } |
c357e426 |
48 | |
42cf5bc1 |
49 | //! Returns the Type of the Light |
50 | Standard_EXPORT V3d_TypeOfLight Type() const; |
c357e426 |
51 | |
42cf5bc1 |
52 | //! returns true if the light is a headlight |
53 | Standard_EXPORT Standard_Boolean Headlight() const; |
c357e426 |
54 | |
42cf5bc1 |
55 | //! Setup headlight flag. |
56 | Standard_EXPORT void SetHeadlight (const Standard_Boolean theValue); |
c357e426 |
57 | |
42cf5bc1 |
58 | //! Modifies the intensity of light source. |
59 | Standard_EXPORT void SetIntensity (const Standard_Real theValue); |
c357e426 |
60 | |
42cf5bc1 |
61 | //! returns the intensity of light source |
62 | Standard_EXPORT Standard_Real Intensity() const; |
c357e426 |
63 | |
42cf5bc1 |
64 | //! returns the smoothness of light source |
65 | Standard_EXPORT Standard_Real Smoothness() const; |
c357e426 |
66 | |
42cf5bc1 |
67 | //! Returns TRUE when a light representation is displayed |
68 | Standard_EXPORT Standard_Boolean IsDisplayed() const; |
69 | |
c357e426 |
70 | friend |
71 | //! Updates the lights of the view. The view is redrawn. |
72 | Standard_EXPORT void V3d_View::UpdateLights() const; |
42cf5bc1 |
73 | |
92efcf78 |
74 | DEFINE_STANDARD_RTTIEXT(V3d_Light,MMgt_TShared) |
42cf5bc1 |
75 | |
76 | protected: |
77 | |
c357e426 |
78 | Standard_EXPORT V3d_Light (const Handle(V3d_Viewer)& theViewer); |
79 | |
80 | //! Sets type of the light. |
81 | Standard_EXPORT void SetType (const V3d_TypeOfLight theType); |
82 | |
42cf5bc1 |
83 | //! Returns the symetric point coordinates of "aPoint" |
84 | //! on the sphere of center "Center" and radius "Radius". |
85 | //! VX,VY,VZ is the project vector of view. |
ee2be2a8 |
86 | Standard_EXPORT static void SymetricPointOnSphere (const Handle(V3d_View)& aView, |
87 | const Graphic3d_Vertex& Center, |
88 | const Graphic3d_Vertex& aPoint, |
89 | const Standard_Real Radius, |
90 | Standard_Real& X, Standard_Real& Y, Standard_Real& Z, |
91 | Standard_Real& VX, Standard_Real& VY, Standard_Real& VZ); |
42cf5bc1 |
92 | |
c357e426 |
93 | protected: |
42cf5bc1 |
94 | |
c357e426 |
95 | //! Return light properties associated to this light source. |
96 | //! Hidden method exposed only to V3d_View. |
97 | Standard_EXPORT const Graphic3d_CLight& Light() const { return myLight; } |
42cf5bc1 |
98 | |
c357e426 |
99 | protected: |
42cf5bc1 |
100 | |
c357e426 |
101 | Graphic3d_CLight myLight; |
102 | Handle(Graphic3d_Structure) myGraphicStructure; |
103 | Handle(Graphic3d_Structure) myGraphicStructure1; |
42cf5bc1 |
104 | }; |
105 | |
42cf5bc1 |
106 | #endif // _V3d_Light_HeaderFile |