Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Nz::Material Class Reference

Graphics class that represents a material. More...

Inheritance diagram for Nz::Material:
Nz::RefCounted Nz::Resource

Public Member Functions

 Material ()
 Constructs a Material object with default states. More...
 
 Material (const MaterialPipeline *pipeline)
 Constructs a Material object using a MaterialPipeline. More...
 
 Material (const MaterialPipelineInfo &pipelineInfo)
 Constructs a Material object using a MaterialPipelineInfo. More...
 
 Material (const String &pipelineName)
 Constructs a Material object using a MaterialPipeline name. More...
 
 Material (const Material &material)
 Constructs a Material object by assignation. More...
 
 ~Material ()
 Destructs the object and calls OnMaterialRelease. More...
 
void Apply (const MaterialPipeline::Instance &instance) const
 Applies shader to the material. More...
 
void BuildFromParameters (const ParameterList &matData, const MaterialParams &matParams=MaterialParams())
 Builds the material from a parameter list. More...
 
void Configure (const MaterialPipeline *pipeline)
 Reset material pipeline state. More...
 
void Configure (const MaterialPipelineInfo &pipelineInfo)
 Reset material pipeline state. More...
 
bool Configure (const String &pipelineName)
 Reset material pipeline state. More...
 
void EnableAlphaTest (bool alphaTest)
 Enable/Disable alpha test for this material. More...
 
void EnableBlending (bool blending)
 Enable/Disable blending for this material. More...
 
void EnableColorWrite (bool colorWrite)
 Enable/Disable color writing for this material. More...
 
void EnableDepthBuffer (bool depthBuffer)
 Enable/Disable depth buffer for this material. More...
 
void EnableDepthSorting (bool depthSorting)
 Enable/Disable depth sorting for this material. More...
 
void EnableDepthWrite (bool depthWrite)
 Enable/Disable depth writing for this material. More...
 
void EnableFaceCulling (bool faceCulling)
 Enable/Disable face culling for this material. More...
 
void EnableReflectionMapping (bool reflection)
 Enable/Disable reflection mapping for this material. More...
 
void EnableScissorTest (bool scissorTest)
 Enable/Disable scissor test for this material. More...
 
void EnableShadowCasting (bool castShadows)
 Enable/Disable shadow casting for this material. More...
 
void EnableShadowReceive (bool receiveShadows)
 Enable/Disable shadow receiving for this material. More...
 
void EnableStencilTest (bool stencilTest)
 Enable/Disable stencil test for this material. More...
 
void EnsurePipelineUpdate () const
 Ensures the pipeline gets updated. More...
 
const TextureRefGetAlphaMap () const
 Gets the alpha map. More...
 
float GetAlphaThreshold () const
 Gets the alpha test threshold. More...
 
Color GetAmbientColor () const
 Gets the ambient color. More...
 
RendererComparison GetDepthFunc () const
 Gets the function to compare depth. More...
 
const MaterialRefGetDepthMaterial () const
 Gets the depth material. More...
 
Color GetDiffuseColor () const
 Gets the diffuse color. More...
 
const TextureRefGetDiffuseMap () const
 Gets the diffuse map. More...
 
TextureSampler & GetDiffuseSampler ()
 Gets the diffuse sampler. More...
 
const TextureSampler & GetDiffuseSampler () const
 Gets the diffuse sampler. More...
 
BlendFunc GetDstBlend () const
 Gets the dst in blend. More...
 
const TextureRefGetEmissiveMap () const
 Gets the emissive map. More...
 
FaceSide GetFaceCulling () const
 Gets the face culling. More...
 
FaceFilling GetFaceFilling () const
 Gets the face filling. More...
 
const TextureRefGetHeightMap () const
 Gets the height map. More...
 
float GetLineWidth () const
 Gets the line width of this material. More...
 
const TextureRefGetNormalMap () const
 Gets the normal map. More...
 
const MaterialPipelineGetPipeline () const
 Gets the render states. More...
 
const MaterialPipelineInfo & GetPipelineInfo () const
 Gets the pipeline informations. More...
 
float GetPointSize () const
 Gets the point size of this material. More...
 
ReflectionMode GetReflectionMode () const
 Gets the reflection mode of the material. More...
 
const UberShader * GetShader () const
 Gets the über-shader used by this material. More...
 
float GetShininess () const
 Gets the shininess. More...
 
Color GetSpecularColor () const
 Gets the specular color. More...
 
const TextureRefGetSpecularMap () const
 Gets the specular map. More...
 
TextureSampler & GetSpecularSampler ()
 Gets the specular sampler. More...
 
const TextureSampler & GetSpecularSampler () const
 Gets the specular sampler. More...
 
BlendFunc GetSrcBlend () const
 Gets the src in blend. More...
 
bool HasAlphaMap () const
 Checks whether this material has an alpha map. More...
 
bool HasDepthMaterial () const
 Checks whether this material has a depth material. More...
 
bool HasDiffuseMap () const
 Checks whether this material has a diffuse map. More...
 
bool HasEmissiveMap () const
 Checks whether this material has a emissive map. More...
 
bool HasHeightMap () const
 Checks whether this material has a height map. More...
 
bool HasNormalMap () const
 Checks whether this material has a normal map. More...
 
bool HasSpecularMap () const
 Checks whether this material has a specular map. More...
 
bool IsAlphaTestEnabled () const
 Checks whether this material has alpha test enabled. More...
 
bool IsBlendingEnabled () const
 Checks whether this material has blending enabled. More...
 
bool IsColorWriteEnabled () const
 Checks whether this material has color write enabled. More...
 
bool IsDepthBufferEnabled () const
 Checks whether this material has depth buffer enabled. More...
 
bool IsDepthSortingEnabled () const
 Checks whether this material has depth sorting enabled. More...
 
bool IsDepthWriteEnabled () const
 Checks whether this material has depth writing enabled. More...
 
bool IsFaceCullingEnabled () const
 Checks whether this material has face culling enabled. More...
 
bool IsReflectionMappingEnabled () const
 Checks whether this material has reflection mapping enabled. More...
 
bool IsScissorTestEnabled () const
 Checks whether this material has scissor test enabled. More...
 
bool IsStencilTestEnabled () const
 Checks whether this material has stencil test enabled. More...
 
bool IsShadowCastingEnabled () const
 Checks whether this material cast shadow. More...
 
bool IsShadowReceiveEnabled () const
 Checks whether this material receive shadow. More...
 
bool LoadFromFile (const String &filePath, const MaterialParams &params=MaterialParams())
 Loads the material from file. More...
 
bool LoadFromMemory (const void *data, std::size_t size, const MaterialParams &params=MaterialParams())
 Loads the material from memory. More...
 
bool LoadFromStream (Stream &stream, const MaterialParams &params=MaterialParams())
 Loads the material from stream. More...
 
void Reset ()
 Resets the material, cleans everything. More...
 
void SaveToParameters (ParameterList *matData)
 Builds a ParameterList with material data. More...
 
bool SetAlphaMap (const String &textureName)
 Sets the alpha map by name. More...
 
void SetAlphaMap (TextureRef alphaMap)
 Sets the alpha map with a reference to a texture. More...
 
void SetAlphaThreshold (float alphaThreshold)
 Sets the alpha threshold. More...
 
void SetAmbientColor (const Color &ambient)
 Sets the color for ambient. More...
 
void SetDepthFunc (RendererComparison depthFunc)
 Sets the depth functor. More...
 
void SetDepthMaterial (MaterialRef depthMaterial)
 Sets the depth material. More...
 
void SetDiffuseColor (const Color &diffuse)
 Sets the color for diffuse. More...
 
bool SetDiffuseMap (const String &textureName)
 Sets the diffuse map by name. More...
 
void SetDiffuseMap (TextureRef diffuseMap)
 Sets the diffuse map with a reference to a texture. More...
 
void SetDiffuseSampler (const TextureSampler &sampler)
 Sets the diffuse sampler. More...
 
void SetDstBlend (BlendFunc func)
 Sets the dst in blend. More...
 
bool SetEmissiveMap (const String &textureName)
 Sets the emissive map by name. More...
 
void SetEmissiveMap (TextureRef textureName)
 Sets the emissive map with a reference to a texture. More...
 
void SetFaceCulling (FaceSide faceSide)
 Sets the face culling. More...
 
void SetFaceFilling (FaceFilling filling)
 Sets the face filling. More...
 
bool SetHeightMap (const String &textureName)
 Sets the height map by path or name. More...
 
void SetHeightMap (TextureRef textureName)
 Sets the height map with a reference to a texture. More...
 
void SetLineWidth (float lineWidth)
 Sets the line width for this material. More...
 
bool SetNormalMap (const String &textureName)
 Sets the normal map by path or name. More...
 
void SetNormalMap (TextureRef textureName)
 Sets the normal map with a reference to a texture. More...
 
void SetPointSize (float pointSize)
 Sets the point size for this material. More...
 
void SetReflectionMode (ReflectionMode reflectionMode)
 Changes reflection mode of the material. More...
 
void SetShader (UberShaderConstRef uberShader)
 Sets the shader with a constant reference to a ubershader. More...
 
bool SetShader (const String &uberShaderName)
 Sets the shader by name. More...
 
void SetShininess (float shininess)
 Sets the shininess of the material. More...
 
void SetSpecularColor (const Color &specular)
 Sets the color for specular. More...
 
bool SetSpecularMap (const String &textureName)
 Sets the specular map by name. More...
 
void SetSpecularMap (TextureRef specularMap)
 Sets the specular map with a reference to a texture. More...
 
void SetSpecularSampler (const TextureSampler &sampler)
 Sets the specular sampler. More...
 
void SetSrcBlend (BlendFunc func)
 Sets the src in blend. More...
 
Materialoperator= (const Material &material)
 Sets the current material with the content of the other one. More...
 
 NazaraSignal (OnMaterialReflectionModeChange, const Material *, ReflectionMode)
 
 NazaraSignal (OnMaterialRelease, const Material *)
 
 NazaraSignal (OnMaterialReset, const Material *)
 
- Public Member Functions inherited from Nz::RefCounted
 RefCounted (bool persistent=true)
 Constructs a RefCounted object with a persistance aspect. More...
 
 RefCounted (const RefCounted &)=delete
 
 RefCounted (RefCounted &&)=default
 
virtual ~RefCounted ()
 Destructs the object. More...
 
void AddReference () const
 Adds a reference to the object.
 
unsigned int GetReferenceCount () const
 Gets the number of references to the object. More...
 
bool IsPersistent () const
 Checks whether the object is persistent. More...
 
bool RemoveReference () const
 Removes a reference to the object. More...
 
bool SetPersistent (bool persistent=true, bool checkReferenceCount=false)
 Sets the persistence of the object. More...
 
RefCountedoperator= (const RefCounted &)=delete
 
RefCountedoperator= (RefCounted &&)=default
 
- Public Member Functions inherited from Nz::Resource
 Resource (const Resource &)=default
 
 Resource (Resource &&) noexcept=default
 
const StringGetFilePath () const
 Gets the file path associated with the resource. More...
 
void SetFilePath (const String &filePath)
 Sets the file path associated with the resource. More...
 
Resourceoperator= (const Resource &)=default
 
Resourceoperator= (Resource &&) noexcept=default
 

Static Public Member Functions

static MaterialRef GetDefault ()
 Gets the default material. More...
 
static int GetTextureUnit (TextureMap textureMap)
 
template<typename... Args>
static MaterialRef New (Args &&... args)
 Creates a new material from the arguments. More...
 

Friends

class Graphics
 

Detailed Description

Graphics class that represents a material.

Constructor & Destructor Documentation

◆ Material() [1/5]

Nz::Material::Material ( )
inline

Constructs a Material object with default states.

See also
Reset

◆ Material() [2/5]

Nz::Material::Material ( const MaterialPipeline pipeline)
inline

Constructs a Material object using a MaterialPipeline.

Calls Configure with the pipeline parameter

See also
Configure

◆ Material() [3/5]

Nz::Material::Material ( const MaterialPipelineInfo &  pipelineInfo)
inline

Constructs a Material object using a MaterialPipelineInfo.

Calls Configure with the pipelineInfo parameter

See also
Configure

◆ Material() [4/5]

Nz::Material::Material ( const String pipelineName)
inline

Constructs a Material object using a MaterialPipeline name.

Calls Configure with the pipelineName parameter

Remarks
In case of error (ie. named pipeline is not registered), throw an exception
See also
Configure

◆ Material() [5/5]

Nz::Material::Material ( const Material material)
inline

Constructs a Material object by assignation.

Parameters
materialMaterial to copy into this

◆ ~Material()

Nz::Material::~Material ( )
inline

Destructs the object and calls OnMaterialRelease.

See also
OnMaterialRelease

Member Function Documentation

◆ Apply()

void Nz::Material::Apply ( const MaterialPipeline::Instance &  instance) const

Applies shader to the material.

Parameters
instancePipeline instance to update
textureUnitUnit for the texture GL_TEXTURE"i"
lastUsedUnitOptional argument to get the last texture unit

◆ BuildFromParameters()

void Nz::Material::BuildFromParameters ( const ParameterList matData,
const MaterialParams &  matParams = MaterialParams() 
)

Builds the material from a parameter list.

Parameters
matDataData information for the material
matParamsAdditional parameters for the material

◆ Configure() [1/3]

void Nz::Material::Configure ( const MaterialPipeline pipeline)
inline

Reset material pipeline state.

Sets the material pipeline

Remarks
pipeline must be valid
See also
Configure

◆ Configure() [2/3]

void Nz::Material::Configure ( const MaterialPipelineInfo &  pipelineInfo)
inline

Reset material pipeline state.

Sets the material pipeline using pipeline info

Remarks
pipeline must be valid
See also
Configure

◆ Configure() [3/3]

bool Nz::Material::Configure ( const String pipelineName)
inline

Reset material pipeline state.

Sets the material pipeline using a name to lookup in the MaterialPipelineLibrary

Returns
True if the material pipeline was found in the library
See also
Configure

◆ EnableAlphaTest()

void Nz::Material::EnableAlphaTest ( bool  alphaTest)
inline

Enable/Disable alpha test for this material.

When enabled, all objects using this material will be rendered using alpha testing, rejecting pixels if their alpha component is under a defined threshold. This allows some kind of transparency with a much cheaper cost as it doesn't prevent any optimization (as deferred rendering or batching).

Parameters
alphaTestDefines if this material will use alpha testing
Remarks
Invalidates the pipeline
See also
IsAlphaTestEnabled
SetAlphaThreshold

◆ EnableBlending()

void Nz::Material::EnableBlending ( bool  blending)
inline

Enable/Disable blending for this material.

When enabled, all objects using this material will be rendered using blending, obeying the dstBlend and srcBlend parameters This is useful with translucent objects, but will reduces performance as it prevents some optimizations (as deferred rendering)

Parameters
blendingDefines if this material will use blending
Remarks
Invalidates the pipeline
See also
IsBlendingEnabled
SetDstBlend
SetSrcBlend

◆ EnableColorWrite()

void Nz::Material::EnableColorWrite ( bool  colorWrite)
inline

Enable/Disable color writing for this material.

Parameters
colorWriteDefines if this material will use color writing
Remarks
Invalidates the pipeline
See also
IsColorWritingEnabled

◆ EnableDepthBuffer()

void Nz::Material::EnableDepthBuffer ( bool  depthBuffer)
inline

Enable/Disable depth buffer for this material.

When enabled, all objects using this material will be rendered using a depth buffer, if the RenderTarget has one. This will enable Depth Test, preventing further fragments to render on top of closer ones.

This parameter is required for depth writing.

In order to enable depth writing without enabling depth test, set the depth comparison function to RendererComparison_Never

Parameters
depthBufferDefines if this material will use depth buffer
Remarks
Invalidates the pipeline
See also
EnableDepthWrite
IsDepthBufferEnabled
SetDepthFunc

◆ EnableDepthSorting()

void Nz::Material::EnableDepthSorting ( bool  depthSorting)
inline

Enable/Disable depth sorting for this material.

When enabled, all objects using this material will be rendered far from near This is useful with translucent objects, but will reduces performance as it breaks batching

Parameters
depthSortingDefines if this material will use depth sorting
Remarks
Depth sorting may not be perfect (may be object-sorting instead of triangle-sorting)
Invalidates the pipeline
See also
IsDepthSortingEnabled

◆ EnableDepthWrite()

void Nz::Material::EnableDepthWrite ( bool  depthWrite)
inline

Enable/Disable depth writing for this material.

When enabled, and if depth buffer is enabled and present, all fragments generated with this material will write to the depth buffer if they pass depth test.

This is usually disabled with translucent objects, as depth test is wanted to prevent them from rendering on top of opaque objects but not depth writing (which could make other translucent fragments to fail depth test)

Parameters
depthBufferDefines if this material will use depth write
Remarks
Invalidates the pipeline
See also
EnableDepthBuffer
IsDepthWriteEnabled

◆ EnableFaceCulling()

void Nz::Material::EnableFaceCulling ( bool  faceCulling)
inline

Enable/Disable face culling for this material.

When enabled, the material prevents front and/or back faces from rendering. This is commonly used as an optimization to prevent processing of hidden faces by the rendering device.

Use SetFaceCulling to control which side will be eliminated.

Parameters
faceCullingDefines if this material will use face culling
Remarks
Invalidates the pipeline
See also
IsFaceCullingEnabled
SetFaceCulling

◆ EnableReflectionMapping()

void Nz::Material::EnableReflectionMapping ( bool  reflection)
inline

Enable/Disable reflection mapping for this material.

When enabled, the material will render reflections from the object environment according to the reflection mode. Whether or not this is expensive depends of the reflection mode and size.

Please note this is only a hint for the render technique, and reflections can be forcefully enabled or disabled depending on the material shader.

Use SetReflectionMode and SetReflectionSize to control reflection quality.

Parameters
reflectionDefines if this material should use reflection mapping
Remarks
May invalidates the pipeline
See also
IsReflectionMappingEnabled
SetReflectionMode
SetReflectionSize

◆ EnableScissorTest()

void Nz::Material::EnableScissorTest ( bool  scissorTest)
inline

Enable/Disable scissor test for this material.

When enabled, the material prevents fragments out of the scissor box to be rendered. This can be useful with GUI, where widgets must not be rendered outside of their parent rendering area.

Parameters
scissorTestDefines if this material will use scissor test
Remarks
Invalidates the pipeline
See also
IsScissorTestEnabled

◆ EnableShadowCasting()

void Nz::Material::EnableShadowCasting ( bool  castShadows)
inline

Enable/Disable shadow casting for this material.

When enabled, all objects using this material will be allowed to cast shadows upon any objects using a material with shadow receiving enabled. The depth material replaces this one when rendering shadows.

Parameters
castShadowsDefines if this material will be allowed to cast shadows
Remarks
Does not invalidate the pipeline
See also
EnableShadowReceive
IsShadowCastingEnabled
SetDepthMaterial

◆ EnableShadowReceive()

void Nz::Material::EnableShadowReceive ( bool  receiveShadows)
inline

Enable/Disable shadow receiving for this material.

When enabled, all objects using this material will be allowed to be casted shadows upon themselves Disabling this can be helpful to prevent some rendering artifacts (especially with translucent objects)

Parameters
receiveShadowsDefines if this material will be able to receive shadows
Remarks
Invalidates the pipeline
See also
IsShadowReceiveEnabled

◆ EnableStencilTest()

void Nz::Material::EnableStencilTest ( bool  stencilTest)
inline

Enable/Disable stencil test for this material.

When enabled, all fragments must pass the stencil test to be rendered.

Parameters
scissorTestDefines if this material will use stencil test
Remarks
Invalidates the pipeline
See also
IsStencilTestEnabled

◆ EnsurePipelineUpdate()

void Nz::Material::EnsurePipelineUpdate ( ) const
inline

Ensures the pipeline gets updated.

When the pipeline gets invalidated, it's not updated until required (per example by calling GetPipeline). Using this function forces the pipeline update, making GetPipeline thread-safe as long as the pipeline does not get invalidated.

See also
GetPipeline

◆ GetAlphaMap()

const TextureRef & Nz::Material::GetAlphaMap ( ) const
inline

Gets the alpha map.

Returns
Constant reference to the current texture
See also
SetAlphaMap

◆ GetAlphaThreshold()

float Nz::Material::GetAlphaThreshold ( ) const
inline

Gets the alpha test threshold.

Returns
The threshold value for the alpha test
See also
EnableAlphaTest
SetAlphaThreshold

◆ GetAmbientColor()

Color Nz::Material::GetAmbientColor ( ) const
inline

Gets the ambient color.

Returns
Ambient color
See also
SetAmbientColor

◆ GetDefault()

MaterialRef Nz::Material::GetDefault ( )
inlinestatic

Gets the default material.

Returns
Reference to the default material
Remarks
This material should NOT be modified as it would affect all objects using it

◆ GetDepthFunc()

RendererComparison Nz::Material::GetDepthFunc ( ) const
inline

Gets the function to compare depth.

Returns
Function comparing the depth of two materials
See also
EnableDepthTest
SetAmbientColor

◆ GetDepthMaterial()

const MaterialRef & Nz::Material::GetDepthMaterial ( ) const
inline

Gets the depth material.

Returns
Constant reference to the depth material
See also
EnableShadowCasting

◆ GetDiffuseColor()

Color Nz::Material::GetDiffuseColor ( ) const
inline

Gets the diffuse color.

Returns
Diffuse color
See also
SetDiffuseColor

◆ GetDiffuseMap()

const TextureRef & Nz::Material::GetDiffuseMap ( ) const
inline

Gets the diffuse map.

Returns
Constant reference to the texture
See also
SetDiffuseMap

◆ GetDiffuseSampler() [1/2]

TextureSampler & Nz::Material::GetDiffuseSampler ( )
inline

Gets the diffuse sampler.

Returns
Reference to the current texture sampler for the diffuse
See also
SetDiffuseSampler

◆ GetDiffuseSampler() [2/2]

const TextureSampler & Nz::Material::GetDiffuseSampler ( ) const
inline

Gets the diffuse sampler.

Returns
Constant reference to the current texture sampler for the diffuse
See also
SetDiffuseSampler

◆ GetDstBlend()

BlendFunc Nz::Material::GetDstBlend ( ) const
inline

Gets the dst in blend.

Returns
Function for dst blending
See also
SetDstBlend

◆ GetEmissiveMap()

const TextureRef & Nz::Material::GetEmissiveMap ( ) const
inline

Gets the emissive map.

Returns
Constant reference to the texture
See also
SetEmissiveMap

◆ GetFaceCulling()

FaceSide Nz::Material::GetFaceCulling ( ) const
inline

Gets the face culling.

Returns
Current face culling side
See also
SetFaceCulling

◆ GetFaceFilling()

FaceFilling Nz::Material::GetFaceFilling ( ) const
inline

Gets the face filling.

Returns
Current face filling

◆ GetHeightMap()

const TextureRef & Nz::Material::GetHeightMap ( ) const
inline

Gets the height map.

Returns
Constant reference to the texture

◆ GetLineWidth()

float Nz::Material::GetLineWidth ( ) const
inline

Gets the line width of this material.

Returns
Line width

◆ GetNormalMap()

const TextureRef & Nz::Material::GetNormalMap ( ) const
inline

Gets the normal map.

Returns
Constant reference to the texture

◆ GetPipeline()

const MaterialPipeline * Nz::Material::GetPipeline ( ) const
inline

Gets the render states.

Returns
Constant reference to the render states

◆ GetPipelineInfo()

const MaterialPipelineInfo & Nz::Material::GetPipelineInfo ( ) const
inline

Gets the pipeline informations.

Returns
Constant reference to the pipeline info

◆ GetPointSize()

float Nz::Material::GetPointSize ( ) const
inline

Gets the point size of this material.

Returns
Point size

◆ GetReflectionMode()

ReflectionMode Nz::Material::GetReflectionMode ( ) const
inline

Gets the reflection mode of the material.

Returns
Current reflection mode
See also
SetReflectionMode

◆ GetShader()

const UberShader * Nz::Material::GetShader ( ) const
inline

Gets the über-shader used by this material.

Returns
Constant pointer to the über-shader used

◆ GetShininess()

float Nz::Material::GetShininess ( ) const
inline

Gets the shininess.

Returns
Current shininess

◆ GetSpecularColor()

Color Nz::Material::GetSpecularColor ( ) const
inline

Gets the specular color.

Returns
Specular color

◆ GetSpecularMap()

const TextureRef & Nz::Material::GetSpecularMap ( ) const
inline

Gets the specular map.

Returns
Constant reference to the texture

◆ GetSpecularSampler() [1/2]

TextureSampler & Nz::Material::GetSpecularSampler ( )
inline

Gets the specular sampler.

Returns
Reference to the current texture sampler for the specular

◆ GetSpecularSampler() [2/2]

const TextureSampler & Nz::Material::GetSpecularSampler ( ) const
inline

Gets the specular sampler.

Returns
Constant reference to the current texture sampler for the specular

◆ GetSrcBlend()

BlendFunc Nz::Material::GetSrcBlend ( ) const
inline

Gets the src in blend.

Returns
Function for src blending

◆ HasAlphaMap()

bool Nz::Material::HasAlphaMap ( ) const
inline

Checks whether this material has an alpha map.

Returns
true If it is the case

◆ HasDepthMaterial()

bool Nz::Material::HasDepthMaterial ( ) const
inline

Checks whether this material has a depth material.

Returns
true If it is the case

◆ HasDiffuseMap()

bool Nz::Material::HasDiffuseMap ( ) const
inline

Checks whether this material has a diffuse map.

Returns
true If it is the case

◆ HasEmissiveMap()

bool Nz::Material::HasEmissiveMap ( ) const
inline

Checks whether this material has a emissive map.

Returns
true If it is the case

◆ HasHeightMap()

bool Nz::Material::HasHeightMap ( ) const
inline

Checks whether this material has a height map.

Returns
true If it is the case

◆ HasNormalMap()

bool Nz::Material::HasNormalMap ( ) const
inline

Checks whether this material has a normal map.

Returns
true If it is the case

◆ HasSpecularMap()

bool Nz::Material::HasSpecularMap ( ) const
inline

Checks whether this material has a specular map.

Returns
true If it is the case

◆ IsAlphaTestEnabled()

bool Nz::Material::IsAlphaTestEnabled ( ) const
inline

Checks whether this material has alpha test enabled.

Returns
true If it is the case

◆ IsBlendingEnabled()

bool Nz::Material::IsBlendingEnabled ( ) const
inline

Checks whether this material has blending enabled.

Returns
true If it is the case

◆ IsColorWriteEnabled()

bool Nz::Material::IsColorWriteEnabled ( ) const
inline

Checks whether this material has color write enabled.

Returns
true If it is the case

◆ IsDepthBufferEnabled()

bool Nz::Material::IsDepthBufferEnabled ( ) const
inline

Checks whether this material has depth buffer enabled.

Returns
true If it is the case

◆ IsDepthSortingEnabled()

bool Nz::Material::IsDepthSortingEnabled ( ) const
inline

Checks whether this material has depth sorting enabled.

Returns
true If it is the case

◆ IsDepthWriteEnabled()

bool Nz::Material::IsDepthWriteEnabled ( ) const
inline

Checks whether this material has depth writing enabled.

Returns
true If it is the case

◆ IsFaceCullingEnabled()

bool Nz::Material::IsFaceCullingEnabled ( ) const
inline

Checks whether this material has face culling enabled.

Returns
true If it is the case

◆ IsReflectionMappingEnabled()

bool Nz::Material::IsReflectionMappingEnabled ( ) const
inline

Checks whether this material has reflection mapping enabled.

Returns
true If it is the case
See also
EnableReflectionMapping

◆ IsScissorTestEnabled()

bool Nz::Material::IsScissorTestEnabled ( ) const
inline

Checks whether this material has scissor test enabled.

Returns
true If it is the case

◆ IsShadowCastingEnabled()

bool Nz::Material::IsShadowCastingEnabled ( ) const
inline

Checks whether this material cast shadow.

Returns
true If it is the case

◆ IsShadowReceiveEnabled()

bool Nz::Material::IsShadowReceiveEnabled ( ) const
inline

Checks whether this material receive shadow.

Returns
true If it is the case

◆ IsStencilTestEnabled()

bool Nz::Material::IsStencilTestEnabled ( ) const
inline

Checks whether this material has stencil test enabled.

Returns
true If it is the case

◆ LoadFromFile()

bool Nz::Material::LoadFromFile ( const String filePath,
const MaterialParams &  params = MaterialParams() 
)
inline

Loads the material from file.

Returns
true if loading is successful
Parameters
filePathPath to the file
paramsParameters for the material

◆ LoadFromMemory()

bool Nz::Material::LoadFromMemory ( const void *  data,
std::size_t  size,
const MaterialParams &  params = MaterialParams() 
)
inline

Loads the material from memory.

Returns
true if loading is successful
Parameters
dataRaw memory
sizeSize of the memory
paramsParameters for the material

◆ LoadFromStream()

bool Nz::Material::LoadFromStream ( Stream stream,
const MaterialParams &  params = MaterialParams() 
)
inline

Loads the material from stream.

Returns
true if loading is successful
Parameters
streamStream to the material
paramsParameters for the material

◆ New()

template<typename... Args>
MaterialRef Nz::Material::New ( Args &&...  args)
static

Creates a new material from the arguments.

Returns
A reference to the newly created material
Parameters
argsArguments for the material

◆ operator=()

Material & Nz::Material::operator= ( const Material material)
inline

Sets the current material with the content of the other one.

Returns
A reference to this
Parameters
materialThe other Material

◆ Reset()

void Nz::Material::Reset ( )

Resets the material, cleans everything.

Remarks
Invalidates the pipeline

◆ SaveToParameters()

void Nz::Material::SaveToParameters ( ParameterList matData)

Builds a ParameterList with material data.

Parameters
matDataDestination parameter list which will receive material data

◆ SetAlphaMap() [1/2]

bool Nz::Material::SetAlphaMap ( const String textureName)
inline

Sets the alpha map by name.

Returns
true If successful
Parameters
textureNameNamed texture

◆ SetAlphaMap() [2/2]

void Nz::Material::SetAlphaMap ( TextureRef  alphaMap)
inline

Sets the alpha map with a reference to a texture.

Returns
true If successful
Parameters
alphaMapTexture
Remarks
Invalidates the pipeline

◆ SetAlphaThreshold()

void Nz::Material::SetAlphaThreshold ( float  alphaThreshold)
inline

Sets the alpha threshold.

Parameters
alphaThresholdThreshold for the alpha

◆ SetAmbientColor()

void Nz::Material::SetAmbientColor ( const Color ambient)
inline

Sets the color for ambient.

Parameters
ambientColor for ambient

◆ SetDepthFunc()

void Nz::Material::SetDepthFunc ( RendererComparison  depthFunc)
inline

Sets the depth functor.

Parameters
depthFunc
Remarks
Invalidates the pipeline

◆ SetDepthMaterial()

void Nz::Material::SetDepthMaterial ( MaterialRef  depthMaterial)
inline

Sets the depth material.

Returns
true If successful
Parameters
depthMaterialMaterial for depth

◆ SetDiffuseColor()

void Nz::Material::SetDiffuseColor ( const Color diffuse)
inline

Sets the color for diffuse.

Parameters
diffuseColor for diffuse

◆ SetDiffuseMap() [1/2]

bool Nz::Material::SetDiffuseMap ( const String textureName)
inline

Sets the diffuse map by name.

Returns
true If successful
Parameters
textureNameNamed texture
Remarks
Invalidates the pipeline

◆ SetDiffuseMap() [2/2]

void Nz::Material::SetDiffuseMap ( TextureRef  diffuseMap)
inline

Sets the diffuse map with a reference to a texture.

Returns
true If successful
Parameters
diffuseMapTexture
Remarks
Invalidates the pipeline

◆ SetDiffuseSampler()

void Nz::Material::SetDiffuseSampler ( const TextureSampler &  sampler)
inline

Sets the diffuse sampler.

Parameters
samplerDiffuse sample

◆ SetDstBlend()

void Nz::Material::SetDstBlend ( BlendFunc  func)
inline

Sets the dst in blend.

Parameters
funcFunction for dst blending
Remarks
Invalidates the pipeline

◆ SetEmissiveMap() [1/2]

bool Nz::Material::SetEmissiveMap ( const String textureName)
inline

Sets the emissive map by name.

Returns
true If successful
Parameters
textureNameNamed texture
See also
GetEmissiveMap

◆ SetEmissiveMap() [2/2]

void Nz::Material::SetEmissiveMap ( TextureRef  emissiveMap)
inline

Sets the emissive map with a reference to a texture.

Returns
true If successful
Parameters
emissiveMapTexture
Remarks
Invalidates the pipeline

◆ SetFaceCulling()

void Nz::Material::SetFaceCulling ( FaceSide  faceSide)
inline

Sets the face culling.

Parameters
faceSideFace to cull
Remarks
Invalidates the pipeline

◆ SetFaceFilling()

void Nz::Material::SetFaceFilling ( FaceFilling  filling)
inline

Sets the face filling.

Parameters
fillingFace to fill
Remarks
Invalidates the pipeline

◆ SetHeightMap() [1/2]

bool Nz::Material::SetHeightMap ( const String textureName)
inline

Sets the height map by path or name.

Returns
true If successful
Parameters
textureNameNamed texture
See also
GetHeightMap

◆ SetHeightMap() [2/2]

void Nz::Material::SetHeightMap ( TextureRef  heightMap)
inline

Sets the height map with a reference to a texture.

Parameters
heightMapTexture
Remarks
Invalidates the pipeline
See also
GetHeightMap

◆ SetLineWidth()

void Nz::Material::SetLineWidth ( float  lineWidth)
inline

Sets the line width for this material.

This parameter is used when rendering lines, to define the width (in pixels) the line will take on the framebuffer

Parameters
lineWidthWidth of the line
Remarks
Invalidates the pipeline
See also
GetLineWidth

◆ SetNormalMap() [1/2]

bool Nz::Material::SetNormalMap ( const String textureName)
inline

Sets the normal map by path or name.

Returns
true If successful
Parameters
textureNameNamed texture
Remarks
Invalidates the pipeline
See also
GetNormalMap

◆ SetNormalMap() [2/2]

void Nz::Material::SetNormalMap ( TextureRef  normalMap)
inline

Sets the normal map with a reference to a texture.

Returns
true If successful
Parameters
normalMapTexture
Remarks
Invalidates the pipeline
See also
GetNormalMap

◆ SetPointSize()

void Nz::Material::SetPointSize ( float  pointSize)
inline

Sets the point size for this material.

This parameter is used when rendering points, to define the size (in pixels) the point will take on the framebuffer

Parameters
pointSizeSize of the point
Remarks
Invalidates the pipeline
See also
GetPointSize

◆ SetReflectionMode()

void Nz::Material::SetReflectionMode ( ReflectionMode  reflectionMode)
inline

Changes reflection mode of the material.

When reflections are enable, the material will render reflections from the object environment according to the reflection mode. This function does change the reflection mode used by the material.

Skyboxes reflections are the cheapest but are static and thus can't reflect other objects. Probes reflections are cheap, depending on probes reflection mode, but require regular probe finding from objects using it. Real-time reflections are expensive but provide the most accurate reflection map (and can reflect other objects around).

Parameters
reflectionModeThe new reflection mode this material should use
Remarks
May invalidates the pipeline
See also
EnableReflectionMapping
IsReflectionMappingEnabled
SetReflectionSize

◆ SetShader() [1/2]

void Nz::Material::SetShader ( UberShaderConstRef  uberShader)
inline

Sets the shader with a constant reference to a ubershader.

Parameters
uberShaderUber shader to apply
Remarks
Invalidates the pipeline
See also
GetShader

◆ SetShader() [2/2]

bool Nz::Material::SetShader ( const String uberShaderName)
inline

Sets the shader by name.

Returns
true If successful
Parameters
uberShaderNameNamed shader

◆ SetShininess()

void Nz::Material::SetShininess ( float  shininess)
inline

Sets the shininess of the material.

Parameters
shininessValue of the shininess

◆ SetSpecularColor()

void Nz::Material::SetSpecularColor ( const Color specular)
inline

Sets the color for specular.

Parameters
specularColor

◆ SetSpecularMap() [1/2]

bool Nz::Material::SetSpecularMap ( const String textureName)
inline

Sets the specular map by name.

Returns
true If successful
Parameters
textureNameNamed texture
Remarks
Invalidates the pipeline

◆ SetSpecularMap() [2/2]

void Nz::Material::SetSpecularMap ( TextureRef  specularMap)
inline

Sets the specular map with a reference to a texture.

Returns
true If successful
Parameters
specularMapTexture
Remarks
Invalidates the pipeline
See also
GetSpecularMap

◆ SetSpecularSampler()

void Nz::Material::SetSpecularSampler ( const TextureSampler &  sampler)
inline

Sets the specular sampler.

Parameters
samplerSpecular sample
See also
GetSpecularSampler

◆ SetSrcBlend()

void Nz::Material::SetSrcBlend ( BlendFunc  func)
inline

Sets the src in blend.

Parameters
funcFunction for src blending
Remarks
Invalidates the pipeline
See also
GetSrcBlend

The documentation for this class was generated from the following files: