28 #ifndef __HardwareVertexBuffer__
29 #define __HardwareVertexBuffer__
39 class HardwareBufferManagerBase;
58 virtual bool checkIfVertexInstanceDataIsSupported();
74 void setIsInstanceData(
const bool val);
76 size_t getInstanceDataStepRate()
const;
78 void setInstanceDataStepRate(
const size_t val);
187 unsigned short getSource(
void)
const {
return mSource; }
195 unsigned short getIndex(
void)
const {
return mIndex; }
197 size_t getSize(
void)
const;
233 if (mType != rhs.
mType ||
254 *pElem =
static_cast<void*
>(
255 static_cast<unsigned char*
>(pBase) + mOffset);
269 *pElem =
static_cast<float*
>(
271 static_cast<unsigned char*
>(pBase) + mOffset));
283 *pElem =
static_cast<RGBA*
>(
285 static_cast<unsigned char*
>(pBase) + mOffset));
296 *pElem =
static_cast<unsigned char*
>(pBase) + mOffset;
308 *pElem =
static_cast<unsigned short*
>(
310 static_cast<unsigned char*
>(pBase) + mOffset));
354 const VertexElementList& getElements(
void)
const;
378 void closeGapsInSource(
void);
392 bool vertexAnimation,
bool vertexAnimationNormals)
const;
395 unsigned short getMaxSource(
void)
const;
427 virtual const VertexElement& insertElement(
unsigned short atPosition,
432 virtual void removeElement(
unsigned short elem_index);
443 virtual void removeAllElements(
void);
450 virtual void modifyElement(
unsigned short elem_index,
unsigned short source,
size_t offset,
VertexElementType theType,
468 virtual VertexElementList findElementsBySource(
unsigned short source)
const;
471 virtual size_t getVertexSize(
unsigned short source)
const;
476 virtual unsigned short getNextFreeTextureCoordinate()
const;
489 VertexElementList::const_iterator i, iend, rhsi, rhsiend;
490 iend = mElementList.end();
493 for (i = mElementList.begin(); i != iend && rhsi != rhsiend; ++i, ++rhsi)
495 if ( !(*i == *rhsi) )
503 return !(*
this == rhs);
543 virtual void unsetBinding(
unsigned short index);
546 virtual void unsetAllBindings(
void);
554 virtual bool isBufferBound(
unsigned short index)
const;
563 virtual unsigned short getNextIndex(
void)
const {
return mHighIndex++; }
567 virtual unsigned short getLastBoundIndex(
void)
const;
573 virtual bool hasGaps(
void)
const;
590 virtual bool hasInstanceData()
const;
void baseVertexPointerToElement(void *pBase, float **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
VertexElementSemantic getSemantic(void) const
Gets the meaning of this element.
map< unsigned short, HardwareVertexBufferSharedPtr >::type VertexBufferBindingMap
Defines the vertex buffer bindings used as source for vertex declarations.
unsigned short mHighIndex
Binormal (Y axis if normal is Z)
VertexElementType getType(void) const
Gets the data format of this element.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
Tangent (X axis if normal is Z)
Class representing colour.
VertexElementType mType
The type of element.
virtual size_t getBufferCount(void) const
Shared pointer implementation used to share vertex buffers.
VertexElementSemantic
Vertex element semantics, used to identify the meaning of vertex buffer contents. ...
unsigned short mSource
The source vertex buffer, as bound to an index using VertexBufferBinding.
alias to more specific colour type - use the current rendersystem's colour packing ...
unsigned short getSource(void) const
Gets the vertex buffer index from where this element draws it's values.
HardwareBufferManagerBase * getManager() const
Return the manager of this buffer, if any.
HardwareBufferLockGuard< HardwareVertexBufferSharedPtr > HardwareVertexBufferLockGuard
Locking helper.
size_t mInstanceDataStepRate
HardwareVertexBufferSharedPtr()
virtual unsigned short getNextIndex(void) const
Gets the highest index which has already been set, plus 1.
unsigned short getIndex(void) const
Gets the index of this element, only applicable for repeating elements.
This class declares the usage of a single vertex buffer as a component of a complete VertexDeclaratio...
VertexElementList mElementList
void baseVertexPointerToElement(void *pBase, void **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
size_t getElementCount(void) const
Get the number of elements in the declaration.
void baseVertexPointerToElement(void *pBase, unsigned char **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
HardwareBufferManagerBase * mMgr
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
size_t getVertexSize(void) const
Gets the size in bytes of a single vertex in this buffer.
VertexElementSemantic mSemantic
The meaning of the element.
D3D style compact colour.
Base definition of a hardware buffer manager.
map< ushort, ushort >::type BindingIndexMap
Usage
Enums describing buffer usage; not mutually exclusive.
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
unsigned short mIndex
Index of the item, only applicable for some elements like texture coords.
std::map< K, V, P, A > type
Position, 3 reals per vertex.
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
VertexBufferBindingMap mBindingMap
list< VertexElement >::type VertexElementList
Defines the list of vertex elements that makes up this declaration.
Abstract class defining common features of hardware buffers.
size_t mOffset
The offset in the buffer that this element starts at.
Normal, 3 reals per vertex.
Specialisation of HardwareBuffer for a vertex buffer.
Reference-counted shared pointer, used for objects where implicit destruction is required.
void baseVertexPointerToElement(void *pBase, unsigned short **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
The number of VertexElementSemantic elements (note - the first value VES_POSITION is 1) ...
void baseVertexPointerToElement(void *pBase, RGBA **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
VertexElement()
Constructor, should not be called directly, only needed because of list.
size_t getOffset(void) const
Gets the offset into the buffer where this element starts.
size_t getNumVertices(void) const
Get the number of vertices in this buffer.
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
bool isInstanceData() const
Get if this vertex buffer is an "instance data" buffer (per instance)
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)