Cubemap.Apply 应用


function Apply (updateMipmaps : bool = true) : void

Description描述

Actually apply all previous SetPixel and SetPixels changes.

实际应用所有先前SetPixel和SetPixels的改变。

If updateMipmaps is true, the mipmap levels are recalculated as well, using  the base level as a source. Usually you want to use true in all cases except when  you've modified the mip levels yourself using SetPixels.

如果updateMipMaps为true,mipmap等级也被重新计算,使用基本等级作为一个源。通常你需要在所有情况下使用true,除了在你使用SetPixels修改了mip等级。

This is a potentially expensive operation, so you'll want to change as many pixels  as possible between Apply calls.

这是非常耗时的操作,因此你要在Apply调用之间改变尽可能多的像素。

参见: SetPixel, SetPixels 函数

  • C#

  • JavaScript

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();}}
var c : Cubemap;c.SetPixel(CubemapFace.PositiveX, 0, 0, Color.red);// Do more changes to the faces...//在面上做更多的改变c.Apply(); // Apply the stuff done to the Cubemap.//应用改变到Cubemap


,