Skip to content

Instantly share code, notes, and snippets.

@unitycoder
Forked from yin8086/PrintUnity3dType.cs
Created November 27, 2022 09:39
Show Gist options
  • Select an option

  • Save unitycoder/074b02087976abbb581f75cebe5bc724 to your computer and use it in GitHub Desktop.

Select an option

Save unitycoder/074b02087976abbb581f75cebe5bc724 to your computer and use it in GitHub Desktop.

Revisions

  1. @yin8086 yin8086 created this gist Apr 22, 2016.
    78 changes: 78 additions & 0 deletions PrintUnity3dType.cs
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,78 @@
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace TestUnityConsole
    {
    class Program
    {
    public enum TextureFormat
    {
    Alpha8 = 1,
    ARGB4444,
    RGB24,
    RGBA32,
    ARGB32,
    RGB565 = 7,
    R16 = 9,
    DXT1,
    DXT5 = 12,
    RGBA4444,
    BGRA32,
    RHalf,
    RGHalf,
    RGBAHalf,
    RFloat,
    RGFloat,
    RGBAFloat,
    YUY2,
    DXT1Crunched = 28,
    DXT5Crunched,
    PVRTC_RGB2,
    PVRTC_RGBA2,
    PVRTC_RGB4,
    PVRTC_RGBA4,
    ETC_RGB4,
    ATC_RGB4,
    ATC_RGBA8,
    EAC_R = 41,
    EAC_R_SIGNED,
    EAC_RG,
    EAC_RG_SIGNED,
    ETC2_RGB,
    ETC2_RGBA1,
    ETC2_RGBA8,
    ASTC_RGB_4x4,
    ASTC_RGB_5x5,
    ASTC_RGB_6x6,
    ASTC_RGB_8x8,
    ASTC_RGB_10x10,
    ASTC_RGB_12x12,
    ASTC_RGBA_4x4,
    ASTC_RGBA_5x5,
    ASTC_RGBA_6x6,
    ASTC_RGBA_8x8,
    ASTC_RGBA_10x10,
    ASTC_RGBA_12x12,
    PVRTC_2BPP_RGB = -127,
    PVRTC_2BPP_RGBA = -127,
    PVRTC_4BPP_RGB = -127,
    PVRTC_4BPP_RGBA = -127
    }

    static void Main(string[] args)
    {
    foreach (string name in Enum.GetNames(typeof(TextureFormat)))
    {
    int cur_value = (int)Enum.Parse(typeof(TextureFormat), name);
    if (cur_value < 0)
    continue;
    Console.WriteLine("{0,18} {1, 5} 0x{2, 4:X4}", name, cur_value, cur_value);
    }

    Console.ReadKey();
    }
    }
    }
    48 changes: 48 additions & 0 deletions TypeChart.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    | Type | value | hex value | |
    | :----------: | :----: | :----: | :----------------------------------------------- |
    | Alpha8 | 1 | 0x0001 | Alpha-only texture format. |
    | ARGB4444 | 2 | 0x0002 | A 16 bits/pixel texture format. Texture stores color with an alpha channel. |
    | RGB24 | 3 | 0x0003 | A color texture format. |
    | RGBA32 | 4 | 0x0004 | Color with alpha texture format, 8-bits per channel. |
    | ARGB32 | 5 | 0x0005 | Color with an alpha channel texture format. |
    | RGB565 | 7 | 0x0007 | A 16 bit color texture format. |
    | R16 | 9 | 0x0009 | A 16 bit color texture format that only has a red channel. |
    | DXT1 | 10 | 0x000A | Compressed color texture format. |
    | DXT5 | 12 | 0x000C | Compressed color with alpha channel texture format. |
    | RGBA4444 | 13 | 0x000D | Color and alpha texture format, 4 bit per channel. |
    | BGRA32 | 14 | 0x000E | Format returned by iPhone camera. |
    | RHalf | 15 | 0x000F | Scalar (R) texture format, 16 bit floating point. |
    | RGHalf | 16 | 0x0010 | Two color (RG) texture format, 16 bit floating point per channel. |
    | RGBAHalf | 17 | 0x0011 | RGB color and alpha texture format, 16 bit floating point per channel. |
    | RFloat | 18 | 0x0012 | Scalar (R) texture format, 32 bit floating point. |
    | RGFloat | 19 | 0x0013 | Two color (RG) texture format, 32 bit floating point per channel. |
    | RGBAFloat | 20 | 0x0014 | RGB color and alpha etxture format, 32-bit floats per channel. |
    | YUY2 | 21 | 0x0015 | A format that uses the YUV color space and is often used for video encoding. Currently, this texture format is only useful for native code plugins as there is no support for texture importing or pixel access for this format. YUY2 is implemented for Direct3D 9, Direct3D 11, and Xbox One.|
    | DXT1Crunched | 28 | 0x001C | Compressed color texture format with crunch compression for small storage sizes. |
    | DXT5Crunched | 29 | 0x001D | Compressed color with alpha channel texture format with crunch compression for small storage sizes. |
    | PVRTC_RGB2 | 30 | 0x001E | PowerVR (iOS) 2 bits/pixel compressed color texture format. |
    | PVRTC_RGBA2 | 31 | 0x001F | PowerVR (iOS) 2 bits/pixel compressed with alpha channel texture format. |
    | PVRTC_RGB4 | 32 | 0x0020 | PowerVR (iOS) 4 bits/pixel compressed color texture format. |
    | PVRTC_RGBA4 | 33 | 0x0021 | PowerVR (iOS) 4 bits/pixel compressed with alpha channel texture format. |
    | ETC_RGB4 | 34 | 0x0022 | ETC (GLES2.0) 4 bits/pixel compressed RGB texture format. |
    | ATC_RGB4 | 35 | 0x0023 | ATC (ATITC) 4 bits/pixel compressed RGB texture format. |
    | ATC_RGBA8 | 36 | 0x0024 | ATC (ATITC) 8 bits/pixel compressed RGB texture format. |
    | EAC_R | 41 | 0x0029 | ETC2 / EAC (GL ES 3.0) 4 bits/pixel compressed unsigned single-channel texture format. |
    | EAC_R_SIGNED | 42 | 0x002A | ETC2 / EAC (GL ES 3.0) 4 bits/pixel compressed signed single-channel texture format. |
    | EAC_RG | 43 | 0x002B | ETC2 / EAC (GL ES 3.0) 8 bits/pixel compressed unsigned dual-channel (RG) texture format. |
    | EAC_RG_SIGNED | 44 | 0x002C | ETC2 / EAC (GL ES 3.0) 8 bits/pixel compressed signed dual-channel (RG) texture format. |
    | ETC2_RGB | 45 | 0x002D | ETC2 (GL ES 3.0) 4 bits/pixel compressed RGB texture format. |
    | ETC2_RGBA1 | 46 | 0x002E | ETC2 (GL ES 3.0) 4 bits/pixel RGB+1-bit alpha texture format. |
    | ETC2_RGBA8 | 47 | 0x002F | ETC2 (GL ES 3.0) 8 bits/pixel compressed RGBA texture format. |
    | ASTC_RGB_4x4 | 48 | 0x0030 | ASTC (4x4 pixel block in 128 bits) compressed RGB texture format. |
    | ASTC_RGB_5x5 | 49 | 0x0031 | ASTC (5x5 pixel block in 128 bits) compressed RGB texture format. |
    | ASTC_RGB_6x6 | 50 | 0x0032 | ASTC (6x6 pixel block in 128 bits) compressed RGB texture format. |
    | ASTC_RGB_8x8 | 51 | 0x0033 | ASTC (8x8 pixel block in 128 bits) compressed RGB texture format. |
    | ASTC_RGB_10x10 | 52 | 0x0034 | ASTC (10x10 pixel block in 128 bits) compressed RGB texture format. |
    | ASTC_RGB_12x12 | 53 | 0x0035 | ASTC (12x12 pixel block in 128 bits) compressed RGB texture format. |
    | ASTC_RGBA_4x4 | 54 | 0x0036 | ASTC (4x4 pixel block in 128 bits) compressed RGBA texture format. |
    | ASTC_RGBA_5x5 | 55 | 0x0037 | ASTC (5x5 pixel block in 128 bits) compressed RGBA texture format. |
    | ASTC_RGBA_6x6 | 56 | 0x0038 | ASTC (6x6 pixel block in 128 bits) compressed RGBA texture format. |
    | ASTC_RGBA_8x8 | 57 | 0x0039 | ASTC (8x8 pixel block in 128 bits) compressed RGBA texture format. |
    | ASTC_RGBA_10x10 | 58 | 0x003A | ASTC (10x10 pixel block in 128 bits) compressed RGBA texture format. |
    | ASTC_RGBA_12x12 | 59 | 0x003B | ASTC (12x12 pixel block in 128 bits) compressed RGBA texture format. |