Mesh.Optimize 网格优化

function Optimize () : void

Description描述

Optimizes the mesh for display.

显示优化的网格。

This operation might take a while but will make the geometry displayed be faster. For example it generates triangle strips out of the triangles. You should use it if you generate a mesh from scratch procedurally and you want to trade better runtime performance against higher load time. Internally it tri-strips your model and optimizes the triangles for vertex cache locality. For imported models you should never call this as the import pipeline already does it for you.

这个指令也许会需要一段时间,但是会使几何体现实的更快。例如:它从三角形中形成三角形带。如果你从头创建一个网格并想在运行的时候取得更好的运行时性能面而不是较高的加载时间,你应该使用它。它三角带化你的模型并为每个顶点缓存位置优化三角形。对于导入的模型你不应该调用这个函数,因为导入已经做过了。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void Start() {
		Mesh mesh = GetComponent<MeshFilter>().mesh;
		mesh.Optimize();
	}
}
function Start () {
	var mesh : Mesh = GetComponent(MeshFilter).mesh;
	mesh.Optimize();
}
Page last updated: 2010-12-9