ShaderMaterial

ShaderMaterial class

着色器材质允许通过外部渲染引擎或着色器语言来描述材质。ShaderMaterial 使用 ShaderTechnique 来描述具体的渲染细节,并且会根据最终渲染平台选择最合适的实现。例如,您的 ShaderMaterial 实例可以拥有两种 technique,一种由 HLSL 定义,另一种由 GLSL 定义。在非 Windows 平台下应使用 GLSL 而不是 HLSL。

方法

constructor

名称描述
constructor()初始化 ShaderMaterial 类的新实例。

Result:


constructor_overload

名称描述
constructor_overload(name)初始化 ShaderMaterial 类的新实例。

Parameters:

名称类型描述
name字符串名称

Result:


getTechniques

名称描述
getTechniques()获取此材料中定义的所有可用技术。

Result:


getName

名称描述
getName()获取或设置名称。名称。

Result:


setName

名称描述
setName(value)获取或设置名称。名称。

Result:


getProperties

名称描述
getProperties()获取所有属性的集合。

Result:


getTexture

名称描述
getTexture(slotName)获取指定槽位的纹理,它可以是材质的属性名称或着色器的参数名称

Parameters:

名称类型描述
slotName字符串槽位名称。

Result: TextureBase


setTexture

名称描述
setTexture(slotName, texture)将纹理设置到指定槽位

Parameters:

名称类型描述
slotName字符串槽位名称。
textureTextureBase纹理。

Result: TextureBase


toString

名称描述
toString()将对象格式化为字符串

Result: 字符串


removeProperty

名称描述
removeProperty(property)移除动态属性。

Parameters:

名称类型描述
propertyProperty要移除哪个属性

Result: boolean


removeProperty

名称描述
removeProperty(property)移除按名称标识的指定属性

Parameters:

名称类型描述
propert字符串null

Result: boolean


getProperty

名称描述
getProperty(property)获取指定属性的值

Parameters:

名称类型描述
property字符串属性名称

Result: 对象


setProperty

名称描述
setProperty(property, value)设置指定属性的值

Parameters:

名称类型描述
property字符串属性名称
对象属性的值

Result: 对象


findProperty

名称描述
findProperty(propertyName)查找属性。它可以是动态属性(由 CreateDynamicProperty/SetProperty 创建)或本机属性(通过其名称标识)

Parameters:

名称类型描述
propertyName字符串属性名称。

Result: Property


iterator

名称描述
iterator()保留供内部使用。

Result: Property