0025201: Visualization - Implementing soft shadows and ambient occlusion in OCCT...
[occt.git] / src / Graphic3d / Graphic3d_CLight.hxx
CommitLineData
973c2be1 1// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 2//
973c2be1 3// This file is part of Open CASCADE Technology software library.
b311480e 4//
d5f74e42 5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
b311480e 10//
973c2be1 11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
b311480e 13
7fd59977 14#ifndef _Graphic3d_CLight_HeaderFile
15#define _Graphic3d_CLight_HeaderFile
16
17#include <InterfaceGraphic_Graphic3d.hxx>
18#include <InterfaceGraphic_Visual3d.hxx>
12381341 19#include <Graphic3d_Vec.hxx>
7fd59977 20
12381341 21//! Light definition
22struct Graphic3d_CLight
23{
7fd59977 24
12381341 25public:
26
27 Graphic3d_Vec4 Color; //!< light color
28 Graphic3d_Vec4 Position; //!< light position
29 Graphic3d_Vec4 Direction; //!< direction of directional/spot light
30 Graphic3d_Vec4 Params; //!< packed light parameters
31 Standard_Integer Type; //!< Visual3d_TypeOfLightSource enumeration
32 Standard_Boolean IsHeadlight; //!< flag to mark head light
189f85a3 33 Standard_ShortReal Smoothness; //!< radius (cone angle) for point (directional) light
34 Standard_ShortReal Intensity; //!< intensity multiplier for light
12381341 35
36 //! Const attenuation factor of positional light source
37 Standard_ShortReal ConstAttenuation() const { return Params.x(); }
38
39 //! Linear attenuation factor of positional light source
40 Standard_ShortReal LinearAttenuation() const { return Params.y(); }
41
42 //! Const, Linear attenuation factors of positional light source
43 Graphic3d_Vec2 Attenuation() const { return Params.xy(); }
44
45 //! Angle in radians of the cone created by the spot
46 Standard_ShortReal Angle() const { return Params.z(); }
47
48 //! Intensity distribution of the spot light, with 0..1 range.
49 Standard_ShortReal Concentration() const { return Params.w(); }
50
51 Standard_ShortReal& ChangeConstAttenuation() { return Params.x(); }
52 Standard_ShortReal& ChangeLinearAttenuation() { return Params.y(); }
53 Graphic3d_Vec2& ChangeAttenuation() { return Params.xy(); }
54 Standard_ShortReal& ChangeAngle() { return Params.z(); }
55 Standard_ShortReal& ChangeConcentration() { return Params.w(); }
56
57public:
58
59 //! Empty constructor
60 Graphic3d_CLight()
61 : Color (1.0f, 1.0f, 1.0f, 1.0f),
62 Position (0.0f, 0.0f, 0.0f, 1.0f),
63 Direction (0.0f, 0.0f, 0.0f, 0.0f),
64 Params (0.0f, 0.0f, 0.0f, 0.0f),
65 Type (0),
189f85a3 66 IsHeadlight (Standard_False),
67 Smoothness (0.0f),
68 Intensity (1.0f)
12381341 69 {
70 //
71 }
72
73public:
74
75 DEFINE_STANDARD_ALLOC
76
77};
7fd59977 78
12381341 79#endif // Graphic3d_CLight_HeaderFile