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参数
- meshThe Mesh to draw.
用来绘制的网格。 - positionPosition of the mesh.
网格的位置。 - rotationRotation of the mesh.
网格的旋转。 - matrixTransformation matrix of the mesh (combines position, rotation and other transformations). Note that the mesh will not be displayed correctly if matrix has negative scale.
网格的变换矩阵(组合位置,旋转和其他变换) 请注意,如果矩阵有负的缩放,该网格将无法正确显示。 - materialIndexSubset of the mesh to draw.
用来绘制的子网格的索引。
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);
}