Class Material

Material class

Material defines the parameters necessary for visual appearance of geometry. Aspose.3D provides shading model for LambertMaterial, PhongMaterial and ShaderMaterial

public abstract class Material : A3DObject, IEnumerable<TextureSlot>

Properties

NameDescription
virtual Name { get; set; }Gets or sets the name.(Inherited from A3DObject.)
Properties { get; }Gets the collection of all properties.(Inherited from A3DObject.)

Methods

NameDescription
FindProperty(string)Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name)(Inherited from A3DObject.)
GetEnumerator()Gets the enumerator to enumerate internal texture slots.
GetProperty(string)Get the value of specified property(Inherited from A3DObject.)
GetTexture(string)Gets the texture from the specified slot, it can be material’s property name or shader’s parameter name
RemoveProperty(Property)Removes a dynamic property.(Inherited from A3DObject.)
RemoveProperty(string)Remove the specified property identified by name(Inherited from A3DObject.)
SetProperty(string, object)Sets the value of specified property(Inherited from A3DObject.)
SetTexture(string, TextureBase)Sets the texture to specified slot
override ToString()Formats object to string

Fields

NameDescription
const MapAmbientUsed in SetTexture to assign a ambient texture mapping.
const MapDiffuseUsed in SetTexture to assign a diffuse texture mapping.
const MapEmissiveUsed in SetTexture to assign a emissive texture mapping.
const MapNormalUsed in SetTexture to assign a normal texture mapping.
const MapSpecularUsed in SetTexture to assign a specular texture mapping.

Examples

var mat = new LambertMaterial();
var tex = new Texture();
tex.FileName = "diffuse.png";
mat.SetTexture(Material.MapDiffuse, tex);
foreach(var slot in mat)
{
    Console.WriteLine($"Texture slot {slot.SlotName} = {slot.Texture}");
}

See Also