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 © 2000-2002 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 #include "OgreStableHeaders.h" 00026 #include "OgreHardwareIndexBuffer.h" 00027 #include "OgreHardwareBufferManager.h" 00028 #include "OgreDefaultHardwareBufferManager.h" 00029 00030 00031 namespace Ogre { 00032 00033 //----------------------------------------------------------------------------- 00034 HardwareIndexBuffer::HardwareIndexBuffer(IndexType idxType, 00035 size_t numIndexes, HardwareBuffer::Usage usage, 00036 bool useSystemMemory, bool useShadowBuffer) 00037 : HardwareBuffer(usage, useSystemMemory, useShadowBuffer), mIndexType(idxType), mNumIndexes(numIndexes) 00038 { 00039 // Calculate the size of the indexes 00040 switch (mIndexType) 00041 { 00042 case IT_16BIT: 00043 mIndexSize = sizeof(unsigned short); 00044 break; 00045 case IT_32BIT: 00046 mIndexSize = sizeof(unsigned int); 00047 break; 00048 } 00049 mSizeInBytes = mIndexSize * mNumIndexes; 00050 00051 // Create a shadow buffer if required 00052 if (mUseShadowBuffer) 00053 { 00054 mpShadowBuffer = new DefaultHardwareIndexBuffer(mIndexType, 00055 mNumIndexes, HardwareBuffer::HBU_DYNAMIC); 00056 } 00057 00058 00059 } 00060 //----------------------------------------------------------------------------- 00061 HardwareIndexBuffer::~HardwareIndexBuffer() 00062 { 00063 if (mpShadowBuffer) 00064 { 00065 delete mpShadowBuffer; 00066 } 00067 } 00068 //----------------------------------------------------------------------------- 00069 HardwareIndexBufferSharedPtr::HardwareIndexBufferSharedPtr(HardwareIndexBuffer* buf) 00070 : SharedPtr<HardwareIndexBuffer>(buf) 00071 { 00072 00073 } 00074 00075 } 00076
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:16 2004