QSDK 1.1 Documentation
Main Page | Modules | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

Draw::VertexArray Struct Reference
[QDraw]

#include <Q/draw.h>

Inheritance diagram for Draw::VertexArray:

Utils::Object Utils::Countable List of all members.

Public Types

enum  Access {
  ReadOnly,
  ReadWrite,
  WriteOnly,
  Truncate,
  Append
}

Public Member Functions

virtual ~VertexArray ()
virtual Rendererrenderer () const=0
virtual size_t size () const=0
virtual unsigned int format () const=0
virtual size_t vertexSize () const=0
virtual Utils::Result resize (size_t newsize)=0
virtual Utils::Result reserve (size_t newsize)=0
virtual void * at (size_t index)=0
virtual Utils::Result set (size_t index, const void *value)=0
virtual size_t add (const void *value)=0
virtual Utils::Result addRef (size_t index)=0
virtual Utils::Result decRef (size_t index)=0
virtual size_t refCount (size_t index)=0
virtual void * lock (Access a)=0
virtual Utils::Result unlock ()=0

Detailed Description

Vertices are managed by VertexArray objects. The VertexArray controls access to the memory used for the vertices using a locking system. This allows an implementation that uses asynchronous rendering (either using threads or in hardware) to safely use the contents of the array.

The format of vertices in the array is fixed when it is created but the size can be changed at any time by calling resize(unsigned int).


Member Enumeration Documentation

enum Draw::VertexArray::Access
 

Enumeration values:
ReadOnly  Read only access.
ReadWrite  Read/write access (reading is really bad for arrays allocated in video memory)
WriteOnly  Generic write only access.
Truncate  Truncate write access (hardware can do buffer renaming, to avoid being stalled on a lock.
Append  Append mode writing, means no locks are needed for writing


Constructor & Destructor Documentation

virtual Draw::VertexArray::~VertexArray  )  [inline, virtual]
 

Destroy the vertex array, reclaiming memory.


Member Function Documentation

virtual size_t Draw::VertexArray::add const void *  value  )  [pure virtual]
 

Add a vertex to the array. The array is first searched to find if a vertex with the same contents exists and if so, that index is returned. The array keeps a reference count for each vertex added in this way.

virtual Utils::Result Draw::VertexArray::addRef size_t  index  )  [pure virtual]
 

Increment the reference count of a vertex in the array.

virtual void* Draw::VertexArray::at size_t  index  )  [pure virtual]
 

Return a pointer to the vertex at the given index. If the array is not locked, an exception will be generated.

virtual Utils::Result Draw::VertexArray::decRef size_t  index  )  [pure virtual]
 

Decrement the reference count of a vertex in the array and if the count reaches zero, add the vertex to a list of free vertices. When a vertex is allocated using add(void*), vertices are taken from the free list before extending the array.

virtual unsigned int Draw::VertexArray::format  )  const [pure virtual]
 

Return the format of the vertices.

virtual void* Draw::VertexArray::lock Access  a  )  [pure virtual]
 

Lock the array to obtain a pointer to its contents. If the array is already locked (either by another thread in the application or internally for asynchronous rendering) then the calling thread blocks until the array is unlocked.

virtual size_t Draw::VertexArray::refCount size_t  index  )  [pure virtual]
 

Return the reference count of a vertex.

virtual Renderer* Draw::VertexArray::renderer  )  const [pure virtual]
 

Return the renderer that owns the vertex array.

virtual Utils::Result Draw::VertexArray::reserve size_t  newsize  )  [pure virtual]
 

Reserve space for allocating vertices. This is a hint that the size of the array may be increased to this size as a result of calling add.

virtual Utils::Result Draw::VertexArray::resize size_t  newsize  )  [pure virtual]
 

Resize the array. If the array is increasing in size, new vertices will contain default values.

virtual Utils::Result Draw::VertexArray::set size_t  index,
const void *  value
[pure virtual]
 

Set one vertex in the array to the given value (which should point at memory formatted according to the array's vertex format). If the array is locked then it will work with the currently locked status, otherwise it will lock the array WriteOnly. Multiple calls to set on an unlocked array will seriously degrade performance. A call to set of an array locked ReadOnly will throw an exception.

virtual size_t Draw::VertexArray::size  )  const [pure virtual]
 

Return a count of how many vertices are in the array.

virtual Utils::Result Draw::VertexArray::unlock  )  [pure virtual]
 

Unlock the array.

virtual size_t Draw::VertexArray::vertexSize  )  const [pure virtual]
 

Return the size of an individual vertex.

Return to QSDK documentation Contents page. Contact details for support, information and fault-reporting.
Qube Software Limited © 2000-2004