1 // Created on: 1992-01-17
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
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.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _V3d_Light_HeaderFile
18 #define _V3d_Light_HeaderFile
20 #include <Graphic3d_CLight.hxx>
21 #include <Graphic3d_Vertex.hxx>
22 #include <MMgt_TShared.hxx>
23 #include <Quantity_NameOfColor.hxx>
24 #include <Quantity_Parameter.hxx>
25 #include <Quantity_TypeOfColor.hxx>
26 #include <Standard.hxx>
27 #include <Standard_Boolean.hxx>
28 #include <Standard_Real.hxx>
29 #include <Standard_Type.hxx>
30 #include <V3d_Coordinate.hxx>
31 #include <V3d_TypeOfLight.hxx>
32 #include <V3d_View.hxx>
34 class Graphic3d_Structure;
39 DEFINE_STANDARD_HANDLE(V3d_Light, MMgt_TShared)
41 //! Defines services on Light type objects..
42 //! (base class for AmbientLight and PositionLight)
43 class V3d_Light : public MMgt_TShared
47 //! Defines the color of a light source according to the type of color
48 //! definition and the three corresponding values.
49 Standard_EXPORT void SetColor (const Quantity_TypeOfColor theType,
50 const Quantity_Parameter theValue1,
51 const Quantity_Parameter theValue2,
52 const Quantity_Parameter theValue3);
54 //! Defines the color of a light source by giving
55 //! the name of the color in the form Quantity_NOC_xxxx.
56 Standard_EXPORT void SetColor (const Quantity_NameOfColor theName);
58 //! Defines the color of a light source by giving the basic color.
59 Standard_EXPORT void SetColor (const Quantity_Color& theColor);
61 //! Returns the color of the light source depending of the color type.
62 Standard_EXPORT void Color (const Quantity_TypeOfColor theType,
63 Quantity_Parameter& theValue1,
64 Quantity_Parameter& theValue2,
65 Quantity_Parameter& theValue3) const;
67 //! Returns the color of the light source.
68 Standard_EXPORT void Color (Quantity_NameOfColor& theName) const;
70 //! Returns the color of the light source.
71 Standard_EXPORT Quantity_Color Color() const;
73 //! Returns the Type of the Light
74 Standard_EXPORT V3d_TypeOfLight Type() const;
76 //! returns true if the light is a headlight
77 Standard_EXPORT Standard_Boolean Headlight() const;
79 //! Setup headlight flag.
80 Standard_EXPORT void SetHeadlight (const Standard_Boolean theValue);
82 //! Modifies the intensity of light source.
83 Standard_EXPORT void SetIntensity (const Standard_Real theValue);
85 //! returns the intensity of light source
86 Standard_EXPORT Standard_Real Intensity() const;
88 //! returns the smoothness of light source
89 Standard_EXPORT Standard_Real Smoothness() const;
91 //! Returns TRUE when a light representation is displayed
92 Standard_EXPORT Standard_Boolean IsDisplayed() const;
95 //! Updates the lights of the view. The view is redrawn.
96 Standard_EXPORT void V3d_View::UpdateLights() const;
98 DEFINE_STANDARD_RTTIEXT(V3d_Light,MMgt_TShared)
102 Standard_EXPORT V3d_Light (const Handle(V3d_Viewer)& theViewer);
104 //! Sets type of the light.
105 Standard_EXPORT void SetType (const V3d_TypeOfLight theType);
107 //! Returns the symetric point coordinates of "aPoint"
108 //! on the sphere of center "Center" and radius "Radius".
109 //! VX,VY,VZ is the project vector of view.
110 Standard_EXPORT static void SymetricPointOnSphere (const Handle(V3d_View)& aView, const Graphic3d_Vertex& Center, const Graphic3d_Vertex& aPoint, const Quantity_Parameter Radius, V3d_Coordinate& X, V3d_Coordinate& Y, V3d_Coordinate& Z, Quantity_Parameter& VX, Quantity_Parameter& VY, Quantity_Parameter& VZ);
114 //! Return light properties associated to this light source.
115 //! Hidden method exposed only to V3d_View.
116 Standard_EXPORT const Graphic3d_CLight& Light() const { return myLight; }
120 Graphic3d_CLight myLight;
121 Handle(Graphic3d_Structure) myGraphicStructure;
122 Handle(Graphic3d_Structure) myGraphicStructure1;
125 #endif // _V3d_Light_HeaderFile