aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp
diff options
context:
space:
mode:
authorSheikh Dawood <[email protected]>2018-04-09 10:13:48 -0500
committerSheikh Dawood <[email protected]>2018-04-09 10:13:48 -0500
commit238605d8225a9135d6b60646e05d066e25424eee (patch)
tree2b013bd4946bb3c699d7a06ef1f21be85d367f63 /PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp
parentAdd ParamTool.exe (diff)
downloadphysx-3.4-238605d8225a9135d6b60646e05d066e25424eee.tar.xz
physx-3.4-238605d8225a9135d6b60646e05d066e25424eee.zip
PhysX 3.4, APEX 1.4 patch release @23879214
Diffstat (limited to 'PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp')
-rw-r--r--PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp44
1 files changed, 17 insertions, 27 deletions
diff --git a/PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp b/PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp
index 7ffd5c72..33af97d6 100644
--- a/PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp
+++ b/PhysX_3.4/Source/GeomUtils/src/GuMeshFactory.cpp
@@ -27,7 +27,6 @@
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
-
#include "PsIntrinsics.h"
#include "GuMeshFactory.h"
#include "PxHeightFieldDesc.h"
@@ -52,12 +51,11 @@ using namespace Gu;
// PT: TODO: refactor all this with a dedicated container
-GuMeshFactory::GuMeshFactory()
-: mTriangleMeshes (PX_DEBUG_EXP("mesh factory triangle mesh hash"))
-, mConvexMeshes (PX_DEBUG_EXP("mesh factory convex mesh hash"))
-, mHeightFields (PX_DEBUG_EXP("mesh factory height field hash"))
-, mFactoryListeners(PX_DEBUG_EXP("FactoryListeners"))
-
+GuMeshFactory::GuMeshFactory() :
+ mTriangleMeshes (PX_DEBUG_EXP("mesh factory triangle mesh hash")),
+ mConvexMeshes (PX_DEBUG_EXP("mesh factory convex mesh hash")),
+ mHeightFields (PX_DEBUG_EXP("mesh factory height field hash")),
+ mFactoryListeners (PX_DEBUG_EXP("FactoryListeners"))
{
}
@@ -98,29 +96,19 @@ void GuMeshFactory::release()
PX_DELETE(this);
}
-namespace
+template <typename T>
+static void addToHash(Ps::CoalescedHashSet<T*>& hash, T* element, Ps::Mutex* mutex)
{
- template<typename TDataType>
- inline void notifyReleaseFactoryItem( Ps::Array<GuMeshFactoryListener*>& listeners, const TDataType* type, PxType typeID)
- {
- PxU32 numListeners = listeners.size();
- for ( PxU32 idx = 0; idx < numListeners; ++idx )
- listeners[idx]->onGuMeshFactoryBufferRelease( type, typeID);
- }
+ if(!element)
+ return;
- template <typename T> void addToHash(Ps::CoalescedHashSet<T*>& hash, T* element, Ps::Mutex* mutex)
- {
- if(!element)
- return;
-
- if(mutex)
- mutex->lock();
+ if(mutex)
+ mutex->lock();
- hash.insert(element);
+ hash.insert(element);
- if(mutex)
- mutex->unlock();
- }
+ if(mutex)
+ mutex->unlock();
}
///////////////////////////////////////////////////////////////////////////////
@@ -675,7 +663,9 @@ void GuMeshFactory::removeFactoryListener( GuMeshFactoryListener& listener )
void GuMeshFactory::notifyFactoryListener(const PxBase* base, PxType typeID)
{
- notifyReleaseFactoryItem(mFactoryListeners, base, typeID);
+ const PxU32 nbListeners = mFactoryListeners.size();
+ for(PxU32 i=0; i<nbListeners; i++)
+ mFactoryListeners[i]->onGuMeshFactoryBufferRelease(base, typeID);
}
///////////////////////////////////////////////////////////////////////////////