4 #ifdef USE_DIRECTX_RENDERER 5 typedef IDirect3DVertexBuffer9* VertexBufferDevicePtr_type;
6 typedef IDirect3DIndexBuffer9* IndexBufferDevicePtr_type;
7 #elif defined(USE_OPENGL_RENDERER) 8 typedef GLuint VertexBufferDevicePtr_type;
9 typedef GLuint IndexBufferDevicePtr_type;
11 typedef int32_t VertexBufferDevicePtr_type;
12 typedef int32_t IndexBufferDevicePtr_type;
26 BufferType_VertexBuffer = 0,
27 BufferType_IndexBuffer,
28 BufferType_MemoryBuffer,
31 VertexBufferDevicePtr_type GetDevicePointer();
33 IndexBufferDevicePtr_type GetDevicePointerAsIndexBuffer();
34 char* GetMemoryPointer();
40 bool CreateBuffer(uint32 nBufferSize, DWORD dwFormat = 0, DWORD dwUsage = 0, D3DPOOL dwPool = D3DPOOL_MANAGED);
41 bool CreateIndexBuffer(uint32 nBufferSize, DWORD dwFormat = 0, DWORD dwUsage = 0);
42 bool CreateMemoryBuffer(uint32 nBufferSize, DWORD dwFormat = 0, DWORD dwUsage = 0);
50 bool Lock(
void** ppData, uint32 offsetToLock = 0, uint32 sizeToLock = 0, DWORD dwFlag = 0);
59 operator bool()
const {
return IsValid(); };
60 bool operator !()
const {
return !
IsValid(); };
61 void RendererRecreated();
62 void UploadMemoryBuffer(
const char* pBuffer, int32 nBufSize = -1);
65 IndexBufferDevicePtr_type m_indexBuffer;
66 VertexBufferDevicePtr_type m_vertexBuffer;
72 EnumBufferType m_bufferType;
81 bool CreateBuffer(uint32 nBufferSize, DWORD dwFormat = 0, DWORD dwUsage = 0);
82 IndexBufferDevicePtr_type GetDevicePointer();
90 bool CreateBuffer(uint32 nBufferSize, DWORD dwFormat = 0, DWORD dwUsage = 0);
91 char* GetDevicePointer();
bool CreateBuffer(uint32 nBufferSize, DWORD dwFormat=0, DWORD dwUsage=0, D3DPOOL dwPool=D3DPOOL_MANAGED)
recreate the buffer based on the new size
Definition: ParaVertexBuffer.cpp:49
pure memory buffer, useful for filling in another thread and then upload to a real vertex buffer in t...
Definition: ParaVertexBuffer.h:87
different physics engine has different winding order.
Definition: EventBinding.h:32
cross platform vertex/index buffer.
Definition: ParaVertexBuffer.h:18
void ReleaseBuffer()
release the buffer.
Definition: ParaVertexBuffer.cpp:95
in OpenGL, there is no different between vertex and index buffer.
Definition: ParaVertexBuffer.h:78
void Unlock()
unlock the buffer
Definition: ParaVertexBuffer.cpp:144
uint32 GetBufferSize()
get the current buffer size.
Definition: ParaVertexBuffer.cpp:36
bool Lock(void **ppData, uint32 offsetToLock=0, uint32 sizeToLock=0, DWORD dwFlag=0)
lock and return a writable buffer into which one can fill the buffer.
Definition: ParaVertexBuffer.cpp:121
bool IsValid() const
boolean: test validity
Definition: ParaVertexBuffer.cpp:177