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