GetTextureColorSpaceString() private method

private GetTextureColorSpaceString ( Texture texture ) : string
texture UnityEngine.Texture
return string
示例#1
0
        private float GetProbeIntensity(ReflectionProbe p)
        {
            if (p == null || p.texture == null)
            {
                return(1f);
            }
            float num = p.intensity;

            if (TextureUtil.GetTextureColorSpaceString(p.texture) == "Linear")
            {
                num = Mathf.LinearToGammaSpace(num);
            }
            return(num);
        }
        private float GetProbeIntensity(ReflectionProbe p)
        {
            if ((p == null) || (p.texture == null))
            {
                return(1f);
            }
            float intensity = p.intensity;

            if (TextureUtil.GetTextureColorSpaceString(p.texture) == "Linear")
            {
                intensity = Mathf.LinearToGammaSpace(intensity);
            }
            return(intensity);
        }
示例#3
0
        public override string GetInfoString()
        {
            Texture         texture         = base.target as Texture;
            Texture2D       texture2D       = base.target as Texture2D;
            TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(texture)) as TextureImporter;
            string          text            = texture.width.ToString() + "x" + texture.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                text = text + " " + TextureUtil.GetTextureColorSpaceString(texture);
            }
            bool          flag          = textureImporter && textureImporter.qualifiesForSpritePacking;
            bool          flag2         = TextureInspector.IsNormalMap(texture);
            bool          flag3         = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(texture));
            bool          flag4         = texture2D != null && TextureUtil.IsNonPowerOfTwo(texture2D);
            TextureFormat textureFormat = TextureUtil.GetTextureFormat(texture);
            bool          flag5         = !flag3;

            if (flag4)
            {
                text += " (NPOT)";
            }
            if (flag3)
            {
                text += " (Not yet compressed)";
            }
            else if (flag2)
            {
                switch (textureFormat)
                {
                case TextureFormat.ARGB4444:
                    text += "  Nm 16 bit";
                    goto IL_176;

                case TextureFormat.RGB24:
IL_11D:
                    if (textureFormat != TextureFormat.DXT5)
                    {
                        text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                        goto IL_176;
                    }
                    text += "  DXTnm";
                    goto IL_176;

                case TextureFormat.RGBA32:
                case TextureFormat.ARGB32:
                    text += "  Nm 32 bit";
                    goto IL_176;
                }
                goto IL_11D;
                IL_176 :;
            }
            else if (flag)
            {
                TextureFormat format;
                ColorSpace    colorSpace;
                int           num;
                textureImporter.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out format, out colorSpace, out num);
                string text2 = text;
                text = string.Concat(new string[]
                {
                    text2,
                    "\n ",
                    TextureUtil.GetTextureFormatString(textureFormat),
                    "(Original) ",
                    TextureUtil.GetTextureFormatString(format),
                    "(Atlas)"
                });
            }
            else
            {
                text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
            }
            if (flag5)
            {
                text = text + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySizeLong(texture));
            }
            if (TextureUtil.GetUsageMode(texture) == TextureUsageMode.AlwaysPadded)
            {
                int gPUWidth  = TextureUtil.GetGPUWidth(texture);
                int gPUHeight = TextureUtil.GetGPUHeight(texture);
                if (texture.width != gPUWidth || texture.height != gPUHeight)
                {
                    text += string.Format("\nPadded to {0}x{1}", gPUWidth, gPUHeight);
                }
            }
            return(text);
        }
        public override string GetInfoString()
        {
            Texture         target = base.target as Texture;
            Texture2D       t      = base.target as Texture2D;
            TextureImporter atPath = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(target)) as TextureImporter;
            string          str    = target.width.ToString() + "x" + target.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                str = str + " " + TextureUtil.GetTextureColorSpaceString(target);
            }
            bool          flag          = true;
            bool          flag2         = (atPath != null) && atPath.qualifiesForSpritePacking;
            bool          flag3         = IsNormalMap(target);
            bool          flag4         = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(target));
            bool          flag5         = (t != null) && TextureUtil.IsNonPowerOfTwo(t);
            TextureFormat textureFormat = TextureUtil.GetTextureFormat(target);

            flag = !flag4;
            if (flag5)
            {
                str = str + " (NPOT)";
            }
            if (flag4)
            {
                str = str + " (Not yet compressed)";
            }
            else if (!flag3)
            {
                if (flag2)
                {
                    TextureFormat format2;
                    ColorSpace    space;
                    int           num3;
                    atPath.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out format2, out space, out num3);
                    string   str2       = str;
                    string[] textArray1 = new string[] { str2, "\n ", TextureUtil.GetTextureFormatString(textureFormat), "(Original) ", TextureUtil.GetTextureFormatString(format2), "(Atlas)" };
                    str = string.Concat(textArray1);
                }
                else
                {
                    str = str + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                }
            }
            else
            {
                switch (textureFormat)
                {
                case TextureFormat.ARGB4444:
                    str = str + "  Nm 16 bit";
                    goto Label_01EF;

                case TextureFormat.RGBA32:
                case TextureFormat.ARGB32:
                    str = str + "  Nm 32 bit";
                    goto Label_01EF;
                }
                if (textureFormat == TextureFormat.DXT5)
                {
                    str = str + "  DXTnm";
                }
                else
                {
                    str = str + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                }
            }
Label_01EF:
            if (flag)
            {
                str = str + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(target));
            }
            if (TextureUtil.GetUsageMode(target) != TextureUsageMode.AlwaysPadded)
            {
                return(str);
            }
            int gPUWidth  = TextureUtil.GetGPUWidth(target);
            int gPUHeight = TextureUtil.GetGPUHeight(target);

            if ((target.width == gPUWidth) && (target.height == gPUHeight))
            {
                return(str);
            }
            return(str + $"
Padded to {gPUWidth}x{gPUHeight}");
        }
示例#5
0
        public override string GetInfoString()
        {
            // TextureInspector code is reused for RenderTexture and Cubemap inspectors.
            // Make sure we can handle the situation where target is just a Texture and
            // not a Texture2D.
            Texture         t  = target as Texture;
            Texture2D       t2 = target as Texture2D;
            TextureImporter textureImporter = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(t)) as TextureImporter;
            string          info            = t.width.ToString() + "x" + t.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                info += " " + TextureUtil.GetTextureColorSpaceString(t);
            }

            bool          showSize              = true;
            bool          isPackedSprite        = textureImporter && textureImporter.qualifiesForSpritePacking;
            bool          isNormalmap           = IsNormalMap(t);
            bool          stillNeedsCompression = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(t));
            bool          isNPOT = t2 != null && TextureUtil.IsNonPowerOfTwo(t2);
            TextureFormat format = TextureUtil.GetTextureFormat(t);

            showSize = !stillNeedsCompression;
            if (isNPOT)
            {
                info += " (NPOT)";
            }
            if (stillNeedsCompression)
            {
                info += " (Not yet compressed)";
            }
            else
            {
                if (isNormalmap)
                {
                    switch (format)
                    {
                    case TextureFormat.DXT5:
                        info += "  DXTnm";
                        break;

                    case TextureFormat.RGBA32:
                    case TextureFormat.ARGB32:
                        info += "  Nm 32 bit";
                        break;

                    case TextureFormat.ARGB4444:
                        info += "  Nm 16 bit";
                        break;

                    default:
                        info += "  " + TextureUtil.GetTextureFormatString(format);
                        break;
                    }
                }
                else if (isPackedSprite)
                {
                    TextureFormat desiredFormat;
                    ColorSpace    dummyColorSpace;
                    int           dummyComressionQuality;
                    textureImporter.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out desiredFormat, out dummyColorSpace, out dummyComressionQuality);

                    info += "\n " + TextureUtil.GetTextureFormatString(format) + "(Original) " + TextureUtil.GetTextureFormatString(desiredFormat) + "(Atlas)";
                }
                else
                {
                    info += "  " + TextureUtil.GetTextureFormatString(format);
                }
            }

            if (showSize)
            {
                info += "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySizeLong(t));
            }

            if (TextureUtil.GetUsageMode(t) == TextureUsageMode.AlwaysPadded)
            {
                var glWidth  = TextureUtil.GetGPUWidth(t);
                var glHeight = TextureUtil.GetGPUHeight(t);
                if (t.width != glWidth || t.height != glHeight)
                {
                    info += string.Format("\nPadded to {0}x{1}", glWidth, glHeight);
                }
            }

            return(info);
        }
示例#6
0
        public override string GetInfoString()
        {
            Texture   texture   = this.target as Texture;
            Texture2D texture2D = this.target as Texture2D;
            string    text      = texture.width.ToString() + "x" + texture.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                text = text + " " + TextureUtil.GetTextureColorSpaceString(texture);
            }
            bool          flag          = TextureInspector.IsNormalMap(texture);
            bool          flag2         = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath(texture));
            bool          flag3         = texture2D != null && TextureUtil.IsNonPowerOfTwo(texture2D);
            TextureFormat textureFormat = TextureUtil.GetTextureFormat(texture);
            bool          flag4         = !flag2;

            if (flag3)
            {
                text += " (NPOT)";
            }
            if (flag2)
            {
                text += " (Not yet compressed)";
            }
            else
            {
                if (flag)
                {
                    TextureFormat textureFormat2 = textureFormat;
                    switch (textureFormat2)
                    {
                    case TextureFormat.ARGB4444:
                        text += "  Nm 16 bit";
                        goto IL_142;

                    case TextureFormat.RGB24:
                    case TextureFormat.RGBA32:
IL_E9:
                        if (textureFormat2 != TextureFormat.DXT5)
                        {
                            text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                            goto IL_142;
                        }
                        text += "  DXTnm";
                        goto IL_142;

                    case TextureFormat.ARGB32:
                        text += "  Nm 32 bit";
                        goto IL_142;
                    }
                    goto IL_E9;
                    IL_142 :;
                }
                else
                {
                    text = text + "  " + TextureUtil.GetTextureFormatString(textureFormat);
                }
            }
            if (flag4)
            {
                text = text + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(texture));
            }
            if (TextureUtil.GetUsageMode(texture) == TextureUsageMode.AlwaysPadded)
            {
                int gLWidth  = TextureUtil.GetGLWidth(texture);
                int gLHeight = TextureUtil.GetGLHeight(texture);
                if (texture.width != gLWidth || texture.height != gLHeight)
                {
                    text += string.Format("\nPadded to {0}x{1}", gLWidth, gLHeight);
                }
            }
            return(text);
        }
        public override string GetInfoString()
        {
            Texture         target1 = this.target as Texture;
            Texture2D       target2 = this.target as Texture2D;
            TextureImporter atPath  = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath((UnityEngine.Object)target1)) as TextureImporter;
            string          str1    = target1.width.ToString() + "x" + target1.height.ToString();

            if (QualitySettings.desiredColorSpace == ColorSpace.Linear)
            {
                str1 = str1 + " " + TextureUtil.GetTextureColorSpaceString(target1);
            }
            bool          flag1          = (bool)((UnityEngine.Object)atPath) && atPath.qualifiesForSpritePacking;
            bool          flag2          = TextureInspector.IsNormalMap(target1);
            bool          beCompressed   = TextureUtil.DoesTextureStillNeedToBeCompressed(AssetDatabase.GetAssetPath((UnityEngine.Object)target1));
            bool          flag3          = (UnityEngine.Object)target2 != (UnityEngine.Object)null && TextureUtil.IsNonPowerOfTwo(target2);
            TextureFormat textureFormat1 = TextureUtil.GetTextureFormat(target1);
            bool          flag4          = !beCompressed;

            if (flag3)
            {
                str1 += " (NPOT)";
            }
            string str2;

            if (beCompressed)
            {
                str2 = str1 + " (Not yet compressed)";
            }
            else if (flag2)
            {
                TextureFormat textureFormat2 = textureFormat1;
                switch (textureFormat2)
                {
                case TextureFormat.ARGB4444:
                    str2 = str1 + "  Nm 16 bit";
                    break;

                case TextureFormat.ARGB32:
                    str2 = str1 + "  Nm 32 bit";
                    break;

                default:
                    str2 = textureFormat2 == TextureFormat.DXT5 ? str1 + "  DXTnm" : str1 + "  " + TextureUtil.GetTextureFormatString(textureFormat1);
                    break;
                }
            }
            else if (flag1)
            {
                TextureFormat desiredFormat;
                ColorSpace    colorSpace;
                int           compressionQuality;
                atPath.ReadTextureImportInstructions(EditorUserBuildSettings.activeBuildTarget, out desiredFormat, out colorSpace, out compressionQuality);
                str2 = str1 + "\n " + TextureUtil.GetTextureFormatString(textureFormat1) + "(Original) " + TextureUtil.GetTextureFormatString(desiredFormat) + "(Atlas)";
            }
            else
            {
                str2 = str1 + "  " + TextureUtil.GetTextureFormatString(textureFormat1);
            }
            if (flag4)
            {
                str2 = str2 + "\n" + EditorUtility.FormatBytes(TextureUtil.GetStorageMemorySize(target1));
            }
            if (TextureUtil.GetUsageMode(target1) == TextureUsageMode.AlwaysPadded)
            {
                int glWidth  = TextureUtil.GetGLWidth(target1);
                int glHeight = TextureUtil.GetGLHeight(target1);
                if (target1.width != glWidth || target1.height != glHeight)
                {
                    str2 += string.Format("\nPadded to {0}x{1}", (object)glWidth, (object)glHeight);
                }
            }
            return(str2);
        }