00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://www.ogre3d.org/ 00006 00007 Copyright (c) 2000-2005 The OGRE Team 00008 Also see acknowledgements in Readme.html 00009 00010 This program is free software; you can redistribute it and/or modify it under 00011 the terms of the GNU Lesser General Public License as published by the Free Software 00012 Foundation; either version 2 of the License, or (at your option) any later 00013 version. 00014 00015 This program is distributed in the hope that it will be useful, but WITHOUT 00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License along with 00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 00022 http://www.gnu.org/copyleft/lesser.txt. 00023 ----------------------------------------------------------------------------- 00024 */ 00025 #ifndef __VertexIndexData_H__ 00026 #define __VertexIndexData_H__ 00027 00028 #include "OgrePrerequisites.h" 00029 #include "OgreHardwareVertexBuffer.h" 00030 #include "OgreHardwareIndexBuffer.h" 00031 00032 namespace Ogre { 00033 00035 typedef std::vector<HardwareBuffer::Usage> BufferUsageList; 00036 00037 00039 class _OgreExport VertexData 00040 { 00041 private: 00043 VertexData(const VertexData& rhs); /* do nothing, should not use */ 00045 VertexData& operator=(const VertexData& rhs); /* do not use */ 00046 public: 00047 VertexData(); 00048 ~VertexData(); 00049 00053 VertexDeclaration* vertexDeclaration; 00057 VertexBufferBinding* vertexBufferBinding; 00059 size_t vertexStart; 00061 size_t vertexCount; 00062 00063 00065 struct HardwareAnimationData 00066 { 00067 const VertexElement* targetVertexElement; 00068 Real parametric; 00069 }; 00070 typedef std::vector<HardwareAnimationData> HardwareAnimationDataList; 00072 HardwareAnimationDataList hwAnimationDataList; 00074 size_t hwAnimDataItemsUsed; 00075 00079 VertexData* clone(bool copyData = true) const; 00080 00100 void prepareForShadowVolume(void); 00101 00115 HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer; 00116 00117 00134 void reorganiseBuffers(VertexDeclaration* newDeclaration, const BufferUsageList& bufferUsage); 00135 00151 void reorganiseBuffers(VertexDeclaration* newDeclaration); 00152 00160 void convertPackedColour(VertexElementType srcType, VertexElementType destType); 00161 00162 00176 void allocateHardwareAnimationElements(ushort count); 00177 00178 00179 00180 }; 00181 00183 class _OgreExport IndexData 00184 { 00185 protected: 00187 IndexData(const IndexData& rhs); /* do nothing, should not use */ 00189 IndexData& operator=(const IndexData& rhs); /* do not use */ 00190 public: 00191 IndexData(); 00192 ~IndexData(); 00194 HardwareIndexBufferSharedPtr indexBuffer; 00195 00197 size_t indexStart; 00198 00200 size_t indexCount; 00201 00205 IndexData* clone(bool copyData = true) const; 00206 00215 void optimiseVertexCacheTriList(void); 00216 00217 }; 00218 00224 class _OgreExport VertexCacheProfiler 00225 { 00226 public: 00227 enum CacheType { 00228 FIFO, LRU 00229 }; 00230 00231 VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO ) 00232 : size ( cachesize ), type ( cachetype ), tail (0), buffersize (0), hit (0), miss (0) 00233 { 00234 cache = new uint32[size]; 00235 }; 00236 00237 ~VertexCacheProfiler() 00238 { 00239 delete[] cache; 00240 } 00241 00242 void profile(const HardwareIndexBufferSharedPtr indexBuffer); 00243 void reset() { hit = 0; miss = 0; tail = 0; buffersize = 0; }; 00244 void flush() { tail = 0; buffersize = 0; }; 00245 00246 unsigned int getHits() { return hit; }; 00247 unsigned int getMisses() { return miss; }; 00248 unsigned int getSize() { return size; }; 00249 private: 00250 unsigned int size; 00251 uint32 *cache; 00252 CacheType type; 00253 00254 unsigned int tail, buffersize; 00255 unsigned int hit, miss; 00256 00257 bool inCache(unsigned int index); 00258 }; 00259 } 00260 #endif 00261
Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:51 2006