2008-10-13 16:45:48 +00:00
|
|
|
/*
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
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.
|
|
|
|
---------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
2009-01-13 18:58:07 +00:00
|
|
|
/** @file aiLight.h
|
|
|
|
* @brief Defines the aiLight data structure
|
2008-10-13 16:45:48 +00:00
|
|
|
*/
|
|
|
|
|
2008-10-17 14:43:53 +00:00
|
|
|
#ifndef __AI_LIGHT_H_INC__
|
|
|
|
#define __AI_LIGHT_H_INC__
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
#include "aiTypes.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** Enumerates all supported types of light sources.
|
|
|
|
*/
|
|
|
|
enum aiLightSourceType
|
|
|
|
{
|
|
|
|
aiLightSource_UNDEFINED = 0x0,
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
//! A directional light source has a well-defined direction
|
|
|
|
//! but is infinitely far away. That's quite a good
|
|
|
|
//! approximation for sun light.
|
2008-10-13 16:45:48 +00:00
|
|
|
aiLightSource_DIRECTIONAL = 0x1,
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
//! A point light source has a well-defined position
|
2009-01-13 18:58:07 +00:00
|
|
|
//! in space but no direction - it emits light in all
|
2008-10-17 14:43:53 +00:00
|
|
|
//! directions. A normal bulb is a point light.
|
2008-10-13 16:45:48 +00:00
|
|
|
aiLightSource_POINT = 0x2,
|
2008-10-17 14:43:53 +00:00
|
|
|
|
2009-01-13 18:58:07 +00:00
|
|
|
//! A spot light source emits light in a specific
|
2008-10-17 14:43:53 +00:00
|
|
|
//! angle. It has a position and a direction it is pointing to.
|
2008-10-19 11:32:33 +00:00
|
|
|
//! A good example for a spot light is a light spot in
|
|
|
|
//! sport arenas.
|
ASE: Added WIP support for *SMOOTHSKINMESH elements in ASE/ASC files. Fixes in the ASE loader. Fixed animation parsing. Temporary implementation of target lights and cameras, including animations.
3DS: Fixed transformation problems (Pivot points), added WIP animation support. No target animation yet (cameras, spot lights). Not yet fully tested, but static models that worked before should still work now, except all look correct now :-) (some problems with very large models remaining)
Further work on the IRR and IRRMESH loaders. IRR still WIP, IRRMESH more stable now.
Work on the LWo loader. Added support for the "one-layer-only" mode. Hierarchy bug still unfixed, UV coords bug still unfixed.
Further work on the FindInvalidDataprocess. Improved validation for normals, no false positives anymore.
Further work on the MDR loader, still WIP.
Moved DeterminePType-Step to ScenePreprocessor.
aiAnimation::mDuration is optional now, ScenePreprocessor computes it automatically if set to -1.
Fixes in the SMD loader. Still crashes on some files.
Updated animation documentation.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@236 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2008-11-09 23:17:19 +00:00
|
|
|
aiLightSource_SPOT = 0x3,
|
|
|
|
|
|
|
|
|
|
|
|
/** This value is not used. It is just there to force the
|
|
|
|
* compiler to map this enum to a 32 Bit integer.
|
|
|
|
*/
|
|
|
|
_aiLightSource_Force32Bit = 0x9fffffff
|
2008-10-13 16:45:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/** 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
|
2008-10-17 14:43:53 +00:00
|
|
|
* a single structure and distinguished by their parameters.
|
2008-11-16 21:56:45 +00:00
|
|
|
* Note - some file formats (such as 3DS, ASE) export a "target point" -
|
|
|
|
* the point a spot light is looking at (it can even be animated). Assimp
|
|
|
|
* writes the target point as a subnode of a spotlights's main node,
|
|
|
|
* called "<spotName>.Target". However, this is just additional information
|
|
|
|
* then, the transformation tracks of the main node make the
|
|
|
|
* spot light already point in the right direction.
|
2008-10-13 16:45:48 +00:00
|
|
|
*/
|
|
|
|
struct aiLight
|
|
|
|
{
|
2008-10-19 11:32:33 +00:00
|
|
|
/** The name of the light source.
|
2008-10-13 16:45:48 +00:00
|
|
|
*
|
2008-10-17 14:43:53 +00:00
|
|
|
* 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.
|
2008-10-13 16:45:48 +00:00
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiString mName;
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
/** The type of the light source.
|
2008-10-19 11:32:33 +00:00
|
|
|
*
|
2009-01-13 18:58:07 +00:00
|
|
|
* aiLightSource_UNDEFINED is not a valid value for this member.
|
2008-10-13 16:45:48 +00:00
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_ENUM aiLightSourceType mType;
|
2008-10-13 16:45:48 +00:00
|
|
|
|
2008-10-17 14:43:53 +00:00
|
|
|
/** Position of the light source in space. Relative to the
|
2008-10-19 11:32:33 +00:00
|
|
|
* transformation of the node corresponding to the light.
|
2008-10-17 14:43:53 +00:00
|
|
|
*
|
|
|
|
* The position is undefined for directional lights.
|
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiVector3D mPosition;
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
/** Direction of the light source in space. Relative to the
|
2008-10-19 11:32:33 +00:00
|
|
|
* transformation of the node corresponding to the light.
|
2008-10-17 14:43:53 +00:00
|
|
|
*
|
2008-10-19 11:32:33 +00:00
|
|
|
* The direction is undefined for point lights. The vector
|
|
|
|
* may be normalized, but it needn't.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiVector3D mDirection;
|
2008-10-13 16:45:48 +00:00
|
|
|
|
2008-10-17 14:43:53 +00:00
|
|
|
/** 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
|
2008-10-19 11:32:33 +00:00
|
|
|
* This member corresponds to the att0 variable in the equation.
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
* Naturally undefined for directional lights.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2008-10-13 16:45:48 +00:00
|
|
|
float mAttenuationConstant;
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
/** 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
|
2008-10-19 11:32:33 +00:00
|
|
|
* This member corresponds to the att1 variable in the equation.
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
* Naturally undefined for directional lights.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2008-10-13 16:45:48 +00:00
|
|
|
float mAttenuationLinear;
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
/** 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
|
2008-10-19 11:32:33 +00:00
|
|
|
* This member corresponds to the att2 variable in the equation.
|
General
- Added format auto-detection to most loaders
- Simplified BaseImporter::CanRead() with some utility methods
- improved fast_atof -> no overruns anymore. Fuck you, irrlicht.
- added assimp_cmd tool to allow command line model processing. Mainly adebugging tool for internal purposes, but others might find it useful, too.
- vc8/vc9: revision number is now written to DLL version header
- mkutil: some batch scripts to simplify tagging & building of release versions
- some API cleanup
- fixing some doxygen markup (+now explicit use of @file <filename>)
- Icon for assimp_view and assimp_cmd
3DS
- Normal vectors are not anymore inverted in some cases
- Improved pivot handling
- Improved handling of x-flipped meshes
Collada
- fixed a minor bug (visual_scene element)
LWS
- WIP implementation. No animations yet, some bugs and crashes.
- Animation system remains disabled, WIP code
- many test files for LWS, but most of them test the anim support, which is, read above, currently disabled.
STL
- fixing a log warning which appears for every model
- added binary&ascii test spider, exported from truespace
MD3
- Cleaning up output tags for automatically joined player models.
IRR
- Fixing coordinate system issues.
- Instance handling improved.
- Some of the reported crashes not yet fixed.
PretransformVertices
- Numerous performance improvements.
- Added config option to preserve the hierarchy during the step.
RemoveRedundantMaterials
- Added config option to specify a list of materials which are kept in every case.
UNREAL
- Added support for the old unreal data format (*.a,*.d,*.uc)
- tested only with exports from Milkshape
- more Unreal stuff to come soon
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@356 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
2009-03-05 22:32:13 +00:00
|
|
|
* Naturally undefined for directional lights.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2008-10-13 16:45:48 +00:00
|
|
|
float mAttenuationQuadratic;
|
|
|
|
|
2008-10-17 14:43:53 +00:00
|
|
|
/** Diffuse color of the light source
|
|
|
|
*
|
2008-10-19 11:32:33 +00:00
|
|
|
* The diffuse light color is multiplied with the diffuse
|
|
|
|
* material color to obtain the final color that contributes
|
|
|
|
* to the diffuse shading term.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiColor3D mColorDiffuse;
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
/** Specular color of the light source
|
|
|
|
*
|
2008-10-19 11:32:33 +00:00
|
|
|
* The specular light color is multiplied with the specular
|
|
|
|
* material color to obtain the final color that contributes
|
|
|
|
* to the specular shading term.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiColor3D mColorSpecular;
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
/** Ambient color of the light source
|
|
|
|
*
|
2008-10-19 11:32:33 +00:00
|
|
|
* The ambient light color is multiplied with the ambient
|
|
|
|
* material color to obtain the final color that contributes
|
|
|
|
* to the ambient shading term. Most renderers will ignore
|
|
|
|
* this value it, is just a remaining of the fixed-function pipeline
|
|
|
|
* that is still supported by quite many file formats.
|
2008-10-17 14:43:53 +00:00
|
|
|
*/
|
2009-01-12 22:06:54 +00:00
|
|
|
C_STRUCT aiColor3D mColorAmbient;
|
2008-10-13 16:45:48 +00:00
|
|
|
|
2008-10-17 14:43:53 +00:00
|
|
|
/** 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.
|
|
|
|
*/
|
2008-10-19 11:32:33 +00:00
|
|
|
float mAngleInnerCone;
|
2008-10-17 14:43:53 +00:00
|
|
|
|
|
|
|
/** 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
|
2008-10-19 11:32:33 +00:00
|
|
|
* undefined for directional lights. The outer angle must be
|
|
|
|
* greater than or equal to the inner angle.
|
2008-10-17 14:43:53 +00:00
|
|
|
* It is assumed that the application uses a smooth
|
|
|
|
* interpolation between the inner and the outer cone of the
|
|
|
|
* spot light.
|
|
|
|
*/
|
2008-10-19 11:32:33 +00:00
|
|
|
float mAngleOuterCone;
|
2008-10-13 16:45:48 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
|
|
|
aiLight()
|
|
|
|
: mType (aiLightSource_UNDEFINED)
|
|
|
|
, mAttenuationConstant (0.f)
|
|
|
|
, mAttenuationLinear (1.f)
|
|
|
|
, mAttenuationQuadratic (0.f)
|
2008-10-17 14:43:53 +00:00
|
|
|
, mAngleInnerCone ((float)AI_MATH_TWO_PI)
|
2008-10-19 11:32:33 +00:00
|
|
|
, mAngleOuterCone ((float)AI_MATH_TWO_PI)
|
2008-10-13 16:45:48 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-10-19 11:32:33 +00:00
|
|
|
#endif // !! __AI_LIGHT_H_INC__
|