M&B: Bannerlord 1.2.9
The horns sound, the ravens gather.
Loading...
Searching...
No Matches
TaleWorlds.Engine.Material Class Referencesealed

Representation of the material in the Mono domain MBMaterial provides methods related to texture, shader, and other material properties.

Inherits TaleWorlds.Engine.Resource.

Public Types

enum  MBTextureType {
  DiffuseMap ,
  DiffuseMap2 ,
  BumpMap ,
  EnvironmentMap ,
  SpecularMap
}
 Types of texture regarding its usage in the related shader. More...
 
enum  MBAlphaBlendMode : byte {
  None ,
  Modulate ,
  AddAlpha ,
  Multiply ,
  Add ,
  Max ,
  Factor ,
  AddModulateCombined ,
  NoAlphaBlendNoWrite ,
  ModulateNoWrite ,
  GbufferAlphaBlend ,
  GbufferAlphaBlendwithVtResolve
}
 Types of alpha blend modes available for MBMaterial. More...
 

Public Member Functions

Material CreateCopy ()
 Creates a copy this MBMaterial Added as a convenience method Same as new MBMaterial(this)
 
void SetShader (Shader shader)
 Sets the material shader.
 
Shader GetShader ()
 Returns the assigned MBShader.
 
UInt64 GetShaderFlags ()
 
void SetShaderFlags (UInt64 flagEntry)
 
void SetMeshVectorArgument (float x, float y, float z, float w)
 
void SetTexture (MBTextureType textureType, Texture texture)
 Sets the texture to the texture slot specified by 'textureType'.
 
void SetTextureAtSlot (int textureSlot, Texture texture)
 
void SetAreaMapScale (float scale)
 
void SetEnableSkinning (bool enable)
 
bool UsingSkinning ()
 
Texture GetTexture (MBTextureType textureType)
 Returns the texture assigned to 'textureType' slot.
 
Texture GetTextureWithSlot (int textureSlot)
 
MBAlphaBlendMode GetAlphaBlendMode ()
 Returns the alpha blend mode of the material.
 
void SetAlphaBlendMode (MBAlphaBlendMode alphaBlendMode)
 Sets the alpha blend mode of this MBMaterial.
 
void SetAlphaTestValue (float alphaTestValue)
 Sets the alpha test value of this MBMaterial.
 
float GetAlphaTestValue ()
 Gets the alpha test value of this MBMaterial.
 
void AddMaterialShaderFlag (String flagName, bool showErrors)
 

Static Public Member Functions

static Material GetDefaultMaterial ()
 
static Material GetOutlineMaterial (Mesh mesh)
 
static Material GetDefaultTableauSampleMaterial (bool transparency)
 
static Material CreateTableauMaterial (RenderTargetComponent.TextureUpdateEventHandler eventHandler, Object objectRef, Material sampleMaterial, int tableauSizeX, int tableauSizeY, bool continuousTableau=false)
 
static Material GetFromResource (string materialName)
 Returns a MBMaterial instance whose name is 'materialName'.
 
static Material GetAlphaMaskTableauMaterial ()
 

Properties

string Name [get, set]
 Gets Name of the material This property is read only.
 
bool UsingSpecular [get, set]
 Property defining the usage of specular light component.
 
bool UsingSpecularMap [get, set]
 Property defining the usage of specular map for specular reflection calculations UsingSpecular should be 'true' for this property to take effect.
 
bool UsingEnvironmentMap [get, set]
 Property defining the usage of environment map.
 
bool UsingSpecularAlpha [get, set]
 Property defining the usage of specular alpha.
 
bool UsingDynamicLight [get, set]
 Property defining whether dynamic lights will effect this material or not.
 
bool UsingSunLight [get, set]
 Property defining whether sun light will effect this material or not.
 
bool UsingFresnel [get, set]
 Property defining the usage of fresnel effect on this material.
 
bool IsSunShadowReceiver [get, set]
 Property defining whether shadows due to sun light will fall on this material.
 
bool IsDynamicShadowReceiver [get, set]
 Property defining whether dynamic shadows will fall on this material.
 
bool UsingDiffuseAlphaMap [get, set]
 Property defining the usage of diffuse alpha map.
 
bool UsingParallaxMapping [get, set]
 Property defining the usage of parallax mapping.
 
bool UsingParallaxOcclusion [get, set]
 Property defining the usage of parallax occlusion.
 
MaterialFlags Flags [get, set]
 
- Properties inherited from TaleWorlds.Engine.Resource
bool IsValid [get]
 

Additional Inherited Members

- Protected Member Functions inherited from TaleWorlds.Engine.Resource
 Resource ()
 
void CheckResourceParameter (Resource param, string paramName="")
 Check if the parameter 'param' is null or invalid and throws an exception containing 'paramName' as further information.
 

Member Enumeration Documentation

◆ MBTextureType

Enumerator
DiffuseMap 
DiffuseMap2 
BumpMap 
EnvironmentMap 
SpecularMap 

◆ MBAlphaBlendMode

Enumerator
None 
Modulate 
AddAlpha 
Multiply 
Add 
Max 
Factor 
AddModulateCombined 
NoAlphaBlendNoWrite 
ModulateNoWrite 
GbufferAlphaBlend 
GbufferAlphaBlendwithVtResolve 

Member Function Documentation

◆ GetDefaultMaterial()

static Material TaleWorlds.Engine.Material.GetDefaultMaterial ( )
static

◆ GetOutlineMaterial()

static Material TaleWorlds.Engine.Material.GetOutlineMaterial ( Mesh mesh)
static

◆ GetDefaultTableauSampleMaterial()

static Material TaleWorlds.Engine.Material.GetDefaultTableauSampleMaterial ( bool transparency)
static

◆ CreateTableauMaterial()

static Material TaleWorlds.Engine.Material.CreateTableauMaterial ( RenderTargetComponent.TextureUpdateEventHandler eventHandler,
Object objectRef,
Material sampleMaterial,
int tableauSizeX,
int tableauSizeY,
bool continuousTableau = false )
static

◆ CreateCopy()

Material TaleWorlds.Engine.Material.CreateCopy ( )
Returns

◆ GetFromResource()

static Material TaleWorlds.Engine.Material.GetFromResource ( string materialName)
static
Parameters
materialNameName of the material to get
Returns
Returns the MBMaterial representation of the material named 'materialName'. Returns the previously retrieved instance. A new instance is created if there is none previously or its has been GCed. Returns null if there is no material named 'materialName'

◆ SetShader()

void TaleWorlds.Engine.Material.SetShader ( Shader shader)
Parameters
shaderShader object to be set as the material shader

◆ GetShader()

Shader TaleWorlds.Engine.Material.GetShader ( )
Returns
Returns the material shader Returns null if no shader is assigned to this material

◆ GetShaderFlags()

UInt64 TaleWorlds.Engine.Material.GetShaderFlags ( )

◆ SetShaderFlags()

void TaleWorlds.Engine.Material.SetShaderFlags ( UInt64 flagEntry)

◆ SetMeshVectorArgument()

void TaleWorlds.Engine.Material.SetMeshVectorArgument ( float x,
float y,
float z,
float w )

◆ SetTexture()

void TaleWorlds.Engine.Material.SetTexture ( MBTextureType textureType,
Texture texture )
Parameters
textureTypeThe texture type.
textureTexture to be assigned to the texture slot specified by 'textureType'

◆ SetTextureAtSlot()

void TaleWorlds.Engine.Material.SetTextureAtSlot ( int textureSlot,
Texture texture )

◆ SetAreaMapScale()

void TaleWorlds.Engine.Material.SetAreaMapScale ( float scale)

◆ SetEnableSkinning()

void TaleWorlds.Engine.Material.SetEnableSkinning ( bool enable)

◆ UsingSkinning()

bool TaleWorlds.Engine.Material.UsingSkinning ( )

◆ GetTexture()

Texture TaleWorlds.Engine.Material.GetTexture ( MBTextureType textureType)
Parameters
textureTypeDefines the texture type slot whose texture assignment will be returned
Returns
Returns the texture assigned to 'textureType' slot Returns null if there is no texture assigned to the specified slot

◆ GetTextureWithSlot()

Texture TaleWorlds.Engine.Material.GetTextureWithSlot ( int textureSlot)

◆ GetAlphaMaskTableauMaterial()

static Material TaleWorlds.Engine.Material.GetAlphaMaskTableauMaterial ( )
static

◆ GetAlphaBlendMode()

MBAlphaBlendMode TaleWorlds.Engine.Material.GetAlphaBlendMode ( )
Returns
Returns the alpha blend mode of the material

◆ SetAlphaBlendMode()

void TaleWorlds.Engine.Material.SetAlphaBlendMode ( MBAlphaBlendMode alphaBlendMode)
Parameters
alphaBlendModeThe alpha blend mode.

◆ SetAlphaTestValue()

void TaleWorlds.Engine.Material.SetAlphaTestValue ( float alphaTestValue)
Parameters
alphaTestValueThe alpha blend value, from 0 to 1

◆ GetAlphaTestValue()

float TaleWorlds.Engine.Material.GetAlphaTestValue ( )

◆ AddMaterialShaderFlag()

void TaleWorlds.Engine.Material.AddMaterialShaderFlag ( String flagName,
bool showErrors )

Property Documentation

◆ Name

string TaleWorlds.Engine.Material.Name
getset

◆ UsingSpecular

bool TaleWorlds.Engine.Material.UsingSpecular
getset

◆ UsingSpecularMap

bool TaleWorlds.Engine.Material.UsingSpecularMap
getset

◆ UsingEnvironmentMap

bool TaleWorlds.Engine.Material.UsingEnvironmentMap
getset

◆ UsingSpecularAlpha

bool TaleWorlds.Engine.Material.UsingSpecularAlpha
getset

◆ UsingDynamicLight

bool TaleWorlds.Engine.Material.UsingDynamicLight
getset

◆ UsingSunLight

bool TaleWorlds.Engine.Material.UsingSunLight
getset

◆ UsingFresnel

bool TaleWorlds.Engine.Material.UsingFresnel
getset

◆ IsSunShadowReceiver

bool TaleWorlds.Engine.Material.IsSunShadowReceiver
getset

◆ IsDynamicShadowReceiver

bool TaleWorlds.Engine.Material.IsDynamicShadowReceiver
getset

◆ UsingDiffuseAlphaMap

bool TaleWorlds.Engine.Material.UsingDiffuseAlphaMap
getset

◆ UsingParallaxMapping

bool TaleWorlds.Engine.Material.UsingParallaxMapping
getset

◆ UsingParallaxOcclusion

bool TaleWorlds.Engine.Material.UsingParallaxOcclusion
getset

◆ Flags

MaterialFlags TaleWorlds.Engine.Material.Flags
getset