TGraphicBuffer Class Reference

This class defines software vertex or index buffer. More...

#include <DataBuffers.h>

Inheritance diagram for TGraphicBuffer:

Inheritance graph
[legend]
Collaboration diagram for TGraphicBuffer:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TGraphicBuffer (const DWORD &size, const DWORD &itemSize)
 Constructor.
 ~TGraphicBuffer (void)
 Destructor.
void Clone (TGraphicBuffer **buffer) const
 Create copy of this buffer.
void Set (const TGraphicBuffer &buffer)
 Copy data from another buffer to this buffer.
void Clone (const DWORD &items, TGraphicBuffer **buffer) const
 Create copy of specified number of items from this buffer.
void Set (const TGraphicBuffer &buffer, const DWORD &items)
 Copy data from another buffer to this buffer.
void AddBuffer (const TGraphicBuffer &buffer)
 Adds data from another buffer at end of this buffer.
void AddBuffer (const TGraphicBuffer &buffer, const DWORD &items)
 Adds data from another buffer at end of this buffer.
void * GetDataAtItem (const DWORD &item)
 Returns pointer to specified item.
const void * GetDataAtItem (const DWORD &item) const
 Returns pointer to specified item.
void * GetData (void)
 Returns pointer to data stored inside buffer.
const void * GetData (void) const
 Returns pointer to data stored inside buffer.
DWORD GetSize (void) const
 Returns size of data stored inside buffer, in bytes.
DWORD GetItemSize (void) const
 Returns size of one item in bytes.
DWORD GetItemsCount (void) const
 Returns number of items stored inside buffer.

Detailed Description

This class defines software vertex or index buffer.

This buffer cannot be used for rendering, but has similar functionality like buffer from renderer.

Data stored inside buffer has no type - they are stored in raw format. This enables copy data directly to/from HW buffers. Nevertheless each buffer has information about size of one data item. This is required for some routines which mainpulate with data.

Definition at line 28 of file DataBuffers.h.


Constructor & Destructor Documentation

TGraphicBuffer::TGraphicBuffer const DWORD size,
const DWORD itemSize
 

Constructor.

Creates buffer with number of items (== SIZE) and with size of one item equal to ITEMSIZE If parameters are wrong, at least buffer with 1 item of size 1 byte is created.

Parameters:
size [in] number of items in buffer - must be at least 1
itemSize [in] size of one item in buffer - must be at least one

Definition at line 35 of file DataBuffers.cpp.

References DBGASSERT, and FALSE.

TGraphicBuffer::~TGraphicBuffer void   ) 
 

Destructor.

Definition at line 60 of file DataBuffers.cpp.


Member Function Documentation

void TGraphicBuffer::AddBuffer const TGraphicBuffer buffer,
const DWORD items
 

Adds data from another buffer at end of this buffer.

Added buffer must have the same ITEM SIZE as this buffer. You must specified number of items from second buffer which will be added. If this number is great than number of available items in BUFFER then maximum possible count of items will be added.

Warning:
This method allocates new memory in buffer.
Parameters:
buffer [in] source buffer with item size equal to item size of this buffer
items [in] number of items from second buffer which will be added

Definition at line 164 of file DataBuffers.cpp.

References DBGTEXTF, and GetItemSize().

Here is the call graph for this function:

void TGraphicBuffer::AddBuffer const TGraphicBuffer buffer  ) 
 

Adds data from another buffer at end of this buffer.

Added buffer must have the same ITEM SIZE as this buffer.

Warning:
This method allocates new memory in buffer.
Parameters:
buffer [in] source buffer with item size equal to item size of this buffer

Definition at line 148 of file DataBuffers.cpp.

References GetItemsCount().

Here is the call graph for this function:

void TGraphicBuffer::Clone const DWORD items,
TGraphicBuffer **  buffer
const
 

Create copy of specified number of items from this buffer.

Number of copied items must be always at least 1.

Warning:
This method allocates memory which must dealocated by caller.
Parameters:
buffer [out] address of pointer where result will be stored
items [in] number of items to copy - must be at least 1

Definition at line 107 of file DataBuffers.cpp.

References Set().

Here is the call graph for this function:

void TGraphicBuffer::Clone TGraphicBuffer **  buffer  )  const
 

Create copy of this buffer.

Warning:
This method allocates memory which must dealocated by caller.
Parameters:
buffer [out] address of pointer where result will be stored

Definition at line 72 of file DataBuffers.cpp.

References Set().

Here is the call graph for this function:

const void* TGraphicBuffer::GetData void   )  const [inline]
 

Returns pointer to data stored inside buffer.

Definition at line 64 of file DataBuffers.h.

void* TGraphicBuffer::GetData void   )  [inline]
 

Returns pointer to data stored inside buffer.

Definition at line 60 of file DataBuffers.h.

const void * TGraphicBuffer::GetDataAtItem const DWORD item  )  const
 

Returns pointer to specified item.

Item index must valid, otherwise NULL is returned.

Parameters:
item [in] index of item

Definition at line 215 of file DataBuffers.cpp.

References DBGTEXTF.

void * TGraphicBuffer::GetDataAtItem const DWORD item  ) 
 

Returns pointer to specified item.

Item index must valid, otherwise NULL is returned.

Parameters:
item [in] index of item

Definition at line 197 of file DataBuffers.cpp.

References DBGTEXTF.

Referenced by NSMeshes::TMeshCreator::CreateBox_XYZ_COLOR(), NSMeshes::TMeshCreator::CreateBox_XYZ_NXNYNZ_COLOR(), and NSMeshes::TMeshCreator::CreateBox_XYZ_TUTV().

DWORD TGraphicBuffer::GetItemsCount void   )  const [inline]
 

Returns number of items stored inside buffer.

Definition at line 76 of file DataBuffers.h.

Referenced by AddBuffer().

DWORD TGraphicBuffer::GetItemSize void   )  const [inline]
 

Returns size of one item in bytes.

Definition at line 72 of file DataBuffers.h.

Referenced by AddBuffer().

DWORD TGraphicBuffer::GetSize void   )  const [inline]
 

Returns size of data stored inside buffer, in bytes.

Definition at line 68 of file DataBuffers.h.

void TGraphicBuffer::Set const TGraphicBuffer buffer,
const DWORD items
 

Copy data from another buffer to this buffer.

Only specified number of items will be copy. Number of copied items must be always at least 1. After this new buffer is exactly the same as original buffer.

Parameters:
buffer [in] original buffer
items [in] number of items to copy - must be at least 1

Definition at line 121 of file DataBuffers.cpp.

References DBGTEXTF, m_data, and m_item_size.

void TGraphicBuffer::Set const TGraphicBuffer buffer  ) 
 

Copy data from another buffer to this buffer.

After this new buffer is exactly the same as original buffer.

Warning:
This method allocates new memory for this buffer.
Parameters:
buffer [in] original buffer

Definition at line 86 of file DataBuffers.cpp.

References m_data, m_item_size, m_number_items, and m_size.

Referenced by Clone().


The documentation for this class was generated from the following files:
Generated on Wed Nov 28 22:42:30 2007 for Joy4D by  doxygen 1.4.6-NO