CopyCubemapFaceIntoTexture() приватный Метод

private CopyCubemapFaceIntoTexture ( Cubemap cubemapRef, CubemapFace face, Texture2D textureRef ) : void
cubemapRef UnityEngine.Cubemap
face CubemapFace
textureRef UnityEngine.Texture2D
Результат void
Пример #1
0
        private void InitTexturesFromCubemap()
        {
            Cubemap target = this.target as Cubemap;

            if (target != null)
            {
                if (this.m_Images == null)
                {
                    this.m_Images = new Texture2D[6];
                }
                for (int i = 0; i < this.m_Images.Length; i++)
                {
                    if ((this.m_Images[i] != null) && !EditorUtility.IsPersistent(this.m_Images[i]))
                    {
                        UnityEngine.Object.DestroyImmediate(this.m_Images[i]);
                    }
                    if (TextureUtil.GetSourceTexture(target, (CubemapFace)i) != null)
                    {
                        this.m_Images[i] = TextureUtil.GetSourceTexture(target, (CubemapFace)i);
                    }
                    else
                    {
                        this.m_Images[i]           = new Texture2D(0x40, 0x40, TextureFormat.ARGB32, false);
                        this.m_Images[i].hideFlags = HideFlags.HideAndDontSave;
                        TextureUtil.CopyCubemapFaceIntoTexture(target, (CubemapFace)i, this.m_Images[i]);
                    }
                }
            }
        }
        private void InitTexturesFromCubemap()
        {
            var c = target as Cubemap;

            if (c != null)
            {
                if (m_Images == null)
                {
                    m_Images = new Texture2D[6];
                }
                for (int i = 0; i < m_Images.Length; ++i)
                {
                    if (m_Images[i] && !EditorUtility.IsPersistent(m_Images[i]))
                    {
                        DestroyImmediate(m_Images[i]);
                    }

                    if (TextureUtil.GetSourceTexture(c, (CubemapFace)i))
                    {
                        m_Images[i] = TextureUtil.GetSourceTexture(c, (CubemapFace)i);
                    }
                    else
                    {
                        m_Images[i]           = new Texture2D(kTextureSize, kTextureSize, TextureFormat.RGBA32, false);
                        m_Images[i].hideFlags = HideFlags.HideAndDontSave;
                        TextureUtil.CopyCubemapFaceIntoTexture(c, (CubemapFace)i, m_Images[i]);
                    }
                }
            }
        }
Пример #3
0
        private void InitTexturesFromCubemap()
        {
            Cubemap target = this.target as Cubemap;

            if (!((UnityEngine.Object)target != (UnityEngine.Object)null))
            {
                return;
            }
            if (this.m_Images == null)
            {
                this.m_Images = new Texture2D[6];
            }
            for (int index = 0; index < this.m_Images.Length; ++index)
            {
                if ((bool)((UnityEngine.Object) this.m_Images[index]) && !EditorUtility.IsPersistent((UnityEngine.Object) this.m_Images[index]))
                {
                    UnityEngine.Object.DestroyImmediate((UnityEngine.Object) this.m_Images[index]);
                }
                if ((bool)((UnityEngine.Object)TextureUtil.GetSourceTexture(target, (CubemapFace)index)))
                {
                    this.m_Images[index] = TextureUtil.GetSourceTexture(target, (CubemapFace)index);
                }
                else
                {
                    this.m_Images[index]           = new Texture2D(64, 64, TextureFormat.ARGB32, false);
                    this.m_Images[index].hideFlags = HideFlags.HideAndDontSave;
                    TextureUtil.CopyCubemapFaceIntoTexture(target, (CubemapFace)index, this.m_Images[index]);
                }
            }
        }