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

PolygonStripBuffer Class Reference

#include <polygonbuffer.h>

Inheritance diagram for PolygonStripBuffer:

Inheritance graph
[legend]
Collaboration diagram for PolygonStripBuffer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Triangle polygon strip buffer class Triangle strip buffers hold data for a single triangle strip.

Author:
Mattias Jansson (mattias@realityrift.com)


Public Types

enum  BUFFERTYPE {
  DYNAMIC = 0x00000000, STATIC = 0x00000001, READPRIORITIZED = 0x00000002, WRITEPRIORITIZED = 0x00000004,
  NOREADWRITE = 0x00000008, NORENDER = 0x00000010, NORMAL = ( DYNAMIC | READPRIORITIZED | WRITEPRIORITIZED )
}
 Buffer type identifiers. Any combination of the flags is valid. More...

enum  BUFFERUPLOADPOLICY { ONUNLOCK, ONRENDER, ONFLUSH }
 Upload policy identifiers. More...

enum  BUFFERLOCK { READ = 1, WRITE = 2, NOUPLOAD = 4, FORCEUPLOAD = 8 }
 Lock type identifiers. More...


Public Member Functions

 PolygonStripBuffer (unsigned int uiType, unsigned int uiNumPolygons, const unsigned short *pusData=0)
virtual ~PolygonStripBuffer ()
virtual void AllocateStrip (unsigned int uiNumPolygons, const unsigned short *pusData=0)
void LoadStripData (const unsigned short *pusData)
unsigned short * GetIndices ()
virtual const void * GetRenderData () const
bool Lock (unsigned int uiLockType)
void Unlock ()
virtual void Upload ()
bool IsLocked () const
bool IsDirty () const
unsigned int GetType () const
unsigned int GetNumAllocated () const
unsigned int GetNumElements () const
void SetNumElements (unsigned int uiNumElements)
void IncRef ()
void DecRef ()
int GetRefCount () const

Static Public Member Functions

std::string GetTypeAsString (unsigned int uiType)
unsigned int GetTypeFromString (std::string const &strType)

Static Public Attributes

BUFFERUPLOADPOLICY s_eUploadPolicy

Protected Member Functions

virtual bool AcquireLock ()
virtual void ReleaseLock ()

Protected Attributes

unsigned short * m_pusBuffer
unsigned short * m_pusIndices
unsigned int m_uiType
unsigned int m_uiLock
bool m_bDirty
unsigned int m_uiNumAllocated
unsigned int m_uiNumCurrent


Member Enumeration Documentation

enum BUFFERTYPE [inherited]
 

Buffer type identifiers. Any combination of the flags is valid.

Enumeration values:
DYNAMIC  Dynamic buffer with system RAM backing store
STATIC  AGP or VRAM storage if possible
READPRIORITIZED  Prioritize read access
WRITEPRIORITIZED  Prioritize write accesss
NOREADWRITE  Buffer that can never be read from or written to, must pass data pointer to ctor
NORENDER  Buffer that must never be sent for rendering, guaranteed to not use video RAM resources
NORMAL  Default type

enum BUFFERUPLOADPOLICY [inherited]
 

Upload policy identifiers.

Enumeration values:
ONUNLOCK  Upload after WRITE lock released
ONRENDER  Upload when used in render primitive queued for render
ONFLUSH  Upload when used in render pipeline flush

enum BUFFERLOCK [inherited]
 

Lock type identifiers.

Enumeration values:
READ  Read access
WRITE  Write access (implies read access)
NOUPLOAD  No upload on unlock, will cause upload-on-render
FORCEUPLOAD  Force upload on unlock


Constructor & Destructor Documentation

PolygonStripBuffer unsigned int  uiType,
unsigned int  uiNumPolygons,
const unsigned short *  pusData = 0
[inline]
 

Parameters:
uiType Buffer type
uiNumPolygons Number of polygons in this strip
pusData Pointer to index data

virtual ~PolygonStripBuffer  )  [virtual]
 

Free memory


Member Function Documentation

virtual bool AcquireLock  )  [inline, protected, virtual]
 

Acquire lock

Returns:
true if lock successful, false if not

Implements Buffer.

virtual void ReleaseLock  )  [inline, protected, virtual]
 

Release lock

Implements Buffer.

virtual void AllocateStrip unsigned int  uiNumPolygons,
const unsigned short *  pusData = 0
[virtual]
 

Allocate strip buffer. There must be no lock held on the buffer when calling this method

Parameters:
uiNumPolygons Number of polygons
pusData Data (will read uiNumPolygons + 2 indices)

void LoadStripData const unsigned short *  pusData  )  [inline]
 

Load strip data. Must have active WRITE lock

Parameters:
pusData Strip data, reads m_uiNumPolygons + 2 indices

unsigned short* GetIndices  )  [inline]
 

Lock (READ or WRITE) must be held for pointer to be valid

Returns:
Pointer to index data

virtual const void* GetRenderData  )  const [inline, virtual]
 

Get pointer to render data. Used by derived buffer classes in device with AGP/video RAM storage to return pointer to data used for rendering.

Returns:
Render data pointer

bool Lock unsigned int  uiLockType  )  [inline, inherited]
 

Lock buffer for read/write operation

Parameters:
uiLockType Lock type
Returns:
true if lock acquired, false if failed (already locked)

void Unlock  )  [inline, inherited]
 

Unlock buffer

virtual void Upload  )  [inline, virtual, inherited]
 

Upload data to backing store, reset dirty flag

bool IsLocked  )  const [inline, inherited]
 

Returns:
true if buffer is locked, false if not

bool IsDirty  )  const [inline, inherited]
 

Returns:
true if buffer is dirty, false if not

unsigned int GetType  )  const [inline, inherited]
 

Returns:
Buffer type

unsigned int GetNumAllocated  )  const [inline, inherited]
 

Returns:
Number of allocated elements

unsigned int GetNumElements  )  const [inline, inherited]
 

Returns:
Number of currently used elements

void SetNumElements unsigned int  uiNumElements  )  [inline, inherited]
 

Set new count of currently used elements

Parameters:
uiNumElements Number of elements currently used, will be clamped to [0,numallocated] range

std::string GetTypeAsString unsigned int  uiType  )  [static, inherited]
 

Get buffer type as string

Parameters:
uiType Type identifier
Returns:
Type as string

unsigned int GetTypeFromString std::string const &  strType  )  [static, inherited]
 

Get buffer type from string

Parameters:
strType String type identifier
Returns:
Type id

void IncRef  )  [inline, inherited]
 

Increase reference count

void DecRef  )  [inline, inherited]
 

Decrease reference count and garbage collect if 0

int GetRefCount  )  const [inline, inherited]
 

Returns:
Current reference count


Member Data Documentation

unsigned short* m_pusBuffer [protected]
 

Real buffer

unsigned short* m_pusIndices [protected]
 

Indices (m_uiNumAllocated+2 of them)

unsigned int m_uiType [protected, inherited]
 

Buffer type

unsigned int m_uiLock [protected, inherited]
 

Current lock type held

bool m_bDirty [protected, inherited]
 

Dirty flag

unsigned int m_uiNumAllocated [protected, inherited]
 

Number of allocated elements

unsigned int m_uiNumCurrent [protected, inherited]
 

Number of currently used elements

BUFFERUPLOADPOLICY s_eUploadPolicy [static, inherited]
 

Buffer upload policy


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:13 2004 for NeoEngine by doxygen 1.3.5