vrshoot

view libs/assimp/assimp/light.h @ 0:b2f14e535253

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