// IDX9.h
#ifndef IDX9_H_
#define IDX9_H_
#include <d3d9.h>
#include <strsafe.h>
#include <iostream>
#include "Math.h"
struct ScreenVertex
{
float x ;
float y ;
float z ;
float rhw ;
} ;
#define SCREEN_VERTEX_FVF (D3DFVF_XYZRHW)
class IDX9
{
private:
static const int BVBSize = 65536 ;
static const int BIBSize = 65536 * 2 ;
LPDIRECT3D9 g_pD3D ;
LPDIRECT3DDEVICE9 g_pd3dDevice ;
LPDIRECT3DVERTEXBUFFER9 pVertexBuffer ;
LPDIRECT3DINDEXBUFFER9 pIndexBuffer ;
void CleanUp() ;
public:
ScreenVertex* backVertexBuffer ;
int* backIndexBuffer ;
int BVBCursor ; // short for backVertexBuffer
int BIBCursor ;
IDX9() ;
~IDX9() ;
bool SetUp(HWND hwnd) ;
void RefreshBackBuffer() ;
bool SubmitPolygonList(PolySelfContained* polyList, int count) ;
bool DrawBackBuffer() ;
void Render() ;
} ;
#endif