00001 #ifndef _Texture_H_
00002 #define _Texture_H_
00003
00004 #include <stdio.h>
00005 #include <io.h>
00006 #include <string.h>
00007 #include "renderer.h"
00008
00009 #define ZAK_TEXTURE_FILTER_NONE 0
00010 #define ZAK_TEXTURE_FILTER_POINT 1
00011 #define ZAK_TEXTURE_FILTER_LINEAR 2
00012 #define ZAK_TEXTURE_FILTER_TRIANGULAR 3
00013 #define ZAK_TEXTURE_FILTER_BOX 4
00014
00015 namespace zak {
00016
00017 class Texture
00018 {
00019 private:
00020 TextureInfo _info;
00021 char * _pszTextureFileName;
00022 unsigned int _uiReferenceCount;
00023
00024 DWORD _filter;
00025 DWORD _mipFilter;
00026
00027 int _iTextureWidth;
00028 int _iTextureHeight;
00029
00030 DWORD _color;
00031
00032 DX_LPTEXTURE _pBitmapTexture;
00033
00034 public:
00035
00036 bool Load(const char * _pszTextureFileName, unsigned int ck, bool persist, DWORD filter=2, DWORD mipFilter=2);
00037 bool Reload();
00038 const char *GetName()const{return const_cast<const char*>(_pszTextureFileName);}
00039 void DecRef(){_uiReferenceCount--;}
00040 void IncRef(){_uiReferenceCount++;}
00041 int GetRefCount(){return _uiReferenceCount;}
00042 int GetWidth(){return _iTextureWidth;}
00043 int GetHeight(){return _iTextureHeight;}
00044 DX_LPTEXTURE GetTexture(){return _pBitmapTexture;}
00045 void Release() { if (_pBitmapTexture) _pBitmapTexture->Release(); _pBitmapTexture = NULL; }
00046
00047 Texture();
00048 ~Texture();
00049 };
00050
00051 }
00052
00053 #endif