Magnum::Shaders::PhongMaterialUniform struct new in Git master

Material uniform for Phong shaders.

Describes material properties referenced from PhongDrawUniform::materialId.

Constructors, destructors, conversion operators

PhongMaterialUniform(DefaultInitT = DefaultInit) explicit constexpr noexcept
Construct with default parameters.
PhongMaterialUniform(NoInitT) explicit noexcept
Construct without initializing the contents.

Public variables

Color4 ambientColor
Ambient color.
Color4 diffuseColor
Diffuse color.
Color4 specularColor
Specular color.
Float normalTextureScale
Normal texture scale.
Float shininess
Shininess.
Float alphaMask
Alpha mask value.

Convenience setters

Provided to allow the use of method chaining for populating a structure in a single expression, otherwise equivalent to accessing the fields directly. Also guaranteed to provide backwards compatibility when packing of the actual fields changes.

auto setAmbientColor(const Color4& color) -> PhongMaterialUniform&
Set the ambientColor field.
auto setDiffuseColor(const Color4& color) -> PhongMaterialUniform&
Set the diffuseColor field.
auto setSpecularColor(const Color4& color) -> PhongMaterialUniform&
Set the specularColor field.
auto setNormalTextureScale(Float scale) -> PhongMaterialUniform&
Set the normalTextureScale field.
auto setShininess(Float shininess) -> PhongMaterialUniform&
Set the shininess field.
auto setAlphaMask(Float alphaMask) -> PhongMaterialUniform&
Set the alphaMask field.

Function documentation

PhongMaterialUniform& Magnum::Shaders::PhongMaterialUniform::setAmbientColor(const Color4& color)

Set the ambientColor field.

Returns Reference to self (for method chaining)

PhongMaterialUniform& Magnum::Shaders::PhongMaterialUniform::setDiffuseColor(const Color4& color)

Set the diffuseColor field.

Returns Reference to self (for method chaining)

PhongMaterialUniform& Magnum::Shaders::PhongMaterialUniform::setSpecularColor(const Color4& color)

Set the specularColor field.

Returns Reference to self (for method chaining)

PhongMaterialUniform& Magnum::Shaders::PhongMaterialUniform::setNormalTextureScale(Float scale)

Set the normalTextureScale field.

Returns Reference to self (for method chaining)

PhongMaterialUniform& Magnum::Shaders::PhongMaterialUniform::setShininess(Float shininess)

Set the shininess field.

Returns Reference to self (for method chaining)

PhongMaterialUniform& Magnum::Shaders::PhongMaterialUniform::setAlphaMask(Float alphaMask)

Set the alphaMask field.

Returns Reference to self (for method chaining)

Variable documentation

Color4 Magnum::Shaders::PhongMaterialUniform::ambientColor

Ambient color.

Default value is 0x00000000_rgbaf. If PhongGL::Flag::AmbientTexture is enabled, be sure to set this field to 0xffffffff_rgbaf, otherwise the texture will be ignored.

If PhongGL::Flag::VertexColor is enabled, the color is multiplied with a color coming from the PhongGL::Color3 / PhongGL::Color4 attribute.

Color4 Magnum::Shaders::PhongMaterialUniform::diffuseColor

Diffuse color.

Default value is 0xffffffff_rgbaf.

Used only if the effective light count for given draw is not zero, ignored otherwise. If PhongGL::Flag::VertexColor is enabled, the color is multiplied with a color coming from the PhongGL::Color3 / PhongGL::Color4 attribute.

Color4 Magnum::Shaders::PhongMaterialUniform::specularColor

Specular color.

Default value is 0xffffff00_rgbaf.

Used only if the effective light count for given draw is not zero and PhongGL::Flag::NoSpecular is not set, ignored otherwise.

Float Magnum::Shaders::PhongMaterialUniform::normalTextureScale

Normal texture scale.

Affects strength of the normal mapping. Default value is 1.0f, meaning the normal texture is not changed in any way; a value of 0.0f disables the normal texture effect altogether.

Used only if PhongGL::Flag::NormalTexture is enabled and the effective light count for given draw is not zero, ignored otherwise.

Float Magnum::Shaders::PhongMaterialUniform::shininess

Shininess.

The larger value, the harder surface (smaller specular highlight). Default value is 80.0f.

Used only if the effective light count for given draw is not zero and PhongGL::Flag::NoSpecular is not set, ignored otherwise.

Float Magnum::Shaders::PhongMaterialUniform::alphaMask

Alpha mask value.

Fragments with alpha values smaller than the mask value will be discarded. Default value is 0.5f.

Used only if PhongGL::Flag::AlphaMask is enabled, ignored otherwise.