The TextureBank Class


 public:
 TextureBankClass() { nTextures = 0; TexturePool = NULL; };
 ~TextureBankClass() {};

 // Management functions
 static void Setup( int nEntries );
 static void Cleanup( void );
 static void ReadPool( int file, char *basename );
 static void FlushHandles( void );

 static void Reference( int id );
 static void Release( int id );
 static void Select( int id );

 // Deferred texture load support (to improve startup load times)
 static void SetDeferredLoad( BOOL state );

 // Debug parameter validation
 static BOOL IsValidIndex( int id );

  public:
 static TexBankEntry *TexturePool;
 static int   nTextures;

  protected:
 static int   TextureFile;
 static BYTE   *CompressedBuffer;
 static int   deferredLoadState;

  protected:
 static void OpenTextureFile( char *basename );
 static void ReadImageData( int id );
 static void CloseTextureFile( void );

 static void LoaderCallBack( struct LoaderQ* request );


Texture Bank Entry

typedef struct TexBankEntry {
 long   fileOffset;  // How far into the .TEX file does the compressed data start?
 long   fileSize;  // How big is the compressed data on disk?
 Texture  tex;   // The container class which manages the texture data
 int   palID;   // The offset into ThePaletteBank to use with this texture
 int   refCount;  // How many objects want this texture right now
} TexBankEntry;