assimp/include/aiLight.h

204 lines
6.3 KiB
C

/*
---------------------------------------------------------------------------
Open Asset Import Library (ASSIMP)
---------------------------------------------------------------------------
Copyright (c) 2006-2008, ASSIMP Development Team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the following
conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the ASSIMP team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the ASSIMP Development Team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------
*/
/** @file Defines the aiLight data structure
*/
#ifndef __AI_LIGHT_H_INC__
#define __AI_LIGHT_H_INC__
#include "aiTypes.h"
#ifdef __cplusplus
extern "C" {
#endif
// ---------------------------------------------------------------------------
/** Enumerates all supported types of light sources.
*/
enum aiLightSourceType
{
aiLightSource_UNDEFINED = 0x0,
//! A directional light source has a well-defined direction
//! but is infinitely far away. That's quite a good
//! approximation for sun light.
aiLightSource_DIRECTIONAL = 0x1,
//! A point light source has a well-defined position
//! in space but no direction - it emmits light in all
//! directions. A normal bulb is a point light.
aiLightSource_POINT = 0x2,
//! A spot light source emmits light in a specific
//! angle. It has a position and a direction it is pointing to.
aiLightSource_SPOT = 0x3
};
// ---------------------------------------------------------------------------
/** Helper structure to describe a light source.
*
* Assimp supports multiple sorts of light sources, including
* directional, point and spot lights. All of them are defined with just
* a single structure and distinguished by their parameters.
*/
struct aiLight
{
/** The name of the light sources.
*
* There must be a node in the scenegraph with the same name.
* This node specifies the position of the light in the scene
* hierarchy and can be animated.
*/
aiString mName;
/** The type of the light source.
*/
aiLightSourceType mType;
/** Position of the light source in space. Relative to the
* node corresponding to the light.
*
* The position is undefined for directional lights.
*/
aiVector3D mPosition;
/** Direction of the light source in space. Relative to the
* node corresponding to the light.
*
* The direction is undefined for point lights.
*/
aiVector3D mDirection;
/** Constant light attenuation factor.
*
* The intensity of the light source at a given distance 'd' from
* the light's position is
* @code
* Atten = 1/( att0 + att1 * d + att2 * d*d)
* @endcode
* This member corresponds to the att01 variable in the equation.
*/
float mAttenuationConstant;
/** Linear light attenuation factor.
*
* The intensity of the light source at a given distance 'd' from
* the light's position is
* @code
* Atten = 1/( att0 + att1 * d + att2 * d*d)
* @endcode
* This member corresponds to the att02 variable in the equation.
*/
float mAttenuationLinear;
/** Quadratic light attenuation factor.
*
* The intensity of the light source at a given distance 'd' from
* the light's position is
* @code
* Atten = 1/( att0 + att1 * d + att2 * d*d)
* @endcode
* This member corresponds to the att03 variable in the equation.
*/
float mAttenuationQuadratic;
/** Diffuse color of the light source
*
* The color has no alpha component which wouldn't make
* sense for light sources.
*/
aiColor3D mColorDiffuse;
/** Specular color of the light source
*
* The color has no alpha component which wouldn't make
* sense for light sources.
*/
aiColor3D mColorSpecular;
/** Ambient color of the light source
*
* The color has no alpha component which wouldn't make
* sense for light sources.
*/
aiColor3D mColorAmbient;
/** Inner angle of a spot light's light cone.
*
* The spot light has maximum influence on objects inside this
* angle. The angle is given in radians. It is 2PI for point
* lights and undefined for directional lights.
*/
float mAngleOuterCone;
/** Outer angle of a spot light's light cone.
*
* The spot light does not affect objects outside this angle.
* The angle is given in radians. It is 2PI for point lights and
* undefined for directional lights.
* It is assumed that the application uses a smooth
* interpolation between the inner and the outer cone of the
* spot light.
*/
float mAngleInnerCone;
#ifdef __cplusplus
aiLight()
: mType (aiLightSource_UNDEFINED)
, mAttenuationConstant (0.f)
, mAttenuationLinear (1.f)
, mAttenuationQuadratic (0.f)
, mAngleOuterCone ((float)AI_MATH_TWO_PI)
, mAngleInnerCone ((float)AI_MATH_TWO_PI)
{
}
#endif
};
#ifdef __cplusplus
}
#endif
#endif // !! __AI_LIGHT_H_INC__