Cubemap.SetPixel 设置像素颜色

function SetPixel (face : CubemapFace, x : int, y : int, color : Color) : void

Description描述

Sets pixel color at coordinates (face, x, y).

设置所在坐标(face, x, y)处的像素颜色。

Call Apply to actually upload the changed pixels to the graphics card. Uploading is an expensive operation, so you'll want to change as many pixels as possible between Apply calls.

调用Apply来实际上载改变后的像素到显卡, 上载是非常耗时的操作,因此你要在Apply调用之间改变尽可能多的像素。

This function works only on ARGB32, RGB24 and Alpha8 texture formats. For other formats SetPixel is ignored.

该函数只工作于ARGB32,RGB24和Alpha8纹理格式上。对于其他格式SetPixels将被忽略.

参见:Apply 函数

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public Cubemap c;

	public void Awake() {

		c.SetPixel(CubemapFace.PositiveX, 0, 0, Color.red);

		c.Apply();

	}

}
// Set the pixel at (0,0) of the +X face red.

//设置x面所在坐标的像素颜色为红色

var c : Cubemap;

c.SetPixel(CubemapFace.PositiveX, 0, 0, Color.red);

c.Apply(); 

// Apply the color to the face.

//应用颜色到面

Page last updated: 2011-3-18