ユーザ用ツール

サイト用ツール


opengl:texturefileformat

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

両方とも前のリビジョン前のリビジョン
次のリビジョン
前のリビジョン
次のリビジョン両方とも次のリビジョン
opengl:texturefileformat [2015/07/04 02:49] – [DDS] ogaopengl:texturefileformat [2015/07/04 03:03] – [PKM] oga
行 30: 行 30:
 DirectX7 以前の DirectDrawSurface 構造をそのままファイルに書き込んだもの。 DirectX7 以前の DirectDrawSurface 構造をそのままファイルに書き込んだもの。
 Realtime 3D のテクスチャ画像形式としては非常に扱いやすく、対応ツールも多いのでほぼ標準として使われています。 Realtime 3D のテクスチャ画像形式としては非常に扱いやすく、対応ツールも多いのでほぼ標準として使われています。
 +[[:ddsformat|詳細は下記ページ]]よりどうぞ。
  
   * [[:ddsformat|DDS フォーマットの詳細解説]]   * [[:ddsformat|DDS フォーマットの詳細解説]]
行 47: 行 48:
   * FourCC で容易に新規フォーマット対応ができる   * FourCC で容易に新規フォーマット対応ができる
   * 古くから用いられており非常に多くのツールが対応している   * 古くから用いられており非常に多くのツールが対応している
-  * ヘッダ長が固定で読み込みが容易 (D3D10 拡張ヘッダの導入によりこの利点失われました)+  * ヘッダ長が固定で読み込みが容易 (DX10 拡張ヘッダの導入によりヘッダサイズ必ずしも固定ではなく 2 種類に増えました)
  
 逆に言えばこれらの特徴を満たす画像フォーマットが他に存在しませんでした。 逆に言えばこれらの特徴を満たす画像フォーマットが他に存在しませんでした。
行 120: 行 121:
 </code> </code>
  
 +
 +<code cpp>
 +enum {
 +    KTX_HEADER_MAGIC0     0x58544bab,
 +    KTX_HEADER_MAGIC1     0xbb313120,
 +    KTX_HEADER_MAGIC2     0x0a1a0a0d,
 +    KTX_HEADER_ENDIAN     0x04030201,
 +};
 +
 +struct T_KTXHEADER {       // 64byte
 +    UI32    Identifier[3];
 +    UI32    endianness;             // 0x04030201
 +    UI32    glType;                 // 0: compressed
 +    UI32    glTypeSize;             // 1: compressed
 +    UI32    glFormat;               // 0: compressed
 +    UI32    glInternalFormat;       // Compressed Format
 +    UI32    glBaseInternalFormat;
 +    UI32    pixelWidth;
 +    UI32    pixelHeight;            // == 0 1D texture
 +    UI32    pixelDepth;             // == 0 2D texture
 +    UI32    numberOfArrayElements;
 +    UI32    numberOfFaces;          // +X,-X,+Y,-Y,+Z,-Z
 +    UI32    numberOfMipmapLevels;   // > 1
 +    UI32    bytesOfKeyValueData;    // metadata
 +public:
 +    bool IsCompressed() const
 +    {
 +        return  glType == 0;
 +    }
 +};
 +</code>
  
  
行 141: 行 173:
     * PVRTC-2 対応     * PVRTC-2 対応
     * データ並びが KTX 順     * データ並びが KTX 順
 +
 +<code cpp>
 +struct T_PVR3HEADER {   // 13x4 = 52
 +    unsigned int    Version;        // 'PVR' 0x03
 +    unsigned int    Flags;
 +    unsigned int    PixelFormat[2]; // ('argb',08080808) or (PVR3_FORMAT_*,00000000)
 +    unsigned int    ColorSpace;
 +    unsigned int    ChannelType;    // PVR3_CHANNELTYPE_
 +    unsigned int    Height;
 +    unsigned int    Width;
 +    unsigned int    Depth;          // >=1
 +    unsigned int    Surfaces;       // >=1 texture array
 +    unsigned int    Faces;          // >=1 cubemap
 +    unsigned int    MipMapCount;    // >=1
 +    unsigned int    MetaDataSize;
 +};
 +</code>
  
 <code> <code>
行 152: 行 201:
     * PVRTC-2 非対応     * PVRTC-2 非対応
     * データ並びが DDS 順     * データ並びが DDS 順
 +
 +
  
 <code> <code>
 ( ( ( width * height ) * mip ) * [cube_face or volume_depth] ) ( ( ( width * height ) * mip ) * [cube_face or volume_depth] )
 +</code>
 +
 +
 +<code cpp>
 +struct T_PVR2HEADER {
 +    unsigned int    hsize;      // == 52 == sizeof(T_PVR2HEADER)
 +    unsigned int    height;
 +    unsigned int    width;
 +    unsigned int    miplevel;   // mipcount-1 (0=single plane)
 +    unsigned int    tformat;    // 0x10 0x08 0x01  bit0-7=PVR2_FORMAT_, bit8-31= PVR2_FLAG_
 +    unsigned int    datasize;   // byte size (one surface size)
 +    unsigned int    bpp;        // bpp
 +    unsigned int    redmask;    // RedMask
 +    unsigned int    greenmask;  // GreenMask
 +    unsigned int    bluemask;   // BlueMask
 +    unsigned int    alphamask;  // AlphaMask
 +    unsigned int    magic;      // == 0x21525650  "PVR!"
 +    unsigned int    depth;      // surfaces (volume or cube)
 +};
 </code> </code>
  
行 178: 行 248:
  
 <code> <code>
-version 1.0+version 1.0  (header.version == 10)
 type: 0=ETC1-RGB, 1=ETC1-RGBA, 2=ETC1-RGB-MIP, 3=ETC1-RGBA-MIP type: 0=ETC1-RGB, 1=ETC1-RGBA, 2=ETC1-RGB-MIP, 3=ETC1-RGBA-MIP
  
-version 2.0+version 2.0  (header.version == 20)
 type: 0=ETC1_RGB, 1=ETC2_RGB, 2=ETC2_RGBA_OLD, 3=ETC2_RGBA, 4=ETC2_RGBA1, 5=ETC2_R, 6=ETC2_RG, 7=ETC2_SIGNED_R, 8=ETC2_SIGNED_RG type: 0=ETC1_RGB, 1=ETC2_RGB, 2=ETC2_RGBA_OLD, 3=ETC2_RGBA, 4=ETC2_RGBA1, 5=ETC2_R, 6=ETC2_RG, 7=ETC2_SIGNED_R, 8=ETC2_SIGNED_RG
 </code> </code>
opengl/texturefileformat.txt · 最終更新: 2015/07/04 03:11 by oga

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki