From abc039174247a32d1664f76894a361300925642a Mon Sep 17 00:00:00 2001 From: johnmccutchan Date: Wed, 13 Feb 2008 19:10:45 +0000 Subject: [PATCH] Use btAlignedAlloc/btAlignedFree --- Extras/BulletMultiThreaded/SpuBatchRaycaster.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Extras/BulletMultiThreaded/SpuBatchRaycaster.cpp b/Extras/BulletMultiThreaded/SpuBatchRaycaster.cpp index 19e050234..79bd97833 100644 --- a/Extras/BulletMultiThreaded/SpuBatchRaycaster.cpp +++ b/Extras/BulletMultiThreaded/SpuBatchRaycaster.cpp @@ -14,6 +14,7 @@ subject to the following restrictions: */ #include +#include "LinearMath/btAlignedAllocator.h" #include "SpuBatchRaycaster.h" SpuBatchRaycaster::SpuBatchRaycaster (class btThreadSupportInterface* threadInterface, int maxNumOutstandingTasks) @@ -30,7 +31,8 @@ SpuBatchRaycaster::~SpuBatchRaycaster () { if (castUponObjectWrappers) { - delete [] castUponObjectWrappers; + btAlignedFree (castUponObjectWrappers); + castUponObjectWrappers = NULL; } } @@ -39,15 +41,16 @@ SpuBatchRaycaster::setCollisionObjects (btCollisionObjectArray& castUponObjects, { if (castUponObjectWrappers) { - delete [] castUponObjectWrappers; + btAlignedFree (castUponObjectWrappers); + castUponObjectWrappers = NULL; } - castUponObjectWrappers = new SpuCollisionObjectWrapper[numCastUponObjects]; + castUponObjectWrappers = (SpuCollisionObjectWrapper*)btAlignedAlloc (sizeof(SpuCollisionObjectWrapper) * numCastUponObjects,16); numCastUponObjectWrappers = numCastUponObjects; for (int i = 0; i < numCastUponObjectWrappers; i++) { - new (&castUponObjectWrappers[i]) SpuCollisionObjectWrapper(castUponObjects[i]); + castUponObjectWrappers[i] = SpuCollisionObjectWrapper(castUponObjects[i]); } }