nuclear@0: /* nuclear@0: --------------------------------------------------------------------------- nuclear@0: Open Asset Import Library (assimp) nuclear@0: --------------------------------------------------------------------------- nuclear@0: nuclear@0: Copyright (c) 2006-2018, assimp team nuclear@0: nuclear@0: nuclear@0: nuclear@0: All rights reserved. nuclear@0: nuclear@0: Redistribution and use of this software in source and binary forms, nuclear@0: with or without modification, are permitted provided that the following nuclear@0: conditions are met: nuclear@0: nuclear@0: * Redistributions of source code must retain the above nuclear@0: copyright notice, this list of conditions and the nuclear@0: following disclaimer. nuclear@0: nuclear@0: * Redistributions in binary form must reproduce the above nuclear@0: copyright notice, this list of conditions and the nuclear@0: following disclaimer in the documentation and/or other nuclear@0: materials provided with the distribution. nuclear@0: nuclear@0: * Neither the name of the assimp team, nor the names of its nuclear@0: contributors may be used to endorse or promote products nuclear@0: derived from this software without specific prior nuclear@0: written permission of the assimp team. nuclear@0: nuclear@0: THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS nuclear@0: "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT nuclear@0: LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR nuclear@0: A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT nuclear@0: OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, nuclear@0: SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT nuclear@0: LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, nuclear@0: DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY nuclear@0: THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT nuclear@0: (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE nuclear@0: OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. nuclear@0: --------------------------------------------------------------------------- nuclear@0: */ nuclear@0: nuclear@0: /** @file light.h nuclear@0: * @brief Defines the aiLight data structure nuclear@0: */ nuclear@0: nuclear@0: #pragma once nuclear@0: #ifndef AI_LIGHT_H_INC nuclear@0: #define AI_LIGHT_H_INC nuclear@0: nuclear@0: #include "types.h" nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: extern "C" { nuclear@0: #endif nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** Enumerates all supported types of light sources. nuclear@0: */ nuclear@0: enum aiLightSourceType nuclear@0: { nuclear@0: aiLightSource_UNDEFINED = 0x0, nuclear@0: nuclear@0: //! A directional light source has a well-defined direction nuclear@0: //! but is infinitely far away. That's quite a good nuclear@0: //! approximation for sun light. nuclear@0: aiLightSource_DIRECTIONAL = 0x1, nuclear@0: nuclear@0: //! A point light source has a well-defined position nuclear@0: //! in space but no direction - it emits light in all nuclear@0: //! directions. A normal bulb is a point light. nuclear@0: aiLightSource_POINT = 0x2, nuclear@0: nuclear@0: //! A spot light source emits light in a specific nuclear@0: //! angle. It has a position and a direction it is pointing to. nuclear@0: //! A good example for a spot light is a light spot in nuclear@0: //! sport arenas. nuclear@0: aiLightSource_SPOT = 0x3, nuclear@0: nuclear@0: //! The generic light level of the world, including the bounces nuclear@0: //! of all other light sources. nuclear@0: //! Typically, there's at most one ambient light in a scene. nuclear@0: //! This light type doesn't have a valid position, direction, or nuclear@0: //! other properties, just a color. nuclear@0: aiLightSource_AMBIENT = 0x4, nuclear@0: nuclear@0: //! An area light is a rectangle with predefined size that uniformly nuclear@0: //! emits light from one of its sides. The position is center of the nuclear@0: //! rectangle and direction is its normal vector. nuclear@0: aiLightSource_AREA = 0x5, nuclear@0: nuclear@0: /** This value is not used. It is just there to force the nuclear@0: * compiler to map this enum to a 32 Bit integer. nuclear@0: */ nuclear@0: #ifndef SWIG nuclear@0: _aiLightSource_Force32Bit = INT_MAX nuclear@0: #endif nuclear@0: }; nuclear@0: nuclear@0: // --------------------------------------------------------------------------- nuclear@0: /** Helper structure to describe a light source. nuclear@0: * nuclear@0: * Assimp supports multiple sorts of light sources, including nuclear@0: * directional, point and spot lights. All of them are defined with just nuclear@0: * a single structure and distinguished by their parameters. nuclear@0: * Note - some file formats (such as 3DS, ASE) export a "target point" - nuclear@0: * the point a spot light is looking at (it can even be animated). Assimp nuclear@0: * writes the target point as a subnode of a spotlights's main node, nuclear@0: * called ".Target". However, this is just additional information nuclear@0: * then, the transformation tracks of the main node make the nuclear@0: * spot light already point in the right direction. nuclear@0: */ nuclear@0: struct aiLight nuclear@0: { nuclear@0: /** The name of the light source. nuclear@0: * nuclear@0: * There must be a node in the scenegraph with the same name. nuclear@0: * This node specifies the position of the light in the scene nuclear@0: * hierarchy and can be animated. nuclear@0: */ nuclear@0: C_STRUCT aiString mName; nuclear@0: nuclear@0: /** The type of the light source. nuclear@0: * nuclear@0: * aiLightSource_UNDEFINED is not a valid value for this member. nuclear@0: */ nuclear@0: C_ENUM aiLightSourceType mType; nuclear@0: nuclear@0: /** Position of the light source in space. Relative to the nuclear@0: * transformation of the node corresponding to the light. nuclear@0: * nuclear@0: * The position is undefined for directional lights. nuclear@0: */ nuclear@0: C_STRUCT aiVector3D mPosition; nuclear@0: nuclear@0: /** Direction of the light source in space. Relative to the nuclear@0: * transformation of the node corresponding to the light. nuclear@0: * nuclear@0: * The direction is undefined for point lights. The vector nuclear@0: * may be normalized, but it needn't. nuclear@0: */ nuclear@0: C_STRUCT aiVector3D mDirection; nuclear@0: nuclear@0: /** Up direction of the light source in space. Relative to the nuclear@0: * transformation of the node corresponding to the light. nuclear@0: * nuclear@0: * The direction is undefined for point lights. The vector nuclear@0: * may be normalized, but it needn't. nuclear@0: */ nuclear@0: C_STRUCT aiVector3D mUp; nuclear@0: nuclear@0: /** Constant light attenuation factor. nuclear@0: * nuclear@0: * The intensity of the light source at a given distance 'd' from nuclear@0: * the light's position is nuclear@0: * @code nuclear@0: * Atten = 1/( att0 + att1 * d + att2 * d*d) nuclear@0: * @endcode nuclear@0: * This member corresponds to the att0 variable in the equation. nuclear@0: * Naturally undefined for directional lights. nuclear@0: */ nuclear@0: float mAttenuationConstant; nuclear@0: nuclear@0: /** Linear light attenuation factor. nuclear@0: * nuclear@0: * The intensity of the light source at a given distance 'd' from nuclear@0: * the light's position is nuclear@0: * @code nuclear@0: * Atten = 1/( att0 + att1 * d + att2 * d*d) nuclear@0: * @endcode nuclear@0: * This member corresponds to the att1 variable in the equation. nuclear@0: * Naturally undefined for directional lights. nuclear@0: */ nuclear@0: float mAttenuationLinear; nuclear@0: nuclear@0: /** Quadratic light attenuation factor. nuclear@0: * nuclear@0: * The intensity of the light source at a given distance 'd' from nuclear@0: * the light's position is nuclear@0: * @code nuclear@0: * Atten = 1/( att0 + att1 * d + att2 * d*d) nuclear@0: * @endcode nuclear@0: * This member corresponds to the att2 variable in the equation. nuclear@0: * Naturally undefined for directional lights. nuclear@0: */ nuclear@0: float mAttenuationQuadratic; nuclear@0: nuclear@0: /** Diffuse color of the light source nuclear@0: * nuclear@0: * The diffuse light color is multiplied with the diffuse nuclear@0: * material color to obtain the final color that contributes nuclear@0: * to the diffuse shading term. nuclear@0: */ nuclear@0: C_STRUCT aiColor3D mColorDiffuse; nuclear@0: nuclear@0: /** Specular color of the light source nuclear@0: * nuclear@0: * The specular light color is multiplied with the specular nuclear@0: * material color to obtain the final color that contributes nuclear@0: * to the specular shading term. nuclear@0: */ nuclear@0: C_STRUCT aiColor3D mColorSpecular; nuclear@0: nuclear@0: /** Ambient color of the light source nuclear@0: * nuclear@0: * The ambient light color is multiplied with the ambient nuclear@0: * material color to obtain the final color that contributes nuclear@0: * to the ambient shading term. Most renderers will ignore nuclear@0: * this value it, is just a remaining of the fixed-function pipeline nuclear@0: * that is still supported by quite many file formats. nuclear@0: */ nuclear@0: C_STRUCT aiColor3D mColorAmbient; nuclear@0: nuclear@0: /** Inner angle of a spot light's light cone. nuclear@0: * nuclear@0: * The spot light has maximum influence on objects inside this nuclear@0: * angle. The angle is given in radians. It is 2PI for point nuclear@0: * lights and undefined for directional lights. nuclear@0: */ nuclear@0: float mAngleInnerCone; nuclear@0: nuclear@0: /** Outer angle of a spot light's light cone. nuclear@0: * nuclear@0: * The spot light does not affect objects outside this angle. nuclear@0: * The angle is given in radians. It is 2PI for point lights and nuclear@0: * undefined for directional lights. The outer angle must be nuclear@0: * greater than or equal to the inner angle. nuclear@0: * It is assumed that the application uses a smooth nuclear@0: * interpolation between the inner and the outer cone of the nuclear@0: * spot light. nuclear@0: */ nuclear@0: float mAngleOuterCone; nuclear@0: nuclear@0: /** Size of area light source. */ nuclear@0: C_STRUCT aiVector2D mSize; nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: nuclear@0: aiLight() AI_NO_EXCEPT nuclear@0: : mType (aiLightSource_UNDEFINED) nuclear@0: , mAttenuationConstant (0.f) nuclear@0: , mAttenuationLinear (1.f) nuclear@0: , mAttenuationQuadratic (0.f) nuclear@0: , mAngleInnerCone ((float)AI_MATH_TWO_PI) nuclear@0: , mAngleOuterCone ((float)AI_MATH_TWO_PI) nuclear@0: , mSize (0.f, 0.f) nuclear@0: { nuclear@0: } nuclear@0: nuclear@0: #endif nuclear@0: }; nuclear@0: nuclear@0: #ifdef __cplusplus nuclear@0: } nuclear@0: #endif nuclear@0: nuclear@0: nuclear@0: #endif // !! AI_LIGHT_H_INC