Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef V_BATCHER
- #define V_BATCHER
- #include <d3d9.h>
- #include <d3dx9.h>
- #include <iostream>
- #include <vector>
- class vBatcher
- {
- //Vertex struct
- struct vertex
- {
- float x;
- float y;
- float z;
- float rhw;
- D3DCOLOR color;
- float u;
- float v;
- };
- //Quad struct
- struct quad
- {
- vertex verts[4];
- LPDIRECT3DTEXTURE9 texture;
- };
- public:
- vBatcher();
- ~vBatcher();
- void initBatcher(LPDIRECT3DDEVICE9 &device);
- void beginBatch();
- void draw(float x, float y, float width, float height, LPDIRECT3DTEXTURE9 texture);
- void endBatch();
- private:
- //DirectX 9 device ref
- LPDIRECT3DDEVICE9 batDevice;
- DWORD CUSTOMFVF2;
- //Index and Vertex buffer items
- LPDIRECT3DVERTEXBUFFER9 vBuffer;
- LPDIRECT3DINDEXBUFFER9 iBuffer;
- UINT vertexBufferSize;
- UINT indexBufferSize;
- DWORD bufferLockFlag;
- //Render vars
- LPDIRECT3DTEXTURE9 currentTexture;
- vertex *vertices;
- short *indices;
- int currentVertexBufferPosition;
- int currentIndexBufferPosition;
- int vertexOffsetForBuffer;
- int numberOfVertsToDraw;
- int numberOfShapesToDraw;
- UINT totalAmountOfData;
- bool bufferIsFull;
- //Draw var items
- std::vector<quad> drawData;
- quad quadData;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement