ProceduralMaterial 程序材质
Inherits from Material
ProceduralMaterial class.
程序材质类。
This class exposes all properties from a Procedural Material, allowing you to modify or animate them. In order to get a Procedural Material used by an object, use the Renderer.material as a ProceduralMaterial. After modifying one or more procedural properties, call RebuildTextures to update the Procedural Material to show the changes.
这个类从一个程序材质公开所有属性,允许你来修改或动画。为了获取程序材质,使用于物体,使用Renderer.material作为程序材质。修改一个或多个程序材质的属性后,调用RebuildTextures来更新程序材质,已显示所做的改变。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public string floatRangeProperty = "Saturation";
public float cycleTime = 10;
void Update() {
ProceduralMaterial substance = renderer.sharedMaterial as ProceduralMaterial;
if (substance) {
float lerp = Mathf.PingPong(Time.time * 2 / cycleTime, 1);
substance.SetProceduralFloat(floatRangeProperty, lerp);
substance.RebuildTextures();
}
}
}
var floatRangeProperty : String = "Saturation";
var cycleTime : float = 10;
function Update () {
var substance : ProceduralMaterial = renderer.sharedMaterial as ProceduralMaterial;
if (substance) {
// Make the property go up and down over time
//使该属性随着时间的推移上下
var lerp = Mathf.PingPong (Time.time * 2 / cycleTime, 1);
substance.SetProceduralFloat (floatRangeProperty, lerp);
substance.RebuildTextures ();
}
}
Variables变量
-
Set & get the Procedural cache budget.
设置和获取程序缓存大小。
-
Checks if the Procedural Material is currently in the process of rebuilding the textures.
检测当前程序材质是否在重建纹理的进程中。
-
Should the Procedural Material be generated at load time?
程序材质是否在加载时生成?
Constructors构造器
Functions函数
-
Get an array of descriptions of all the properties this Procedural Material has.
获取这个程序材质所有属性描述的一个数组。
-
Checks if the Procedural Material has a property of a given name.
检测程序材质是否具有给定名称的属性。
-
Get a named Procedural boolean property.
获取一个命名的程序布尔属性。
-
Set a named Procedural boolean property.
设置一个命名的程序布尔属性。
-
Get a named Procedural float property.
获取一个命名的程序浮点数属性。
-
Set a named Procedural float property.
设置一个命名的程序浮点数属性。
-
Get a named Procedural vector property.
获取一个命名的程序向量属性。
-
Set a named Procedural vector property.
设置一个命名的程序向量属性。
-
Get a named Procedural color property.
获取一个命名的程序颜色属性。
-
Set a named Procedural color property.
设置一个命名的程序颜色属性。
-
Get a named Procedural enum property.
获取一个命名的程序枚举属性。
-
Set a named Procedural enum property.
设置一个命名的程序枚举属性。
-
Get a named Procedural texture property.
获取一个命名的程序纹理属性。
-
Set a named Procedural texture property.
设置一个命名的程序纹理属性。
-
Checks if a named Procedural property is cached for efficient runtime tweaking.
检查一个命名的程序属性是否被缓存,用于高效地运行时调节。
-
Specifies if a named Procedural property should be cached for efficient runtime tweaking.
指定命名的程序属性,为高效运行时调节缓存。
-
Clear the Procedural cache. 清除程序缓存。
-
Triggers an asyncronous rebuild of all dirty textures.
触发所有修改的纹理异步重建。
-
Triggers an immediate (synchronous) rebuild of all dirty textures.
触发所有修改的纹理立即(同步)重建。
Class Variables类变量
Class Functions类函数
Inherited members继承成员
Inherited Variables继承变量
-
The shader used by the material.
材质使用的着色器。
-
The main material's color.
主材质的颜色。
-
The main material's texture.
主材质的纹理。
-
The texture offset of the main texture.
主纹理中的纹理偏移量。
-
The texture scale of the main texture.
主纹理中的纹理缩放量。
-
How many passes are in this material (Read Only).
在这个材质中有多少pass。(只读)
-
Render queue of this material
这个材质的渲染队列
-
The name of the object. //物体的名字
-
Should the object be hidden, saved with the scene or modifiable by the user?
物体是否被隐藏、保存在场景中或被用户修改?
Inherited Constructors继承构造器
Inherited Functions继承函数
-
Set a named color value.
设置已命名的颜色值。
-
Get a named color value.
获取已命名的颜色值
-
Set a named vector value.
设置已命名的向量值
-
Get a named vector value.
获取已命名的向量值
-
Set a named texture.
设置已命名的纹理
-
Get a named texture.
设置已命名的纹理
-
Sets the placement offset of texture propertyName.
设置纹理propertyName的偏移量。
-
Gets the placement offset of texture propertyName.
获取纹理propertyName的偏移量。
-
Sets the placement scale of texture propertyName.
设置纹理propertyName的缩放量。
-
Gets the placement scale of texture propertyName.
获取纹理propertyName的缩放量
-
Set a named matrix for the shader.
为这个shader设置一个命名矩阵
-
Get a named matrix value from the shader.
从这个shader中获取命名矩阵的值
-
Set a named float value.
设置一个命名的浮点数
-
Get a named float value.
获取一个命名的浮点数
-
Checks if material's shader has a property of a given name.
检查材质的着色器是否具有给定名称的属性
-
Get the value of material's shader tag.
获取材质着色器的标签值。
-
Interpolate properties between two materials.
在两个材质之间插值
-
Activate the given pass for rendering.
为渲染激活给定的pass
-
Copy properties from other material into this material.
拷贝其他材质的属性到这个材质
Inherited Class Functions继承类函数
-
Removes a gameobject, component or asset.
删除一个游戏物体、组件或资源
-
Destroys the object obj immediately. It is strongly recommended to use Destroy instead.
立即销毁物体obj,强烈建议使用Destroy代替。
-
Makes the object target not be destroyed automatically when loading a new scene.
加载新场景的时候使目标物体不被自动销毁。
-
Returns the first active loaded object of Type type.
返回Type类型第一个激活的加载的物体。
-
Returns a list of all active loaded objects of Type type.
返回Type类型的所有激活的加载的物体列表
-
Clones the object original and returns the clone.
克隆原始物体,并返回克隆的物体
Page last updated: 2011-9-13