Class GLTFMaterial
Defined in File GLTFMaterial.h
Inheritance Relationships
Base Type
public csp::systems::Material
(Class Material)
Class Documentation
-
class GLTFMaterial : public csp::systems::Material
Data class which represents a GLTF material.
Public Functions
-
void SetAlphaMode(EAlphaMode Mode)
Sets how to alpha value is interpreted.
- Parameters
Mode – EAlphaMode
-
EAlphaMode GetAlphaMode() const
Gets how to alpha value is interpreted.
- Returns
EAlphaMode
-
void SetAlphaCutoff(float Cutoff)
Sets the alpha cutoff value When alphaMode is set to MASK the alphaCutoff property specifies the cutoff threshold.
If the alpha value is greater than or equal to the alphaCutoff value then it is rendered as fully opaque, otherwise, it is rendered as fully transparent. alphaCutoff value is ignored for other modes.
- Parameters
Cutoff – float
-
float GetAlphaCutoff() const
Gets the alpha cutoff value.
- Returns
float
-
void SetDoubleSided(bool DoubleSided)
Sets the doubleSided property which specifies whether the material is double sided.
When this value is false, back - face culling is enabled, i.e., only front-facing triangles are rendered. When this value is true, back - face culling is disabled and double sided lighting is enabled.
- Parameters
DoubleSided – bool
-
bool GetDoubleSided() const
Gets the double sided value.
- Returns
bool
-
void SetBaseColorFactor(const csp::common::Vector4 &Factor)
Sets the factors for the base color of the material.
This value defines linear multipliers for the sampled texels of the base color texture.
- Parameters
Factor – const csp::common::Vector4&
-
const csp::common::Vector4 &GetBaseColorFactor() const
Gets the factor of the base color texture.
- Returns
-
void SetMetallicFactor(float Factor)
Sets the factor for the metalness of the material.
This value defines a linear multiplier for the sampled metalness values of the metallic-roughness texture.
- Parameters
Factor – float
-
float GetMetallicFactor() const
Gets the factor of the metallic texture.
- Returns
float
-
void SetRoughnessFactor(float Factor)
Sets the factor for the roughness of the material.
This value defines a linear multiplier for the sampled roughness values of the metallic-roughness texture.
- Parameters
Factor – float
-
float GetRoughnessFactor() const
Gets the factor of the roughness texture.
- Returns
float
-
void SetEmissiveFactor(const csp::common::Vector3 &Factor)
Sets factors for the emissive color of the material.
This value defines linear multipliers for the sampled texels of the emissive texture.
- Parameters
Factor – const csp::common::Vector3&
-
const csp::common::Vector3 &GetEmissiveFactor() const
Gets the factor of the emissive color texture.
- Returns
-
void SetBaseColorTexture(const TextureInfo &Texture)
Sets the base color texture.
The first three components (RGB) MUST be encoded with the sRGB transfer function. They specify the base color of the material. If the fourth component (A) is present, it represents the linear alpha coverage of the material. Otherwise, the alpha coverage is equal to 1.0. The material.alphaMode property specifies how alpha is interpreted. The stored texels MUST NOT be premultiplied. When undefined, the texture MUST be sampled as having 1.0 in all components.
- Parameters
Texture – const TextureInfo&
-
const TextureInfo &GetBaseColorTexture() const
Gets the base color texture.
- Returns
const TextureInfo&
-
void SetMetallicRoughnessTexture(const TextureInfo &Texture)
Sets the metallic-roughness texture.
The metalness values are sampled from the B channel. The roughness values are sampled from the G channel. These values MUST be encoded with a linear transfer function. If other channels are present (R or A), they MUST be ignored for metallic-roughness calculations. When undefined, the texture MUST be sampled as having 1.0 in G and B components.
- Parameters
Texture – const TextureInfo&
-
const TextureInfo &GetMetallicRoughnessTexture() const
Gets the metallic-roughness texture.
- Returns
const TextureInfo&
-
void SetNormalTexture(const TextureInfo &Texture)
Sets the tangent space normal texture.
The texture encodes RGB components with linear transfer function. Each texel represents the XYZ components of a normal vector in tangent space. The normal vectors use the convention +X is right and +Y is up. +Z points toward the viewer. If a fourth component (A) is present, it MUST be ignored. When undefined, the material does not have a tangent space normal texture.
- Parameters
Texture – const TextureInfo&
-
const TextureInfo &GetNormalTexture() const
Gets the tangent space normal texture.
- Returns
const TextureInfo&
-
void SetOcclusionTexture(const TextureInfo &Texture)
Sets the occlusion texture.
The occlusion values are linearly sampled from the R channel. Higher values indicate areas that receive full indirect lighting and lower values indicate no indirect lighting. If other channels are present (GBA), they MUST be ignored for occlusion calculations. When undefined, the material does not have an occlusion texture.
- Parameters
Texture – const TextureInfo&
-
const TextureInfo &GetOcclusionTexture() const
Gets the occlusion texture.
- Returns
const TextureInfo&
-
void SetEmissiveTexture(const TextureInfo &Texture)
Sets the emissive texture.
It controls the color and intensity of the light being emitted by the material. This texture contains RGB components encoded with the sRGB transfer function. If a fourth component (A) is present, it MUST be ignored. When undefined, the texture MUST be sampled as having 1.0 in RGB components.
- Parameters
Texture – const TextureInfo&
-
const TextureInfo &GetEmissiveTexture() const
Gets the emissive texture.
- Returns
const TextureInfo&
-
GLTFMaterial(const csp::common::String &Name, const csp::common::String &AssetCollectionId, const csp::common::String &AssetId)
Constructor which links the material to an asset.
- Parameters
Name – const csp::common::String& : The name of the material.
AssetCollectionId – const csp::common::String& : The asset collection where the material info is stored
AssetId – const csp::common::String& : The asset where the material info is stored
-
GLTFMaterial()
-
void SetAlphaMode(EAlphaMode Mode)