]> git.lizzy.rs Git - irrlicht.git/blob - include/SLight.h
Merging r6075 through r6106 from trunk to ogl-es branch.
[irrlicht.git] / include / SLight.h
1 // Copyright (C) 2002-2012 Nikolaus Gebhardt\r
2 // This file is part of the "Irrlicht Engine".\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h\r
4 \r
5 #ifndef __S_LIGHT_H_INCLUDED__\r
6 #define __S_LIGHT_H_INCLUDED__\r
7 \r
8 #include "SColor.h"\r
9 \r
10 namespace irr\r
11 {\r
12 namespace video\r
13 {\r
14 \r
15 //! Enumeration for different types of lights\r
16 enum E_LIGHT_TYPE\r
17 {\r
18         //! point light, it has a position in space and radiates light in all directions\r
19         ELT_POINT,\r
20         //! spot light, it has a position in space, a direction, and a limited cone of influence\r
21         ELT_SPOT,\r
22         //! directional light, coming from a direction from an infinite distance\r
23         ELT_DIRECTIONAL,\r
24 \r
25         //! Only used for counting the elements of this enum\r
26         ELT_COUNT\r
27 };\r
28 \r
29 //! Names for light types\r
30 const c8* const LightTypeNames[] =\r
31 {\r
32         "Point",\r
33         "Spot",\r
34         "Directional",\r
35         0\r
36 };\r
37 \r
38 //! structure for holding data describing a dynamic point light.\r
39 /** Irrlicht supports point lights, spot lights, and directional lights.\r
40 */\r
41 struct SLight\r
42 {\r
43         SLight() : AmbientColor(0.f,0.f,0.f), DiffuseColor(1.f,1.f,1.f),\r
44                 SpecularColor(1.f,1.f,1.f), Attenuation(1.f,0.f,0.f),\r
45                 OuterCone(45.f), InnerCone(0.f), Falloff(2.f),\r
46                 Position(0.f,0.f,0.f), Direction(0.f,0.f,1.f),\r
47                 Radius(100.f), Type(ELT_POINT), CastShadows(true)\r
48                 {}\r
49 \r
50         //! Ambient color emitted by the light\r
51         SColorf AmbientColor;\r
52 \r
53         //! Diffuse color emitted by the light.\r
54         /** This is the primary color you want to set. */\r
55         SColorf DiffuseColor;\r
56 \r
57         //! Specular color emitted by the light.\r
58         /** For details how to use specular highlights, see SMaterial::Shininess */\r
59         SColorf SpecularColor;\r
60 \r
61         //! Attenuation factors (constant, linear, quadratic)\r
62         /** Changes the light strength fading over distance.\r
63         Can also be altered by setting the radius, Attenuation will change to\r
64         (0,1.f/radius,0). Can be overridden after radius was set. */\r
65         core::vector3df Attenuation;\r
66 \r
67         //! The angle of the spot's outer cone. Ignored for other lights.\r
68         f32 OuterCone;\r
69 \r
70         //! The angle of the spot's inner cone. Ignored for other lights.\r
71         f32 InnerCone;\r
72 \r
73         //! The light strength's decrease between Outer and Inner cone. Only for spot lights\r
74         f32 Falloff;\r
75 \r
76         //! Read-ONLY! Position of the light.\r
77         /** If Type is ELT_DIRECTIONAL, it is ignored. Changed via light scene node's position. */\r
78         core::vector3df Position;\r
79 \r
80         //! Read-ONLY! Direction of the light.\r
81         /** If Type is ELT_POINT, it is ignored. Changed via light scene node's rotation. */\r
82         core::vector3df Direction;\r
83 \r
84         //! Read-ONLY! Radius of light. Everything within this radius will be lighted.\r
85         /** On OpenGL light doesn't stop at radius. To get same light as in OpenGL in other drivers\r
86         do set the radius to a large value like sqrt(FLT_MAX) and then set the Attenuation afterwards.\r
87         */\r
88         f32 Radius;\r
89 \r
90         //! Read-ONLY! Type of the light. Default: ELT_POINT\r
91         E_LIGHT_TYPE Type;\r
92 \r
93         //! Read-ONLY! Does the light cast shadows?\r
94         bool CastShadows:1;\r
95 };\r
96 \r
97 } // end namespace video\r
98 } // end namespace irr\r
99 \r
100 #endif\r
101 \r