vrshoot
diff 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 diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/libs/assimp/assimp/light.h Sat Feb 01 19:58:19 2014 +0200 1.3 @@ -0,0 +1,233 @@ 1.4 +/* 1.5 +--------------------------------------------------------------------------- 1.6 +Open Asset Import Library (assimp) 1.7 +--------------------------------------------------------------------------- 1.8 + 1.9 +Copyright (c) 2006-2012, assimp team 1.10 + 1.11 +All rights reserved. 1.12 + 1.13 +Redistribution and use of this software in source and binary forms, 1.14 +with or without modification, are permitted provided that the following 1.15 +conditions are met: 1.16 + 1.17 +* Redistributions of source code must retain the above 1.18 + copyright notice, this list of conditions and the 1.19 + following disclaimer. 1.20 + 1.21 +* Redistributions in binary form must reproduce the above 1.22 + copyright notice, this list of conditions and the 1.23 + following disclaimer in the documentation and/or other 1.24 + materials provided with the distribution. 1.25 + 1.26 +* Neither the name of the assimp team, nor the names of its 1.27 + contributors may be used to endorse or promote products 1.28 + derived from this software without specific prior 1.29 + written permission of the assimp team. 1.30 + 1.31 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.32 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.33 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1.34 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 1.35 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.36 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.37 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 1.38 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 1.39 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 1.40 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 1.41 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1.42 +--------------------------------------------------------------------------- 1.43 +*/ 1.44 + 1.45 +/** @file light.h 1.46 + * @brief Defines the aiLight data structure 1.47 + */ 1.48 + 1.49 +#ifndef __AI_LIGHT_H_INC__ 1.50 +#define __AI_LIGHT_H_INC__ 1.51 + 1.52 +#include "types.h" 1.53 + 1.54 +#ifdef __cplusplus 1.55 +extern "C" { 1.56 +#endif 1.57 + 1.58 +// --------------------------------------------------------------------------- 1.59 +/** Enumerates all supported types of light sources. 1.60 + */ 1.61 +enum aiLightSourceType 1.62 +{ 1.63 + aiLightSource_UNDEFINED = 0x0, 1.64 + 1.65 + //! A directional light source has a well-defined direction 1.66 + //! but is infinitely far away. That's quite a good 1.67 + //! approximation for sun light. 1.68 + aiLightSource_DIRECTIONAL = 0x1, 1.69 + 1.70 + //! A point light source has a well-defined position 1.71 + //! in space but no direction - it emits light in all 1.72 + //! directions. A normal bulb is a point light. 1.73 + aiLightSource_POINT = 0x2, 1.74 + 1.75 + //! A spot light source emits light in a specific 1.76 + //! angle. It has a position and a direction it is pointing to. 1.77 + //! A good example for a spot light is a light spot in 1.78 + //! sport arenas. 1.79 + aiLightSource_SPOT = 0x3, 1.80 + 1.81 + 1.82 + /** This value is not used. It is just there to force the 1.83 + * compiler to map this enum to a 32 Bit integer. 1.84 + */ 1.85 +#ifndef SWIG 1.86 + _aiLightSource_Force32Bit = INT_MAX 1.87 +#endif 1.88 +}; 1.89 + 1.90 +// --------------------------------------------------------------------------- 1.91 +/** Helper structure to describe a light source. 1.92 + * 1.93 + * Assimp supports multiple sorts of light sources, including 1.94 + * directional, point and spot lights. All of them are defined with just 1.95 + * a single structure and distinguished by their parameters. 1.96 + * Note - some file formats (such as 3DS, ASE) export a "target point" - 1.97 + * the point a spot light is looking at (it can even be animated). Assimp 1.98 + * writes the target point as a subnode of a spotlights's main node, 1.99 + * called "<spotName>.Target". However, this is just additional information 1.100 + * then, the transformation tracks of the main node make the 1.101 + * spot light already point in the right direction. 1.102 +*/ 1.103 +struct aiLight 1.104 +{ 1.105 + /** The name of the light source. 1.106 + * 1.107 + * There must be a node in the scenegraph with the same name. 1.108 + * This node specifies the position of the light in the scene 1.109 + * hierarchy and can be animated. 1.110 + */ 1.111 + C_STRUCT aiString mName; 1.112 + 1.113 + /** The type of the light source. 1.114 + * 1.115 + * aiLightSource_UNDEFINED is not a valid value for this member. 1.116 + */ 1.117 + C_ENUM aiLightSourceType mType; 1.118 + 1.119 + /** Position of the light source in space. Relative to the 1.120 + * transformation of the node corresponding to the light. 1.121 + * 1.122 + * The position is undefined for directional lights. 1.123 + */ 1.124 + C_STRUCT aiVector3D mPosition; 1.125 + 1.126 + /** Direction of the light source in space. Relative to the 1.127 + * transformation of the node corresponding to the light. 1.128 + * 1.129 + * The direction is undefined for point lights. The vector 1.130 + * may be normalized, but it needn't. 1.131 + */ 1.132 + C_STRUCT aiVector3D mDirection; 1.133 + 1.134 + /** Constant light attenuation factor. 1.135 + * 1.136 + * The intensity of the light source at a given distance 'd' from 1.137 + * the light's position is 1.138 + * @code 1.139 + * Atten = 1/( att0 + att1 * d + att2 * d*d) 1.140 + * @endcode 1.141 + * This member corresponds to the att0 variable in the equation. 1.142 + * Naturally undefined for directional lights. 1.143 + */ 1.144 + float mAttenuationConstant; 1.145 + 1.146 + /** Linear light attenuation factor. 1.147 + * 1.148 + * The intensity of the light source at a given distance 'd' from 1.149 + * the light's position is 1.150 + * @code 1.151 + * Atten = 1/( att0 + att1 * d + att2 * d*d) 1.152 + * @endcode 1.153 + * This member corresponds to the att1 variable in the equation. 1.154 + * Naturally undefined for directional lights. 1.155 + */ 1.156 + float mAttenuationLinear; 1.157 + 1.158 + /** Quadratic light attenuation factor. 1.159 + * 1.160 + * The intensity of the light source at a given distance 'd' from 1.161 + * the light's position is 1.162 + * @code 1.163 + * Atten = 1/( att0 + att1 * d + att2 * d*d) 1.164 + * @endcode 1.165 + * This member corresponds to the att2 variable in the equation. 1.166 + * Naturally undefined for directional lights. 1.167 + */ 1.168 + float mAttenuationQuadratic; 1.169 + 1.170 + /** Diffuse color of the light source 1.171 + * 1.172 + * The diffuse light color is multiplied with the diffuse 1.173 + * material color to obtain the final color that contributes 1.174 + * to the diffuse shading term. 1.175 + */ 1.176 + C_STRUCT aiColor3D mColorDiffuse; 1.177 + 1.178 + /** Specular color of the light source 1.179 + * 1.180 + * The specular light color is multiplied with the specular 1.181 + * material color to obtain the final color that contributes 1.182 + * to the specular shading term. 1.183 + */ 1.184 + C_STRUCT aiColor3D mColorSpecular; 1.185 + 1.186 + /** Ambient color of the light source 1.187 + * 1.188 + * The ambient light color is multiplied with the ambient 1.189 + * material color to obtain the final color that contributes 1.190 + * to the ambient shading term. Most renderers will ignore 1.191 + * this value it, is just a remaining of the fixed-function pipeline 1.192 + * that is still supported by quite many file formats. 1.193 + */ 1.194 + C_STRUCT aiColor3D mColorAmbient; 1.195 + 1.196 + /** Inner angle of a spot light's light cone. 1.197 + * 1.198 + * The spot light has maximum influence on objects inside this 1.199 + * angle. The angle is given in radians. It is 2PI for point 1.200 + * lights and undefined for directional lights. 1.201 + */ 1.202 + float mAngleInnerCone; 1.203 + 1.204 + /** Outer angle of a spot light's light cone. 1.205 + * 1.206 + * The spot light does not affect objects outside this angle. 1.207 + * The angle is given in radians. It is 2PI for point lights and 1.208 + * undefined for directional lights. The outer angle must be 1.209 + * greater than or equal to the inner angle. 1.210 + * It is assumed that the application uses a smooth 1.211 + * interpolation between the inner and the outer cone of the 1.212 + * spot light. 1.213 + */ 1.214 + float mAngleOuterCone; 1.215 + 1.216 +#ifdef __cplusplus 1.217 + 1.218 + aiLight() 1.219 + : mType (aiLightSource_UNDEFINED) 1.220 + , mAttenuationConstant (0.f) 1.221 + , mAttenuationLinear (1.f) 1.222 + , mAttenuationQuadratic (0.f) 1.223 + , mAngleInnerCone ((float)AI_MATH_TWO_PI) 1.224 + , mAngleOuterCone ((float)AI_MATH_TWO_PI) 1.225 + { 1.226 + } 1.227 + 1.228 +#endif 1.229 +}; 1.230 + 1.231 +#ifdef __cplusplus 1.232 +} 1.233 +#endif 1.234 + 1.235 + 1.236 +#endif // !! __AI_LIGHT_H_INC__