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
| Name | Description |
|---|
| virtual Name { get; set; } | Gets or sets the name. |
| Properties { get; } | Gets the collection of all properties. |
Methods
| Name | Description |
|---|
| FindProperty(string) | Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name) |
| GetEnumerator() | Gets the enumerator to enumerate internal texture slots. |
| GetProperty(string) | Get the value of specified property |
| 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. |
| RemoveProperty(string) | Remove the specified property identified by name |
| SetProperty(string, object) | Sets the value of specified property |
| SetTexture(string, TextureBase) | Sets the texture to specified slot |
| override ToString() | Formats object to string |
Fields
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