Graphics.Blit 位块传送

static function Blit (source : Texture, dest : RenderTexture) : void
static function Blit (source : Texture, dest : RenderTexture, mat : Material, pass : int = -1) : void

Description描述

Copies source texture into destination render texture.

拷贝源纹理到目的渲染纹理。

This is mostly used for implementing image effects.

这主要是用于实现图像效果。

Blit sets dest to be active render texture, sets source as _MainTex property on the material, and draws a full-screen quad.

Blit设置dest到激活的渲染纹理,在材质上设置source作为_MainTex属性,并且绘制一个全屏方块。

参见: Graphics.BlitMultiTap

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	public Texture aTexture;
	public RenderTexture rTex;
	void Start() {
		if (!typeof(aTexture) || !typeof(rTex))
			Debug.LogError("A texture or a render texture are missing, assign them.");

	}
	void Update() {
		Graphics.Blit(aTexture, rTex);
	}
}
// Copies aTexture to rTex and displays it in all cameras.
//拷贝aTexture到rTex并显示它在所有相机

var aTexture : Texture;
var rTex : RenderTexture;

function Start() {
	if(!aTexture || !rTex)
		Debug.LogError("A texture or a render texture are missing, assign them.");
}

function Update () {
	Graphics.Blit (aTexture, rTex);
}
Page last updated: 2011-2-27