类 Material
内容
[
隐藏
]Material class
Material 定义了几何体外观所需的参数。Aspose.3D 提供了针对 LambertMaterial、PhongMaterial 和 ShaderMaterial 的着色模型。
public abstract class Material : A3DObject, IEnumerable<TextureSlot>
属性
| 名称 | 描述 |
|---|---|
| virtual Name { get; set; } | 获取或设置名称。 |
| Properties { get; } | 获取所有属性的集合。 |
方法
| 名称 | 描述 |
|---|---|
| FindProperty(string) | 查找属性。它可以是动态属性(由 CreateDynamicProperty/SetProperty 创建)或本地属性(通过其名称识别) |
| GetEnumerator() | 获取枚举器以枚举内部纹理槽。 |
| GetProperty(string) | 获取指定属性的值 |
| GetTexture(string) | 从指定槽获取纹理,它可以是材质的属性名称或着色器的参数名称。 |
| RemoveProperty(Property) | 移除动态属性。 |
| RemoveProperty(string) | 移除通过名称识别的指定属性 |
| SetProperty(string, object) | 设置指定属性的值 |
| SetTexture(string, TextureBase) | 将纹理设置到指定槽。 |
| override ToString() | 将对象格式化为字符串。 |
字段
| 名称 | 描述 |
|---|---|
| const MapAmbient | 在 SetTexture 中用于分配环境纹理映射。 |
| const MapDiffuse | 在SetTexture中用于分配漫反射纹理映射。 |
| const MapEmissive | 在SetTexture中用于分配自发光纹理映射。 |
| const MapNormal | 在SetTexture中用于分配法线纹理映射。 |
| const MapSpecular | 在SetTexture中用于分配高光纹理映射。 |
示例
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}");
}
另请参见
- class A3DObject
- class TextureSlot
- namespace Aspose.ThreeD.Shading
- assembly Aspose.3D