@ -35,6 +35,63 @@
namespace Magnum { namespace Trade {
namespace Magnum { namespace Trade {
/**
@ brief Light type
@ m_since_latest
@ see @ ref LightData : : type ( )
*/
enum class LightType : UnsignedByte {
/* Zero reserved for an invalid value */
/**
* Ambient light , without any position , direction or attenuation . Meant to
* be added to ambient color in Phong workflows , has no use in physically
* based workflows .
* @ m_since_latest
*/
Ambient = 1 ,
/**
* Light at a position that is infinitely far away , emitted in a direction
* of negative Z axis . The rotation is inherited from absolute object
* transformation ; scale and position don ' t affect the light in any way .
* Because the light is at infinite distance , it ' s not attenuated in any
* way .
* @ m_since_latest
*/
Directional ,
# ifdef MAGNUM_BUILD_DEPRECATED
/**
* Directional light .
* @ m_deprecated_since_latest Use @ ref LightType : : Directional instead .
*/
Infinite CORRADE_DEPRECATED_ENUM ( " use LightType::Directional instead " ) = Directional ,
# endif
/**
* Point light , emitting light in all directions . The position is inherited
* from absolute object transformation ; scale and rotation don ' t affect the
* light in any way . Brightness attenuates depending on the
* @ ref LightData : : range ( ) value .
*/
Point ,
/**
* Spot light , emitting light in a cone in direction of local negative Z
* axis . The position and rotation is inherited from absolute object
* transformation ; scale doesn ' t affect the light in any way . The angle and
* falloff of the cone is defined using @ ref LightData : : innerConeAngle ( )
* and @ ref LightData : : outerConeAngle ( ) and brightness attenuates depending
* on the @ ref LightData : : range ( ) value .
*/
Spot
} ;
/** @debugoperatorenum{LightType} */
MAGNUM_TRADE_EXPORT Debug & operator < < ( Debug & debug , LightType value ) ;
/**
/**
@ brief Light data
@ brief Light data
@ -50,20 +107,22 @@ everything except spotlights.
You can choose a constructor overload that matches the subset of input
You can choose a constructor overload that matches the subset of input
parameters and let the class set the rest implicitly . For example , a
parameters and let the class set the rest implicitly . For example , a
@ ref Type : : Point light constructed using a range will have @ ref attenuation ( )
@ ref Light Type: : Point light constructed using a range will have
implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce and cone angles to
@ ref attenuation ( ) implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce and cone
@ cpp 360.0 _degf @ ce :
angles to @ cpp 360.0 _degf @ ce :
@ snippet MagnumTrade . cpp LightData - populating - range
@ snippet MagnumTrade . cpp LightData - populating - range
Or , a @ ref Type : : Spot light constructed from a constant / linear / quadratic
Or , a @ ref LightType : : Spot light constructed from a constant / linear /
attenuation will have @ ref range ( ) implicitly set to @ ref Constants : : inf ( ) :
quadratic attenuation will have @ ref range ( ) implicitly set to
@ ref Constants : : inf ( ) :
@ snippet MagnumTrade . cpp LightData - populating - attenuation
@ snippet MagnumTrade . cpp LightData - populating - attenuation
And a @ ref Type : : Directional light that doesn ' t attenuate can be constructed
And a @ ref LightType : : Directional light that doesn ' t attenuate can be
without either , causing @ ref attenuation ( ) to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
constructed without either , causing @ ref attenuation ( ) to be
and @ ref range ( ) @ ref Constants : : inf ( ) , cancelling out the attenuation equation :
@ cpp { 1.0f , 0.0f , 0.0f } @ ce and @ ref range ( ) @ ref Constants : : inf ( ) , cancelling
out the attenuation equation :
@ snippet MagnumTrade . cpp LightData - populating - none
@ snippet MagnumTrade . cpp LightData - populating - none
@ -100,7 +159,7 @@ a simple inverse square: @f[
F_ { att } = \ lim_ { { \ color { m - info } R } \ to \ infty } \ frac { { \ color { m - dim } \ operatorname { clamp } ( } 1 \ mathbin { \ color { m - dim } - } { \ color { m - dim } ( \ frac { d } { R } ) ^ 4 , 0 , 1 ) ^ 2 } } { { \ color { m - success } K_c } + { \ color { m - dim } K_l d } \ mathbin { \ color { m - dim } + } { \ color { m - success } K_q } d ^ 2 } = \ frac { 1 } { 1 + d ^ 2 }
F_ { att } = \ lim_ { { \ color { m - info } R } \ to \ infty } \ frac { { \ color { m - dim } \ operatorname { clamp } ( } 1 \ mathbin { \ color { m - dim } - } { \ color { m - dim } ( \ frac { d } { R } ) ^ 4 , 0 , 1 ) ^ 2 } } { { \ color { m - success } K_c } + { \ color { m - dim } K_l d } \ mathbin { \ color { m - dim } + } { \ color { m - success } K_q } d ^ 2 } = \ frac { 1 } { 1 + d ^ 2 }
@ f ]
@ f ]
As a special case , a @ ref Type : : Directional light is defined by
As a special case , a @ ref Light Type: : Directional light is defined by
@ ref attenuation ( ) set to @ cpp { 1.0f , 0.0f , 0.0f } @ ce and @ ref range ( ) to
@ ref attenuation ( ) set to @ cpp { 1.0f , 0.0f , 0.0f } @ ce and @ ref range ( ) to
@ ref Constants : : inf ( ) - - - thus without any attenuation : @ f [
@ ref Constants : : inf ( ) - - - thus without any attenuation : @ f [
F_ { att } = \ lim_ { { \ color { m - info } R } \ to \ infty } \ frac { { \ color { m - dim } \ operatorname { clamp } ( } 1 \ mathbin { \ color { m - dim } - } { \ color { m - dim } ( \ frac { d } { R } ) ^ 4 , 0 , 1 ) ^ 2 } } { { \ color { m - success } K_c } \ mathbin { \ color { m - dim } + } { \ color { m - dim } K_l d + K_q d ^ 2 } } = 1
F_ { att } = \ lim_ { { \ color { m - info } R } \ to \ infty } \ frac { { \ color { m - dim } \ operatorname { clamp } ( } 1 \ mathbin { \ color { m - dim } - } { \ color { m - dim } ( \ frac { d } { R } ) ^ 4 , 0 , 1 ) ^ 2 } } { { \ color { m - success } K_c } \ mathbin { \ color { m - dim } + } { \ color { m - dim } K_l d + K_q d ^ 2 } } = 1
@ -109,67 +168,20 @@ As a special case, a @ref Type::Directional light is defined by
@ section Trade - LightData - units Units
@ section Trade - LightData - units Units
To follow physically - based principles in lighting calculation , intensity is
To follow physically - based principles in lighting calculation , intensity is
assumed to be in in * candela * ( lm / sr ) for @ ref Type : : Point and @ ref Type : : Spot ,
assumed to be in in * candela * ( lm / sr ) for @ ref Light Type: : Point and
and in * lux * ( lm / m < sup > 2 < / sup > ) for @ ref Type : : Directional . Distance @ f $ d @ f $
@ ref LightType : : Spot , and in * lux * ( lm / m < sup > 2 < / sup > ) for
is in meters .
@ ref LightType : : Directional . Distance @ f $ d @ f $ is in meters .
@ see @ ref AbstractImporter : : light ( )
@ see @ ref AbstractImporter : : light ( )
*/
*/
class MAGNUM_TRADE_EXPORT LightData {
class MAGNUM_TRADE_EXPORT LightData {
public :
public :
/**
# ifdef MAGNUM_BUILD_DEPRECATED
* @ brief Light type
/** @brief @copybrief LightType
*
* @ m_deprecated_since_latest Use @ ref LightType instead .
* @ see @ ref type ( )
* @ todo move this to LightType outside of the class for consistency
*/
*/
enum class Type : UnsignedByte {
typedef CORRADE_DEPRECATED ( " use LightType instead " ) LightType Type ;
/* Zero reserved for an invalid value */
# endif
/**
* Ambient light , without any position , direction or attenuation .
* Meant to be added to ambient color in Phong workflows , has no
* use in physically based workflows .
* @ m_since_latest
*/
Ambient = 1 ,
/**
* Light at a position that is infinitely far away , emitted in a
* direction of negative Z axis . The rotation is inherited from
* absolute object transformation ; scale and position don ' t affect
* the light in any way . Because the light is at infinite distance ,
* it ' s not attenuated in any way .
* @ m_since_latest
*/
Directional ,
# ifdef MAGNUM_BUILD_DEPRECATED
/**
* Directional light .
* @ m_deprecated_since_latest Use @ ref Type : : Directional instead .
*/
Infinite CORRADE_DEPRECATED_ENUM ( " use Type::Directional instead " ) = Directional ,
# endif
/**
* Point light , emitting light in all directions . The position is
* inherited from absolute object transformation ; scale and
* rotation don ' t affect the light in any way . Brightness
* attenuates depending on the @ ref range ( ) value .
*/
Point ,
/**
* Spot light , emitting light in a cone in direction of local
* negative Z axis . The position and rotation is inherited from
* absolute object transformation ; scale doesn ' t affect the light
* in any way . The angle and falloff of the cone is defined using
* @ ref innerConeAngle ( ) and @ ref outerConeAngle ( ) and brightness
* attenuates depending on the @ ref range ( ) value .
*/
Spot
} ;
/**
/**
* @ brief Constructor
* @ brief Constructor
@ -178,35 +190,37 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param attenuation Constant , linear and quadratic light
* @ param attenuation Constant , linear and quadratic light
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* for an @ ref Type : : Ambient and @ ref Type : : Directional light .
* for an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param range Light range , after which the intensity is
* @ param range Light range , after which the intensity is
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* an @ ref Type : : Ambient and @ ref Type : : Directional light .
* an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param innerConeAngle Inner cone angle . Expected to be greater
* @ param innerConeAngle Inner cone angle . Expected to be greater
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* @ p outerConeAngle for a @ ref Type : : Spot light ,
* @ p outerConeAngle for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param outerConeAngle Outer cone angle . Expected to be greater
* @ param outerConeAngle Outer cone angle . Expected to be greater
* than or equal to @ p innerConeAngle and less than or equal to
* than or equal to @ p innerConeAngle and less than or equal to
* @ cpp 360.0 _degf @ ce for a @ ref Type : : Spot light ,
* @ cpp 360.0 _degf @ ce for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
*
*
* This is a combined constructor including both attenuation and range
* This is a combined constructor including both attenuation and range
* parameters . Use @ ref LightData ( Type , const Color3 & , Float , const Vector3 & , Rad , Rad , const void * )
* parameters . Use @ ref LightData ( Light Type, const Color3 & , Float , const Vector3 & , Rad , Rad , const void * )
* for light data defined by just attenuation parameters and
* for light data defined by just attenuation parameters and
* @ ref LightData ( Type , const Color3 & , Float , Float , Rad , Rad , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , Float , Rad , Rad , const void * )
* for light data defined by a range alone , and
* for light data defined by a range alone , and
* @ ref LightData ( Type , const Color3 & , Float , Rad , Rad , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , Rad , Rad , const void * )
* for an implicit inverse square attenuation . See
* for an implicit inverse square attenuation . See
* @ ref Trade - LightData - attenuation for more information .
* @ ref Trade - LightData - attenuation for more information .
*
*
* For lights other than spot it may be more convenient to use
* For lights other than spot it may be more convenient to use
* @ ref LightData ( Type , const Color3 & , Float , const Vector3 & , Float , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , const Vector3 & , Float , const void * )
* and friends instead .
* and friends instead .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , Float range , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , Float range , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct with implicit cone angles
* @ brief Construct with implicit cone angles
@ -215,29 +229,31 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param attenuation Constant , linear and quadratic light
* @ param attenuation Constant , linear and quadratic light
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* for an @ ref Type : : Ambient and @ ref Type : : Directional light .
* for an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param range Light range , after which the intensity is
* @ param range Light range , after which the intensity is
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* an @ ref Type : : Ambient and @ ref Type : : Directional light .
* an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
*
*
* This is a combined constructor including both attenuation and range
* This is a combined constructor including both attenuation and range
* parameters . Use @ ref LightData ( Type , const Color3 & , Float , const Vector3 & , const void * )
* parameters . Use @ ref LightData ( Light Type, const Color3 & , Float , const Vector3 & , const void * )
* for light data defined by just attenuation parameters and
* for light data defined by just attenuation parameters and
* @ ref LightData ( Type , const Color3 & , Float , Float , const void * ) for
* @ ref LightData ( Light Type, const Color3 & , Float , Float , const void * )
* light data defined by a range alone , and
* for light data defined by a range alone , and
* @ ref LightData ( Type , const Color3 & , Float , const void * ) for an
* @ ref LightData ( Light Type, const Color3 & , Float , const void * ) for an
* implicit inverse square attenuation . See
* implicit inverse square attenuation . See
* @ ref Trade - LightData - attenuation for more information .
* @ ref Trade - LightData - attenuation for more information .
*
*
* For a @ ref Type : : Spot light , @ ref innerConeAngle ( ) is implicitly set
* For a @ ref Light Type: : Spot light , @ ref innerConeAngle ( ) is
* to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to @ cpp 90.0 _degf @ ce ,
* implicitly set to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to
* and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ cpp 90.0 _degf @ ce , and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ ref LightData ( Type , const Color3 & , Float , const Vector3 & , Float , Rad , Rad , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , const Vector3 & , Float , Rad , Rad , const void * )
* in order to specify cone angles as well .
* in order to specify cone angles as well .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , Float range , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , Float range , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct attenuation - based light data
* @ brief Construct attenuation - based light data
@ -246,14 +262,15 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param attenuation Constant , linear and quadratic light
* @ param attenuation Constant , linear and quadratic light
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* for an @ ref Type : : Ambient and @ ref Type : : Directional light .
* for an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param innerConeAngle Inner cone angle . Expected to be greater
* @ param innerConeAngle Inner cone angle . Expected to be greater
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* @ p outerConeAngle for a @ ref Type : : Spot light ,
* @ p outerConeAngle for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param outerConeAngle Inner cone angle . Expected to be greater
* @ param outerConeAngle Inner cone angle . Expected to be greater
* than or equal to @ p innerConeAngle and less than or equal to
* than or equal to @ p innerConeAngle and less than or equal to
* @ cpp 360.0 _degf @ ce for a @ ref Type : : Spot light ,
* @ cpp 360.0 _degf @ ce for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
@ -262,10 +279,10 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ ref Trade - LightData - attenuation for more information .
* @ ref Trade - LightData - attenuation for more information .
*
*
* For lights other than spot it may be more convenient to use
* For lights other than spot it may be more convenient to use
* @ ref LightData ( Type , const Color3 & , Float , const Vector3 & , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , const Vector3 & , const void * )
* instead .
* instead .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct attenuation - based light data with implicit cone angles
* @ brief Construct attenuation - based light data with implicit cone angles
@ -274,20 +291,21 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param attenuation Constant , linear and quadratic light
* @ param attenuation Constant , linear and quadratic light
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* attenuation factor . Expected to be @ cpp { 1.0f , 0.0f , 0.0f } @ ce
* for an @ ref Type : : Ambient and @ ref Type : : Directional light .
* for an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
*
*
* The @ ref range ( ) is implicitly set to @ ref Constants : : inf ( ) . See
* The @ ref range ( ) is implicitly set to @ ref Constants : : inf ( ) . See
* @ ref Trade - LightData - attenuation for more information .
* @ ref Trade - LightData - attenuation for more information .
*
*
* For a @ ref Type : : Spot light , @ ref innerConeAngle ( ) is implicitly set
* For a @ ref Light Type: : Spot light , @ ref innerConeAngle ( ) is
* to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to @ cpp 90.0 _degf @ ce ,
* implicitly set to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to
* and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ cpp 90.0 _degf @ ce , and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ ref LightData ( Type , const Color3 & , Float , const Vector3 & , Rad , Rad , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , const Vector3 & , Rad , Rad , const void * )
* in order to specify cone angles as well .
* in order to specify cone angles as well .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , const Vector3 & attenuation , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct range - based light data
* @ brief Construct range - based light data
@ -296,29 +314,30 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param range Light range , after which the intensity is
* @ param range Light range , after which the intensity is
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* an @ ref Type : : Ambient and @ ref Type : : Directional light .
* an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param innerConeAngle Inner cone angle . Expected to be greater
* @ param innerConeAngle Inner cone angle . Expected to be greater
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* @ p outerConeAngle for a @ ref Type : : Spot light ,
* @ p outerConeAngle for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param outerConeAngle Outer cone angle . Expected to be greater
* @ param outerConeAngle Outer cone angle . Expected to be greater
* than or equal to @ p innerConeAngle and less than or equal to
* than or equal to @ p innerConeAngle and less than or equal to
* @ cpp 360.0 _degf @ ce for a @ ref Type : : Spot light ,
* @ cpp 360.0 _degf @ ce for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
*
*
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* for a @ ref Type : : Point and @ ref Type : : Spot light and to
* for a @ ref Light Type: : Point and @ ref Light Type: : Spot light and to
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Type : : Ambient and
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Light Type: : Ambient and
* @ ref Type : : Directional light . See @ ref Trade - LightData - attenuation
* @ ref Light Type: : Directional light . See
* for more information .
* @ ref Trade - LightData - attenuation for more information .
*
*
* For lights other than spot it may be more convenient to use
* For lights other than spot it may be more convenient to use
* @ ref LightData ( Type , const Color3 & , Float , Float , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , Float , const void * )
* instead .
* instead .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , Float range , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , Float range , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct range - based light data with implicit cone angles
* @ brief Construct range - based light data with implicit cone angles
@ -327,23 +346,24 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param range Light range , after which the intensity is
* @ param range Light range , after which the intensity is
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* considered to be zero . Expected to be @ ref Constants : : inf ( ) for
* an @ ref Type : : Ambient and @ ref Type : : Directional light .
* an @ ref LightType : : Ambient and @ ref LightType : : Directional
* light .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
*
*
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* for a @ ref Type : : Point and @ ref Type : : Spot light and to
* for a @ ref Light Type: : Point and @ ref Light Type: : Spot light and to
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Type : : Ambient and
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Light Type: : Ambient and
* @ ref Type : : Directional light . See @ ref Trade - LightData - attenuation
* @ ref Light Type: : Directional light . See
* for more information .
* @ ref Trade - LightData - attenuation for more information .
*
*
* For a @ ref Type : : Spot light , @ ref innerConeAngle ( ) is implicitly set
* For a @ ref Light Type: : Spot light , @ ref innerConeAngle ( ) is
* to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to @ cpp 90.0 _degf @ ce ,
* implicitly set to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to
* and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ cpp 90.0 _degf @ ce , and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ ref LightData ( Type , const Color3 & , Float , Float , Rad , Rad , const void * )
* @ ref LightData ( Light Type, const Color3 & , Float , Float , Rad , Rad , const void * )
* in order to specify cone angles as well .
* in order to specify cone angles as well .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , Float range , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , Float range , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct light data with implicit attenuation
* @ brief Construct light data with implicit attenuation
@ -352,26 +372,27 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param intensity Light intensity
* @ param intensity Light intensity
* @ param innerConeAngle Inner cone angle . Expected to be greater
* @ param innerConeAngle Inner cone angle . Expected to be greater
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* than or equal to @ cpp 0.0 _degf @ ce and less than or equal to
* @ p outerConeAngle for a @ ref Type : : Spot light ,
* @ p outerConeAngle for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param outerConeAngle Outer cone angle . Expected to be greater
* @ param outerConeAngle Outer cone angle . Expected to be greater
* than or equal to @ p innerConeAngle and less than or equal to
* than or equal to @ p innerConeAngle and less than or equal to
* @ cpp 360.0 _degf @ ce for a @ ref Type : : Spot light ,
* @ cpp 360.0 _degf @ ce for a @ ref Light Type: : Spot light ,
* @ cpp 360.0 _degf @ ce otherwise .
* @ cpp 360.0 _degf @ ce otherwise .
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
* @ m_since_latest
* @ m_since_latest
*
*
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* for a @ ref Type : : Point and @ ref Type : : Spot light and to
* for a @ ref Light Type: : Point and @ ref Light Type: : Spot light and to
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Type : : Ambient and
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Light Type: : Ambient and
* @ ref Type : : Directional light ; @ ref range ( ) is always
* @ ref Light Type: : Directional light ; @ ref range ( ) is always
* @ ref Constants : : inf ( ) . See @ ref Trade - LightData - attenuation for more
* @ ref Constants : : inf ( ) . See @ ref Trade - LightData - attenuation for more
* information .
* information .
*
*
* For lights other than spot it may be more convenient to use
* For lights other than spot it may be more convenient to use
* @ ref LightData ( Type , const Color3 & , Float , const void * ) instead .
* @ ref LightData ( LightType , const Color3 & , Float , const void * )
* instead .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , Rad innerConeAngle , Rad outerConeAngle , const void * importerState = nullptr ) noexcept ;
/**
/**
* @ brief Construct light data with implicit attenuation and cone angles
* @ brief Construct light data with implicit attenuation and cone angles
@ -381,19 +402,19 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ param importerState Importer - specific state
* @ param importerState Importer - specific state
*
*
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* The @ ref attenuation ( ) is implicitly set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce
* for a @ ref Type : : Point and @ ref Type : : Spot light and to
* for a @ ref Light Type: : Point and @ ref Light Type: : Spot light and to
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Type : : Ambient and
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Light Type: : Ambient and
* @ ref Type : : Directional light ; @ ref range ( ) is always
* @ ref Light Type: : Directional light ; @ ref range ( ) is always
* @ ref Constants : : inf ( ) . See @ ref Trade - LightData - attenuation for more
* @ ref Constants : : inf ( ) . See @ ref Trade - LightData - attenuation for more
* information .
* information .
*
*
* For a @ ref Type : : Spot light , @ ref innerConeAngle ( ) is implicitly set
* For a @ ref Light Type: : Spot light , @ ref innerConeAngle ( ) is
* to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to @ cpp 90.0 _degf @ ce ,
* implicitly set to @ cpp 0.0 _degf @ ce and @ ref outerConeAngle ( ) to
* and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ cpp 90.0 _degf @ ce , and both are @ cpp 360.0 _degf @ ce otherwise . Use
* @ ref LightData ( Type , const Color3 & , Float , Rad , Rad , const void * ) in
* @ ref LightData ( Light Type, const Color3 & , Float , Rad , Rad , const void * )
* order to specify cone angles as well .
* in order to specify cone angles as well .
*/
*/
explicit LightData ( Type type , const Color3 & color , Float intensity , const void * importerState = nullptr ) noexcept ;
explicit LightData ( Light Type type , const Color3 & color , Float intensity , const void * importerState = nullptr ) noexcept ;
/** @brief Copying is not allowed */
/** @brief Copying is not allowed */
LightData ( const LightData & ) = delete ;
LightData ( const LightData & ) = delete ;
@ -408,7 +429,7 @@ class MAGNUM_TRADE_EXPORT LightData {
LightData & operator = ( LightData & & ) noexcept = default ;
LightData & operator = ( LightData & & ) noexcept = default ;
/** @brief Light type */
/** @brief Light type */
Type type ( ) const { return _type ; }
Light Type type ( ) const { return _type ; }
/** @brief Light color */
/** @brief Light color */
Color3 color ( ) const { return _color ; }
Color3 color ( ) const { return _color ; }
@ -416,9 +437,9 @@ class MAGNUM_TRADE_EXPORT LightData {
/**
/**
* @ brief Light intensity
* @ brief Light intensity
*
*
* Defined in * candela * ( lm / sr ) for @ ref Type : : Point and
* Defined in * candela * ( lm / sr ) for @ ref Light Type: : Point and
* @ ref Type : : Spot , and in * lux * ( lm / m < sup > 2 < / sup > ) for
* @ ref Light Type: : Spot , and in * lux * ( lm / m < sup > 2 < / sup > ) for
* @ ref Type : : Directional .
* @ ref Light Type: : Directional .
*/
*/
Float intensity ( ) const { return _intensity ; }
Float intensity ( ) const { return _intensity ; }
@ -429,11 +450,11 @@ class MAGNUM_TRADE_EXPORT LightData {
* Values of @ f $ \ color { m - success } K_c @ f $ ,
* Values of @ f $ \ color { m - success } K_c @ f $ ,
* @ f $ \ color { m - success } K_l @ f $ and @ f $ \ color { m - success } K_q @ f $ in
* @ f $ \ color { m - success } K_l @ f $ and @ f $ \ color { m - success } K_q @ f $ in
* the @ ref Trade - LightData - attenuation " attenuation equation " . Always
* the @ ref Trade - LightData - attenuation " attenuation equation " . Always
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Type : : Ambient and
* @ cpp { 1.0f , 0.0f , 0.0f } @ ce for an @ ref Light Type: : Ambient and
* @ ref Type : : Directional light , set to @ cpp { 1.0f , 0.0f , 1.0f } @ ce for
* @ ref Light Type: : Directional light , set to
* range - based attenuation - - - and if @ ref range ( ) is
* @ cpp { 1.0f , 0.0f , 1.0f } @ ce for range - based attenuation - - - and if
* @ ref Constants : : inf ( ) as well , the attenuation equation is simply
* @ ref range ( ) is @ ref Constants : : inf ( ) as well , the attenuation
* @ f $ F_ { att } = \ frac { 1 } { 1 + d ^ 2 } @ f $ .
* equation is simply @ f $ F_ { att } = \ frac { 1 } { 1 + d ^ 2 } @ f $ .
*/
*/
Vector3 attenuation ( ) const { return _attenuation ; }
Vector3 attenuation ( ) const { return _attenuation ; }
@ -450,7 +471,8 @@ class MAGNUM_TRADE_EXPORT LightData {
* - if @ ref attenuation ( ) is @ cpp { 1.0f , 0.0f , 0.0f } @ ce , the
* - if @ ref attenuation ( ) is @ cpp { 1.0f , 0.0f , 0.0f } @ ce , the
* attenuation equation is @ f $ F_ { att } = 1 @ f $ .
* attenuation equation is @ f $ F_ { att } = 1 @ f $ .
*
*
* The latter is always the case for a @ ref Type : : Directional light .
* The latter is always the case for a @ ref LightType : : Directional
* light .
*/
*/
Float range ( ) const { return _range ; }
Float range ( ) const { return _range ; }
@ -458,9 +480,9 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ brief Inner cone angle
* @ brief Inner cone angle
* @ m_since_latest
* @ m_since_latest
*
*
* For a @ ref Type : : Spot light , it ' s always less than
* For a @ ref Light Type: : Spot light , it ' s always less than
* @ ref outerConeAngle ( ) . For a @ ref Type : : Directional or
* @ ref outerConeAngle ( ) . For a @ ref Light Type: : Directional or
* @ ref Type : : Point light it ' s always @ cpp 360.0 _degf @ ce .
* @ ref Light Type: : Point light it ' s always @ cpp 360.0 _degf @ ce .
*/
*/
Rad innerConeAngle ( ) const { return _innerConeAngle ; }
Rad innerConeAngle ( ) const { return _innerConeAngle ; }
@ -468,10 +490,10 @@ class MAGNUM_TRADE_EXPORT LightData {
* @ brief Outer cone angle
* @ brief Outer cone angle
* @ m_since_latest
* @ m_since_latest
*
*
* For a @ ref Type : : Spot light , it ' s always greater than
* For a @ ref Light Type: : Spot light , it ' s always greater than
* @ ref outerConeAngle ( ) and less than or equal to @ cpp 90.0 _degf @ ce .
* @ ref outerConeAngle ( ) and less than or equal to @ cpp 90.0 _degf @ ce .
* For a @ ref Type : : Directional or @ ref Type : : Point light it ' s always
* For a @ ref Light Type: : Directional or @ ref Light Type: : Point light
* @ cpp 360.0 _degf @ ce .
* it ' s always @ cpp 360.0 _degf @ ce .
*/
*/
Rad outerConeAngle ( ) const { return _outerConeAngle ; }
Rad outerConeAngle ( ) const { return _outerConeAngle ; }
@ -483,7 +505,7 @@ class MAGNUM_TRADE_EXPORT LightData {
const void * importerState ( ) const { return _importerState ; }
const void * importerState ( ) const { return _importerState ; }
private :
private :
Type _type ;
Light Type _type ;
Vector3 _color ;
Vector3 _color ;
Float _intensity ;
Float _intensity ;
Vector3 _attenuation ;
Vector3 _attenuation ;
@ -492,9 +514,6 @@ class MAGNUM_TRADE_EXPORT LightData {
const void * _importerState ;
const void * _importerState ;
} ;
} ;
/** @debugoperatorclassenum{LightData,LightData::Type} */
MAGNUM_TRADE_EXPORT Debug & operator < < ( Debug & debug , LightData : : Type value ) ;
} }
} }
# endif
# endif