OgreVertexIndexData.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __VertexIndexData_H__
#define __VertexIndexData_H__
#include "OgrePrerequisites.h"
#include "OgreHardwareVertexBuffer.h"
#include "OgreHardwareIndexBuffer.h"
#include "OgreHeaderPrefix.h"
namespace Ogre {
typedef vector<HardwareBuffer::Usage>::type BufferUsageList;
class _OgreExport VertexData : public VertexDataAlloc
{
private:
VertexData(const VertexData& rhs); /* do nothing, should not use */
VertexData& operator=(const VertexData& rhs); /* do not use */
HardwareBufferManagerBase* mMgr;
public:
VertexData(HardwareBufferManagerBase* mgr = 0);
VertexData(VertexDeclaration* dcl, VertexBufferBinding* bind);
~VertexData();
VertexDeclaration* vertexDeclaration;
VertexBufferBinding* vertexBufferBinding;
bool mDeleteDclBinding;
size_t vertexStart;
size_t vertexCount;
struct HardwareAnimationData
{
unsigned short targetBufferIndex;
Real parametric;
};
typedef vector<HardwareAnimationData>::type HardwareAnimationDataList;
HardwareAnimationDataList hwAnimationDataList;
size_t hwAnimDataItemsUsed;
VertexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
void prepareForShadowVolume(void);
HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer;
void reorganiseBuffers(VertexDeclaration* newDeclaration, const BufferUsageList& bufferUsage,
HardwareBufferManagerBase* mgr = 0);
void reorganiseBuffers(VertexDeclaration* newDeclaration, HardwareBufferManagerBase* mgr = 0);
void closeGapsInBindings(void);
void removeUnusedBuffers(void);
void convertPackedColour(VertexElementType srcType, VertexElementType destType);
ushort allocateHardwareAnimationElements(ushort count, bool animateNormals);
};
class _OgreExport IndexData : public IndexDataAlloc
{
protected:
IndexData(const IndexData& rhs); /* do nothing, should not use */
IndexData& operator=(const IndexData& rhs); /* do not use */
public:
IndexData();
~IndexData();
HardwareIndexBufferSharedPtr indexBuffer;
size_t indexStart;
size_t indexCount;
IndexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
void optimiseVertexCacheTriList(void);
};
class _OgreExport VertexCacheProfiler : public BufferAlloc
{
public:
enum CacheType {
FIFO, LRU
};
VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
: size ( cachesize ), tail (0), buffersize (0), hit (0), miss (0)
{
cache = OGRE_ALLOC_T(uint32, size, MEMCATEGORY_GEOMETRY);
}
~VertexCacheProfiler()
{
OGRE_FREE(cache, MEMCATEGORY_GEOMETRY);
}
void profile(const HardwareIndexBufferSharedPtr& indexBuffer);
void reset() { hit = 0; miss = 0; tail = 0; buffersize = 0; }
void flush() { tail = 0; buffersize = 0; }
unsigned int getHits() { return hit; }
unsigned int getMisses() { return miss; }
unsigned int getSize() { return size; }
private:
unsigned int size;
uint32 *cache;
unsigned int tail, buffersize;
unsigned int hit, miss;
bool inCache(unsigned int index);
};
}
#include "OgreHeaderSuffix.h"
#endif
Ogre::IndexData::indexBuffer
HardwareIndexBufferSharedPtr indexBuffer
Pointer to the HardwareIndexBuffer to use, must be specified if useIndexes = true.
Definition: OgreVertexIndexData.h:253
Ogre::VertexData::vertexCount
size_t vertexCount
The number of vertices used in this operation.
Definition: OgreVertexIndexData.h:90
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::VertexElementType
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
Definition: OgreHardwareVertexBuffer.h:123
Ogre::VertexCacheProfiler::getMisses
unsigned int getMisses()
Definition: OgreVertexIndexData.h:308
Ogre::HardwareIndexBufferSharedPtr
Shared pointer implementation used to share index buffers.
Definition: OgreHardwareIndexBuffer.h:79
Ogre::VertexData::hwAnimationDataList
HardwareAnimationDataList hwAnimationDataList
VertexElements used for hardware morph / pose animation.
Definition: OgreVertexIndexData.h:101
Ogre::vector::type
std::vector< T, A > type
Definition: OgrePrerequisites.h:494
Ogre::VertexCacheProfiler::getSize
unsigned int getSize()
Definition: OgreVertexIndexData.h:309
Ogre::VertexData
Summary class collecting together vertex source information.
Definition: OgreVertexIndexData.h:49
Ogre::VertexCacheProfiler::size
unsigned int size
Definition: OgreVertexIndexData.h:311
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::VertexCacheProfiler::getHits
unsigned int getHits()
Definition: OgreVertexIndexData.h:307
Ogre::IndexData
Summary class collecting together index data source information.
Definition: OgreVertexIndexData.h:242
OGRE_ALLOC_T
#define OGRE_ALLOC_T(T, count, category)
Allocate a block of memory for a primitive type, and indicate the category of usage.
Definition: OgreMemoryAllocatorConfig.h:428
OgreHardwareIndexBuffer.h
Ogre::BufferUsageList
vector< HardwareBuffer::Usage >::type BufferUsageList
Define a list of usage flags.
Definition: OgreVertexIndexData.h:45
Ogre::VertexCacheProfiler::tail
unsigned int tail
Definition: OgreVertexIndexData.h:314
Ogre::VertexData::HardwareAnimationData::targetBufferIndex
unsigned short targetBufferIndex
Definition: OgreVertexIndexData.h:96
Ogre::VertexData::HardwareAnimationDataList
vector< HardwareAnimationData >::type HardwareAnimationDataList
Definition: OgreVertexIndexData.h:99
Ogre::VertexCacheProfiler::VertexCacheProfiler
VertexCacheProfiler(unsigned int cachesize=16, CacheType cachetype=FIFO)
Definition: OgreVertexIndexData.h:292
Ogre::VertexCacheProfiler::~VertexCacheProfiler
~VertexCacheProfiler()
Definition: OgreVertexIndexData.h:298
Ogre::VertexData::HardwareAnimationData
Struct used to hold hardware morph / pose vertex data information.
Definition: OgreVertexIndexData.h:94
Ogre::VertexData::vertexDeclaration
VertexDeclaration * vertexDeclaration
Declaration of the vertex to be used in this operation.
Definition: OgreVertexIndexData.h:80
Ogre::MEMCATEGORY_GEOMETRY
Geometry held in main memory.
Definition: OgreMemoryAllocatorConfig.h:164
Ogre::VertexDeclaration
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
Definition: OgreHardwareVertexBuffer.h:337
Ogre::HardwareVertexBufferSharedPtr
Shared pointer implementation used to share vertex buffers.
Definition: OgreHardwareVertexBuffer.h:86
Ogre::VertexData::hwAnimDataItemsUsed
size_t hwAnimDataItemsUsed
Number of hardware animation data items used.
Definition: OgreVertexIndexData.h:103
OgrePrerequisites.h
Ogre::VertexCacheProfiler::flush
void flush()
Definition: OgreVertexIndexData.h:305
Ogre::HardwareBufferManagerBase
Base definition of a hardware buffer manager.
Definition: OgreHardwareBufferManager.h:113
Ogre::VertexData::vertexBufferBinding
VertexBufferBinding * vertexBufferBinding
The vertex buffer bindings to be used.
Definition: OgreVertexIndexData.h:84
OGRE_FREE
#define OGRE_FREE(ptr, category)
Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to en...
Definition: OgreMemoryAllocatorConfig.h:430
Ogre::VertexData::HardwareAnimationData::parametric
Real parametric
Definition: OgreVertexIndexData.h:97
OgreHardwareVertexBuffer.h
Ogre::VertexCacheProfiler::reset
void reset()
Definition: OgreVertexIndexData.h:304
Ogre::VertexCacheProfiler
Vertex cache profiler.
Definition: OgreVertexIndexData.h:285
OgreHeaderSuffix.h
Ogre::VertexBufferBinding
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
Definition: OgreHardwareVertexBuffer.h:521
Ogre::VertexCacheProfiler::CacheType
CacheType
Definition: OgreVertexIndexData.h:288
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
Ogre::VertexCacheProfiler::miss
unsigned int miss
Definition: OgreVertexIndexData.h:315
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::vector
Definition: OgrePrerequisites.h:491
Ogre::VertexData::hardwareShadowVolWBuffer
HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer
Additional shadow volume vertex buffer storage.
Definition: OgreVertexIndexData.h:146
OgreHeaderPrefix.h
Ogre::VertexCacheProfiler::cache
uint32 * cache
Definition: OgreVertexIndexData.h:312
Ogre::ushort
unsigned short ushort
Definition: OgrePrerequisites.h:113
Ogre::VertexData::mDeleteDclBinding
bool mDeleteDclBinding
Whether this class should delete the declaration and binding.
Definition: OgreVertexIndexData.h:86
Ogre::IndexData::indexStart
size_t indexStart
Index in the buffer to start from for this operation.
Definition: OgreVertexIndexData.h:256
Ogre::IndexData::indexCount
size_t indexCount
The number of indexes to use from the buffer.
Definition: OgreVertexIndexData.h:259
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:58
Ogre::VertexData::mMgr
HardwareBufferManagerBase * mMgr
Definition: OgreVertexIndexData.h:57
Ogre::VertexData::vertexStart
size_t vertexStart
The base vertex index to start from.
Definition: OgreVertexIndexData.h:88

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.