1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
3 // This file is part of Open CASCADE Technology software library.
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
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.
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
14 #ifndef _Graphic3d_CLight_HeaderFile
15 #define _Graphic3d_CLight_HeaderFile
17 #include <Graphic3d_TypeOfLightSource.hxx>
18 #include <Graphic3d_Vec.hxx>
19 #include <InterfaceGraphic_Graphic3d.hxx>
20 #include <NCollection_List.hxx>
23 struct Graphic3d_CLight
28 Graphic3d_Vec4 Color; //!< light color
29 Graphic3d_Vec4 Position; //!< light position
30 Graphic3d_Vec4 Direction; //!< direction of directional/spot light
31 Graphic3d_Vec4 Params; //!< packed light parameters
32 Graphic3d_TypeOfLightSource Type; //!< Graphic3d_TypeOfLightSource enumeration
33 Standard_Boolean IsHeadlight; //!< flag to mark head light
34 Standard_ShortReal Smoothness; //!< radius (cone angle) for point (directional) light
35 Standard_ShortReal Intensity; //!< intensity multiplier for light
37 //! Const attenuation factor of positional light source
38 Standard_ShortReal ConstAttenuation() const { return Params.x(); }
40 //! Linear attenuation factor of positional light source
41 Standard_ShortReal LinearAttenuation() const { return Params.y(); }
43 //! Const, Linear attenuation factors of positional light source
44 Graphic3d_Vec2 Attenuation() const { return Params.xy(); }
46 //! Angle in radians of the cone created by the spot
47 Standard_ShortReal Angle() const { return Params.z(); }
49 //! Intensity distribution of the spot light, with 0..1 range.
50 Standard_ShortReal Concentration() const { return Params.w(); }
52 Standard_ShortReal& ChangeConstAttenuation() { return Params.x(); }
53 Standard_ShortReal& ChangeLinearAttenuation() { return Params.y(); }
54 Graphic3d_Vec2& ChangeAttenuation() { return Params.xy(); }
55 Standard_ShortReal& ChangeAngle() { return Params.z(); }
56 Standard_ShortReal& ChangeConcentration() { return Params.w(); }
62 : Color (1.0f, 1.0f, 1.0f, 1.0f),
63 Position (0.0f, 0.0f, 0.0f, 1.0f),
64 Direction (0.0f, 0.0f, 0.0f, 0.0f),
65 Params (0.0f, 0.0f, 0.0f, 0.0f),
66 Type (Graphic3d_TOLS_AMBIENT),
67 IsHeadlight (Standard_False),
80 typedef NCollection_List<Graphic3d_CLight> Graphic3d_ListOfCLight;
82 #endif // Graphic3d_CLight_HeaderFile