0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / V3d / V3d_Light.hxx
CommitLineData
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 <Quantity_Parameter.hxx>
c357e426 25#include <Standard.hxx>
42cf5bc1 26#include <Standard_Boolean.hxx>
27#include <Standard_Real.hxx>
c357e426 28#include <Standard_Type.hxx>
42cf5bc1 29#include <V3d_Coordinate.hxx>
c357e426 30#include <V3d_TypeOfLight.hxx>
31#include <V3d_View.hxx>
32
42cf5bc1 33class Graphic3d_Structure;
c357e426 34class V3d_Viewer;
42cf5bc1 35
36class V3d_Light;
37DEFINE_STANDARD_HANDLE(V3d_Light, MMgt_TShared)
38
39//! Defines services on Light type objects..
40//! (base class for AmbientLight and PositionLight)
41class V3d_Light : public MMgt_TShared
42{
42cf5bc1 43public:
44
c357e426 45 //! Defines the color of a light source by giving the basic color.
46 Standard_EXPORT void SetColor (const Quantity_Color& theColor);
47
c357e426 48 //! Returns the color of the light source.
87432b82 49 Quantity_Color Color() const { return Quantity_Color (myLight.Color.rgb()); }
c357e426 50
42cf5bc1 51 //! Returns the Type of the Light
52 Standard_EXPORT V3d_TypeOfLight Type() const;
c357e426 53
42cf5bc1 54 //! returns true if the light is a headlight
55 Standard_EXPORT Standard_Boolean Headlight() const;
c357e426 56
42cf5bc1 57 //! Setup headlight flag.
58 Standard_EXPORT void SetHeadlight (const Standard_Boolean theValue);
c357e426 59
42cf5bc1 60 //! Modifies the intensity of light source.
61 Standard_EXPORT void SetIntensity (const Standard_Real theValue);
c357e426 62
42cf5bc1 63 //! returns the intensity of light source
64 Standard_EXPORT Standard_Real Intensity() const;
c357e426 65
42cf5bc1 66 //! returns the smoothness of light source
67 Standard_EXPORT Standard_Real Smoothness() const;
c357e426 68
42cf5bc1 69 //! Returns TRUE when a light representation is displayed
70 Standard_EXPORT Standard_Boolean IsDisplayed() const;
71
c357e426 72friend
73 //! Updates the lights of the view. The view is redrawn.
74 Standard_EXPORT void V3d_View::UpdateLights() const;
42cf5bc1 75
92efcf78 76 DEFINE_STANDARD_RTTIEXT(V3d_Light,MMgt_TShared)
42cf5bc1 77
78protected:
79
c357e426 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
42cf5bc1 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
c357e426 90protected:
42cf5bc1 91
c357e426 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; }
42cf5bc1 95
c357e426 96protected:
42cf5bc1 97
c357e426 98 Graphic3d_CLight myLight;
99 Handle(Graphic3d_Structure) myGraphicStructure;
100 Handle(Graphic3d_Structure) myGraphicStructure1;
42cf5bc1 101};
102
42cf5bc1 103#endif // _V3d_Light_HeaderFile