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 | |
c357e426 |
17 | #include <Graphic3d_TypeOfLightSource.hxx> |
12381341 |
18 | #include <Graphic3d_Vec.hxx> |
c357e426 |
19 | #include <NCollection_List.hxx> |
7fd59977 |
20 | |
12381341 |
21 | //! Light definition |
22 | struct Graphic3d_CLight |
23 | { |
7fd59977 |
24 | |
12381341 |
25 | public: |
26 | |
7c3ef2f7 |
27 | Graphic3d_Vec3d Position; //!< light position |
c357e426 |
28 | Graphic3d_Vec4 Color; //!< light color |
c357e426 |
29 | Graphic3d_Vec4 Direction; //!< direction of directional/spot light |
30 | Graphic3d_Vec4 Params; //!< packed light parameters |
c357e426 |
31 | Standard_ShortReal Smoothness; //!< radius (cone angle) for point (directional) light |
32 | Standard_ShortReal Intensity; //!< intensity multiplier for light |
7c3ef2f7 |
33 | Graphic3d_TypeOfLightSource Type; //!< Graphic3d_TypeOfLightSource enumeration |
34 | Standard_Boolean IsHeadlight; //!< flag to mark head 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 | |
57 | public: |
58 | |
59 | //! Empty constructor |
60 | Graphic3d_CLight() |
7c3ef2f7 |
61 | : Position (0.0, 0.0, 0.0), |
62 | Color (1.0f, 1.0f, 1.0f, 1.0f), |
12381341 |
63 | Direction (0.0f, 0.0f, 0.0f, 0.0f), |
64 | Params (0.0f, 0.0f, 0.0f, 0.0f), |
189f85a3 |
65 | Smoothness (0.0f), |
7c3ef2f7 |
66 | Intensity (1.0f), |
67 | Type (Graphic3d_TOLS_AMBIENT), |
68 | IsHeadlight (Standard_False) |
12381341 |
69 | { |
70 | // |
71 | } |
72 | |
73 | public: |
74 | |
75 | DEFINE_STANDARD_ALLOC |
76 | |
77 | }; |
7fd59977 |
78 | |
c357e426 |
79 | typedef NCollection_List<Graphic3d_CLight> Graphic3d_ListOfCLight; |
80 | |
12381341 |
81 | #endif // Graphic3d_CLight_HeaderFile |