mirror of https://github.com/mosra/magnum.git
Browse Source
This is a bit huge because of all the new overloads that take a MaterialLayer instead of a string, but all that is just boring boilerplate. Additionally this: * exposes glTF clear coat parameters (which, interestingly enough, reuse existing attributes and don't introduce any new) * provides a convenience wrapper in PbrClearCoatMaterialData * and a convenience base for material layer wrappers that redirect all APIs with implicit layer argument to desired layer instead of the base materialpull/459/head
10 changed files with 1341 additions and 8 deletions
@ -0,0 +1,29 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||
2020 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
/* See Magnum/Trade/MaterialData.cpp and Magnum/Trade/Test/MaterialDataTest.cpp */ |
||||
#ifdef _c |
||||
_c(ClearCoat) |
||||
#endif |
||||
@ -0,0 +1,255 @@
|
||||
#ifndef Magnum_Trade_MaterialLayerData_h |
||||
#define Magnum_Trade_MaterialLayerData_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||
2020 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
/** @file
|
||||
* @brief Class @ref Magnum::Trade::MaterialLayerData |
||||
* @m_since_latest |
||||
*/ |
||||
|
||||
#include "Magnum/Math/Matrix3.h" |
||||
#include "Magnum/Trade/MaterialData.h" |
||||
|
||||
namespace Magnum { namespace Trade { |
||||
|
||||
/**
|
||||
@brief Material layer data |
||||
@m_since_latest |
||||
|
||||
Convenience wrapper that re-routes all @ref MaterialData base material layer |
||||
and attribute accessors APIS from to a layer specified in the @p layer template |
||||
parameter. All APIs expect that given layer exists. |
||||
*/ |
||||
template<MaterialLayer layer> class MaterialLayerData: public MaterialData { |
||||
public: |
||||
/* Allow constructing subclasses directly. While not used in the
|
||||
general Importer workflow, it allows users to create instances with |
||||
desired convenience APIs easier (and simplifies testing) */ |
||||
using MaterialData::MaterialData; |
||||
|
||||
/* Bring in all other overloads as well and override just the ones
|
||||
with implicit layers */ |
||||
using MaterialData::layerName; |
||||
using MaterialData::layerFactor; |
||||
using MaterialData::layerFactorTexture; |
||||
using MaterialData::layerFactorTextureSwizzle; |
||||
using MaterialData::layerFactorTextureMatrix; |
||||
using MaterialData::layerFactorTextureCoordinates; |
||||
using MaterialData::attributeCount; |
||||
using MaterialData::hasAttribute; |
||||
using MaterialData::attributeId; |
||||
using MaterialData::attributeName; |
||||
using MaterialData::attributeType; |
||||
using MaterialData::attribute; |
||||
using MaterialData::tryAttribute; |
||||
using MaterialData::attributeOr; |
||||
|
||||
/**
|
||||
* @brief Layer name |
||||
* |
||||
* Same as calling @ref MaterialData::layerName() with @ref layerId() |
||||
* for @p layer. |
||||
*/ |
||||
Containers::StringView layerName() const { |
||||
return MaterialData::layerName(layerId(layer)); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Layer factor |
||||
* |
||||
* Same as calling @ref MaterialData::layerFactor() with @p layer. |
||||
*/ |
||||
Float layerFactor() const { |
||||
return MaterialData::layerFactor(layer); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Layer factor texture ID |
||||
* |
||||
* Same as calling @ref MaterialData::layerFactorTexture() with |
||||
* @p layer. |
||||
*/ |
||||
UnsignedInt layerFactorTexture() const { |
||||
return MaterialData::layerFactorTexture(layer); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Layer factor texture swizzle |
||||
* |
||||
* Same as calling @ref MaterialData::layerFactorTextureSwizzle() with |
||||
* @p layer. |
||||
*/ |
||||
MaterialTextureSwizzle layerFactorTextureSwizzle() const { |
||||
return MaterialData::layerFactorTextureSwizzle(layer); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Layer factor texture coordinate transformation matrix |
||||
* |
||||
* Same as calling @ref MaterialData::layerFactorTextureMatrix() with |
||||
* @p layer. |
||||
*/ |
||||
Matrix3 layerFactorTextureMatrix() const { |
||||
return MaterialData::layerFactorTextureMatrix(layer); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Layer factor texture coordinate set |
||||
* |
||||
* Same as calling @ref MaterialData::layerFactorTextureCoordinates() |
||||
* with @p layer. |
||||
*/ |
||||
UnsignedInt layerFactorTextureCoordinates() const { |
||||
return MaterialData::layerFactorTextureCoordinates(layer); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Attribute count in this layer |
||||
* |
||||
* Same as calling @ref MaterialData::attributeCount() with @p layer. |
||||
*/ |
||||
UnsignedInt attributeCount() const { |
||||
return MaterialData::attributeCount(layer); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Whether this layer has given attribute |
||||
* |
||||
* Same as calling @ref MaterialData::hasAttribute() with @p layer. |
||||
*/ |
||||
bool hasAttribute(Containers::StringView name) const { |
||||
return MaterialData::hasAttribute(layer, name); |
||||
} |
||||
bool hasAttribute(MaterialAttribute name) const { |
||||
return MaterialData::hasAttribute(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief ID of a named attribute in this layer |
||||
* |
||||
* Same as calling @ref MaterialData::attributeId() with @p layer. |
||||
*/ |
||||
UnsignedInt attributeId(Containers::StringView name) const { |
||||
return MaterialData::attributeId(layer, name); |
||||
} |
||||
UnsignedInt attributeId(MaterialAttribute name) const { |
||||
return MaterialData::attributeId(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief Name of an attribute in this layer |
||||
* |
||||
* Same as calling @ref MaterialData::attributeName() with @p layer. |
||||
*/ |
||||
Containers::StringView attributeName(UnsignedInt id) const { |
||||
return MaterialData::attributeName(layer, id); |
||||
} |
||||
|
||||
/**
|
||||
* @brief Type of an attribute in this layer |
||||
* |
||||
* Same as calling @ref MaterialData::attributeType() with @p layer. |
||||
*/ |
||||
MaterialAttributeType attributeType(UnsignedInt id) const { |
||||
return MaterialData::attributeType(layer, id); |
||||
} |
||||
MaterialAttributeType attributeType(Containers::StringView name) const { |
||||
return MaterialData::attributeType(layer, name); |
||||
} /**< @overload */ |
||||
MaterialAttributeType attributeType(MaterialAttribute name) const { |
||||
return MaterialData::attributeType(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief Type-erased value of an attribute in this layer |
||||
* |
||||
* Same as calling @ref MaterialData::attribute() with @p layer. |
||||
*/ |
||||
const void* attribute(UnsignedInt id) const { |
||||
return MaterialData::attribute(layer, id); |
||||
} |
||||
const void* attribute(Containers::StringView name) const { |
||||
return MaterialData::attribute(layer, name); |
||||
} /**< @overload */ |
||||
const void* attribute(MaterialAttribute name) const { |
||||
return MaterialData::attribute(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief Value of an attribute in this layer |
||||
* |
||||
* Same as calling @ref MaterialData::attribute() with @p layer. |
||||
*/ |
||||
template<class T> T attribute(UnsignedInt id) const { |
||||
return MaterialData::attribute<T>(layer, id); |
||||
} |
||||
template<class T> T attribute(Containers::StringView name) const { |
||||
return MaterialData::attribute<T>(layer, name); |
||||
} /**< @overload */ |
||||
template<class T> T attribute(MaterialAttribute name) const { |
||||
return MaterialData::attribute<T>(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief Type-erased attribute value in this layer, if exists |
||||
* |
||||
* Same as calling @ref MaterialData::tryAttribute() with @p layer. |
||||
*/ |
||||
const void* tryAttribute(Containers::StringView name) const { |
||||
return MaterialData::tryAttribute(layer, name); |
||||
} |
||||
const void* tryAttribute(MaterialAttribute name) const { |
||||
return MaterialData::tryAttribute(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief Value of a named attribute in this layer, if exists |
||||
* |
||||
* Same as calling @ref MaterialData::tryAttribute() with @p layer. |
||||
*/ |
||||
template<class T> Containers::Optional<T> tryAttribute(Containers::StringView name) const { |
||||
return MaterialData::tryAttribute<T>(layer, name); |
||||
} |
||||
template<class T> Containers::Optional<T> tryAttribute(MaterialAttribute name) const { |
||||
return MaterialData::tryAttribute<T>(layer, name); |
||||
} /**< @overload */ |
||||
|
||||
/**
|
||||
* @brief Value of a named attribute in this layer or a default |
||||
* |
||||
* Same as calling @ref MaterialData::attributeOr() with @p layer. |
||||
*/ |
||||
template<class T> T attributeOr(Containers::StringView name, const T& defaultValue) const { |
||||
return MaterialData::attributeOr<T>(layer, name, defaultValue); |
||||
} |
||||
template<class T> T attributeOr(MaterialAttribute name, const T& defaultValue) const { |
||||
return MaterialData::attributeOr<T>(layer, name, defaultValue); |
||||
} /**< @overload */ |
||||
}; |
||||
|
||||
}} |
||||
|
||||
#endif |
||||
@ -0,0 +1,110 @@
|
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||
2020 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
#include "PbrClearCoatMaterialData.h" |
||||
|
||||
namespace Magnum { namespace Trade { |
||||
|
||||
bool PbrClearCoatMaterialData::hasTextureTransformation() const { |
||||
return hasAttribute(MaterialAttribute::LayerFactorTextureMatrix) || |
||||
hasAttribute(MaterialAttribute::RoughnessTextureMatrix) || |
||||
hasAttribute(MaterialAttribute::NormalTextureMatrix) || |
||||
hasAttribute(MaterialAttribute::TextureMatrix) || |
||||
hasAttribute(0, MaterialAttribute::TextureMatrix); |
||||
} |
||||
|
||||
bool PbrClearCoatMaterialData::hasTextureCoordinates() const { |
||||
return hasAttribute(MaterialAttribute::LayerFactorTextureCoordinates) || |
||||
hasAttribute(MaterialAttribute::RoughnessTextureCoordinates) || |
||||
hasAttribute(MaterialAttribute::NormalTextureCoordinates) || |
||||
hasAttribute(MaterialAttribute::TextureCoordinates) || |
||||
hasAttribute(0, MaterialAttribute::TextureCoordinates); |
||||
} |
||||
|
||||
Float PbrClearCoatMaterialData::roughness() const { |
||||
return attributeOr(MaterialAttribute::Roughness, 0.0f); |
||||
} |
||||
|
||||
UnsignedInt PbrClearCoatMaterialData::roughnessTexture() const { |
||||
return attribute<UnsignedInt>(MaterialAttribute::RoughnessTexture); |
||||
} |
||||
|
||||
MaterialTextureSwizzle PbrClearCoatMaterialData::roughnessTextureSwizzle() const { |
||||
CORRADE_ASSERT(hasAttribute(MaterialAttribute::RoughnessTexture), |
||||
"Trade::PbrClearCoatMaterialData::roughnessTextureSwizzle(): the layer doesn't have a roughness texture", {}); |
||||
return attributeOr(MaterialAttribute::RoughnessTextureSwizzle, MaterialTextureSwizzle::R); |
||||
} |
||||
|
||||
Matrix3 PbrClearCoatMaterialData::roughnessTextureMatrix() const { |
||||
CORRADE_ASSERT(hasAttribute(MaterialAttribute::RoughnessTexture), |
||||
"Trade::PbrClearCoatMaterialData::roughnessTextureMatrix(): the layer doesn't have a roughness texture", {}); |
||||
if(Containers::Optional<Matrix3> value = tryAttribute<Matrix3>(MaterialAttribute::RoughnessTextureMatrix)) |
||||
return *value; |
||||
if(Containers::Optional<Matrix3> value = tryAttribute<Matrix3>(MaterialAttribute::TextureMatrix)) |
||||
return *value; |
||||
return attributeOr(0, MaterialAttribute::TextureMatrix, Matrix3{}); |
||||
} |
||||
|
||||
UnsignedInt PbrClearCoatMaterialData::roughnessTextureCoordinates() const { |
||||
CORRADE_ASSERT(hasAttribute(MaterialAttribute::RoughnessTexture), |
||||
"Trade::PbrClearCoatMaterialData::roughnessTextureCoordinates(): the layer doesn't have a roughness texture", {}); |
||||
if(Containers::Optional<UnsignedInt> value = tryAttribute<UnsignedInt>(MaterialAttribute::RoughnessTextureCoordinates)) |
||||
return *value; |
||||
if(Containers::Optional<UnsignedInt> value = tryAttribute<UnsignedInt>(MaterialAttribute::TextureCoordinates)) |
||||
return *value; |
||||
return attributeOr(0, MaterialAttribute::TextureCoordinates, 0u); |
||||
} |
||||
|
||||
UnsignedInt PbrClearCoatMaterialData::normalTexture() const { |
||||
return attribute<UnsignedInt>(MaterialAttribute::NormalTexture); |
||||
} |
||||
|
||||
MaterialTextureSwizzle PbrClearCoatMaterialData::normalTextureSwizzle() const { |
||||
CORRADE_ASSERT(hasAttribute(MaterialAttribute::NormalTexture), |
||||
"Trade::PbrClearCoatMaterialData::normalTextureSwizzle(): the layer doesn't have a normal texture", {}); |
||||
return attributeOr(MaterialAttribute::NormalTextureSwizzle, MaterialTextureSwizzle::RGB); |
||||
} |
||||
|
||||
Matrix3 PbrClearCoatMaterialData::normalTextureMatrix() const { |
||||
CORRADE_ASSERT(hasAttribute(MaterialAttribute::NormalTexture), |
||||
"Trade::PbrClearCoatMaterialData::normalTextureMatrix(): the layer doesn't have a normal texture", {}); |
||||
if(Containers::Optional<Matrix3> value = tryAttribute<Matrix3>(MaterialAttribute::NormalTextureMatrix)) |
||||
return *value; |
||||
if(Containers::Optional<Matrix3> value = tryAttribute<Matrix3>(MaterialAttribute::TextureMatrix)) |
||||
return *value; |
||||
return attributeOr(0, MaterialAttribute::TextureMatrix, Matrix3{}); |
||||
} |
||||
|
||||
UnsignedInt PbrClearCoatMaterialData::normalTextureCoordinates() const { |
||||
CORRADE_ASSERT(hasAttribute(MaterialAttribute::NormalTexture), |
||||
"Trade::PbrClearCoatMaterialData::normalTextureCoordinates(): the layer doesn't have a normal texture", {}); |
||||
if(Containers::Optional<UnsignedInt> value = tryAttribute<UnsignedInt>(MaterialAttribute::NormalTextureCoordinates)) |
||||
return *value; |
||||
if(Containers::Optional<UnsignedInt> value = tryAttribute<UnsignedInt>(MaterialAttribute::TextureCoordinates)) |
||||
return *value; |
||||
return attributeOr(0, MaterialAttribute::TextureCoordinates, 0u); |
||||
} |
||||
|
||||
}} |
||||
@ -0,0 +1,193 @@
|
||||
#ifndef Magnum_Trade_PbrClearCoatMaterialData_h |
||||
#define Magnum_Trade_PbrClearCoatMaterialData_h |
||||
/*
|
||||
This file is part of Magnum. |
||||
|
||||
Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, |
||||
2020 Vladimír Vondruš <mosra@centrum.cz> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a |
||||
copy of this software and associated documentation files (the "Software"), |
||||
to deal in the Software without restriction, including without limitation |
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense, |
||||
and/or sell copies of the Software, and to permit persons to whom the |
||||
Software is furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included |
||||
in all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
||||
DEALINGS IN THE SOFTWARE. |
||||
*/ |
||||
|
||||
/** @file
|
||||
* @brief Class @ref Magnum::Trade::PbrClearCoatMaterialData |
||||
* @m_since_latest |
||||
*/ |
||||
|
||||
#include "Magnum/Trade/MaterialLayerData.h" |
||||
|
||||
namespace Magnum { namespace Trade { |
||||
|
||||
/**
|
||||
@brief Clear coat material layer data |
||||
@m_since_latest |
||||
|
||||
Exposes properties of a @ref MaterialLayer::ClearCoat layer. All APIs expect |
||||
that the layer is present in the material. |
||||
@see @ref AbstractImporter::material(), @ref MaterialType::PbrClearCoat |
||||
*/ |
||||
class MAGNUM_TRADE_EXPORT PbrClearCoatMaterialData: public MaterialLayerData<MaterialLayer::ClearCoat> { |
||||
public: |
||||
#ifndef DOXYGEN_GENERATING_OUTPUT |
||||
/* Allow constructing subclasses directly. While not used in the
|
||||
general Importer workflow, it allows users to create instances with |
||||
desired convenience APIs easier (and simplifies testing). It's |
||||
however hidden from the docs as constructing instances this way |
||||
isn't really common and it would add a lot of noise. */ |
||||
using MaterialLayerData<MaterialLayer::ClearCoat>::MaterialLayerData; |
||||
#endif |
||||
|
||||
/**
|
||||
* @brief Whether the material has texture transformation |
||||
* |
||||
* Returns @cpp true @ce if any of the |
||||
* @ref MaterialAttribute::LayerFactorTextureMatrix, |
||||
* @ref MaterialAttribute::RoughnessTextureMatrix, |
||||
* @ref MaterialAttribute::NormalTextureMatrix or |
||||
* @ref MaterialAttribute::TextureMatrix attributes are present in this |
||||
* layer or if @ref MaterialAttribute::TextureMatrix is present in the |
||||
* base material, @cpp false @ce otherwise |
||||
*/ |
||||
bool hasTextureTransformation() const; |
||||
|
||||
/**
|
||||
* @brief Whether the material uses extra texture coordinate sets |
||||
* |
||||
* Returns @cpp true @ce if any of the |
||||
* @ref MaterialAttribute::LayerFactorTextureCoordinates, |
||||
* @ref MaterialAttribute::RoughnessTextureCoordinates, |
||||
* @ref MaterialAttribute::NormalTextureCoordinates or |
||||
* @ref MaterialAttribute::TextureCoordinates attributes are present in |
||||
* this material or if @ref MaterialAttribute::TextureCoordinates is |
||||
* present in the base material, @cpp false @ce otherwise. |
||||
*/ |
||||
bool hasTextureCoordinates() const; |
||||
|
||||
/**
|
||||
* @brief Roughness factor |
||||
* |
||||
* Convenience access to the @ref MaterialAttribute::Roughness |
||||
* attribute in this layer. If not present, the default is @cpp 1.0f @ce. |
||||
* |
||||
* If the layer has a @ref MaterialAttribute::RoughnessTexture, the |
||||
* factor and texture is meant to be multiplied together. |
||||
*/ |
||||
Float roughness() const; |
||||
|
||||
/**
|
||||
* @brief Roughness texture ID |
||||
* |
||||
* Available only if @ref MaterialAttribute::RoughnessTexture is |
||||
* present in this layer. Meant to be multiplied with @ref roughness(). |
||||
* @see @ref AbstractImporter::texture() |
||||
*/ |
||||
UnsignedInt roughnessTexture() const; |
||||
|
||||
/**
|
||||
* @brief Roughness texture swizzle |
||||
* |
||||
* Convenience access to the @ref MaterialAttribute::RoughnessTextureSwizzle |
||||
* attribute in this layer. If not present, the default is @cpp 1.0f @ce. |
||||
* Available only if @ref MaterialAttribute::RoughnessTexture is |
||||
* present in this layer. |
||||
* @see @ref hasAttribute() |
||||
*/ |
||||
MaterialTextureSwizzle roughnessTextureSwizzle() const; |
||||
|
||||
/**
|
||||
* @brief Roughness texture coordinate transformation matrix |
||||
* |
||||
* Convenience access to the @ref MaterialAttribute::RoughnessTextureMatrix |
||||
* / @ref MaterialAttribute::TextureMatrix attributes in this layer or |
||||
* a @ref MaterialAttribute::TextureMatrix attribute in the base |
||||
* material. If neither is present, the default is an identity matrix. |
||||
* Available only if @ref MaterialAttribute::RoughnessTexture is |
||||
* present in this layer. |
||||
* @see @ref hasAttribute() |
||||
*/ |
||||
Matrix3 roughnessTextureMatrix() const; |
||||
|
||||
/**
|
||||
* @brief Roughness texture coordinate set |
||||
* |
||||
* Convenience access to the @ref MaterialAttribute::RoughnessTextureCoordinates |
||||
* / @ref MaterialAttribute::TextureCoordinates attributes in this |
||||
* layer or a @ref MaterialAttribute::TextureCoordinates attribute in |
||||
* the base material. If neither is present, the default is @cpp 0 @ce. |
||||
* Available only if @ref MaterialAttribute::RoughnessTexture is |
||||
* present in this layer. |
||||
* @see @ref hasAttribute() |
||||
*/ |
||||
UnsignedInt roughnessTextureCoordinates() const; |
||||
|
||||
/**
|
||||
* @brief Normal texture ID |
||||
* |
||||
* Available only if @ref MaterialAttribute::NormalTexture is present |
||||
* in this layer. |
||||
* @see @ref hasAttribute(), @ref AbstractImporter::texture() |
||||
*/ |
||||
UnsignedInt normalTexture() const; |
||||
|
||||
/**
|
||||
* @brief Normal texture swizzle |
||||
* |
||||
* Convenience access to the |
||||
* @ref MaterialAttribute::NormalTextureSwizzle attribute in this |
||||
* layer. If not present, the default is |
||||
* @ref MaterialTextureSwizzle::RGB. Available only if |
||||
* @ref MaterialAttribute::NormalTexture is present in this layer. |
||||
* |
||||
* The texture can be also just two-component, in which case the |
||||
* remaining component is implicit and calculated as |
||||
* @f$ z = \sqrt{1 - x^2 - y^2} @f$. |
||||
* @see @ref hasAttribute() |
||||
*/ |
||||
MaterialTextureSwizzle normalTextureSwizzle() const; |
||||
|
||||
/**
|
||||
* @brief Normal texture coordinate transformation matrix |
||||
* |
||||
* Convenience access to the @ref MaterialAttribute::NormalTextureMatrix |
||||
* / @ref MaterialAttribute::TextureMatrix attributes in this layer or |
||||
* a @ref MaterialAttribute::TextureMatrix attribute in the base |
||||
* material. If neither is present, the default is an identity matrix. |
||||
* Available only if @ref MaterialAttribute::NormalTexture is present |
||||
* in this layer. |
||||
* @see @ref hasAttribute() |
||||
*/ |
||||
Matrix3 normalTextureMatrix() const; |
||||
|
||||
/**
|
||||
* @brief Normal texture coordinate set |
||||
* |
||||
* Convenience access to the @ref MaterialAttribute::NormalTextureCoordinates |
||||
* / @ref MaterialAttribute::TextureCoordinates attributes in this |
||||
* layer or a @ref MaterialAttribute::TextureCoordinates attribute in |
||||
* the base material. If neither is present, the default is @cpp 0 @ce. |
||||
* Available only if @ref MaterialAttribute::NormalTexture is present |
||||
* in this layer. |
||||
* @see @ref hasAttribute() |
||||
*/ |
||||
UnsignedInt normalTextureCoordinates() const; |
||||
}; |
||||
|
||||
}} |
||||
|
||||
#endif |
||||
Loading…
Reference in new issue