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 <InterfaceGraphic_Graphic3d.hxx>
18 #include <InterfaceGraphic_Visual3d.hxx>
19 #include <Graphic3d_Vec.hxx>
22 struct Graphic3d_CLight
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
33 Standard_ShortReal Smoothness; //!< radius (cone angle) for point (directional) light
34 Standard_ShortReal Intensity; //!< intensity multiplier for light
36 //! Const attenuation factor of positional light source
37 Standard_ShortReal ConstAttenuation() const { return Params.x(); }
39 //! Linear attenuation factor of positional light source
40 Standard_ShortReal LinearAttenuation() const { return Params.y(); }
42 //! Const, Linear attenuation factors of positional light source
43 Graphic3d_Vec2 Attenuation() const { return Params.xy(); }
45 //! Angle in radians of the cone created by the spot
46 Standard_ShortReal Angle() const { return Params.z(); }
48 //! Intensity distribution of the spot light, with 0..1 range.
49 Standard_ShortReal Concentration() const { return Params.w(); }
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(); }
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),
66 IsHeadlight (Standard_False),
79 #endif // Graphic3d_CLight_HeaderFile