0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / V3d / V3d_PositionalLight.hxx
CommitLineData
42cf5bc1 1// Created on: 1992-01-22
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_PositionalLight_HeaderFile
18#define _V3d_PositionalLight_HeaderFile
19
42cf5bc1 20#include <Quantity_Coefficient.hxx>
c357e426 21#include <V3d_PositionLight.hxx>
42cf5bc1 22
23class V3d_PositionalLight;
24DEFINE_STANDARD_HANDLE(V3d_PositionalLight, V3d_PositionLight)
25
26//! Creation and modification of an isolated
27//! (positional) light source.
28class V3d_PositionalLight : public V3d_PositionLight
29{
42cf5bc1 30public:
31
c357e426 32 //! Creates an isolated light source theX, theY, theZ in the viewer.
33 //! It is also defined by the color theColor and
34 //! two attenuation factors theConstAttentuation, theLinearAttentuation.
42cf5bc1 35 //! The resulting attenuation factor determining the
36 //! illumination of a surface depends on the following
37 //! formula :
c357e426 38 //! F = 1/(ConstAttenuation + LinearAttenuation*Length)
42cf5bc1 39 //! Length is the distance of the isolated source
c357e426 40 //! from the surface. //! Warning! raises BadValue from V3d
41 //! if one of the attenuation coefficients is not in range [0, 1].
42 Standard_EXPORT V3d_PositionalLight (const Handle(V3d_Viewer)& theViewer,
43 const V3d_Coordinate theX,
44 const V3d_Coordinate theY,
45 const V3d_Coordinate theZ,
87432b82 46 const Quantity_Color& theColor = Quantity_NOC_WHITE,
c357e426 47 const Quantity_Coefficient theConstAttenuation = 1.0,
48 const Quantity_Coefficient theLinearAttenuation = 0.0);
49
50 //! Creates a light source of the Positional type in the viewer.
51 //! theXt, theYt, theZt : Coordinate of Target light source.
52 //! theXp, theYp, theZp : Coordinate of Position light source.
42cf5bc1 53 //! The light source is also defined by the color Color
c357e426 54 //! and two attenuation factors theConstAttentuation,
55 //! theLinearAttentuation that determine the illumination of a
42cf5bc1 56 //! surface using the following formula :
c357e426 57 //! F = 1/(ConstAttenuation + LinearAttenuation*Length)
58 //! Length is the distance of the isolated source
59 //! from the surface. //! Warning! raises BadValue from V3d
42cf5bc1 60 //! if one of the attenuation coefficients is not between 0 et 1.
c357e426 61 Standard_EXPORT V3d_PositionalLight (const Handle(V3d_Viewer)& theViewer,
62 const V3d_Coordinate theXt,
63 const V3d_Coordinate theYt,
64 const V3d_Coordinate theZt,
65 const V3d_Coordinate theXp,
66 const V3d_Coordinate theYp,
67 const V3d_Coordinate theZp,
87432b82 68 const Quantity_Color& theColor = Quantity_NOC_WHITE,
c357e426 69 const Quantity_Coefficient theConstAttenuation = 1.0,
70 const Quantity_Coefficient theLinearAttenuation = 0.0);
71
42cf5bc1 72 //! Defines the position of the light source.
c357e426 73 Standard_EXPORT virtual void SetPosition (const V3d_Coordinate theX,
74 const V3d_Coordinate theY,
75 const V3d_Coordinate theZ) Standard_OVERRIDE;
76
42cf5bc1 77 //! Defines the attenuation factors.
78 //! Warning: raises BadValue from V3d
79 //! if one of the attenuation coefficients is not between 0 et 1.
c357e426 80 Standard_EXPORT void SetAttenuation (const Quantity_Coefficient theConstAttenuation,
81 const Quantity_Coefficient theLinearAttenuation);
82
42cf5bc1 83 //! Modifies the smoothing radius
84 Standard_EXPORT void SetSmoothRadius (const Standard_Real theValue);
c357e426 85
42cf5bc1 86 //! Display the graphic structure of light source
c357e426 87 //! in the chosen view. We have three type of representation
42cf5bc1 88 //! - SIMPLE : Only the light source is displayed.
89 //! - PARTIAL : The light source and the light space are
90 //! displayed.
91 //! - COMPLETE : The light source, the light space and the
92 //! radius of light space are displayed.
93 //! We can choose the "SAMELAST" as parameter of representation
94 //! In this case the graphic structure representation will be
95 //! the last displayed.
c357e426 96 Standard_EXPORT void Display (const Handle(V3d_View)& theView,
97 const V3d_TypeOfRepresentation theRepresentation) Standard_OVERRIDE;
42cf5bc1 98
c357e426 99 //! Returns the position of the light source.
100 Standard_EXPORT void Position (V3d_Coordinate& theX,
101 V3d_Coordinate& theY,
102 V3d_Coordinate& theZ) const Standard_OVERRIDE;
42cf5bc1 103
c357e426 104 //! Returns the attenuation factors.
105 Standard_EXPORT void Attenuation (Quantity_Coefficient& theConstAttenuation,
106 Quantity_Coefficient& theLinearAttenuation) const;
42cf5bc1 107
92efcf78 108 DEFINE_STANDARD_RTTIEXT(V3d_PositionalLight,V3d_PositionLight)
42cf5bc1 109
42cf5bc1 110private:
111
42cf5bc1 112 //! Defined the representation of the positional light source.
c357e426 113 Standard_EXPORT void Symbol (const Handle(Graphic3d_Group)& theSymbol,
114 const Handle(V3d_View)& theView) const Standard_OVERRIDE;
42cf5bc1 115};
116
42cf5bc1 117#endif // _V3d_PositionalLight_HeaderFile