- Main Page
- Data Structures
- Files

- File List
- Globals

# E:/DevIL/src-IL/include/il_vtf.h

    00001 //-----------------------------------------------------------------------------
    00002 //
    00003 // ImageLib Sources
    00004 // Copyright (C) 2000-2008 by Denton Woods
    00005 // Last modified: 12/27/2008
    00006 //
    00007 // Filename: src-IL/include/il_vtf.h
    00008 //
    00009 // Description: Reads from and writes to a Valve Texture Format (.vtf) file.
    00010 //                These are used in Valve's Source games.  VTF specs available
    00011 //                from http://developer.valvesoftware.com/wiki/VTF.
    00012 //
    00013 //-----------------------------------------------------------------------------
    00014
    00015
    00016 #ifndef VTF_H
    00017 #define VTF_H
    00018
    00019 #include "il_internal.h"
    00020
    00021 #ifdef _MSC_VER
    00022 #pragma pack(push, vtf_struct, 1)
    00023 #elif defined(MACOSX) || defined(__GNUC__)
    00024 #pragma pack(1)
    00025 #endif
    00026
    00027 typedef struct VTFHEAD
    00028 {
    00029         ILubyte         Signature[4];           // File signature ("VTF\0").
    00030         ILuint          Version[2];                     // version[0].version[1] (currently 7.2).
    00031         ILuint          HeaderSize;                     // Size of the header struct (16 byte aligned; currently 80 bytes).
    00032         ILushort        Width;                          // Width of the largest mipmap in pixels. Must be a power of 2.
    00033         ILushort        Height;                         // Height of the largest mipmap in pixels. Must be a power of 2.
    00034         ILuint          Flags;                          // VTF flags.
    00035         ILushort        Frames;                         // Number of frames, if animated (1 for no animation).
    00036         ILushort        FirstFrame;                     // First frame in animation (0 based).
    00037         ILubyte         Padding0[4];            // reflectivity padding (16 byte alignment).
    00038         ILfloat         Reflectivity[3];        // reflectivity vector.
    00039         ILubyte         Padding1[4];            // reflectivity padding (8 byte packing).
    00040         ILfloat         BumpmapScale;           // Bumpmap scale.
    00041         ILuint          HighResImageFormat;     // High resolution image format.
    00042         ILubyte         MipmapCount;            // Number of mipmaps.
    00043         ILuint          LowResImageFormat;      // Low resolution image format (always DXT1).
    00044         ILubyte         LowResImageWidth;       // Low resolution image width.
    00045         ILubyte         LowResImageHeight;      // Low resolution image height.
    00046         ILushort        Depth;                          // Depth of the largest mipmap in pixels.
    00047                                                                         // Must be a power of 2. Can be 0 or 1 for a 2D texture (v7.2 only).
    00048 } IL_PACKSTRUCT VTFHEAD;
    00049
    00050 #if defined(MACOSX) || defined(__GNUC__)
    00051 #pragma pack()
    00052 #elif _MSC_VER
    00053 #pragma pack(pop, vtf_struct)
    00054 #endif
    00055
    00056 enum
    00057 {
    00058         IMAGE_FORMAT_NONE = -1,
    00059         IMAGE_FORMAT_RGBA8888 = 0,
    00060         IMAGE_FORMAT_ABGR8888,
    00061         IMAGE_FORMAT_RGB888,
    00062         IMAGE_FORMAT_BGR888,
    00063         IMAGE_FORMAT_RGB565,
    00064         IMAGE_FORMAT_I8,
    00065         IMAGE_FORMAT_IA88,
    00066         IMAGE_FORMAT_P8,
    00067         IMAGE_FORMAT_A8,
    00068         IMAGE_FORMAT_RGB888_BLUESCREEN,
    00069         IMAGE_FORMAT_BGR888_BLUESCREEN,
    00070         IMAGE_FORMAT_ARGB8888,
    00071         IMAGE_FORMAT_BGRA8888,
    00072         IMAGE_FORMAT_DXT1,
    00073         IMAGE_FORMAT_DXT3,
    00074         IMAGE_FORMAT_DXT5,
    00075         IMAGE_FORMAT_BGRX8888,
    00076         IMAGE_FORMAT_BGR565,
    00077         IMAGE_FORMAT_BGRX5551,
    00078         IMAGE_FORMAT_BGRA4444,
    00079         IMAGE_FORMAT_DXT1_ONEBITALPHA,
    00080         IMAGE_FORMAT_BGRA5551,
    00081         IMAGE_FORMAT_UV88,
    00082         IMAGE_FORMAT_UVWQ8888,
    00083         IMAGE_FORMAT_RGBA16161616F,
    00084         IMAGE_FORMAT_RGBA16161616,
    00085         IMAGE_FORMAT_UVLX8888
    00086 };
    00087
    00088 enum
    00089 {
    00090         TEXTUREFLAGS_POINTSAMPLE = 0x00000001,
    00091         TEXTUREFLAGS_TRILINEAR = 0x00000002,
    00092         TEXTUREFLAGS_CLAMPS = 0x00000004,
    00093         TEXTUREFLAGS_CLAMPT = 0x00000008,
    00094         TEXTUREFLAGS_ANISOTROPIC = 0x00000010,
    00095         TEXTUREFLAGS_HINT_DXT5 = 0x00000020,
    00096         TEXTUREFLAGS_NOCOMPRESS = 0x00000040,
    00097         TEXTUREFLAGS_NORMAL = 0x00000080,
    00098         TEXTUREFLAGS_NOMIP = 0x00000100,
    00099         TEXTUREFLAGS_NOLOD = 0x00000200,
    00100         TEXTUREFLAGS_MINMIP = 0x00000400,
    00101         TEXTUREFLAGS_PROCEDURAL = 0x00000800,
    00102         TEXTUREFLAGS_ONEBITALPHA = 0x00001000,
    00103         TEXTUREFLAGS_EIGHTBITALPHA = 0x00002000,
    00104         TEXTUREFLAGS_ENVMAP = 0x00004000,
    00105         TEXTUREFLAGS_RENDERTARGET = 0x00008000,
    00106         TEXTUREFLAGS_DEPTHRENDERTARGET = 0x00010000,
    00107         TEXTUREFLAGS_NODEBUGOVERRIDE = 0x00020000,
    00108         TEXTUREFLAGS_SINGLECOPY = 0x00040000,
    00109         TEXTUREFLAGS_ONEOVERMIPLEVELINALPHA = 0x00080000,
    00110         TEXTUREFLAGS_PREMULTCOLORBYONEOVERMIPLEVEL = 0x00100000,
    00111         TEXTUREFLAGS_NORMALTODUDV = 0x00200000,
    00112         TEXTUREFLAGS_ALPHATESTMIPGENERATION = 0x00400000,
    00113         TEXTUREFLAGS_NODEPTHBUFFER = 0x00800000,
    00114         TEXTUREFLAGS_NICEFILTERED = 0x01000000,
    00115         TEXTUREFLAGS_CLAMPU = 0x02000000
    00116 };
    00117
    00118
    00119
    00120 // Internal functions
    00121 ILboolean       iIsValidVtf(void);
    00122 ILboolean       iGetVtfHead(VTFHEAD *Header);
    00123 ILboolean       iCheckVtf(VTFHEAD *Header);
    00124 ILboolean       iLoadVtfInternal(void);
    00125 ILboolean       VtfInitFacesMipmaps(ILimage *BaseImage, ILuint NumFaces, VTFHEAD *Header);
    00126 ILboolean       VtfInitMipmaps(ILimage *BaseImage, VTFHEAD *Header);
    00127 ILboolean       VtfReadData(void);
    00128 ILboolean       VtfDecompressDXT1(ILimage *Image);
    00129 ILboolean       VtfDecompressDXT5(ILimage *Image);
    00130
    00131 #endif//VTF_H