This commit is contained in:
parent
6f7a6252bc
commit
4eef48176b
21 changed files with 1050 additions and 885 deletions
|
@ -33,62 +33,135 @@ public:
|
|||
{
|
||||
ElemType2d=0,
|
||||
ElemType3d,
|
||||
ElemTypeMax
|
||||
};
|
||||
enum ElemEnums
|
||||
enum
|
||||
{
|
||||
PCTexWidth =16,
|
||||
PCTexHeight =PCTexWidth,
|
||||
UnitSize=16,
|
||||
};
|
||||
|
||||
// CElem();
|
||||
CElem(int Blank,int Width=PCTexWidth,int Height=PCTexHeight ); // Blank (2d)
|
||||
CElem(CCore *Core,const char *Filename,int TexId,int XOfs,int YOfs); // 2d elem
|
||||
CElem(CCore *Core,const char *Filename,CScene &ThisScene,int Node); // 3d elem
|
||||
CElem(int Width,int Height); // Blank (2d)
|
||||
CElem(CCore *Core,const char *Filename,int TexId,int XOfs,int YOfs,int Width,int Height); // 2d elem
|
||||
CElem(CCore *Core,const char *Filename,CScene &ThisScene,int Node); // 3d elem
|
||||
|
||||
void CleanUp();
|
||||
void Purge();
|
||||
void Render(int Flags,bool Render3d);
|
||||
|
||||
int GetPCTexW() {return(PCTexWidth);}
|
||||
int GetPCTexH() {return(PCTexHeight);}
|
||||
u8 *GetPCTexRGB() {return(PCTexRGB);}
|
||||
int GetElemWidth() {return(ElemWidth);}
|
||||
int GetElemHeight() {return(ElemHeight);}
|
||||
u8 *GetElemRGB() {return(ElemRGB);}
|
||||
|
||||
bool IsValid() {return(ValidFlag);}
|
||||
|
||||
bool IsElem3d() {return(Type==ElemType3d);}
|
||||
int GetTexXOfs() {return(TexXOfs);}
|
||||
int GetTexYOfs() {return(TexYOfs);}
|
||||
int GetTexID() {return(Tex2dID);}
|
||||
|
||||
void CreateBlankTileGfx();
|
||||
void CreateInvalidTileGfx();
|
||||
|
||||
std::vector<sTriFace> &GetTriList() {return(TriList);}
|
||||
|
||||
protected:
|
||||
void Build3dElem(CTexCache &TexCache,CScene &ThisScene,int Node);
|
||||
void Build2dElem(CCore *Core,const char *Filename,int TexId);
|
||||
// void FixUp();
|
||||
void Build3dDrawList(CTexCache &TexCache,GLint &List);
|
||||
void Build2dDrawList(CTexCache &TexCache,GLint &List);
|
||||
|
||||
void RenderElem4Texture(sRGBData &RGBData);
|
||||
void Create2dTexture(CTexCache &TexCache,const char *Filename,int ID);
|
||||
bool CheckHasData(sRGBData &RGBData);
|
||||
|
||||
void Calc3dSize();
|
||||
GString SetPath;
|
||||
|
||||
std::vector<sTriFace> TriList;
|
||||
|
||||
|
||||
Vector3 Ofs;
|
||||
int Width,Height;
|
||||
|
||||
GLint DrawList[2];
|
||||
GLint DrawList[ElemTypeMax];
|
||||
ElemType Type;
|
||||
bool ValidFlag;
|
||||
int TexXOfs,TexYOfs;
|
||||
int Tex2dID;
|
||||
|
||||
// char PCTexName[256];
|
||||
int PCTexID;
|
||||
u8 *PCTexRGB;
|
||||
int ElemWidth,ElemHeight;
|
||||
float UnitWidth,UnitHeight;
|
||||
int ElemID;
|
||||
u8 *ElemRGB;
|
||||
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
class CElemSet
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
DEF_ELEMWIDTH=16,
|
||||
DEF_ELEMHEIGHT=16,
|
||||
DEF_ELEMBROWSWEWIDTH=8,
|
||||
};
|
||||
|
||||
CElemSet(const char *_Filename,int Idx,int Width=DEF_ELEMWIDTH,int Height=DEF_ELEMHEIGHT);
|
||||
~CElemSet();
|
||||
|
||||
int IsLoaded() {return(Loaded);}
|
||||
int GetCount() {return(ElemList.size());}
|
||||
|
||||
void Load(CCore *Core);
|
||||
|
||||
const char *GetFilename() {return(Filename);}
|
||||
const char *GetName() {return(Name);}
|
||||
int GetBrowserWidth() {return(ElemBrowserWidth);}
|
||||
|
||||
void RenderElem(int Elem,int Flags,bool Render3d) {ElemList[Elem].Render(Flags,Render3d);}
|
||||
CElem &GetElem(int No) {return(ElemList[No]);}
|
||||
void Purge();
|
||||
bool IsValid(int No);
|
||||
|
||||
bool operator==(CElemSet const &v1) {return (Name==v1.Name);}
|
||||
|
||||
private:
|
||||
void Load2d(CCore *Core);
|
||||
void Load3d(CCore *Core);
|
||||
|
||||
CPoint GetElemPos(int ID);
|
||||
|
||||
GString Filename,Name;
|
||||
|
||||
int SetNumber;
|
||||
int DefWidth,DefHeight;
|
||||
CList<CElem> ElemList;
|
||||
bool Loaded;
|
||||
int ElemBrowserWidth;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
class CElemBank
|
||||
{
|
||||
public:
|
||||
CElemBank();
|
||||
~CElemBank();
|
||||
|
||||
void Load(CFile *File,int Version);
|
||||
void Save(CFile *File);
|
||||
|
||||
void AddSet(const char *Filename);
|
||||
void LoadAllSets(CCore *Core);
|
||||
void LoadNewSet(CCore *Core);
|
||||
void ReloadAllSets();
|
||||
void DeleteSet(int Set);
|
||||
int NeedLoad() {return(LoadFlag);}
|
||||
CElem &GetElem(int Set,int Elem);
|
||||
bool IsValid(int Set,int Elem);
|
||||
|
||||
int GetSetCount() {return(SetList.size());}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
CList<CElemSet> SetList;
|
||||
bool LoadFlag;
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue