CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

csRenderBuffer Class Reference
[Graphics]

Basic renderbuffer for OpenGL renderer. More...

#include <csgfx/renderbuffer.h>

Inheritance diagram for csRenderBuffer:

iRenderBuffer iBase List of all members.

Public Member Functions

virtual void CopyInto (const void *data, size_t elementCount, size_t elemOffset=0)
 Copy data to the render buffer.
virtual csRenderBufferType GetBufferType () const
 Get type of buffer (static/dynamic).
virtual int GetComponentCount () const
 Gets the number of components per element.
virtual csRenderBufferComponentType GetComponentType () const
 Gets the component type (float, int, etc).
virtual size_t GetElementCount () const
 Number of elements in a buffer.
virtual size_t GetElementDistance () const
 Get the distance between two elements (in bytes, includes stride).
virtual iRenderBufferGetMasterBuffer () const
 Get the master buffer in case this is an interleaved buffer.
virtual size_t GetOffset () const
 Get the offset of the buffer (in bytes).
virtual size_t GetRangeEnd () const
 The highest index contained in this buffer, only valid for index buffers.
virtual size_t GetRangeStart () const
 The lowest index contained in this buffer, only valid for index buffers.
virtual size_t GetSize () const
 Get the size of the buffer (in bytes).
virtual size_t GetStride () const
 Get the stride of the buffer (in bytes).
virtual uint GetVersion ()
 Get version.
virtual bool IsIndexBuffer () const
 Whether the buffer is an index buffer.
virtual bool IsMasterBuffer ()
virtual void * Lock (csRenderBufferLockType lockType)
 Lock the buffer to allow writing and give us a pointer to the data.
virtual void Release ()
 Releases the buffer. After this all writing to the buffer is illegal.
virtual ~csRenderBuffer ()
 Destructor.

Static Public Member Functions

static csRef< iRenderBufferCreateIndexRenderBuffer (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, size_t rangeStart, size_t rangeEnd, bool copy=true)
 Create an index buffer.
static csRef< iRenderBufferCreateInterleavedRenderBuffers (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.
static csRef< iRenderBufferCreateRenderBuffer (size_t elementCount, csRenderBufferType type, csRenderBufferComponentType componentType, uint componentCount, bool copy=true)
 Create a render buffer.
static csRenderBufferName GetBufferNameFromDescr (const char *name)
 Retrieve the buffer name for a "friendly" buffer description.
static const char * GetDescrFromBufferName (csRenderBufferName bufferName)
 Utility to retrieve the "friendly" string name of a buffer description, e.g.

Public Attributes

 SCF_DECLARE_IBASE

Protected Member Functions

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

Protected Attributes

unsigned char * buffer
 buffer holding the data
size_t bufferSize
 datatype for each component
csRenderBufferType bufferType
 hint about main usage
uint compCount
 number of components per element
csRenderBufferComponentType comptype
 datatype for each component
bool doCopy
 should we copy data, or just use supplied buffer
bool doDelete
 if buffer should be deleted on deallocation
bool isIndex
 if this is index-buffer
bool isLocked
 currently locked? (to prevent recursive locking)
csRenderBufferLockType lastLock
 last type of lock used
csRef< iRenderBuffermasterBuffer
size_t offset
 offset from buffer start to data
size_t rangeEnd
 range start for index-buffer
size_t rangeStart
 range start for index-buffer
size_t stride
 buffer stride
unsigned int version
 modification number

Detailed Description

Basic renderbuffer for OpenGL renderer.

Definition at line 51 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
[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]
 

Copy data to the render buffer.

Implements iRenderBuffer.

static csRef<iRenderBuffer> csRenderBuffer::CreateIndexRenderBuffer size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
size_t  rangeStart,
size_t  rangeEnd,
bool  copy = true
[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 svae 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<iRenderBuffer> 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.
  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<iRenderBuffer> csRenderBuffer::CreateRenderBuffer size_t  elementCount,
csRenderBufferType  type,
csRenderBufferComponentType  componentType,
uint  componentCount,
bool  copy = true
[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 svae 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 type of buffer (static/dynamic).

Implements iRenderBuffer.

Definition at line 98 of file renderbuffer.h.

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

Gets the number of components per element.

Implements iRenderBuffer.

Definition at line 86 of file renderbuffer.h.

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

Gets the component type (float, int, etc).

Implements iRenderBuffer.

Definition at line 92 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]
 

Number of elements in a buffer.

Implements iRenderBuffer.

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

Get the distance between two elements (in bytes, includes stride).

Implements iRenderBuffer.

Definition at line 115 of file renderbuffer.h.

References csRenderBufferComponentSizes.

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

Get the master buffer in case this is an interleaved buffer.

The master buffer is the buffer that actually holds the data; while it can be used to retrieve or set data, it must not be used for actual rendering. Use the interleaved buffers instead.

Implements iRenderBuffer.

Definition at line 135 of file renderbuffer.h.

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

Get the offset of the buffer (in bytes).

Implements iRenderBuffer.

Definition at line 121 of file renderbuffer.h.

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

The highest index contained in this buffer, only valid for index buffers.

Implements iRenderBuffer.

Definition at line 145 of file renderbuffer.h.

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

The lowest index contained in this buffer, only valid for index buffers.

Implements iRenderBuffer.

Definition at line 143 of file renderbuffer.h.

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

Get the size of the buffer (in bytes).

Implements iRenderBuffer.

Definition at line 104 of file renderbuffer.h.

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

Get the stride of the buffer (in bytes).

Implements iRenderBuffer.

Definition at line 110 of file renderbuffer.h.

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

Get version.

Implements iRenderBuffer.

Definition at line 125 of file renderbuffer.h.

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

Whether the buffer is an index buffer.

Implements iRenderBuffer.

Definition at line 140 of file renderbuffer.h.

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

Lock the buffer to allow writing and give us a pointer to the data.

The pointer will be (void*)-1 if there was some error.

Parameters:
lockType The type of lock desired.

Implements iRenderBuffer.

virtual void csRenderBuffer::Release  )  [virtual]
 

Releases the buffer. After this all writing to the buffer is illegal.

Implements iRenderBuffer.


Member Data Documentation

unsigned char* csRenderBuffer::buffer [protected]
 

buffer holding the data

Definition at line 258 of file renderbuffer.h.

size_t csRenderBuffer::bufferSize [protected]
 

datatype for each component

Definition at line 232 of file renderbuffer.h.

csRenderBufferType csRenderBuffer::bufferType [protected]
 

hint about main usage

Definition at line 227 of file renderbuffer.h.

uint csRenderBuffer::compCount [protected]
 

number of components per element

Definition at line 234 of file renderbuffer.h.

csRenderBufferComponentType csRenderBuffer::comptype [protected]
 

datatype for each component

Definition at line 229 of file renderbuffer.h.

bool csRenderBuffer::doCopy [protected]
 

should we copy data, or just use supplied buffer

Definition at line 249 of file renderbuffer.h.

bool csRenderBuffer::doDelete [protected]
 

if buffer should be deleted on deallocation

Definition at line 251 of file renderbuffer.h.

bool csRenderBuffer::isIndex [protected]
 

if this is index-buffer

Definition at line 255 of file renderbuffer.h.

bool csRenderBuffer::isLocked [protected]
 

currently locked? (to prevent recursive locking)

Definition at line 253 of file renderbuffer.h.

csRenderBufferLockType csRenderBuffer::lastLock [protected]
 

last type of lock used

Definition at line 260 of file renderbuffer.h.

size_t csRenderBuffer::offset [protected]
 

offset from buffer start to data

Definition at line 238 of file renderbuffer.h.

size_t csRenderBuffer::rangeEnd [protected]
 

range start for index-buffer

Definition at line 243 of file renderbuffer.h.

size_t csRenderBuffer::rangeStart [protected]
 

range start for index-buffer

Definition at line 241 of file renderbuffer.h.

size_t csRenderBuffer::stride [protected]
 

buffer stride

Definition at line 236 of file renderbuffer.h.

unsigned int csRenderBuffer::version [protected]
 

modification number

Definition at line 246 of file renderbuffer.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.4.4