Main Page   Class Hierarchy   Compound List   File List   Compound Members  

D3DVertexBuffer Class Reference

#include <D3DVertexBuffer.h>

Inheritance diagram for D3DVertexBuffer:

vbInterface List of all members.

Public Member Functions

 D3DVertexBuffer ()
 ~D3DVertexBuffer ()
HRESULT createVB (int, VOID *)
void destroyVB (void)
HRESULT lockVB (void)
void unlockVB (void)
void addTriToVB (D3DXVECTOR3 pos, FLOAT r, FLOAT g, FLOAT b, FLOAT a)
void flushVB (void)
void addTriToVB (D3DXVECTOR3, FLOAT, FLOAT, FLOAT, FLOAT, D3DXVECTOR2)

Protected Attributes

UINT m_iVertexSize
UINT m_iVertexLimit
UINT m_iVerticesInBuffer
BOOL m_bIsLocked
CUSTOM_VERTEX * m_pVertices
LPDIRECT3DVERTEXBUFFER8 m_lpVB
LPDIRECT3DDEVICE8 m_lpD3DDevice

Detailed Description

This object encapsulates the Direct3D8 implementation of our vbInterface object. Basically it will act as a way to add triangle data to our graphics pipeline.


Constructor & Destructor Documentation

D3DVertexBuffer::D3DVertexBuffer  ) 
 

Constructor

D3DVertexBuffer::~D3DVertexBuffer  ) 
 

Destructor


Member Function Documentation

void D3DVertexBuffer::addTriToVB D3DXVECTOR3  ,
FLOAT  ,
FLOAT  ,
FLOAT  ,
FLOAT  ,
D3DXVECTOR2 
[virtual]
 

(v1.3) overloaded the addTriToVB method to account for texture mapping coordinates

Parameters:
D3DXVECTOR3 - (x, y, z) position of our vertex
FLOAT - red component of our vertex
FLOAT - green component of our vertex
FLOAT - blue component of our vertex
FLOAT - alpha component of our vertex
D3DXVECTOR2 - (u, v) texture mapping coordinates
Returns:
void

Implements vbInterface.

void D3DVertexBuffer::addTriToVB D3DXVECTOR3  pos,
FLOAT  r,
FLOAT  g,
FLOAT  b,
FLOAT  a
[virtual]
 

This method is responsible for adding a triangle to our vertex buffer interface. Although it IS a bit of a waste having a virtual method being called for every single triangle that we add, we are just trying to create a way to demonstrate a fashion of rendering primitives with both OpenGL and Direct3D8. The reader can optimize as desired.

Parameters:
D3DXVECTOR3 - (x, y, z) position of our vertex
FLOAT - red component of our vertex
FLOAT - green component of our vertex
FLOAT - blue component of our vertex
FLOAT - alpha component of our vertex
Returns:
void

Implements vbInterface.

HRESULT D3DVertexBuffer::createVB int  ,
VOID * 
[virtual]
 

This method is responsible for creating our vertex buffer interface object. Because OpenGL and Direct3D8 initialize things just a little bit differently, I decided to give us the flexibility to pass in any "extra" object that we would need to create our vertex buffer.

Parameters:
int - How many triangles our vertex buffer should hold
VOID* - A pointer to any extra creation object we need
Returns:
HRESULT - SUCCEEDED if things are ok, FAILED otherwise

Implements vbInterface.

void D3DVertexBuffer::destroyVB void   )  [virtual]
 

This method just destroys our vertex buffer and handles any memory cleanup

Parameters:
void 
Returns:
void

Implements vbInterface.

void D3DVertexBuffer::flushVB void   ) 
 

This method is just responsible for signaling to the vertex buffer that we wish to flush out the memory area of any pending triangle data

Parameters:
void 
Returns:
void

HRESULT D3DVertexBuffer::lockVB void   )  [virtual]
 

This method is responsible for locking down the vertex buffer memory. Basically the hardware will just lock down an area that we can use to add/update any triangle data.

Parameters:
void 
Returns:
HRESULT - if we SUCCEEDED or FAILED

Implements vbInterface.

void D3DVertexBuffer::unlockVB void   )  [virtual]
 

This method is responsible for signalling to the vertex buffer that we are finished adding triangles. Let's unlock the video memory, so that we can perform other operations with the hardware/pipeline

Parameters:
void 
Returns:
void

Implements vbInterface.


Member Data Documentation

BOOL D3DVertexBuffer::m_bIsLocked [protected]
 

the count of vertices currently in buffer

UINT D3DVertexBuffer::m_iVertexLimit [protected]
 

the size of a vertex

UINT D3DVertexBuffer::m_iVerticesInBuffer [protected]
 

max number of vertices to batch

LPDIRECT3DDEVICE8 D3DVertexBuffer::m_lpD3DDevice [protected]
 

pointer to our IDirect3DVertexBuffer8 interface

LPDIRECT3DVERTEXBUFFER8 D3DVertexBuffer::m_lpVB [protected]
 

a pointer to our vertex structure

CUSTOM_VERTEX* D3DVertexBuffer::m_pVertices [protected]
 

is our vertex buffer locked


The documentation for this class was generated from the following files:
Generated on Thu Jul 3 07:23:27 2003 for GameFramework by doxygen 1.3.1