rev |
line source |
nuclear@0
|
1 /*
|
nuclear@0
|
2 ---------------------------------------------------------------------------
|
nuclear@0
|
3 Open Asset Import Library (assimp)
|
nuclear@0
|
4 ---------------------------------------------------------------------------
|
nuclear@0
|
5
|
nuclear@0
|
6 Copyright (c) 2006-2012, assimp team
|
nuclear@0
|
7
|
nuclear@0
|
8 All rights reserved.
|
nuclear@0
|
9
|
nuclear@0
|
10 Redistribution and use of this software in source and binary forms,
|
nuclear@0
|
11 with or without modification, are permitted provided that the following
|
nuclear@0
|
12 conditions are met:
|
nuclear@0
|
13
|
nuclear@0
|
14 * Redistributions of source code must retain the above
|
nuclear@0
|
15 copyright notice, this list of conditions and the
|
nuclear@0
|
16 following disclaimer.
|
nuclear@0
|
17
|
nuclear@0
|
18 * Redistributions in binary form must reproduce the above
|
nuclear@0
|
19 copyright notice, this list of conditions and the
|
nuclear@0
|
20 following disclaimer in the documentation and/or other
|
nuclear@0
|
21 materials provided with the distribution.
|
nuclear@0
|
22
|
nuclear@0
|
23 * Neither the name of the assimp team, nor the names of its
|
nuclear@0
|
24 contributors may be used to endorse or promote products
|
nuclear@0
|
25 derived from this software without specific prior
|
nuclear@0
|
26 written permission of the assimp team.
|
nuclear@0
|
27
|
nuclear@0
|
28 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
nuclear@0
|
29 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
nuclear@0
|
30 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
nuclear@0
|
31 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
nuclear@0
|
32 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
33 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
nuclear@0
|
34 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
nuclear@0
|
35 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
nuclear@0
|
36 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
nuclear@0
|
37 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
nuclear@0
|
38 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
39 ---------------------------------------------------------------------------
|
nuclear@0
|
40 */
|
nuclear@0
|
41
|
nuclear@0
|
42 /** @file light.h
|
nuclear@0
|
43 * @brief Defines the aiLight data structure
|
nuclear@0
|
44 */
|
nuclear@0
|
45
|
nuclear@0
|
46 #ifndef __AI_LIGHT_H_INC__
|
nuclear@0
|
47 #define __AI_LIGHT_H_INC__
|
nuclear@0
|
48
|
nuclear@0
|
49 #include "types.h"
|
nuclear@0
|
50
|
nuclear@0
|
51 #ifdef __cplusplus
|
nuclear@0
|
52 extern "C" {
|
nuclear@0
|
53 #endif
|
nuclear@0
|
54
|
nuclear@0
|
55 // ---------------------------------------------------------------------------
|
nuclear@0
|
56 /** Enumerates all supported types of light sources.
|
nuclear@0
|
57 */
|
nuclear@0
|
58 enum aiLightSourceType
|
nuclear@0
|
59 {
|
nuclear@0
|
60 aiLightSource_UNDEFINED = 0x0,
|
nuclear@0
|
61
|
nuclear@0
|
62 //! A directional light source has a well-defined direction
|
nuclear@0
|
63 //! but is infinitely far away. That's quite a good
|
nuclear@0
|
64 //! approximation for sun light.
|
nuclear@0
|
65 aiLightSource_DIRECTIONAL = 0x1,
|
nuclear@0
|
66
|
nuclear@0
|
67 //! A point light source has a well-defined position
|
nuclear@0
|
68 //! in space but no direction - it emits light in all
|
nuclear@0
|
69 //! directions. A normal bulb is a point light.
|
nuclear@0
|
70 aiLightSource_POINT = 0x2,
|
nuclear@0
|
71
|
nuclear@0
|
72 //! A spot light source emits light in a specific
|
nuclear@0
|
73 //! angle. It has a position and a direction it is pointing to.
|
nuclear@0
|
74 //! A good example for a spot light is a light spot in
|
nuclear@0
|
75 //! sport arenas.
|
nuclear@0
|
76 aiLightSource_SPOT = 0x3,
|
nuclear@0
|
77
|
nuclear@0
|
78
|
nuclear@0
|
79 /** This value is not used. It is just there to force the
|
nuclear@0
|
80 * compiler to map this enum to a 32 Bit integer.
|
nuclear@0
|
81 */
|
nuclear@0
|
82 #ifndef SWIG
|
nuclear@0
|
83 _aiLightSource_Force32Bit = INT_MAX
|
nuclear@0
|
84 #endif
|
nuclear@0
|
85 };
|
nuclear@0
|
86
|
nuclear@0
|
87 // ---------------------------------------------------------------------------
|
nuclear@0
|
88 /** Helper structure to describe a light source.
|
nuclear@0
|
89 *
|
nuclear@0
|
90 * Assimp supports multiple sorts of light sources, including
|
nuclear@0
|
91 * directional, point and spot lights. All of them are defined with just
|
nuclear@0
|
92 * a single structure and distinguished by their parameters.
|
nuclear@0
|
93 * Note - some file formats (such as 3DS, ASE) export a "target point" -
|
nuclear@0
|
94 * the point a spot light is looking at (it can even be animated). Assimp
|
nuclear@0
|
95 * writes the target point as a subnode of a spotlights's main node,
|
nuclear@0
|
96 * called "<spotName>.Target". However, this is just additional information
|
nuclear@0
|
97 * then, the transformation tracks of the main node make the
|
nuclear@0
|
98 * spot light already point in the right direction.
|
nuclear@0
|
99 */
|
nuclear@0
|
100 struct aiLight
|
nuclear@0
|
101 {
|
nuclear@0
|
102 /** The name of the light source.
|
nuclear@0
|
103 *
|
nuclear@0
|
104 * There must be a node in the scenegraph with the same name.
|
nuclear@0
|
105 * This node specifies the position of the light in the scene
|
nuclear@0
|
106 * hierarchy and can be animated.
|
nuclear@0
|
107 */
|
nuclear@0
|
108 C_STRUCT aiString mName;
|
nuclear@0
|
109
|
nuclear@0
|
110 /** The type of the light source.
|
nuclear@0
|
111 *
|
nuclear@0
|
112 * aiLightSource_UNDEFINED is not a valid value for this member.
|
nuclear@0
|
113 */
|
nuclear@0
|
114 C_ENUM aiLightSourceType mType;
|
nuclear@0
|
115
|
nuclear@0
|
116 /** Position of the light source in space. Relative to the
|
nuclear@0
|
117 * transformation of the node corresponding to the light.
|
nuclear@0
|
118 *
|
nuclear@0
|
119 * The position is undefined for directional lights.
|
nuclear@0
|
120 */
|
nuclear@0
|
121 C_STRUCT aiVector3D mPosition;
|
nuclear@0
|
122
|
nuclear@0
|
123 /** Direction of the light source in space. Relative to the
|
nuclear@0
|
124 * transformation of the node corresponding to the light.
|
nuclear@0
|
125 *
|
nuclear@0
|
126 * The direction is undefined for point lights. The vector
|
nuclear@0
|
127 * may be normalized, but it needn't.
|
nuclear@0
|
128 */
|
nuclear@0
|
129 C_STRUCT aiVector3D mDirection;
|
nuclear@0
|
130
|
nuclear@0
|
131 /** Constant light attenuation factor.
|
nuclear@0
|
132 *
|
nuclear@0
|
133 * The intensity of the light source at a given distance 'd' from
|
nuclear@0
|
134 * the light's position is
|
nuclear@0
|
135 * @code
|
nuclear@0
|
136 * Atten = 1/( att0 + att1 * d + att2 * d*d)
|
nuclear@0
|
137 * @endcode
|
nuclear@0
|
138 * This member corresponds to the att0 variable in the equation.
|
nuclear@0
|
139 * Naturally undefined for directional lights.
|
nuclear@0
|
140 */
|
nuclear@0
|
141 float mAttenuationConstant;
|
nuclear@0
|
142
|
nuclear@0
|
143 /** Linear light attenuation factor.
|
nuclear@0
|
144 *
|
nuclear@0
|
145 * The intensity of the light source at a given distance 'd' from
|
nuclear@0
|
146 * the light's position is
|
nuclear@0
|
147 * @code
|
nuclear@0
|
148 * Atten = 1/( att0 + att1 * d + att2 * d*d)
|
nuclear@0
|
149 * @endcode
|
nuclear@0
|
150 * This member corresponds to the att1 variable in the equation.
|
nuclear@0
|
151 * Naturally undefined for directional lights.
|
nuclear@0
|
152 */
|
nuclear@0
|
153 float mAttenuationLinear;
|
nuclear@0
|
154
|
nuclear@0
|
155 /** Quadratic light attenuation factor.
|
nuclear@0
|
156 *
|
nuclear@0
|
157 * The intensity of the light source at a given distance 'd' from
|
nuclear@0
|
158 * the light's position is
|
nuclear@0
|
159 * @code
|
nuclear@0
|
160 * Atten = 1/( att0 + att1 * d + att2 * d*d)
|
nuclear@0
|
161 * @endcode
|
nuclear@0
|
162 * This member corresponds to the att2 variable in the equation.
|
nuclear@0
|
163 * Naturally undefined for directional lights.
|
nuclear@0
|
164 */
|
nuclear@0
|
165 float mAttenuationQuadratic;
|
nuclear@0
|
166
|
nuclear@0
|
167 /** Diffuse color of the light source
|
nuclear@0
|
168 *
|
nuclear@0
|
169 * The diffuse light color is multiplied with the diffuse
|
nuclear@0
|
170 * material color to obtain the final color that contributes
|
nuclear@0
|
171 * to the diffuse shading term.
|
nuclear@0
|
172 */
|
nuclear@0
|
173 C_STRUCT aiColor3D mColorDiffuse;
|
nuclear@0
|
174
|
nuclear@0
|
175 /** Specular color of the light source
|
nuclear@0
|
176 *
|
nuclear@0
|
177 * The specular light color is multiplied with the specular
|
nuclear@0
|
178 * material color to obtain the final color that contributes
|
nuclear@0
|
179 * to the specular shading term.
|
nuclear@0
|
180 */
|
nuclear@0
|
181 C_STRUCT aiColor3D mColorSpecular;
|
nuclear@0
|
182
|
nuclear@0
|
183 /** Ambient color of the light source
|
nuclear@0
|
184 *
|
nuclear@0
|
185 * The ambient light color is multiplied with the ambient
|
nuclear@0
|
186 * material color to obtain the final color that contributes
|
nuclear@0
|
187 * to the ambient shading term. Most renderers will ignore
|
nuclear@0
|
188 * this value it, is just a remaining of the fixed-function pipeline
|
nuclear@0
|
189 * that is still supported by quite many file formats.
|
nuclear@0
|
190 */
|
nuclear@0
|
191 C_STRUCT aiColor3D mColorAmbient;
|
nuclear@0
|
192
|
nuclear@0
|
193 /** Inner angle of a spot light's light cone.
|
nuclear@0
|
194 *
|
nuclear@0
|
195 * The spot light has maximum influence on objects inside this
|
nuclear@0
|
196 * angle. The angle is given in radians. It is 2PI for point
|
nuclear@0
|
197 * lights and undefined for directional lights.
|
nuclear@0
|
198 */
|
nuclear@0
|
199 float mAngleInnerCone;
|
nuclear@0
|
200
|
nuclear@0
|
201 /** Outer angle of a spot light's light cone.
|
nuclear@0
|
202 *
|
nuclear@0
|
203 * The spot light does not affect objects outside this angle.
|
nuclear@0
|
204 * The angle is given in radians. It is 2PI for point lights and
|
nuclear@0
|
205 * undefined for directional lights. The outer angle must be
|
nuclear@0
|
206 * greater than or equal to the inner angle.
|
nuclear@0
|
207 * It is assumed that the application uses a smooth
|
nuclear@0
|
208 * interpolation between the inner and the outer cone of the
|
nuclear@0
|
209 * spot light.
|
nuclear@0
|
210 */
|
nuclear@0
|
211 float mAngleOuterCone;
|
nuclear@0
|
212
|
nuclear@0
|
213 #ifdef __cplusplus
|
nuclear@0
|
214
|
nuclear@0
|
215 aiLight()
|
nuclear@0
|
216 : mType (aiLightSource_UNDEFINED)
|
nuclear@0
|
217 , mAttenuationConstant (0.f)
|
nuclear@0
|
218 , mAttenuationLinear (1.f)
|
nuclear@0
|
219 , mAttenuationQuadratic (0.f)
|
nuclear@0
|
220 , mAngleInnerCone ((float)AI_MATH_TWO_PI)
|
nuclear@0
|
221 , mAngleOuterCone ((float)AI_MATH_TWO_PI)
|
nuclear@0
|
222 {
|
nuclear@0
|
223 }
|
nuclear@0
|
224
|
nuclear@0
|
225 #endif
|
nuclear@0
|
226 };
|
nuclear@0
|
227
|
nuclear@0
|
228 #ifdef __cplusplus
|
nuclear@0
|
229 }
|
nuclear@0
|
230 #endif
|
nuclear@0
|
231
|
nuclear@0
|
232
|
nuclear@0
|
233 #endif // !! __AI_LIGHT_H_INC__
|