123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
-
-
- #ifndef _TEXTURE_H
- #define _TEXTURE_H
-
- #include <stdio.h>
-
-
- class Texture {
- public:
-
- enum ColorMode {
- GREYSCALE = 1,
- RGB,
- RGBA,
- ARGB
- };
-
- enum TextureFlag {
- fUseMipmaps = (1 << 0),
- fUseMultiTexture = (1 << 1),
- };
-
-
-
- Texture();
-
-
-
- ~Texture();
-
-
-
- static unsigned char *generateColorTexture(unsigned char rgba[4],
- unsigned int width,
- unsigned int height);
-
-
-
- int getTextureCount();
-
-
-
- void bindMultiTexture(int texture0, int texture1);
-
-
-
- void bindTextureId(unsigned int n);
-
-
-
- void clearFlag(TextureFlag flag);
-
- void disableMultiTexture();
-
-
-
- int loadBuffer(unsigned char *image,
- unsigned int width, unsigned int height,
- ColorMode mode, unsigned int bpp);
-
-
-
- int loadBufferSlot(unsigned char *image,
- unsigned int width, unsigned int height,
- ColorMode mode, unsigned int bpp,
- unsigned int slot);
-
-
-
- int loadColorTexture(unsigned char rgba[4],
- unsigned int width, unsigned int height);
-
-
-
- int loadTGA(const char *filename);
-
- int loadPCX(const char *filename);
-
-
-
- void reset();
-
-
-
- void setFlag(TextureFlag flag);
-
-
-
- void setMaxTextureCount(unsigned int n);
-
- void useMultiTexture(float u, float v);
-
- void useMultiTexture(float aU, float aV, float bU, float bV);
-
- private:
-
- int nextPower(int seed);
-
- unsigned char *scaleBuffer(unsigned char *image, int width, int height,
- int components);
-
- unsigned int *mTextureIds;
- unsigned int mTextureCount;
- unsigned int mTextureLimit;
- unsigned int mFlags;
- int mTextureId;
- int mTextureId2;
- };
-
- #endif
|