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_Color.hxx>
24 #include <Quantity_Parameter.hxx>
25 #include <Standard.hxx>
26 #include <Standard_Boolean.hxx>
27 #include <Standard_Real.hxx>
28 #include <Standard_Type.hxx>
29 #include <V3d_Coordinate.hxx>
30 #include <V3d_TypeOfLight.hxx>
31 #include <V3d_View.hxx>
33 class Graphic3d_Structure;
37 DEFINE_STANDARD_HANDLE(V3d_Light, MMgt_TShared)
39 //! Defines services on Light type objects..
40 //! (base class for AmbientLight and PositionLight)
41 class V3d_Light : public MMgt_TShared
45 //! Defines the color of a light source by giving the basic color.
46 Standard_EXPORT void SetColor (const Quantity_Color& theColor);
48 //! Returns the color of the light source.
49 Quantity_Color Color() const { return Quantity_Color (myLight.Color.rgb()); }
51 //! Returns the Type of the Light
52 Standard_EXPORT V3d_TypeOfLight Type() const;
54 //! returns true if the light is a headlight
55 Standard_EXPORT Standard_Boolean Headlight() const;
57 //! Setup headlight flag.
58 Standard_EXPORT void SetHeadlight (const Standard_Boolean theValue);
60 //! Modifies the intensity of light source.
61 Standard_EXPORT void SetIntensity (const Standard_Real theValue);
63 //! returns the intensity of light source
64 Standard_EXPORT Standard_Real Intensity() const;
66 //! returns the smoothness of light source
67 Standard_EXPORT Standard_Real Smoothness() const;
69 //! Returns TRUE when a light representation is displayed
70 Standard_EXPORT Standard_Boolean IsDisplayed() const;
73 //! Updates the lights of the view. The view is redrawn.
74 Standard_EXPORT void V3d_View::UpdateLights() const;
76 DEFINE_STANDARD_RTTIEXT(V3d_Light,MMgt_TShared)
80 Standard_EXPORT V3d_Light (const Handle(V3d_Viewer)& theViewer);
82 //! Sets type of the light.
83 Standard_EXPORT void SetType (const V3d_TypeOfLight theType);
85 //! Returns the symetric point coordinates of "aPoint"
86 //! on the sphere of center "Center" and radius "Radius".
87 //! VX,VY,VZ is the project vector of view.
88 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);
92 //! Return light properties associated to this light source.
93 //! Hidden method exposed only to V3d_View.
94 Standard_EXPORT const Graphic3d_CLight& Light() const { return myLight; }
98 Graphic3d_CLight myLight;
99 Handle(Graphic3d_Structure) myGraphicStructure;
100 Handle(Graphic3d_Structure) myGraphicStructure1;
103 #endif // _V3d_Light_HeaderFile