Class Material
Namespace: ValveResourceFormat.ResourceTypes
Assembly: ValveResourceFormat.dll
Represents a material resource containing shader parameters and texture references.
public class Material : KeyValuesOrNTROInheritance
object ← Block ← KeyValuesOrNTRO ← Material
Inherited Members
KeyValuesOrNTRO.Type, KeyValuesOrNTRO.Data, KeyValuesOrNTRO.Format, KeyValuesOrNTRO.Read(BinaryReader), KeyValuesOrNTRO.Serialize(Stream), KeyValuesOrNTRO.WriteText(IndentedTextWriter), Block.Type, Block.Offset, Block.Size, Block.Resource, Block.Read(BinaryReader), Block.ToString(), Block.WriteText(IndentedTextWriter), Block.Serialize(Stream)
Extension Methods
ResourceDataExtensions.AsKeyValueCollection(Block)
Properties
DynamicExpressions
Gets Material.DynamicParams and Material.DynamicTextureParams decompiled to readable source. Nothing evaluates them; a parameter driven by one keeps its static baked value.
public Dictionary<string, string> DynamicExpressions { get; }Property Value
Dictionary<string, string>
DynamicParams
Gets the compiled expressions of the dynamic scalar and vector parameters, by parameter name.
public Dictionary<string, byte[]> DynamicParams { get; }Property Value
Dictionary<string, byte[]>
DynamicTextureParams
Gets the compiled expressions of the dynamic texture parameters, by parameter name.
public Dictionary<string, byte[]> DynamicTextureParams { get; }Property Value
Dictionary<string, byte[]>
FloatAttributes
Gets the floating-point material attributes.
public Dictionary<string, float> FloatAttributes { get; }Property Value
Dictionary<string, float>
FloatParams
Gets the floating-point shader parameters.
public Dictionary<string, float> FloatParams { get; }Property Value
Dictionary<string, float>
InputSignature
Gets the vertex shader input signature defining vertex attributes.
public Material.VsInputSignature InputSignature { get; }Property Value
IntAttributes
Gets the integer material attributes.
public Dictionary<string, long> IntAttributes { get; }Property Value
Dictionary<string, long>
IntParams
Gets the integer shader parameters.
public Dictionary<string, long> IntParams { get; }Property Value
Dictionary<string, long>
Name
Gets or sets the material name.
public string Name { get; set; }Property Value
string
RenderAttributesUsed
Gets the render attributes that the compiled expressions might have used.
public string[] RenderAttributesUsed { get; }Property Value
string[]
ShaderName
Gets or sets the shader name used by this material.
public string ShaderName { get; set; }Property Value
string
StringAttributes
Gets the string material attributes.
public Dictionary<string, string> StringAttributes { get; }Property Value
Dictionary<string, string>
TextureParams
Gets the texture shader parameters.
public Dictionary<string, string> TextureParams { get; }Property Value
Dictionary<string, string>
VectorAttributes
Gets the vector material attributes.
public Dictionary<string, Vector4> VectorAttributes { get; }Property Value
Dictionary<string, Vector4>
VectorParams
Gets the vector shader parameters.
public Dictionary<string, Vector4> VectorParams { get; }Property Value
Dictionary<string, Vector4>
Methods
FindD3DInputSignatureElement(VsInputSignature, string, int)
Finds an input signature element by Direct3D semantic name and index.
public static Material.InputSignatureElement FindD3DInputSignatureElement(Material.VsInputSignature insg, string d3dName, int d3dIndex)Parameters
insg Material.VsInputSignature
The input signature to search.
d3dName string
The Direct3D semantic name.
d3dIndex int
The Direct3D semantic index.
Returns
Material.InputSignatureElement
The matching element, or default if not found.
GetShaderArguments()
Gets the shader arguments from integer parameters starting with "F_".
public Dictionary<string, byte> GetShaderArguments()Returns
Dictionary<string, byte>
Dictionary of shader argument names and values.
LoadInputSignature(IFileLoader, string)
Loads a material's vertex shader input signature, which maps its DirectX semantics to engine ones. Returns Material.VsInputSignature.Empty for a material that cannot be loaded.
public static Material.VsInputSignature LoadInputSignature(IFileLoader fileLoader, string materialPath)Parameters
fileLoader IFileLoader
Loader for the material resource.
materialPath string
Resource path of the material, e.g. materials/foo.vmat.
Returns
Read(BinaryReader)
Reads the block data from a binary reader.
public override void Read(BinaryReader reader)Parameters
reader BinaryReader
The binary reader to read from.

