返回介绍

Graphics.DrawMeshNow 立即绘制网格

发布于 2019-12-18 15:37:44 字数 3571 浏览 1067 评论 0 收藏 0

JavaScript => public static function DrawMeshNow(mesh: Mesh, position: Vector3, rotation: Quaternion): void;
JavaScript =>public static function DrawMeshNow(mesh: Mesh, position: Vector3, rotation: Quaternion, materialIndex: int): void;
JavaScript =>public static function DrawMeshNow(mesh: Mesh, matrix: Matrix4x4): void;
JavaScript =>public static function DrawMeshNow(mesh: Mesh, matrix: Matrix4x4, materialIndex: int): void;
C# => public static void DrawMeshNow(Mesh mesh, Vector3 position, Quaternion rotation);
C# =>public static void DrawMeshNow(Mesh mesh, Vector3 position, Quaternion rotation, int materialIndex);
C# =>public static void DrawMeshNow(Mesh mesh, Matrix4x4 matrix);
C# =>public static void DrawMeshNow(Mesh mesh, Matrix4x4 matrix, int materialIndex);

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.

该函数立即绘制一个指定网格。当前设置着色器和材质将(请参考Material.SetPass)会被使用。

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.

该网格仅会被绘制一次,它将不会被逐象素点亮并且不会投射和接受实时阴影。如果你想集成全部灯光和阴影,使用Graphics.DrawMesh替代它。

JavaScript:

#pragma strict
// Attach this script to a Camera
public var mesh: Mesh;
public var mat: Material;
public function OnPostRender() {
	// set first shader pass of the material
	mat.SetPass(0);
	// draw mesh at the origin
	Graphics.DrawMeshNow(mesh, Vector3.zero, Quaternion.identity);
}

C#:

using UnityEngine;
using System.Collections;
 
// Attach this script to a Camera
public class ExampleClass : MonoBehaviour {
    public Mesh mesh;
    public Material mat;
    public void OnPostRender() {
        // set first shader pass of the material
        mat.SetPass(0);
        // draw mesh at the origin
        Graphics.DrawMeshNow(mesh, Vector3.zero, Quaternion.identity);
    }
}

graphics

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文