| 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 | |
| 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> |
| 32 | |
| 33 | class Graphic3d_Structure; |
| 34 | class V3d_Viewer; |
| 35 | |
| 36 | class V3d_Light; |
| 37 | DEFINE_STANDARD_HANDLE(V3d_Light, MMgt_TShared) |
| 38 | |
| 39 | //! Defines services on Light type objects.. |
| 40 | //! (base class for AmbientLight and PositionLight) |
| 41 | class V3d_Light : public MMgt_TShared |
| 42 | { |
| 43 | public: |
| 44 | |
| 45 | //! Defines the color of a light source by giving the basic color. |
| 46 | Standard_EXPORT void SetColor (const Quantity_Color& theColor); |
| 47 | |
| 48 | //! Returns the color of the light source. |
| 49 | Quantity_Color Color() const { return Quantity_Color (myLight.Color.rgb()); } |
| 50 | |
| 51 | //! Returns the Type of the Light |
| 52 | Standard_EXPORT V3d_TypeOfLight Type() const; |
| 53 | |
| 54 | //! returns true if the light is a headlight |
| 55 | Standard_EXPORT Standard_Boolean Headlight() const; |
| 56 | |
| 57 | //! Setup headlight flag. |
| 58 | Standard_EXPORT void SetHeadlight (const Standard_Boolean theValue); |
| 59 | |
| 60 | //! Modifies the intensity of light source. |
| 61 | Standard_EXPORT void SetIntensity (const Standard_Real theValue); |
| 62 | |
| 63 | //! returns the intensity of light source |
| 64 | Standard_EXPORT Standard_Real Intensity() const; |
| 65 | |
| 66 | //! returns the smoothness of light source |
| 67 | Standard_EXPORT Standard_Real Smoothness() const; |
| 68 | |
| 69 | //! Returns TRUE when a light representation is displayed |
| 70 | Standard_EXPORT Standard_Boolean IsDisplayed() const; |
| 71 | |
| 72 | friend |
| 73 | //! Updates the lights of the view. The view is redrawn. |
| 74 | Standard_EXPORT void V3d_View::UpdateLights() const; |
| 75 | |
| 76 | DEFINE_STANDARD_RTTIEXT(V3d_Light,MMgt_TShared) |
| 77 | |
| 78 | protected: |
| 79 | |
| 80 | Standard_EXPORT V3d_Light (const Handle(V3d_Viewer)& theViewer); |
| 81 | |
| 82 | //! Sets type of the light. |
| 83 | Standard_EXPORT void SetType (const V3d_TypeOfLight theType); |
| 84 | |
| 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); |
| 89 | |
| 90 | protected: |
| 91 | |
| 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; } |
| 95 | |
| 96 | protected: |
| 97 | |
| 98 | Graphic3d_CLight myLight; |
| 99 | Handle(Graphic3d_Structure) myGraphicStructure; |
| 100 | Handle(Graphic3d_Structure) myGraphicStructure1; |
| 101 | }; |
| 102 | |
| 103 | #endif // _V3d_Light_HeaderFile |