Cubemap.GetPixel 获取像素颜色


function GetPixel (face : CubemapFace, x : int, y : int) : Color

Description描述

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

返回所在坐标(face, x, y)处的样式颜色。

If the pixel coordinates are out of bounds (larger than width/height or small than 0),  they will be clamped or repeat based on the texture's wrap mode.

如果像素坐标超出边界(大于宽/高或小于0),它将基于纹理的循环模式来限制或重复。

The texture must have the Is Readable flag set in the import settings, otherwise this function will fail.

这个纹理必须在导入设置中设置为可读,否则,这个函数将错误。

  • C#

  • JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public Cubemap c;public void Awake() {Debug.Log(c.GetPixel(CubemapFace.PositiveX, 0, 0));}}
// prints the color of the pixel at (0,0) of the +X face//打印x面像素所在(0,0) 处的颜色var c : Cubemap;Debug.Log(c.GetPixel(CubemapFace.PositiveX, 0, 0));


,