class
#include <Magnum/Trade/PhongMaterialData.h>
PhongMaterialData Phong material data.
See Material types and convenience accessors for more information about how to use this class.
Base classes
- class MaterialData new in Git master
- Material data.
Public types
- enum class Flag: UnsignedInt { DoubleSided = 1 << 0, AmbientTexture = 1 << 1, DiffuseTexture = 1 << 2, SpecularTexture = 1 << 3, NormalTexture = 1 << 4 new in 2020.06, TextureTransformation = 1 << 5 new in 2020.06, TextureCoordinates = 1 << 6 new in Git master, TextureCoordinateSets = TextureCoordinates deprecated in Git master } deprecated in Git master
- Material flag.
-
using Flags = Containers::
EnumSet<Flag> deprecated in Git master - Material flags.
Constructors, destructors, conversion operators
- PhongMaterialData(Flags flags, const Color4& ambientColor, UnsignedInt ambientTexture, const Color4& diffuseColor, UnsignedInt diffuseTexture, const Color4& specularColor, UnsignedInt specularTexture, UnsignedInt normalTexture, const Matrix3& textureMatrix, MaterialAlphaMode alphaMode, Float alphaMask, Float shininess, const void* importerState = nullptr) deprecated in Git master explicit noexcept
- Constructor.
- PhongMaterialData(Flags flags, const Color4& ambientColor, UnsignedInt ambientTexture, UnsignedInt ambientTextureCoordinates, const Color4& diffuseColor, UnsignedInt diffuseTexture, UnsignedInt diffuseTextureCoordinates, const Color4& specularColor, UnsignedInt specularTexture, UnsignedInt specularTextureCoordinates, UnsignedInt normalTexture, UnsignedInt normalTextureCoordinates, const Matrix3& textureMatrix, MaterialAlphaMode alphaMode, Float alphaMask, Float shininess, const void* importerState = nullptr) deprecated in Git master explicit noexcept
- Construct with non-zero texture coordinate sets.
- PhongMaterialData(Flags flags, MaterialAlphaMode alphaMode, Float alphaMask, Float shininess, const void* importerState = nullptr) deprecated in 2020.06 explicit noexcept
- Constructor.
Public functions
- auto hasSpecularTexture() const -> bool new in Git master
- Whether the material has a specular texture.
- auto hasTextureTransformation() const -> bool new in Git master
- Whether the material has texture transformation.
- auto hasCommonTextureTransformation() const -> bool new in Git master
- Whether the material has a common transformation for all textures.
- auto hasTextureCoordinates() const -> bool new in Git master
- Whether the material uses extra texture coordinate sets.
- auto hasCommonTextureCoordinates() const -> bool new in Git master
- Whether the material has a common coordinate set for all textures.
- auto hasTextureLayer() const -> bool new in Git master
- Whether the material uses array texture layers.
- auto hasCommonTextureLayer() const -> bool new in Git master
- Whether the material has a common array texture layer for all textures.
- auto flags() const -> Flags deprecated in Git master
- Material flags.
- auto ambientColor() const -> Color4
- Ambient color.
- auto ambientTexture() const -> UnsignedInt
- Ambient texture ID.
- auto ambientTextureMatrix() const -> Matrix3 new in Git master
- Ambient texture coordinate transformation matrix.
- auto ambientTextureCoordinates() const -> UnsignedInt new in Git master
- Ambient texture coordinate set.
- auto ambientCoordinateSet() const -> UnsignedInt deprecated in Git master
- Ambient texture coordinate set.
- auto ambientTextureLayer() const -> UnsignedInt new in Git master
- Ambient array texture layer.
- auto diffuseColor() const -> Color4
- Diffuse color.
- auto diffuseTexture() const -> UnsignedInt
- Diffuse texture ID.
- auto diffuseTextureMatrix() const -> Matrix3 new in Git master
- Diffuse texture coordinate transformation matrix.
- auto diffuseTextureCoordinates() const -> UnsignedInt new in Git master
- Diffuse texture coordinate set.
- auto diffuseCoordinateSet() const -> UnsignedInt deprecated in Git master
- Diffuse texture coordinate set.
- auto diffuseTextureLayer() const -> UnsignedInt new in Git master
- Diffuse array texture layer.
- auto specularColor() const -> Color4
- Specular color.
- auto specularTexture() const -> UnsignedInt
- Specular texture ID.
- auto specularTextureSwizzle() const -> MaterialTextureSwizzle new in Git master
- Specular texture swizzle.
- auto specularTextureMatrix() const -> Matrix3 new in Git master
- Specular texture coordinate transformation matrix.
- auto specularTextureCoordinates() const -> UnsignedInt new in Git master
- Specular texture coordinate set.
- auto specularCoordinateSet() const -> UnsignedInt deprecated in Git master
- Specular texture coordinate set.
- auto specularTextureLayer() const -> UnsignedInt new in Git master
- Specular array texture layer.
- auto normalTexture() const -> UnsignedInt new in 2020.06
- Normal texture ID.
- auto normalTextureScale() const -> Float new in Git master
- Normal texture scale.
- auto normalTextureSwizzle() const -> MaterialTextureSwizzle new in Git master
- Normal texture swizzle.
- auto normalTextureMatrix() const -> Matrix3 new in Git master
- Normal texture coordinate transformation matrix.
- auto normalTextureCoordinates() const -> UnsignedInt new in Git master
- Normal texture coordinate set.
- auto normalCoordinateSet() const -> UnsignedInt deprecated in Git master
- Normal texture coordinate set.
- auto normalTextureLayer() const -> UnsignedInt new in Git master
- Normal array texture layer.
- auto commonTextureMatrix() const -> Matrix3 new in Git master
- Common texture coordinate transformation matrix for all textures.
- auto textureMatrix() const -> Matrix3 deprecated in Git master
- Common texture coordinate transformation matrix for all textures.
- auto commonTextureCoordinates() const -> UnsignedInt new in Git master
- Common texture coordinate set for all textures.
- auto commonTextureLayer() const -> UnsignedInt new in Git master
- Common array texture layer for all textures.
- auto shininess() const -> Float
- Shininess.
Enum documentation
enum class Magnum:: Trade:: PhongMaterialData:: Flag: UnsignedInt
Material flag.
A superset of MaterialData::
Enumerators | |
---|---|
DoubleSided |
The material is double-sided. Back faces should not be culled away but rendered as well, with normals flipped for correct lighting. |
AmbientTexture |
The material has an ambient texture |
DiffuseTexture |
The material has a diffuse texture |
SpecularTexture |
The material has a specular texture |
NormalTexture new in 2020.06 |
The material has a normal texture |
TextureTransformation new in 2020.06 |
The material has a texture coordinate transformation |
TextureCoordinates new in Git master |
The material uses non-default texture coordinate sets |
TextureCoordinateSets |
The material uses non-default texture coordinate sets |
Typedef documentation
typedef Containers:: EnumSet<Flag> Magnum:: Trade:: PhongMaterialData:: Flags
Material flags.
A superset of MaterialData::
Function documentation
Magnum:: Trade:: PhongMaterialData:: PhongMaterialData(Flags flags,
const Color4& ambientColor,
UnsignedInt ambientTexture,
const Color4& diffuseColor,
UnsignedInt diffuseTexture,
const Color4& specularColor,
UnsignedInt specularTexture,
UnsignedInt normalTexture,
const Matrix3& textureMatrix,
MaterialAlphaMode alphaMode,
Float alphaMask,
Float shininess,
const void* importerState = nullptr) explicit noexcept
Constructor.
Parameters | |
---|---|
flags | Material flags |
ambientColor | Ambient color. Use 0x000000ff_rgbaf for a default value for a non-textured material and 0xffffffff_rgbaf for a default value for a textured material. |
ambientTexture | Ambient texture ID. Ignored if flags doesn't have Flag:: |
diffuseColor | Diffuse color. Use 0xffffffff_rgbaf for a default value for both a non-textured and a textured material. |
diffuseTexture | Diffuse texture ID. Ignored if flags doesn't have Flag:: |
specularColor | Specular color. Use 0xffffff00_rgbaf for a default value for both a non-textured and a textured material. |
specularTexture | Specular texture ID. Ignored if flags doesn't have Flag:: |
normalTexture | Normal texture ID. Ignored if flags doesn't have Flag:: |
textureMatrix | Texture coordinate transformation |
alphaMode | Alpha mode. Use MaterialAlphaMode:: |
alphaMask | Alpha mask value. Use 0.5f for a default value. |
shininess | Shininess. Use 80.0f for a default value. |
importerState | Importer-specific state |
All *TextureCoordinates()
accessors are implicitly zero with this constructor. If textureMatrix
is not default-constructed, expects Flag::
Magnum:: Trade:: PhongMaterialData:: PhongMaterialData(Flags flags,
const Color4& ambientColor,
UnsignedInt ambientTexture,
UnsignedInt ambientTextureCoordinates,
const Color4& diffuseColor,
UnsignedInt diffuseTexture,
UnsignedInt diffuseTextureCoordinates,
const Color4& specularColor,
UnsignedInt specularTexture,
UnsignedInt specularTextureCoordinates,
UnsignedInt normalTexture,
UnsignedInt normalTextureCoordinates,
const Matrix3& textureMatrix,
MaterialAlphaMode alphaMode,
Float alphaMask,
Float shininess,
const void* importerState = nullptr) explicit noexcept
Construct with non-zero texture coordinate sets.
Parameters | |
---|---|
flags | Material flags |
ambientColor | Ambient color. Use 0x000000ff_rgbaf for a default value for a non-textured material and 0xffffffff_rgbaf for a default value for a textured material. |
ambientTexture | Ambient texture ID. Ignored if flags doesn't have Flag:: |
ambientTextureCoordinates | Ambient texture coordinate set. Ignored if flags doesn't have Flag:: |
diffuseColor | Diffuse color. Use 0xffffffff_rgbaf for a default value for both a non-textured and a textured material. |
diffuseTexture | Diffuse texture ID. Ignored if flags doesn't have Flag:: |
diffuseTextureCoordinates | Diffuse texture coordinate set. Ignored if flags doesn't have Flag:: |
specularColor | Specular color. Use 0xffffff00_rgbaf for a default value for both a non-textured and a textured material. |
specularTexture | Specular texture ID. Ignored if flags doesn't have Flag:: |
specularTextureCoordinates | Specular texture coordinate set. Ignored if flags doesn't have Flag:: |
normalTexture | Normal texture ID. Ignored if flags doesn't have Flag:: |
normalTextureCoordinates | Normal texture coordinate set. Ignored if flags doesn't have Flag:: |
textureMatrix | Texture coordinate transformation |
alphaMode | Alpha mode. Use MaterialAlphaMode:: |
alphaMask | Alpha mask value. Use 0.5f for a default value. |
shininess | Shininess. Use 80.0f for a default value. |
importerState | Importer-specific state |
If textureMatrix
is not default-constructed, expects Flag::*Coordinates
parameter is non-zero, expects Flag::
Magnum:: Trade:: PhongMaterialData:: PhongMaterialData(Flags flags,
MaterialAlphaMode alphaMode,
Float alphaMask,
Float shininess,
const void* importerState = nullptr) explicit noexcept
Constructor.
bool Magnum:: Trade:: PhongMaterialData:: hasSpecularTexture() const new in Git master
Whether the material has a specular texture.
Returns true
if any of the MaterialAttribute::false
otherwise.
bool Magnum:: Trade:: PhongMaterialData:: hasTextureTransformation() const new in Git master
Whether the material has texture transformation.
Returns true
if any of the MaterialAttribute::false
otherwise.
bool Magnum:: Trade:: PhongMaterialData:: hasCommonTextureTransformation() const new in Git master
Whether the material has a common transformation for all textures.
Returns true
if, for each texture that is present, ambientTextureMatrix(), diffuseTextureMatrix(), specularTextureMatrix() and normalTextureMatrix() have the same value, false
otherwise. In particular, returns true
also if there's no texture transformation at all. Use hasTextureTransformation() to distinguish that case.
bool Magnum:: Trade:: PhongMaterialData:: hasTextureCoordinates() const new in Git master
Whether the material uses extra texture coordinate sets.
Returns true
if any of the MaterialAttribute::false
otherwise.
bool Magnum:: Trade:: PhongMaterialData:: hasCommonTextureCoordinates() const new in Git master
Whether the material has a common coordinate set for all textures.
Returns true
if, for each texture that is present, ambientTextureCoordinates(), diffuseTextureCoordinates(), specularTextureCoordinates() and normalTextureCoordinates() have the same value, false
otherwise. In particular, returns true
also if there's no extra texture coordinate set used at all. Use hasTextureCoordinates() to distinguish that case.
bool Magnum:: Trade:: PhongMaterialData:: hasTextureLayer() const new in Git master
Whether the material uses array texture layers.
Returns true
if any of the MaterialAttribute::false
otherwise.
bool Magnum:: Trade:: PhongMaterialData:: hasCommonTextureLayer() const new in Git master
Whether the material has a common array texture layer for all textures.
Returns true
if, for each texture that is present, ambientTextureLayer(), diffuseTextureLayer(), specularTextureLayer() and normalTextureLayer() have the same value, false
otherwise. In particular, returns true
also if there's no extra texture coordinate set used at all. Use hasTextureLayer() to distinguish that case.
Flags Magnum:: Trade:: PhongMaterialData:: flags() const
Material flags.
A superset of MaterialData::
Color4 Magnum:: Trade:: PhongMaterialData:: ambientColor() const
Ambient color.
Convenience access to the MaterialAttribute::0xffffffff_rgbaf
if there's MaterialAttribute::0x000000ff_rgbaf
otherwise.
If the material has MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: ambientTexture() const
Ambient texture ID.
Available only if MaterialAttribute::
Matrix3 Magnum:: Trade:: PhongMaterialData:: ambientTextureMatrix() const new in Git master
Ambient texture coordinate transformation matrix.
Convenience access to the MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: ambientTextureCoordinates() const new in Git master
Ambient texture coordinate set.
Convenience access to the MaterialAttribute::0
. Available only if the material has MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: ambientCoordinateSet() const
Ambient texture coordinate set.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: ambientTextureLayer() const new in Git master
Ambient array texture layer.
Convenience access to the MaterialAttribute::0
. Available only if the material has MaterialAttribute::
Color4 Magnum:: Trade:: PhongMaterialData:: diffuseColor() const
Diffuse color.
Convenience access to the MaterialAttribute::0xffffffff_rgbaf
.
If the material has MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: diffuseTexture() const
Diffuse texture ID.
Available only if MaterialAttribute::
Matrix3 Magnum:: Trade:: PhongMaterialData:: diffuseTextureMatrix() const new in Git master
Diffuse texture coordinate transformation matrix.
Convenience access to the MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: diffuseTextureCoordinates() const new in Git master
Diffuse texture coordinate set.
Convenience access to the MaterialAttribute::0
. Available only if the material has MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: diffuseCoordinateSet() const
Diffuse texture coordinate set.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: diffuseTextureLayer() const new in Git master
Diffuse array texture layer.
Convenience access to the MaterialAttribute::0
. Available only if the material has MaterialAttribute::
Color4 Magnum:: Trade:: PhongMaterialData:: specularColor() const
Specular color.
Convenience access to the MaterialAttribute::0xffffff00_rgbaf
.
If the material has a specular texture, the color and texture is meant to be multiplied together.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: specularTexture() const
Specular texture ID.
Available only if either MaterialAttribute::
MaterialTextureSwizzle Magnum:: Trade:: PhongMaterialData:: specularTextureSwizzle() const new in Git master
Specular texture swizzle.
If MaterialAttribute::
Matrix3 Magnum:: Trade:: PhongMaterialData:: specularTextureMatrix() const new in Git master
Specular texture coordinate transformation matrix.
Convenience access to the MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: specularTextureCoordinates() const new in Git master
Specular texture coordinate set.
Convenience access to the MaterialAttribute::0
. Available only if the material has a specular texture.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: specularCoordinateSet() const
Specular texture coordinate set.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: specularTextureLayer() const new in Git master
Specular array texture layer.
Convenience access to the MaterialAttribute::0
. Available only if the material has a specular texture.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: normalTexture() const new in 2020.06
Normal texture ID.
Available only if MaterialAttribute::
Float Magnum:: Trade:: PhongMaterialData:: normalTextureScale() const new in Git master
Normal texture scale.
Convenience access to the MaterialAttribute::1.0f
. Available only if MaterialAttribute::
MaterialTextureSwizzle Magnum:: Trade:: PhongMaterialData:: normalTextureSwizzle() const new in Git master
Normal texture swizzle.
Convenience access to the MaterialAttribute::
Matrix3 Magnum:: Trade:: PhongMaterialData:: normalTextureMatrix() const new in Git master
Normal texture coordinate transformation matrix.
Convenience access to the MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: normalTextureCoordinates() const new in Git master
Normal texture coordinate set.
Convenience access to the MaterialAttribute::0
. Available only if the material has MaterialAttribute::
UnsignedInt Magnum:: Trade:: PhongMaterialData:: normalCoordinateSet() const
Normal texture coordinate set.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: normalTextureLayer() const new in Git master
Normal array texture layer.
Convenience access to the MaterialAttribute::0
. Available only if the material has MaterialAttribute::
Matrix3 Magnum:: Trade:: PhongMaterialData:: commonTextureMatrix() const new in Git master
Common texture coordinate transformation matrix for all textures.
Expects that hasCommonTextureTransformation() is true
; returns a matrix that's the same for all of ambientTextureMatrix(), diffuseTextureMatrix(), specularTextureMatrix() and normalTextureMatrix() where a texture is present. If no texture is present, returns an identity matrix.
Matrix3 Magnum:: Trade:: PhongMaterialData:: textureMatrix() const
Common texture coordinate transformation matrix for all textures.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: commonTextureCoordinates() const new in Git master
Common texture coordinate set for all textures.
Expects that hasCommonTextureCoordinates() is true
; returns a coordinate set that's the same for all of ambientTextureCoordinates(), diffuseTextureCoordinates(), specularTextureCoordinates() and normalTextureCoordinates() where a texture is present. If no texture is present, returns 0
.
UnsignedInt Magnum:: Trade:: PhongMaterialData:: commonTextureLayer() const new in Git master
Common array texture layer for all textures.
Expects that hasCommonTextureLayer() is true
; returns a layer that's the same for all of ambientTextureLayer(), diffuseTextureLayer(), specularTextureLayer() and normalTextureLayer() where a texture is present. If no texture is present, returns 0
.
Float Magnum:: Trade:: PhongMaterialData:: shininess() const
Shininess.
Convenience access to the MaterialAttribute::80.0f
.
Debug& operator<<(Debug& debug,
PhongMaterialData:: Flag value)
Debug output operator.
Debug& operator<<(Debug& debug,
PhongMaterialData:: Flags value)
Debug output operator.