Class MaterialInstance
Instance of the Material
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Content/Assets/MaterialInstance.h
Syntax
public class MaterialInstance : public MaterialBase
Methods
Bind(BindParameters& params)
Binds the material state to the GPU pipeline. Should be called before the draw command.
Declaration
public virtual void Bind(BindParameters& params) override
Parameters
BindParameters
params
The material bind settings. |
Overrides
CanUseInstancing(InstancingHandler& handler)
Returns true if material can use draw calls instancing.
Declaration
public virtual bool CanUseInstancing(InstancingHandler& handler) const override
Parameters
InstancingHandler
handler
The output data for the instancing handling used to hash, batch and write draw calls. Valid only when function returns true. |
Returns
bool
True if can use instancing, otherwise false. |
Overrides
CanUseLightmap()
Returns true if material can use lightmaps (this includes lightmaps offline baking and sampling at runtime).
Declaration
public virtual bool CanUseLightmap() const override
Returns
bool
True if can use lightmaps, otherwise false |
Overrides
GetBaseMaterial()
Gets the base material. If value gets changed parameters collection is restored to the default values of the new material.
Declaration
public MaterialBase* GetBaseMaterial() const
Returns
MaterialBase
|
getChunksToPreload()
Gets packed chunks indices to preload before asset loading action
Declaration
protected virtual AssetChunksFlag getChunksToPreload() const override
Returns
AssetChunksFlag
Chunks to load flags |
Overrides
GetDrawModes()
Gets the mask of render passes supported by this material.
Declaration
public virtual DrawPass GetDrawModes() const override
Returns
DrawPass
The draw passes supported by this material. |
Overrides
GetInfo()
Gets the material info, structure which describes material surface.
Declaration
public virtual MaterialInfo GetInfo() const override
Returns
MaterialInfo
The constant reference to the material descriptor. |
Overrides
GetReferences(Array<Guid>& assets, Array<String>& files)
Declaration
public void GetReferences(Array<Guid>& assets, Array<String>& files) const override
Parameters
Array<Guid>
assets
|
Array<String>
files
|
GetShader()
Gets the shader resource.
Declaration
public virtual GPUShader* GetShader() const override
Returns
GPUShader
The material shader resource. |
Overrides
IsMaterialInstance()
Returns true if material is a material instance.
Declaration
public virtual bool IsMaterialInstance() const override
Returns
bool
|
Overrides
IsReady()
Returns true if material is ready for rendering.
Declaration
public virtual bool IsReady() const override
Returns
bool
True if can render that material |
Overrides
load()
Load data from the chunks
Declaration
protected virtual LoadResult load() override
Returns
LoadResult
Loading result |
Overrides
ResetParameters()
Resets all parameters back to the base material (including disabling parameter overrides).
Declaration
public void ResetParameters()
Save(const StringView& path=StringView::Empty)
Saves this asset to the file. Supported only in Editor.
Declaration
public virtual bool Save(const StringView& path=StringView::Empty) override
Parameters
StringView
path
The custom asset path to use for the saving. Use empty value to save this asset to its own storage location. Can be used to duplicate asset. Must be specified when saving virtual asset. |
Returns
bool
True when cannot save data, otherwise false. |
Overrides
SetBaseMaterial(MaterialBase* baseMaterial)
Sets the base material. If value gets changed parameters collection is restored to the default values of the new material.
Declaration
public void SetBaseMaterial(MaterialBase* baseMaterial)
Parameters
MaterialBase
baseMaterial
The base material. |
unload(bool isReloading)
Unloads asset data
Declaration
protected virtual void unload(bool isReloading) override
Parameters
bool
isReloading
True if asset is reloading data, otherwise false. |