浏览代码

enable cooking in PhysX

mikymod 12 年之前
父节点
当前提交
61741260d2
共有 2 个文件被更改,包括 11 次插入0 次删除
  1. 3 0
      engine/CMakeLists.txt
  2. 8 0
      engine/physics/PhysicsWorld.cpp

+ 3 - 0
engine/CMakeLists.txt

@@ -532,6 +532,7 @@ if (LINUX)
 			PhysX3CharacterKinematicCHECKED
 			PhysX3CHECKED
 			PhysX3CommonCHECKED
+			PhysX3CookingCHECKED
 			PhysX3ExtensionsCHECKED
 			PhysXProfileSDKCHECKED
 			PhysXVisualDebuggerSDKCHECKED
@@ -548,6 +549,7 @@ if (LINUX)
 			PhysX3CharacterKinematicPROFILE
 			PhysX3PROFILE
 			PhysX3CommonPROFILE
+			PhysX3CookingPROFILE
 			PhysX3ExtensionsPROFILE
 			PhysXProfileSDKPROFILE
 			PhysXVisualDebuggerSDKPROFILE
@@ -572,6 +574,7 @@ if (LINUX)
 			PhysX3CharacterKinematic
 			PhysX3
 			PhysX3Common
+			PhysX3Cooking
 			PhysX3Extensions
 			PhysXProfileSDK
 			PhysXVisualDebuggerSDK

+ 8 - 0
engine/physics/PhysicsWorld.cpp

@@ -72,6 +72,9 @@ namespace physics_system
 {
 	using physx::PxFoundation;
 	using physx::PxPhysics;
+	using physx::PxCooking;
+	using physx::PxCookingParams;
+	using physx::PxTolerancesScale;
 	using physx::PxAllocatorCallback;
 	using physx::PxErrorCallback;
 	using physx::PxErrorCode;
@@ -170,6 +173,7 @@ namespace physics_system
 	static PhysXError* s_px_error;
 	static PxFoundation* s_foundation;
 	static PxPhysics* s_physics;
+	static PxCooking* s_cooking;
 
 	void init()
 	{
@@ -184,11 +188,15 @@ namespace physics_system
 
 		bool extension = PxInitExtensions(*s_physics);
 		CE_ASSERT(extension, "Unable to initialize PhysX Extensions");
+
+		s_cooking = PxCreateCooking(PX_PHYSICS_VERSION, *s_foundation, PxCookingParams(PxTolerancesScale()));
+		CE_ASSERT(s_cooking, "Unable to create PhysX Cooking");
 	}
 
 	void shutdown()
 	{
 		PxCloseExtensions();
+		s_cooking->release();
 		s_physics->release();
 		s_foundation->release();