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