OGRE  1.9.0
OgreVertexIndexData.h
Go to the documentation of this file.
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2014 Torus Knot Software Ltd
8
9Permission is hereby granted, free of charge, to any person obtaining a copy
10of this software and associated documentation files (the "Software"), to deal
11in the Software without restriction, including without limitation the rights
12to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13copies of the Software, and to permit persons to whom the Software is
14furnished to do so, subject to the following conditions:
15
16The above copyright notice and this permission notice shall be included in
17all copies or substantial portions of the Software.
18
19THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25THE SOFTWARE.
26-----------------------------------------------------------------------------
27*/
28#ifndef __VertexIndexData_H__
29#define __VertexIndexData_H__
30
31#include "OgrePrerequisites.h"
34#include "OgreHeaderPrefix.h"
35
36namespace 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
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,
169
188
199
209
218
219
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
257
260
266 IndexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
267
277
278 };
279
286 {
287 public:
288 VertexCacheProfiler(unsigned int cachesize = 16)
289 : size ( cachesize ), tail (0), buffersize (0), hit (0), miss (0)
290 {
292 }
293
295 {
297 }
298
299 void profile(const HardwareIndexBufferSharedPtr& indexBuffer);
300 void reset() { hit = 0; miss = 0; tail = 0; buffersize = 0; }
301 void flush() { tail = 0; buffersize = 0; }
302
303 unsigned int getHits() { return hit; }
304 unsigned int getMisses() { return miss; }
305 unsigned int getSize() { return size; }
306 private:
307 unsigned int size;
309
310 unsigned int tail, buffersize;
311 unsigned int hit, miss;
312
313 bool inCache(unsigned int index);
314 };
317}
318
319#include "OgreHeaderSuffix.h"
320
321#endif
322
#define _OgreExport
Superclass for all objects that wish to use custom memory allocators when their new / delete operator...
Base definition of a hardware buffer manager.
Shared pointer implementation used to share index buffers.
Shared pointer implementation used to share vertex buffers.
Summary class collecting together index data source information.
IndexData(const IndexData &rhs)
Protected copy constructor, to prevent misuse.
void optimiseVertexCacheTriList(void)
Re-order the indexes in this index data structure to be more vertex cache friendly; that is to re-use...
HardwareIndexBufferSharedPtr indexBuffer
Pointer to the HardwareIndexBuffer to use, must be specified if useIndexes = true.
IndexData & operator=(const IndexData &rhs)
Protected operator=, to prevent misuse.
size_t indexStart
Index in the buffer to start from for this operation.
IndexData * clone(bool copyData=true, HardwareBufferManagerBase *mgr=0) const
Clones this index data, potentially including replicating the index buffer.
size_t indexCount
The number of indexes to use from the buffer.
Records the state of all the vertex buffer bindings required to provide a vertex declaration with the...
bool inCache(unsigned int index)
void profile(const HardwareIndexBufferSharedPtr &indexBuffer)
VertexCacheProfiler(unsigned int cachesize=16)
Summary class collecting together vertex source information.
VertexData & operator=(const VertexData &rhs)
Protected operator=, to prevent misuse.
size_t vertexCount
The number of vertices used in this operation.
void convertPackedColour(VertexElementType srcType, VertexElementType destType)
Convert all packed colour values (VET_COLOUR_*) in buffers used to another type.
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.
HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer
Additional shadow volume vertex buffer storage.
void closeGapsInBindings(void)
Remove any gaps in the vertex buffer bindings.
VertexBufferBinding * vertexBufferBinding
The vertex buffer bindings to be used.
VertexData(HardwareBufferManagerBase *mgr=0)
Constructor.
void prepareForShadowVolume(void)
Modifies the vertex data to be suitable for use for rendering shadow geometry.
HardwareAnimationDataList hwAnimationDataList
VertexElements used for hardware morph / pose animation.
bool mDeleteDclBinding
Whether this class should delete the declaration and binding.
HardwareBufferManagerBase * mMgr
VertexData(VertexDeclaration *dcl, VertexBufferBinding *bind)
Constructor.
VertexData * clone(bool copyData=true, HardwareBufferManagerBase *mgr=0) const
Clones this vertex data, potentially including replicating any vertex buffers.
vector< HardwareAnimationData >::type HardwareAnimationDataList
void removeUnusedBuffers(void)
Remove all vertex buffers that never used by the vertex declaration.
size_t vertexStart
The base vertex index to start from.
VertexDeclaration * vertexDeclaration
Declaration of the vertex to be used in this operation.
VertexData(const VertexData &rhs)
Protected copy constructor, to prevent misuse.
void reorganiseBuffers(VertexDeclaration *newDeclaration, HardwareBufferManagerBase *mgr=0)
Reorganises the data in the vertex buffers according to the new vertex declaration passed in.
ushort allocateHardwareAnimationElements(ushort count, bool animateNormals)
Allocate elements to serve a holder of morph / pose target data for hardware morphing / pose blending...
size_t hwAnimDataItemsUsed
Number of hardware animation data items used.
This class declares the format of a set of vertex inputs, which can be issued to the rendering API th...
#define OGRE_ALLOC_T(T, count, category)
Allocate a block of memory for a primitive type, and indicate the category of usage.
#define OGRE_FREE(ptr, category)
Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to en...
@ MEMCATEGORY_GEOMETRY
Geometry held in main memory.
VertexElementType
Vertex element type, used to identify the base types of the vertex contents.
vector< HardwareBuffer::Usage >::type BufferUsageList
Define a list of usage flags.
float Real
Software floating point type.
unsigned int uint32
unsigned short ushort
Struct used to hold hardware morph / pose vertex data information.
std::vector< T, A > type