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);
549 virtual const VertexBufferBindingMap& getBindings(
void)
const;
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;
587 virtual void closeGaps(BindingIndexMap& bindingIndexMap);
590 virtual bool hasInstanceData()
const;
VertexElementType getType(void) const
Gets the data format of this element.
list< VertexElement >::type VertexElementList
Defines the list of vertex elements that makes up this declaration.
unsigned short mSource
The source vertex buffer, as bound to an index using VertexBufferBinding.
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
void baseVertexPointerToElement(void *pBase, unsigned short **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
unsigned short getSource(void) const
Gets the vertex buffer index from where this element draws it's values.
VertexElement()
Constructor, should not be called directly, only needed because of list.
void baseVertexPointerToElement(void *pBase, float **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
alias to more specific colour type - use the current rendersystem's colour packing ...
Class representing colour.
Specialisation of HardwareBuffer for a vertex buffer.
virtual size_t getBufferCount(void) const
bool isInstanceData() const
Get if this vertex buffer is an "instance data" buffer (per instance)
size_t getElementCount(void) const
Get the number of elements in the declaration.
VertexBufferBindingMap mBindingMap
VertexElementList mElementList
Position, 3 reals per vertex.
unsigned short mHighIndex
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
Shared pointer implementation used to share vertex buffers.
size_t getOffset(void) const
Gets the offset into the buffer where this element starts.
VertexElementSemantic getSemantic(void) const
Gets the meaning of this element.
std::map< K, V, P, A > type
void baseVertexPointerToElement(void *pBase, unsigned char **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
Base definition of a hardware buffer manager.
HardwareBufferLockGuard< HardwareVertexBufferSharedPtr > HardwareVertexBufferLockGuard
Locking helper.
size_t mInstanceDataStepRate
map< unsigned short, HardwareVertexBufferSharedPtr >::type VertexBufferBindingMap
Defines the vertex buffer bindings used as source for vertex declarations.
VertexElementType mType
The type of element.
bool operator!=(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
map< ushort, ushort >::type BindingIndexMap
Usage
Enums describing buffer usage; not mutually exclusive.
size_t getNumVertices(void) const
Get the number of vertices in this buffer.
virtual unsigned short getNextIndex(void) const
Gets the highest index which has already been set, plus 1.
HardwareBufferManagerBase * getManager() const
Return the manager of this buffer, if any.
size_t getVertexSize(void) const
Gets the size in bytes of a single vertex in this buffer.
VertexElementSemantic
Vertex element semantics, used to identify the meaning of vertex buffer contents. ...
Abstract class defining common features of hardware buffers.
Tangent (X axis if normal is Z)
VertexElementSemantic mSemantic
The meaning of the element.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
This class declares the usage of a single vertex buffer as a component of a complete VertexDeclaratio...
unsigned short getIndex(void) const
Gets the index of this element, only applicable for repeating elements.
This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info...
void baseVertexPointerToElement(void *pBase, void **pElem) const
Adjusts a pointer to the base of a vertex to point at this element.
Normal, 3 reals per vertex.
Reference-counted shared pointer, used for objects where implicit destruction is required.
bool operator==(STLAllocator< T, P > const &, STLAllocator< T2, P > const &)
determine equality, can memory from another allocator be released by this allocator, (ISO C++)
HardwareBufferManagerBase * mMgr
HardwareVertexBufferSharedPtr()
Binormal (Y axis if normal is Z)
D3D style compact colour.
size_t mOffset
The offset in the buffer that this element starts at.
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
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.
unsigned short mIndex
Index of the item, only applicable for some elements like texture coords.