OgreVertexIndexData.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2013 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __VertexIndexData_H__
29 #define __VertexIndexData_H__
30 
31 #include "OgrePrerequisites.h"
34 #include "OgreHeaderPrefix.h"
35 
36 namespace Ogre {
46 
47 
50  {
51  private:
53  VertexData(const VertexData& rhs); /* do nothing, should not use */
55  VertexData& operator=(const VertexData& rhs); /* do not use */
56 
58  public:
76 
88  size_t vertexStart;
90  size_t vertexCount;
91 
92 
95  {
96  unsigned short targetBufferIndex;
98  };
104 
110  VertexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
111 
132 
147 
148 
167  void reorganiseBuffers(VertexDeclaration* newDeclaration, const BufferUsageList& bufferUsage,
168  HardwareBufferManagerBase* mgr = 0);
169 
188 
199 
209 
218 
219 
235  ushort allocateHardwareAnimationElements(ushort count, bool animateNormals);
236 
237 
238 
239  };
240 
243  {
244  protected:
246  IndexData(const IndexData& rhs); /* do nothing, should not use */
248  IndexData& operator=(const IndexData& rhs); /* do not use */
249  public:
254 
256  size_t indexStart;
257 
259  size_t indexCount;
260 
266  IndexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
267 
277 
278  };
279 
286  {
287  public:
288  enum CacheType {
289  FIFO, LRU
290  };
291 
292  VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
293  : size ( cachesize ), tail (0), buffersize (0), hit (0), miss (0)
294  {
295  cache = OGRE_ALLOC_T(uint32, size, MEMCATEGORY_GEOMETRY);
296  }
297 
299  {
301  }
302 
303  void profile(const HardwareIndexBufferSharedPtr& indexBuffer);
304  void reset() { hit = 0; miss = 0; tail = 0; buffersize = 0; }
305  void flush() { tail = 0; buffersize = 0; }
306 
307  unsigned int getHits() { return hit; }
308  unsigned int getMisses() { return miss; }
309  unsigned int getSize() { return size; }
310  private:
311  unsigned int size;
313 
314  unsigned int tail, buffersize;
315  unsigned int hit, miss;
316 
317  bool inCache(unsigned int index);
318  };
321 }
322 
323 #include "OgreHeaderSuffix.h"
324 
325 #endif
326 
OgreHeaderSuffix.h
Ogre::IndexData::operator=
IndexData & operator=(const IndexData &rhs)
Protected operator=, to prevent misuse.
Ogre::VertexCacheProfiler::getMisses
unsigned int getMisses()
Definition: OgreVertexIndexData.h:308
Ogre::VertexData::vertexDeclaration
VertexDeclaration * vertexDeclaration
Declaration of the vertex to be used in this operation.
Definition: OgreVertexIndexData.h:80
Ogre::MEMCATEGORY_GEOMETRY
@ MEMCATEGORY_GEOMETRY
Geometry held in main memory.
Definition: OgreMemoryAllocatorConfig.h:164
Ogre::VertexCacheProfiler::tail
unsigned int tail
Definition: OgreVertexIndexData.h:314
Ogre::AllocatedObject
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Definition: OgreMemoryAllocatedObject.h:59
Ogre
Definition: OgreAndroidLogListener.h:35
Ogre::VertexData::VertexData
VertexData(VertexDeclaration *dcl, VertexBufferBinding *bind)
Constructor.
Ogre::VertexCacheProfiler::getSize
unsigned int getSize()
Definition: OgreVertexIndexData.h:309
Ogre::VertexData::mDeleteDclBinding
bool mDeleteDclBinding
Whether this class should delete the declaration and binding.
Definition: OgreVertexIndexData.h:86
Ogre::ushort
unsigned short ushort
Definition: OgrePrerequisites.h:113
Ogre::VertexData::HardwareAnimationDataList
vector< HardwareAnimationData >::type HardwareAnimationDataList
Definition: OgreVertexIndexData.h:99
Ogre::VertexCacheProfiler::~VertexCacheProfiler
~VertexCacheProfiler()
Definition: OgreVertexIndexData.h:298
Ogre::VertexData::convertPackedColour
void convertPackedColour(VertexElementType srcType, VertexElementType destType)
Convert all packed colour values (VET_COLOUR_*) in buffers used to another type.
Ogre::IndexData::IndexData
IndexData(const IndexData &rhs)
Protected copy constructor, to prevent misuse.
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::VertexData::HardwareAnimationData::targetBufferIndex
unsigned short targetBufferIndex
Definition: OgreVertexIndexData.h:96
Ogre::HardwareBufferManagerBase
Base definition of a hardware buffer manager.
Definition: OgreHardwareBufferManager.h:114
Ogre::VertexData::hwAnimationDataList
HardwareAnimationDataList hwAnimationDataList
VertexElements used for hardware morph / pose animation.
Definition: OgreVertexIndexData.h:101
Ogre::VertexCacheProfiler::size
unsigned int size
Definition: OgreVertexIndexData.h:311
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
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::VertexCacheProfiler::reset
void reset()
Definition: OgreVertexIndexData.h:304
Ogre::VertexCacheProfiler::VertexCacheProfiler
VertexCacheProfiler(unsigned int cachesize=16, CacheType cachetype=FIFO)
Definition: OgreVertexIndexData.h:292
Ogre::IndexData::optimiseVertexCacheTriList
void optimiseVertexCacheTriList(void)
Re-order the indexes in this index data structure to be more vertex cache friendly; that is to re-use...
Ogre::HardwareIndexBufferSharedPtr
Shared pointer implementation used to share index buffers.
Definition: OgreHardwareIndexBuffer.h:80
Ogre::VertexCacheProfiler::inCache
bool inCache(unsigned int index)
Ogre::VertexCacheProfiler::cache
uint32 * cache
Definition: OgreVertexIndexData.h:312
Ogre::uint32
unsigned int uint32
Definition: OgrePlatform.h:359
OgreHardwareIndexBuffer.h
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
Ogre::VertexCacheProfiler
Vertex cache profiler.
Definition: OgreVertexIndexData.h:286
Ogre::VertexCacheProfiler::flush
void flush()
Definition: OgreVertexIndexData.h:305
Ogre::VertexData::hardwareShadowVolWBuffer
HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer
Additional shadow volume vertex buffer storage.
Definition: OgreVertexIndexData.h:146
Ogre::VertexData::allocateHardwareAnimationElements
ushort allocateHardwareAnimationElements(ushort count, bool animateNormals)
Allocate elements to serve a holder of morph / pose target data for hardware morphing / pose blending...
Ogre::VertexData::HardwareAnimationData
Struct used to hold hardware morph / pose vertex data information.
Definition: OgreVertexIndexData.h:95
Ogre::VertexData
Summary class collecting together vertex source information.
Definition: OgreVertexIndexData.h:50
Ogre::VertexBufferBinding
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
Definition: OgreHardwareVertexBuffer.h:522
Ogre::vector::type
std::vector< T, A > type
Definition: OgrePrerequisites.h:494
Ogre::VertexElementType
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
Definition: OgreHardwareVertexBuffer.h:124
OgreHeaderPrefix.h
Ogre::VertexData::clone
VertexData * clone(bool copyData=true, HardwareBufferManagerBase *mgr=0) const
Clones this vertex data, potentially including replicating any vertex buffers.
OgrePrerequisites.h
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:338
Ogre::HardwareVertexBufferSharedPtr
Shared pointer implementation used to share vertex buffers.
Definition: OgreHardwareVertexBuffer.h:87
Ogre::VertexData::hwAnimDataItemsUsed
size_t hwAnimDataItemsUsed
Number of hardware animation data items used.
Definition: OgreVertexIndexData.h:103
Ogre::VertexData::closeGapsInBindings
void closeGapsInBindings(void)
Remove any gaps in the vertex buffer bindings.
Ogre::IndexData::~IndexData
~IndexData()
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::BufferUsageList
vector< HardwareBuffer::Usage >::type BufferUsageList
Define a list of usage flags.
Definition: OgreVertexIndexData.h:45
Ogre::VertexData::reorganiseBuffers
void reorganiseBuffers(VertexDeclaration *newDeclaration, const BufferUsageList &bufferUsage, HardwareBufferManagerBase *mgr=0)
Reorganises the data in the vertex buffers according to the new vertex declaration passed in.
Ogre::VertexData::reorganiseBuffers
void reorganiseBuffers(VertexDeclaration *newDeclaration, HardwareBufferManagerBase *mgr=0)
Reorganises the data in the vertex buffers according to the new vertex declaration passed in.
Ogre::IndexData::IndexData
IndexData()
OgreHardwareVertexBuffer.h
Ogre::VertexData::HardwareAnimationData::parametric
Real parametric
Definition: OgreVertexIndexData.h:97
Ogre::VertexData::~VertexData
~VertexData()
Ogre::VertexCacheProfiler::CacheType
CacheType
Definition: OgreVertexIndexData.h:288
Ogre::VertexData::vertexStart
size_t vertexStart
The base vertex index to start from.
Definition: OgreVertexIndexData.h:88
Ogre::VertexCacheProfiler::miss
unsigned int miss
Definition: OgreVertexIndexData.h:315
Ogre::VertexData::VertexData
VertexData(HardwareBufferManagerBase *mgr=0)
Constructor.
Ogre::VertexData::prepareForShadowVolume
void prepareForShadowVolume(void)
Modifies the vertex data to be suitable for use for rendering shadow geometry.
Ogre::VertexData::mMgr
HardwareBufferManagerBase * mMgr
Definition: OgreVertexIndexData.h:57
Ogre::VertexData::operator=
VertexData & operator=(const VertexData &rhs)
Protected operator=, to prevent misuse.
Ogre::VertexCacheProfiler::getHits
unsigned int getHits()
Definition: OgreVertexIndexData.h:307
Ogre::VertexData::VertexData
VertexData(const VertexData &rhs)
Protected copy constructor, to prevent misuse.
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::VertexCacheProfiler::FIFO
@ FIFO
Definition: OgreVertexIndexData.h:289
Ogre::VertexData::removeUnusedBuffers
void removeUnusedBuffers(void)
Remove all vertex buffers that never used by the vertex declaration.
Ogre::vector
Definition: OgrePrerequisites.h:492
Ogre::IndexData::clone
IndexData * clone(bool copyData=true, HardwareBufferManagerBase *mgr=0) const
Clones this index data, potentially including replicating the index buffer.
Ogre::IndexData
Summary class collecting together index data source information.
Definition: OgreVertexIndexData.h:243
Ogre::VertexData::vertexBufferBinding
VertexBufferBinding * vertexBufferBinding
The vertex buffer bindings to be used.
Definition: OgreVertexIndexData.h:84
Ogre::VertexCacheProfiler::profile
void profile(const HardwareIndexBufferSharedPtr &indexBuffer)

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