// CBlitter - [2020-04-13 11:57:46]
#ifndef _CBLITTER_H_
#define _CBLITTER_H_

#include "CFTTUberShader.h"
#include "CFTTTexture.h"
#include "CFTT2D_TexturedVert.h"
#include "CFTTGraphicsBuffer.h"

/*
0020CF2C CBlitter::CBlitter(int,int,int)
0020CFE0 CBlitter::~CBlitter()
0020D004 CBlitter::Clear()
0020D05C CBlitter::Render()
0020D2B8 CBlitter::OnFrameEnd()
0020D2BC CBlitter::OnMaterialModified(CFTTUberShader *,int)
0020D328 CBlitter::OnTextureDeletion(CFTTTexture *)
0020D32A CBlitter::AllocRect()
0020D3B8 CBlitter::CheckForDrawCallSwitch(int,int)
0020D45A CBlitter::AllocTri()
0020D4DA CBlitter::OnIBORequired()
0020D518 CBlitter::AllocLines(int)
0020D5AE CBlitter::AddVertList(CFTT2D_TexturedVert *,int)
0020D668 CBlitter::SetTexture(CFTTTexture *)
0020D688 CBlitter::SetPrimType(FTTPRIMTYPE)
0020D68C CBlitter::SetMatID(int)
0020D690 CBlitter::SetScissor(int,int,int,int)
0020D69C CBlitter::SetFlipY(bool)
0020D6A0 CBlitter::SetFlipX(bool)
0020D6A4 CBlitter::GetFlipX()
0020D6A8 CBlitter::GetFlipY()

0x50
*/

struct Material_0x20 {
  int dMatID_0;
  CFTTTexture *pTexture_4;
  FTTPRIMTYPE ePrimType_8;
  int x_C;  //裁剪区域
  int y_10;
  int width_14;
  int height_18;
  CFTTUberShaderSnapshot *pSnapshot_1C;
};

struct CBlitter_struct_2C {
  Material_0x20 material_0;
  int field_20;
  uint32_t field_24;
  uint32_t field_28;
};

class CBlitter {
public:
  CBlitter(int, int, int);                         // 0020CF2C
  ~CBlitter();                                     // 0020CFE0
  void Clear();                                    // 0020D004
  void Render();                                   // 0020D05C
  void OnFrameEnd();                               // 0020D2B8
  void OnMaterialModified(CFTTUberShader *, int);  // 0020D2BC
  void OnTextureDeletion(CFTTTexture *);           // 0020D328
  CFTT2D_TexturedVert *AllocRect();                // 0020D32A
  bool CheckForDrawCallSwitch(int, int);           // 0020D3B8
  CFTT2D_TexturedVert *AllocTri();                 // 0020D45A
  void OnIBORequired();                            // 0020D4DA
  CFTT2D_TexturedVert *AllocLines(int);            // 0020D518
  void AddVertList(CFTT2D_TexturedVert *, int);    // 0020D5AE
  void SetTexture(CFTTTexture *pTexture);          // 0020D668
  void SetPrimType(FTTPRIMTYPE e);                 // 0020D688
  void SetMatID(int);                              // 0020D68C
  void SetScissor(int x, int y, int w, int h);     // 0020D690
  void SetFlipY(bool b);                           // 0020D69C
  void SetFlipX(bool b);                           // 0020D6A0
  bool GetFlipX();                                 // 0020D6A4
  bool GetFlipY();                                 // 0020D6A8

  bool bFlipX_0;
  bool bFlipY_1;
  bool bIBO_2;
  bool unuse_3;  //没有用到，仅对齐
  Material_0x20 material_4;
  CBlitter_struct_2C *pT_24;
  int dList24Count_28;
  uint dCount_2C;
  int field_30;
  int field_34;
  int dLineCount_38;
  volatile int dint_3C;  //部分指令是取short, 但是总体上认为3C这个位置是一个int
  CFTTGraphicsBuffer *pGrabuf_40;
  CFTTGraphicsBuffer *pGrabuf_44;
  ushort *pshort_48;  //没有找到分配的函数
  CFTT2D_TexturedVert *pTextureVer_4C;
};

#endif  //_CBLITTER_H_