Graphics.DrawMeshNow 立即绘制网格

static function DrawMeshNow (mesh : Mesh, position : Vector3, rotation : Quaternion) : void
static function DrawMeshNow (mesh : Mesh, position : Vector3, rotation : Quaternion, materialIndex : int) : void
static function DrawMeshNow (mesh : Mesh, matrix : Matrix4x4) : void
static function DrawMeshNow (mesh : Mesh, matrix : Matrix4x4, materialIndex : int) : void

Parameters参数

Description描述

Draw a mesh immediately.

立即绘制一个网格。

This function will draw a given mesh immediately. Currently set shader and material (see Material.SetPass) will be used. The mesh will be just drawn once, it won't be per-pixel lit and will not cast or receive realtime shadows. If you want full integration with lighting and shadowing, use Graphics.DrawMesh instead.

这个函数将立即绘制一个给定网格。当前设置着色器和材质将被使用(参见Material.SetPass)。网格将只绘制一次,它不会被每个像素光照并不会投射或接收实时阴影。如果你想与灯光和阴影完全整合,使用Graphics.DrawMesh代替。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Mesh aMesh;
	public Material mat;
	void OnPostRender() {
		mat.SetPass(1);
		Graphics.DrawMeshNow(aMesh, Vector3.zero, Quaternion.identity);
	}
}
// Attach this script to a camera.
// Draws a mesh inmediately.
//附加这个脚本到一个摄像机
//立即绘制一个网格

var aMesh : Mesh;
var mat : Material;

function OnPostRender() {
	// SetPass to 0 if the material doesnt have a texture.
	//如果材质没有个纹理,SetPass为0
	mat.SetPass(1);
	Graphics.DrawMeshNow(aMesh, Vector3.zero, Quaternion.identity);
}
最后修改:2011年2月27日 Sunday 19:37

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。