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

private ReformatCubemap ( Cubemap &cubemap, int width, int height, TextureFormat textureFormat, bool useMipmap, bool linear ) : bool
cubemap UnityEngine.Cubemap
width int
height int
textureFormat TextureFormat
useMipmap bool
linear bool
Результат bool
Пример #1
0
        public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap cubemap = this.target as Cubemap;

            if (cubemap == null)
            {
                return;
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
            this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
            this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
            this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            EditorGUIUtility.labelWidth = 0f;
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.HelpBox("Lowering face size is a destructive operation, you might need to re-assign the textures later to fix resolution issues. It's preferable to use Cubemap texture import type instead of Legacy Cubemap assets.", MessageType.Warning);
            int num = TextureUtil.GetGLWidth(cubemap);

            num = EditorGUILayout.IntPopup("Face size", num, CubemapInspector.kSizes, CubemapInspector.kSizesValues, new GUILayoutOption[0]);
            int  num2      = TextureUtil.CountMipmaps(cubemap);
            bool useMipmap = EditorGUILayout.Toggle("MipMaps", num2 > 1, new GUILayoutOption[0]);
            bool flag      = TextureUtil.GetLinearSampled(cubemap);

            flag = EditorGUILayout.Toggle("Linear", flag, new GUILayoutOption[0]);
            bool flag2 = TextureUtil.IsCubemapReadable(cubemap);

            flag2 = EditorGUILayout.Toggle("Readable", flag2, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                if (TextureUtil.ReformatCubemap(ref cubemap, num, num, cubemap.format, useMipmap, flag))
                {
                    this.InitTexturesFromCubemap();
                }
                TextureUtil.MarkCubemapReadable(cubemap, flag2);
                cubemap.Apply();
            }
        }
Пример #2
0
        public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap cubemap = this.target as Cubemap;

            if (cubemap == null)
            {
                return;
            }
            GUILayout.BeginVertical(new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
            this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
            this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
            this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
            GUILayout.EndHorizontal();
            GUILayout.EndVertical();
            EditorGUIUtility.labelWidth = 0f;
            EditorGUILayout.Space();
            EditorGUI.BeginChangeCheck();
            int num = TextureUtil.GetGLWidth(cubemap);

            num = EditorGUILayout.IntPopup("Face size", num, CubemapInspector.kSizes, CubemapInspector.kSizesValues, new GUILayoutOption[0]);
            int  num2      = TextureUtil.CountMipmaps(cubemap);
            bool useMipmap = EditorGUILayout.Toggle("MipMaps", num2 > 1, new GUILayoutOption[0]);
            bool flag      = TextureUtil.GetLinearSampled(cubemap);

            flag = EditorGUILayout.Toggle("Linear", flag, new GUILayoutOption[0]);
            bool flag2 = TextureUtil.IsCubemapReadable(cubemap);

            flag2 = EditorGUILayout.Toggle("Readable", flag2, new GUILayoutOption[0]);
            if (EditorGUI.EndChangeCheck())
            {
                if (TextureUtil.ReformatCubemap(ref cubemap, num, num, cubemap.format, useMipmap, flag))
                {
                    this.InitTexturesFromCubemap();
                }
                TextureUtil.MarkCubemapReadable(cubemap, flag2);
                cubemap.Apply();
            }
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap target = base.target as Cubemap;

            if (target != null)
            {
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
                this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
                this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
                this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                EditorGUIUtility.labelWidth = 0f;
                EditorGUILayout.Space();
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.HelpBox("Lowering face size is a destructive operation, you might need to re-assign the textures later to fix resolution issues. It's preferable to use Cubemap texture import type instead of Legacy Cubemap assets.", MessageType.Warning);
                int gPUWidth = TextureUtil.GetGPUWidth(target);
                gPUWidth = EditorGUILayout.IntPopup("Face size", gPUWidth, kSizes, kSizesValues, new GUILayoutOption[0]);
                int  mipmapCount   = TextureUtil.GetMipmapCount(target);
                bool useMipmap     = EditorGUILayout.Toggle("MipMaps", mipmapCount > 1, new GUILayoutOption[0]);
                bool linearSampled = TextureUtil.GetLinearSampled(target);
                linearSampled = EditorGUILayout.Toggle("Linear", linearSampled, new GUILayoutOption[0]);
                bool flag3 = TextureUtil.IsCubemapReadable(target);
                flag3 = EditorGUILayout.Toggle("Readable", flag3, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    if (TextureUtil.ReformatCubemap(ref target, gPUWidth, gPUWidth, target.format, useMipmap, linearSampled))
                    {
                        this.InitTexturesFromCubemap();
                    }
                    TextureUtil.MarkCubemapReadable(target, flag3);
                    target.Apply();
                }
            }
        }
Пример #4
0
        public override void OnInspectorGUI()
        {
            if (this.m_Images == null)
            {
                this.InitTexturesFromCubemap();
            }
            EditorGUIUtility.labelWidth = 50f;
            Cubemap target = this.target as Cubemap;

            if (target != null)
            {
                GUILayout.BeginVertical(new GUILayoutOption[0]);
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Right\n(+X)", CubemapFace.PositiveX);
                this.ShowFace("Left\n(-X)", CubemapFace.NegativeX);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
                this.ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                this.ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
                this.ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
                GUILayout.EndHorizontal();
                GUILayout.EndVertical();
                EditorGUIUtility.labelWidth = 0f;
                EditorGUILayout.Space();
                EditorGUI.BeginChangeCheck();
                int gLWidth = TextureUtil.GetGLWidth(target);
                gLWidth = EditorGUILayout.IntPopup("Face size", gLWidth, kSizes, kSizesValues, new GUILayoutOption[0]);
                int  num2          = TextureUtil.CountMipmaps(target);
                bool useMipmap     = EditorGUILayout.Toggle("MipMaps", num2 > 1, new GUILayoutOption[0]);
                bool linearSampled = TextureUtil.GetLinearSampled(target);
                linearSampled = EditorGUILayout.Toggle("Linear", linearSampled, new GUILayoutOption[0]);
                bool flag3 = TextureUtil.IsCubemapReadable(target);
                flag3 = EditorGUILayout.Toggle("Readable", flag3, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    if (TextureUtil.ReformatCubemap(ref target, gLWidth, gLWidth, target.format, useMipmap, linearSampled))
                    {
                        this.InitTexturesFromCubemap();
                    }
                    TextureUtil.MarkCubemapReadable(target, flag3);
                    target.Apply();
                }
            }
        }
        public override void OnInspectorGUI()
        {
            if (m_Images == null)
            {
                InitTexturesFromCubemap();
            }

            EditorGUIUtility.labelWidth = 50;
            var c = target as Cubemap;

            if (c == null)
            {
                return;
            }

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal();
            ShowFace("Right\n(+X)", CubemapFace.PositiveX);
            ShowFace("Left\n(-X)", CubemapFace.NegativeX);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            ShowFace("Top\n(+Y)", CubemapFace.PositiveY);
            ShowFace("Bottom\n(-Y)", CubemapFace.NegativeY);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            ShowFace("Front\n(+Z)", CubemapFace.PositiveZ);
            ShowFace("Back\n(-Z)", CubemapFace.NegativeZ);
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();

            EditorGUIUtility.labelWidth = 0;

            EditorGUILayout.Space();

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.HelpBox("Lowering face size is a destructive operation, you might need to re-assign the textures later to fix resolution issues. It's preferable to use Cubemap texture import type instead of Legacy Cubemap assets.", MessageType.Warning);
            int faceSize = TextureUtil.GetGPUWidth(c);

            faceSize = EditorGUILayout.IntPopup("Face size", faceSize, kSizes, kSizesValues);

            int  mipMaps   = TextureUtil.GetMipmapCount(c);
            bool useMipMap = EditorGUILayout.Toggle("MipMaps", mipMaps > 1);

            bool streamingMipmaps = TextureUtil.GetCubemapStreamingMipmaps(c);

            if (useMipMap)
            {
                streamingMipmaps = EditorGUILayout.Toggle(EditorGUIUtility.TrTextContent("Streaming Mipmaps", "Don't load image data immediately but wait till image data is requested from script."), streamingMipmaps);
            }

            bool linear = TextureUtil.GetLinearSampled(c);

            linear = EditorGUILayout.Toggle("Linear", linear);

            bool readable = TextureUtil.IsCubemapReadable(c);

            readable = EditorGUILayout.Toggle("Readable", readable);

            if (EditorGUI.EndChangeCheck())
            {
                // reformat the cubemap
                if (TextureUtil.ReformatCubemap(c, faceSize, faceSize, c.format, useMipMap, linear))
                {
                    InitTexturesFromCubemap();
                }

                TextureUtil.MarkCubemapReadable(c, readable);
                TextureUtil.SetCubemapStreamingMipmaps(c, streamingMipmaps);
                c.Apply();
            }
        }