2006-01-06 03:46:54 +00:00
|
|
|
#ifndef __BL_TEXTURE_H__
|
|
|
|
#define __BL_TEXTURE_H__
|
2006-02-13 05:45:32 +00:00
|
|
|
|
2006-04-02 21:04:20 +00:00
|
|
|
// #include <vector>
|
|
|
|
// #include <map>
|
2006-02-13 05:45:32 +00:00
|
|
|
|
|
|
|
#include "MT_Matrix4x4.h"
|
|
|
|
#include "KX_Camera.h"
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
// --
|
|
|
|
struct Image;
|
|
|
|
struct EnvMap;
|
2006-02-13 05:45:32 +00:00
|
|
|
class BL_Material;
|
|
|
|
class RAS_Rect;
|
|
|
|
class RAS_ICanvas;
|
2006-04-02 21:04:20 +00:00
|
|
|
//class RTData;
|
2006-02-13 05:45:32 +00:00
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
#include "STR_String.h"
|
|
|
|
|
|
|
|
class BL_Texture
|
|
|
|
{
|
|
|
|
private:
|
2006-04-02 21:04:20 +00:00
|
|
|
unsigned int mTexture; // Bound texture unit data
|
|
|
|
bool mOk; // ...
|
|
|
|
bool mNeedsDeleted; // If generated
|
|
|
|
unsigned int mType; // enum TEXTURE_2D | CUBE_MAP
|
|
|
|
int mUnit; // Texture unit associated with mTexture
|
|
|
|
unsigned int mEnvState; // cache textureEnv
|
|
|
|
static unsigned int mDisableState; // speed up disabling calls
|
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
void InitNonPow2Tex(unsigned int *p,int x,int y,bool mipmap );
|
|
|
|
void InitGLTex(unsigned int *p,int x,int y,bool mipmap );
|
|
|
|
public:
|
|
|
|
BL_Texture();
|
|
|
|
~BL_Texture( );
|
2006-04-02 21:04:20 +00:00
|
|
|
|
2006-01-06 03:46:54 +00:00
|
|
|
bool Ok();
|
2006-02-13 05:45:32 +00:00
|
|
|
int GetUnit() {return mUnit;}
|
|
|
|
void SetUnit(int unit) {mUnit = unit;}
|
2006-01-06 03:46:54 +00:00
|
|
|
|
|
|
|
unsigned int GetTextureType() const;
|
2006-02-13 05:45:32 +00:00
|
|
|
void DeleteTex();
|
2006-01-06 03:46:54 +00:00
|
|
|
|
2006-02-13 05:45:32 +00:00
|
|
|
bool InitFromImage(int unit, Image *img, bool mipmap);
|
|
|
|
bool InitCubeMap(int unit,EnvMap *cubemap );
|
|
|
|
|
|
|
|
bool IsValid();
|
|
|
|
void Validate();
|
|
|
|
|
|
|
|
static void ActivateFirst();
|
|
|
|
static void DisableAllTextures();
|
|
|
|
static void ActivateUnit(int unit);
|
|
|
|
static int GetMaxUnits();
|
|
|
|
static int GetPow2(int x);
|
2007-01-13 08:30:08 +00:00
|
|
|
static void SplitEnvMap(EnvMap *map);
|
2006-02-13 05:45:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
void ActivateTexture();
|
|
|
|
void SetMapping(int mode);
|
|
|
|
void DisableUnit();
|
|
|
|
void setTexEnv(BL_Material *mat, bool modulate=false);
|
2006-01-06 03:46:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif//__BL_TEXTURE_H__
|