// CFTTBatchModelManager - [2020-04-13 11:57:46]
#ifndef _CFTTBATCHMODELMANAGER_H_
#define _CFTTBATCHMODELMANAGER_H_

#include "TUV.h"
#include "CFTTBatchCache.h"
#include "TFTTCacheLookup.h"
#include "CFTTBMMMatrixCache.h"

/*
0020F240 CFTTBatchModelManager::CFTTBatchModelManager(int,bool,int,uint,bool,bool)
0020F378 CFTTBatchModelManager::~CFTTBatchModelManager()
0020F1EC CFTTBatchModelManager::InitialiseCodePath()
0020F414 CFTTBatchModelManager::PerformFlushOnFull()
0020F450 CFTTBatchModelManager::End()
0020F480 CFTTBatchModelManager::Begin()
0020F494 CFTTBatchModelManager::AddBin(CFTTBatchModelBin *,int,uint,int,int,bool,bool)
0020F4EC CFTTBatchModelManager::FlushThreaded()
0020F5B4 CFTTBatchModelManager::Flush(int,bool,bool)
0020F670 CFTTBatchModelManager::ResetCache(bool)
0020F68C CFTTBatchModelManager::SetMatrix(CFTTMatrix32 const&)
0020F694 CFTTBatchModelManager::AddModelVerts(int,CFTTModel *,int,CFTTMatrix32 const*,TUV *,TFTTCacheLookup,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*),CFTTMatrix32 const*)
0020F8E4 CFTTBatchModelManager::SkinVertsBoned(CFTTModel *,int,float *,void *,CFTTMatrix32 const*,CFTTBMMMatrixCache::StartCount,CFTTBMMMatrixCache::StartCount,TUV *,TFTTCacheLookup,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*))
0020FA32 CFTTBatchModelManager::CopyVerts(CFTTModel *,int,float *,void *,CFTTMatrix32 const*,CFTTBMMMatrixCache::StartCount,CFTTBMMMatrixCache::StartCount,TUV *,TFTTCacheLookup,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*))
0020FAD8 CFTTBatchModelManager::AddModel(CFTTModel *,CFTTMatrix32 const*,TUV *,TFTTCacheInstance,int,int,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*),CFTTMatrix32 const*)
0020FD4A CFTTBatchModelManager::AddModelX(CFTTModel *,int,CFTTMatrix32 const*,TUV *,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*),CFTTMatrix32 const*)
0020FE6E CFTTBatchModelManager::SetFlushOnFullCB(void (*)(CFTTBatchModelManager*,void *),void *)
0020FE74 CFTTBatchModelManager::SkinVertsBlend(CFTTModel *,int,float *,void *,CFTTMatrix32 const*,CFTTBMMMatrixCache::StartCount,CFTTBMMMatrixCache::StartCount,TUV *,TFTTCacheLookup,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*))
0020FE76 CFTTBatchModelManager::SkinVerts(CFTTModel *,int,float *,void *,CFTTMatrix32 const*,CFTTBMMMatrixCache::StartCount,CFTTBMMMatrixCache::StartCount,TUV *,TFTTCacheLookup,void (*)(void *,CFTTModel *,int,CFTTMatrix32 const*))

0x4EC
*/

// class CFTTBatchModelManager;
class CFTTBatchModelBin;

class CFTTBatchModelManager {
public:
  typedef void (*pFlushOnFullCBCallBack)(CFTTBatchModelManager *, void *);
  typedef void (*callback_1)(void *, CFTTModel *, int, CFTTMatrix32 const *);
  // CFTTBatchModelManager::pFunc是8字节，(CFTTBatchModelManager::*pFunc)中的"CFTTBatchModelManager::"导致了8个字节
  //而且必须有"CFTTBatchModelManager::"，只有加上这个，才能保存成员函数指针的地址
  typedef void (CFTTBatchModelManager::*pFunc)(CFTTModel *,
                                               int,
                                               float *,
                                               void *,
                                               CFTTMatrix32 const *,
                                               CFTTBMMMatrixCache::StartCount,
                                               CFTTBMMMatrixCache::StartCount,
                                               TUV *,
                                               TFTTCacheLookup,
                                               CFTTBatchModelManager::callback_1);

  void SetFlushOnFullCB(pFlushOnFullCBCallBack pFlushOnFullCBCallBack_r1, void *p_v_r2);  // 0020FE6E
  CFTTBatchModelBin *AddBin(CFTTBatchModelBin *p_cfttbatchmodelbin_r1_arg,
                            int d_r2_arg, uint ud_r3_arg, int d_arg_0,
                            int d_arg_4, bool b_arg_8, bool b_arg_c);  // 0020F494

  static void InitialiseCodePath();  // 0020F1EC

  CFTTBatchModelManager(int d_r1_arg, bool b_r2_arg, int d_r3_arg, unsigned int ud_arg_0, bool b_arg_4, bool b_arg_8);  // 0020F240

  ~CFTTBatchModelManager();              // 0020F378
  bool PerformFlushOnFull();             // 0020F414
  void End();                            // 0020F450
  void Begin();                          // 0020F480
  void FlushThreaded();                  // 0020F4EC
  void Flush(int, bool, bool);           // 0020F5B4
  void ResetCache(bool);                 // 0020F670
  void SetMatrix(CFTTMatrix32 const &);  // 0020F68C
  int AddModelVerts(int, CFTTModel *,
                    int,
                    CFTTMatrix32 const *,
                    TUV *,
                    TFTTCacheLookup,
                    void (*)(void *, CFTTModel *, int, CFTTMatrix32 const *),
                    CFTTMatrix32 const *);  // 0020F694
  void SkinVertsBoned(CFTTModel *,
                      int,
                      float *,
                      void *,
                      CFTTMatrix32 const *,
                      CFTTBMMMatrixCache::StartCount,
                      CFTTBMMMatrixCache::StartCount,
                      TUV *,
                      TFTTCacheLookup,
                      void (*)(void *, CFTTModel *, int, CFTTMatrix32 const *));  // 0020F8E4

  void CopyVerts(CFTTModel *p_cfttmodel_r1_arg,
                 int i_r2_arg, float *p_f_r3_arg,
                 void *p_v_arg_0,
                 CFTTMatrix32 const *p_cfttmatrix32_arg_4,
                 CFTTBMMMatrixCache::StartCount cfttbmmmatrixcache_startcount_arg_8,
                 CFTTBMMMatrixCache::StartCount cfttbmmmatrixcache_startcount_arg_10,
                 TUV *p_tuv_arg_18,
                 TFTTCacheLookup tfttcachelookup_arg_1c = TFTTCacheLookup(),
                 callback_1 callback_1_arg_24 = nullptr);  // 0020FA32
  void AddModel(CFTTModel *,
                CFTTMatrix32 const *,
                TUV *,
                TFTTCacheInstance,
                int,
                int,
                void (*)(void *, CFTTModel *, int, CFTTMatrix32 const *),
                CFTTMatrix32 const *);  // 0020FAD8
  void AddModelX(CFTTModel *,
                 int,
                 CFTTMatrix32 const *,
                 TUV *,
                 void (*)(void *, CFTTModel *, int, CFTTMatrix32 const *),
                 CFTTMatrix32 const *);  // 0020FD4A

  void SkinVertsBlend(CFTTModel *,
                      int,
                      float *,
                      void *,
                      CFTTMatrix32 const *,
                      CFTTBMMMatrixCache::StartCount,
                      CFTTBMMMatrixCache::StartCount,
                      TUV *,
                      TFTTCacheLookup,
                      void (*)(void *, CFTTModel *, int, CFTTMatrix32 const *));  // 0020FE74
  void SkinVerts(CFTTModel *,
                 int,
                 float *,
                 void *,
                 CFTTMatrix32 const *,
                 CFTTBMMMatrixCache::StartCount,
                 CFTTBMMMatrixCache::StartCount,
                 TUV *,
                 TFTTCacheLookup,
                 void (*)(void *, CFTTModel *, int, CFTTMatrix32 const *));  // 0020FE76

  // 0x4EC
  // field_0   CFTTBMMMatrixCache super class
  CFTTBMMMatrixCache cfttbmmmatrixcache_0;
  CFTTMatrix32 cfttmatrix32_24;
  bool field_64;  // if false invoke ProcessShadowVertsCount else invoke ProcessRigidVertsBumpCount
  bool field_65;  // if false invoke ProcessRigidVertsCount
  char field_66;
  char field_67;
  int field_68;                                 //= 0x18 or 0x20
  CFTTBatchModelBin **pp_cfttbatchmodelbin_6C;  // CFTTBatchModelBin*指针数组
  int field_70;                                 // pp_cfttbatchmodelbin_6C的元素count
  int field_74;                                 // pp_cfttbatchmodelbin_6C的buffer count
  CFTTMatrix32 cfttmatrix32_78;
  int field_B8;
  int field_BC;
  int field_C0;
  int field_C4;
  int field_C8;
  int field_CC;
  int field_D0;
  pFlushOnFullCBCallBack field_D4;
  void *field_D8;  // field_D4的第二个参数
  bool field_DC;
  bool field_DD;
  char field_DE;
  char field_DF;
  CFTTGraphicsBuffer *p_cfttgraphicsbuffer_E0;
  void *field_E4;
  int field_E8[0x100];
  CFTTBatchCache *p_cfttbatchcache_4E8;
};

// this->field_68; //结构体大小
// this->field_BC; //结构体索引?
// this->field_E4; //结构体首地址

extern CFTTBatchModelManager *GFXPLAYER_pBatch;

#endif  //_CFTTBATCHMODELMANAGER_H_