CrystalSpace

Public API Reference

csRenderBuffer Class Reference
[Graphics]

Render buffer - basic container for mesh geometry data. More...

#include <csgfx/renderbuffer.h>

Inherits scfImplementation1< csRenderBuffer, iRenderBuffer >.

List of all members.

Classes

struct  Props
 To scrape off a few bytes use bitfields; assumes values are in sane limits. More...

Public Member Functions

virtual ~csRenderBuffer ()
 Destructor.
iRenderBuffer implementation

virtual void * Lock (csRenderBufferLockType lockType)
 Get version.
virtual void Release ()
 Get version.
virtual void CopyInto (const void *data, size_t elementCount, size_t elemOffset=0)
 Get version.
virtual int GetComponentCount () const
 Get version.
virtual csRenderBufferComponentType GetComponentType () const
 Get version.
virtual csRenderBufferType GetBufferType () const
 Get version.
virtual size_t GetSize () const
 Get version.
virtual size_t GetStride () const
 Get version.
virtual size_t GetElementDistance () const
 Get version.
virtual size_t GetOffset () const
 Get version.
virtual uint GetVersion ()
 Get version.
bool IsMasterBuffer ()
 Get version.
virtual iRenderBufferGetMasterBuffer () const
 Get version.
virtual bool IsIndexBuffer () const
 Get version.
virtual size_t GetRangeStart () const
 Get version.
virtual size_t GetRangeEnd () const
 Get version.
virtual size_t GetElementCount () const
 Get version.
virtual void SetCallback (iRenderBufferCallback *cb)
 Get version.
virtual void SetData (const void *data)
 Get version.

void SetRenderBufferProperties (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, uint componentCount, bool copy=true)
 Change properties of a render buffer after creation (DANGEROUS).
void SetIndexBufferProperties (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, size_t rangeStart, size_t rangeEnd, bool copy=true)
 Change properties of a render buffer after creation (DANGEROUS).

Static Public Member Functions

Render buffer creation

static csRef< csRenderBufferCreateRenderBuffer (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, uint componentCount)
 Create a render buffer.
static csRef< csRenderBufferCreateRenderBuffer (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, uint componentCount, bool copy)
 Create a render buffer.
static csRef< csRenderBufferCreateIndexRenderBuffer (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, size_t rangeStart, size_t rangeEnd)
 Create an index buffer.
static csRef< csRenderBufferCreateIndexRenderBuffer (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, size_t rangeStart, size_t rangeEnd, bool copy)
 Create a render buffer.
static csRef< csRenderBufferCreateInterleavedRenderBuffers (size_t elementCount, csRenderBufferType type, uint count, const csInterleavedSubBufferOptions *elements, csRef< iRenderBuffer > *buffers)
 Create an interleaved renderbuffer (You would use this then set stride to determine offset and stride of the interleaved buffer.
"Friendly" name utilities

static const char * GetDescrFromBufferName (csRenderBufferName bufferName)
 Utility to retrieve the "friendly" string name of a buffer description, e.g.
static csRenderBufferName GetBufferNameFromDescr (const char *name)
 Retrieve the buffer name for a "friendly" buffer description.

Protected Member Functions

 csRenderBuffer (size_t size, csRenderBufferType type, csRenderBufferComponentType componentType, uint componentCount, size_t rangeStart, size_t rangeEnd, bool copy=true)
 Constructor.

Protected Attributes

unsigned char * buffer
 buffer holding the data
size_t bufferSize
 Total size of the buffer.
struct csRenderBuffer::Props props
 To scrape off a few bytes use bitfields; assumes values are in sane limits.
size_t rangeEnd
 range start for index-buffer
size_t rangeStart
 range start for index-buffer
unsigned int version
 modification number

Detailed Description

Render buffer - basic container for mesh geometry data.

Definition at line 58 of file renderbuffer.h.


Constructor & Destructor Documentation

csRenderBuffer::csRenderBuffer ( size_t  size,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
uint  componentCount,
size_t  rangeStart,
size_t  rangeEnd,
bool  copy = true 
) [protected]

Constructor.

virtual csRenderBuffer::~csRenderBuffer (  )  [virtual]

Destructor.


Member Function Documentation

virtual void csRenderBuffer::CopyInto ( const void *  data,
size_t  elementCount,
size_t  elemOffset = 0 
) [virtual]

Get version.

static csRef<csRenderBuffer> csRenderBuffer::CreateIndexRenderBuffer ( size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
size_t  rangeStart,
size_t  rangeEnd 
) [static]

Create an index buffer.

Parameters:
elementCount Number of elements in the buffer.
type Type of buffer; CS_BUF_DYNAMIC, CS_BUF_STATIC or CS_BUF_STREAM.
componentType Components Types; usually CS_BUFCOMP_UNSIGNED_INT
rangeStart Minimum index value that is expected to be written to the created buffer.
rangeEnd Maximum index value that is expected to be written to the created buffer.
copy if true (default) then this buffer will make a copy of the data, else just save the buffer pointers provided by the caller. This has some implications: CopyInto() does not copy, merely update the internal buffer pointer. Lock() just returns that pointer. The pointer passed to CopyInto() must be valid over the lifetime of the render buffer.
static csRef<csRenderBuffer> csRenderBuffer::CreateIndexRenderBuffer ( size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
size_t  rangeStart,
size_t  rangeEnd,
bool  copy 
) [static]

Create a render buffer.

Parameters:
elementCount Number of elements in the buffer.
type Type of buffer; CS_BUF_DYNAMIC, CS_BUF_STATIC or CS_BUF_STREAM.
componentType Components Types; CS_BUFCOMP_FLOAT, CS_BUFCOMP_INT, etc
componentCount Number of components per element (e.g. 4 for RGBA)
copy if true (default) then this buffer will make a copy of the data, else just save the buffer pointers provided by the caller. This has some implications: CopyInto() does not copy, merely update the internal buffer pointer. Lock() just returns that pointer. The pointer passed to CopyInto() must be valid over the lifetime of the render buffer.
static csRef<csRenderBuffer> csRenderBuffer::CreateInterleavedRenderBuffers ( size_t  elementCount,
csRenderBufferType  type,
uint  count,
const csInterleavedSubBufferOptions elements,
csRef< iRenderBuffer > *  buffers 
) [static]

Create an interleaved renderbuffer (You would use this then set stride to determine offset and stride of the interleaved buffer.

Parameters:
elementCount Number of elements in the buffer.
type Type of buffer; CS_BUF_DYNAMIC, CS_BUF_STATIC or CS_BUF_STREAM.
count number of render buffers you want
elements Array of csInterleavedSubBufferOptions describing the properties of the individual buffers to be interleaved.
buffers an array of render buffer references that can hold at least 'count' render buffers.

Example on creating an interleaved buffer consisting of one three and two component float buffer:

  static const csInterleavedSubBufferOptions interleavedElements[2] =
    {{CS_BUFCOMP_FLOAT, 3}, {CS_BUFCOMP_FLOAT, 2}};
  csRef<iRenderBuffer> buffers[2];
  csRenderBuffer::CreateInterleavedRenderBuffers (num_verts, CS_BUF_STATIC,
    2, interleavedElements, buffers);
  csRef<iRenderBuffer> vertex_buffer = buffers[0];
  csRef<iRenderBuffer> texel_buffer = buffers[1];
static csRef<csRenderBuffer> csRenderBuffer::CreateRenderBuffer ( size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
uint  componentCount 
) [static]

Create a render buffer.

Parameters:
elementCount Number of elements in the buffer.
type Type of buffer; CS_BUF_DYNAMIC, CS_BUF_STATIC or CS_BUF_STREAM.
componentType Components Types; CS_BUFCOMP_FLOAT, CS_BUFCOMP_INT, etc
componentCount Number of components per element (e.g. 4 for RGBA)
copy if true (default) then this buffer will make a copy of the data, else just save the buffer pointers provided by the caller. This has some implications: CopyInto() does not copy, merely update the internal buffer pointer. Lock() just returns that pointer. The pointer passed to CopyInto() must be valid over the lifetime of the render buffer.
static csRef<csRenderBuffer> csRenderBuffer::CreateRenderBuffer ( size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
uint  componentCount,
bool  copy 
) [static]

Create a render buffer.

Parameters:
elementCount Number of elements in the buffer.
type Type of buffer; CS_BUF_DYNAMIC, CS_BUF_STATIC or CS_BUF_STREAM.
componentType Components Types; CS_BUFCOMP_FLOAT, CS_BUFCOMP_INT, etc
componentCount Number of components per element (e.g. 4 for RGBA)
copy if true (default) then this buffer will make a copy of the data, else just save the buffer pointers provided by the caller. This has some implications: CopyInto() does not copy, merely update the internal buffer pointer. Lock() just returns that pointer. The pointer passed to CopyInto() must be valid over the lifetime of the render buffer.
static csRenderBufferName csRenderBuffer::GetBufferNameFromDescr ( const char *  name  )  [static]

Retrieve the buffer name for a "friendly" buffer description.

Can be used to parse e.g. shader files.

virtual csRenderBufferType csRenderBuffer::GetBufferType (  )  const [inline, virtual]

Get version.

Definition at line 95 of file renderbuffer.h.

virtual int csRenderBuffer::GetComponentCount (  )  const [inline, virtual]

Get version.

Definition at line 85 of file renderbuffer.h.

virtual csRenderBufferComponentType csRenderBuffer::GetComponentType (  )  const [inline, virtual]

Get version.

Definition at line 90 of file renderbuffer.h.

static const char* csRenderBuffer::GetDescrFromBufferName ( csRenderBufferName  bufferName  )  [static]

Utility to retrieve the "friendly" string name of a buffer description, e.g.

"position" for CS_BUFFER_POSITION.

virtual size_t csRenderBuffer::GetElementCount (  )  const [virtual]

Get version.

virtual size_t csRenderBuffer::GetElementDistance (  )  const [inline, virtual]

Get version.

Definition at line 110 of file renderbuffer.h.

virtual iRenderBuffer* csRenderBuffer::GetMasterBuffer (  )  const [inline, virtual]

Get version.

Definition at line 130 of file renderbuffer.h.

virtual size_t csRenderBuffer::GetOffset (  )  const [inline, virtual]

Get version.

Definition at line 116 of file renderbuffer.h.

virtual size_t csRenderBuffer::GetRangeEnd (  )  const [inline, virtual]

Get version.

Definition at line 140 of file renderbuffer.h.

virtual size_t csRenderBuffer::GetRangeStart (  )  const [inline, virtual]

Get version.

Definition at line 138 of file renderbuffer.h.

virtual size_t csRenderBuffer::GetSize (  )  const [inline, virtual]

Get version.

Definition at line 100 of file renderbuffer.h.

virtual size_t csRenderBuffer::GetStride (  )  const [inline, virtual]

Get version.

Definition at line 105 of file renderbuffer.h.

virtual uint csRenderBuffer::GetVersion (  )  [inline, virtual]

Get version.

Definition at line 120 of file renderbuffer.h.

virtual bool csRenderBuffer::IsIndexBuffer (  )  const [inline, virtual]

Get version.

Definition at line 135 of file renderbuffer.h.

bool csRenderBuffer::IsMasterBuffer (  )  [inline]

Get version.

Definition at line 125 of file renderbuffer.h.

virtual void* csRenderBuffer::Lock ( csRenderBufferLockType  lockType  )  [virtual]

Get version.

virtual void csRenderBuffer::Release (  )  [virtual]

Get version.

virtual void csRenderBuffer::SetCallback ( iRenderBufferCallback cb  )  [inline, virtual]

Get version.

Definition at line 145 of file renderbuffer.h.

virtual void csRenderBuffer::SetData ( const void *  data  )  [virtual]

Get version.

void csRenderBuffer::SetIndexBufferProperties ( size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
size_t  rangeStart,
size_t  rangeEnd,
bool  copy = true 
)

Change properties of a render buffer after creation (DANGEROUS).

Warning:
If the buffer was already passed around and is thus probably used somewhere, changing properties with this methiod is a sure-fire way to wreak havoc. This function is useful in very very specific scenarios; only use it if you really know what you're doing.
void csRenderBuffer::SetRenderBufferProperties ( size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
uint  componentCount,
bool  copy = true 
)

Change properties of a render buffer after creation (DANGEROUS).

Warning:
If the buffer was already passed around and is thus probably used somewhere, changing properties with this methiod is a sure-fire way to wreak havoc. This function is useful in very very specific scenarios; only use it if you really know what you're doing.

Member Data Documentation

unsigned char* csRenderBuffer::buffer [protected]

buffer holding the data

Definition at line 319 of file renderbuffer.h.

size_t csRenderBuffer::bufferSize [protected]

Total size of the buffer.

Definition at line 268 of file renderbuffer.h.

To scrape off a few bytes use bitfields; assumes values are in sane limits.

size_t csRenderBuffer::rangeEnd [protected]

range start for index-buffer

Definition at line 313 of file renderbuffer.h.

size_t csRenderBuffer::rangeStart [protected]

range start for index-buffer

Definition at line 311 of file renderbuffer.h.

unsigned int csRenderBuffer::version [protected]

modification number

Definition at line 316 of file renderbuffer.h.


The documentation for this class was generated from the following file:

Generated for Crystal Space 1.4.1 by doxygen 1.7.1