//CFTTUberShader - [2020-04-13 11:57:46]
#ifndef _CFTTUBERSHADER_H_
#define _CFTTUBERSHADER_H_

#include "CFTTVector32.h"
#include "CFTTVector32x4.h"
#include "CFTTMemPool_Resizing.h"
#include "CFTTShaderProgram.h"
#include "CFTTUberShaderBlendMode.h"
#include "CFTTTexParam.h"

//#include "CFTTMaterial.h"
/*
00201EBC CFTTUberShader::CFTTUberShader(CFTTUberShaderSetup const*)
00201EE0 CFTTUberShader::~CFTTUberShader()
00201D00 CFTTUberShader::AllocateMaterialState()
00201D1C CFTTUberShader::DeallocateMaterialState(uchar *)
00201DAC CFTTUberShader::GetTexParam(CFTTUberShaderDataDescription const*,
                                     CFTTTexParam *,
                                     uchar const*,
                                     uchar const*)
00201DE8 CFTTUberShader::CopyMaterialState(CFTTMaterial *,CFTTMaterial *)
00201E70 CFTTUberShader::ApplyShader(CFTTMaterial const*)
00201E7A CFTTUberShader::ApplyInternal(uchar const*,uchar const*)
00201EE4 CFTTUberShader::SetData(int,uchar const*,int)
00201FE4 CFTTUberShader::GetShaderProperty(int,
                                           uchar *,f
                                           int,
                                           uchar const*,
                                           uchar const*,
                                           bool *)
00202180 CFTTUberShader::CreateSnapshot(int)
002021E4 CFTTUberShader::AcquireMemPool(uint)
00202264 CFTTUberShader::ApplySnapshot(CFTTUberShaderSnapshot *)
00202270 CFTTUberShader::ReleaseSnapshot(CFTTUberShaderSnapshot *)
00202278 CFTTUberShader::CreateAllShaders()
002022B4 CFTTUberShader::CreateShader()
0020249C CFTTUberShader::DestroyAllShaders()
002024E4 CFTTUberShader::DestroyShader()
00202578 CFTTUberShader::GetCullMode(uchar const*,uchar const*)
002025A4 CFTTUberShader::GetBlendMode(uchar const*,uchar const*)
002025D4 CFTTUberShader::ReleaseMemPool(CFTTMemPool_Resizing *)
002025D6 CFTTUberShader::DeleteShaderPrograms()
00202620 CFTTUberShader::CalcPermutation(uchar const*,uchar const*)
*/

class CFTTMaterial;
//class CFTTUberShader;

//struct TShaderSnapshot {
// CFTTUberShader *pShader;
// uchar *pShaderData;
// uchar *pMaterialData;
//};
//-------------------------------------------------------------------------------------------------
// size: 0x1C
class CFTTUberShaderDataDescription {
public:
  const char *sName_0;
  int dType_4;
  uint field_8;
  int field_C;
  int field_10;
  int field_14;
  int dlen_18;
};
//-------------------------------------------------------------------------------------------------
struct TShader_Device_C {
  const char *filename_0;
  uchar *shader_data_4;
  int dfilesize_8;
};
//-------------------------------------------------------------------------------------------------
//0x68
class CFTTUberShaderSetup {
public:
  const char *name_0;
  uint field_4;
  int dCount_Desc_8;
  CFTTUberShaderDataDescription *list_DataDescription_C;
  int count_10;
  int len_14;
  int dMaterial_buf_len_18;
  int dCount_BlendMode_1C;
  CFTTUberShaderBlendMode *list_BlendMod_20;
  int dCount_CullMode_24;
  EFTTCullMode *list_CullMode_28;
  TShader_Device_C list_Device_2C[5];
};
//-------------------------------------------------------------------------------------------------
class CFTTUberShaderSnapshot {
public:
  CFTTUberShader *pShader_0;
  uchar pdat_4[8];  //随便定义的，长度未知，动态生成的
};
//-------------------------------------------------------------------------------------------------
class CFTTUberShader {
public:
  CFTTUberShader(CFTTUberShaderSetup const *pShaderSetup);  //00201EBC
  ~CFTTUberShader();                                        //00201EE0
  uchar *AllocateMaterialState();                           //00201D00
  void DeallocateMaterialState(uchar *pdata);               //00201D1C
  void GetTexParam(CFTTUberShaderDataDescription const *pDataDescription,
                   CFTTTexParam *pTexParam,
                   uchar const *pDat1,
                   uchar const *pDat2) const;              //00201DAC
  void CopyMaterialState(CFTTMaterial *, CFTTMaterial *);  //00201DE8
  void ApplyShader(CFTTMaterial const *);                  //00201E70
  void ApplyInternal(uchar const *, uchar const *);        //00201E7A
  void SetData(int, uchar const *, int);                   //00201EE4
  void GetShaderProperty(int index,
                         uchar *pOut,
                         int a3,
                         uchar const *pDat1,
                         uchar const *pDat2,
                         bool *bflag) const;                     //00201FE4
  CFTTUberShaderSnapshot *CreateSnapshot(int a1);                //00202180
  static CFTTMemPool_Resizing *AcquireMemPool(uint len);         //002021E4
  void ApplySnapshot(CFTTUberShaderSnapshot *pSnapshot);         //00202264
  void ReleaseSnapshot(CFTTUberShaderSnapshot *pSnapshot);       //00202270
  static void CreateAllShaders();                                //00202278
  void CreateShader();                                           //002022B4
  static void DestroyAllShaders();                               //0020249C
  void DestroyShader();                                          //002024E4
  EFTTCullMode GetCullMode(uchar const *, uchar const *) const;  //00202578
  CFTTUberShaderBlendMode *GetBlendMode(uchar const *pDat1,
                                        uchar const *pDat2) const;   //002025A4
  void ReleaseMemPool(CFTTMemPool_Resizing *);                       //002025D4
  void DeleteShaderPrograms();                                       //002025D6
  int CalcPermutation(uchar const *pDat, uchar const *pDat2) const;  //00202620

  CFTTUberShaderSetup *pCFTTUberShaderSetup_0;
  uchar *pShaderData_4;
  CFTTMemPool_Resizing *pMaterialState_MemPool_8;
  CFTTMemPool_Resizing *pAcquireMemPool_C;
  CFTTShaderProgram **pShaderProgram_10;
  CFTTUberShader *listhead_14;
  uchar byte_18;
  uchar byte_19;
  uchar byte_1A;
  uchar byte_1B;

  static CFTTUberShader *s_pLinkedListHead;
  static char *s_pShaderPath;
};
//-------------------------------------------------------------------------------------------------
#endif  //_CFTTUBERSHADER_H_