diff --git a/panda/src/physx/config_physx.cxx b/panda/src/physx/config_physx.cxx index 92a8ab5038..072145ca42 100644 --- a/panda/src/physx/config_physx.cxx +++ b/panda/src/physx/config_physx.cxx @@ -22,6 +22,7 @@ #include "physxCapsuleController.h" #include "physxCapsuleForceFieldShape.h" #include "physxCapsuleShape.h" +#include "physxClothMesh.h" #include "physxContactPair.h" #include "physxContactPoint.h" #include "physxController.h" @@ -58,10 +59,6 @@ #include "physxWheel.h" #include "physxWheelShape.h" -#if NX_USE_CLOTH_API -#include "physxClothMesh.h" -#endif - ConfigureDef(config_physx); NotifyCategoryDef(physx, ""); @@ -121,6 +118,7 @@ init_libphysx() { PhysxCapsuleController::init_type(); PhysxCapsuleForceFieldShape::init_type(); PhysxCapsuleShape::init_type(); + PhysxClothMesh::init_type(); PhysxContactPair::init_type(); PhysxContactPoint::init_type(); PhysxController::init_type(); @@ -157,10 +155,6 @@ init_libphysx() { PhysxWheel::init_type(); PhysxWheelShape::init_type(); -#if NX_USE_CLOTH_API - PhysxClothMesh::init_type(); -#endif - PandaSystem *ps = PandaSystem::get_global_ptr(); ps->add_system("PhysX"); } diff --git a/panda/src/physx/physxClothMesh.cxx b/panda/src/physx/physxClothMesh.cxx index 85f2a8f746..242bf75d5c 100644 --- a/panda/src/physx/physxClothMesh.cxx +++ b/panda/src/physx/physxClothMesh.cxx @@ -15,8 +15,6 @@ #include "physxClothMesh.h" #include "physxMeshPool.h" -#if NX_USE_CLOTH_API - TypeHandle PhysxClothMesh::_type_handle; //////////////////////////////////////////////////////////////////// @@ -76,5 +74,3 @@ get_reference_count() const { return _ptr->getReferenceCount(); } -#endif - diff --git a/panda/src/physx/physxClothMesh.h b/panda/src/physx/physxClothMesh.h index dbd90fbe56..bf96fa7ab5 100644 --- a/panda/src/physx/physxClothMesh.h +++ b/panda/src/physx/physxClothMesh.h @@ -20,7 +20,6 @@ #include "physxObject.h" #include "physx_includes.h" -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Class : PhysxClothMesh // Description : @@ -72,6 +71,5 @@ private: }; #include "physxClothMesh.I" -#endif #endif // PHYSXCLOTHMESH_H diff --git a/panda/src/physx/physxClothMeshDesc.cxx b/panda/src/physx/physxClothMeshDesc.cxx index c9a61d637f..b7aa3c4a91 100644 --- a/panda/src/physx/physxClothMeshDesc.cxx +++ b/panda/src/physx/physxClothMeshDesc.cxx @@ -19,8 +19,6 @@ #include "geomNode.h" #include "geomVertexReader.h" -#if NX_USE_CLOTH_API - //////////////////////////////////////////////////////////////////// // Function: PhysxClothMeshDesc::set_num_vertices // Access: Published @@ -223,5 +221,3 @@ set_from_node_path(const NodePath &np) { _desc.triangles = _triangles; } -#endif - diff --git a/panda/src/physx/physxClothMeshDesc.h b/panda/src/physx/physxClothMeshDesc.h index 78829d603a..536170578a 100644 --- a/panda/src/physx/physxClothMeshDesc.h +++ b/panda/src/physx/physxClothMeshDesc.h @@ -22,7 +22,6 @@ #include "physx_includes.h" -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Class : PhysxClothMeshDesc // Description : @@ -54,6 +53,5 @@ private: }; #include "physxClothMeshDesc.I" -#endif #endif // PHYSXCLOTHMESHDESC_H diff --git a/panda/src/physx/physxKitchen.cxx b/panda/src/physx/physxKitchen.cxx index 708761d022..b58e70d678 100644 --- a/panda/src/physx/physxKitchen.cxx +++ b/panda/src/physx/physxKitchen.cxx @@ -20,11 +20,8 @@ #include "physxFileStream.h" #include "physxMemoryReadBuffer.h" #include "physxMemoryWriteBuffer.h" - -#if NX_USE_CLOTH_API #include "physxClothMesh.h" #include "physxClothMeshDesc.h" -#endif //////////////////////////////////////////////////////////////////// // Function: PhysxKitchen::set_cooking_params @@ -88,7 +85,6 @@ cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc, const Filename &filena return _cooking->NxCookTriangleMesh(meshDesc.get_desc(), stream); } -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Function: PhysxKitchen::cook_cloth_mesh // Access: Published @@ -105,7 +101,6 @@ cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc, const Filename &filename) { PhysxFileStream stream = PhysxFileStream(filename, false); return _cooking->NxCookClothMesh(meshDesc.get_desc(), stream); } -#endif //////////////////////////////////////////////////////////////////// // Function: PhysxKitchen::cook_convex_mesh @@ -163,7 +158,6 @@ cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc) { return mesh; } -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Function: PhysxKitchen::cook_cloth_mesh // Access: Published @@ -174,8 +168,8 @@ cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc) { nassertr_always(meshDesc.is_valid(), false); - PhysxMemoryWriteBuffer buffer; - bool status = _cooking->NxCookClothMesh(meshDesc.get_desc(), buffer); + PhysxMemoryWriteBuffer wbuffer; + bool status = _cooking->NxCookClothMesh(meshDesc.get_desc(), wbuffer); nassertr(status, NULL); NxPhysicsSDK *sdk = NxGetPhysicsSDK(); @@ -184,12 +178,12 @@ cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc) { PhysxClothMesh *mesh = new PhysxClothMesh(); nassertr(mesh, NULL); - NxClothMesh *meshPtr = sdk->createClothMesh(PhysxMemoryReadBuffer(buffer.data)); + PhysxMemoryReadBuffer rbuffer(wbuffer.data); + NxClothMesh *meshPtr = sdk->createClothMesh(rbuffer); nassertr(meshPtr, NULL); mesh->link(meshPtr); return mesh; } -#endif diff --git a/panda/src/physx/physxKitchen.h b/panda/src/physx/physxKitchen.h index 174cd5326e..bc601f1754 100644 --- a/panda/src/physx/physxKitchen.h +++ b/panda/src/physx/physxKitchen.h @@ -24,11 +24,8 @@ class PhysxConvexMesh; class PhysxConvexMeshDesc; class PhysxTriangleMesh; class PhysxTriangleMeshDesc; - -#if NX_USE_CLOTH_API class PhysxClothMesh; class PhysxClothMeshDesc; -#endif //////////////////////////////////////////////////////////////////// // Class : PhysxKitchen @@ -43,15 +40,12 @@ PUBLISHED: void set_cooking_params(float skinWidth, bool hintCollisionSpeed); bool cook_convex_mesh(const PhysxConvexMeshDesc &meshDesc, const Filename &filename); - PhysxConvexMesh *cook_convex_mesh(const PhysxConvexMeshDesc &meshDesc); - bool cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc, const Filename &filename); - PhysxTriangleMesh *cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc); - -#if NX_USE_CLOTH_API bool cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc, const Filename &filename); + + PhysxConvexMesh *cook_convex_mesh(const PhysxConvexMeshDesc &meshDesc); + PhysxTriangleMesh *cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc); PhysxClothMesh *cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc); -#endif private: NxCookingInterface *_cooking; diff --git a/panda/src/physx/physxManager.cxx b/panda/src/physx/physxManager.cxx index 434f6f8b25..b775962379 100644 --- a/panda/src/physx/physxManager.cxx +++ b/panda/src/physx/physxManager.cxx @@ -271,7 +271,6 @@ get_triangle_mesh(unsigned int idx) { return (PhysxTriangleMesh *)_triangle_meshes[idx]; } -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Function: PhysxManager::get_num_cloth_meshes // Access: Published @@ -295,7 +294,6 @@ get_cloth_mesh(unsigned int idx) { return (PhysxClothMesh *)_cloth_meshes[idx]; } -#endif //////////////////////////////////////////////////////////////////// // Function: PhysxManager::is_hardware_available diff --git a/panda/src/physx/physxManager.h b/panda/src/physx/physxManager.h index f68322b6e3..ae7fb5b936 100644 --- a/panda/src/physx/physxManager.h +++ b/panda/src/physx/physxManager.h @@ -71,11 +71,9 @@ PUBLISHED: PhysxTriangleMesh *get_triangle_mesh(unsigned int idx); MAKE_SEQ(get_triangle_meshes, get_num_triangle_meshes, get_triangle_mesh); -#if NX_USE_CLOTH_API unsigned int get_num_cloth_meshes(); PhysxClothMesh *get_cloth_mesh(unsigned int idx); MAKE_SEQ(get_cloth_meshes, get_num_cloth_meshes, get_cloth_mesh); -#endif INLINE void ls() const; INLINE void ls(ostream &out, int indent_level=0) const; @@ -87,10 +85,7 @@ public: PhysxObjectCollection _heightfields; PhysxObjectCollection _convex_meshes; PhysxObjectCollection _triangle_meshes; - -#if NX_USE_CLOTH_API PhysxObjectCollection _cloth_meshes; -#endif INLINE static NxVec3 vec3_to_nxVec3(const LVector3f &v); INLINE static LVector3f nxVec3_to_vec3(const NxVec3 &v); diff --git a/panda/src/physx/physxMemoryReadBuffer.h b/panda/src/physx/physxMemoryReadBuffer.h index 9432fe64f1..b2e418667e 100644 --- a/panda/src/physx/physxMemoryReadBuffer.h +++ b/panda/src/physx/physxMemoryReadBuffer.h @@ -23,7 +23,7 @@ // Class : PhysxMemoryReadBuffer // Description : //////////////////////////////////////////////////////////////////// -class PhysxMemoryReadBuffer : public NxStream { +class EXPCL_PANDAPHYSX PhysxMemoryReadBuffer : public NxStream { public: PhysxMemoryReadBuffer(const NxU8 *data); diff --git a/panda/src/physx/physxMemoryWriteBuffer.h b/panda/src/physx/physxMemoryWriteBuffer.h index 1f6a0cc8dd..12e59c00c0 100644 --- a/panda/src/physx/physxMemoryWriteBuffer.h +++ b/panda/src/physx/physxMemoryWriteBuffer.h @@ -23,7 +23,7 @@ // Class : PhysxMemoryWriteBuffer // Description : //////////////////////////////////////////////////////////////////// -class PhysxMemoryWriteBuffer : public NxStream { +class EXPCL_PANDAPHYSX PhysxMemoryWriteBuffer : public NxStream { public: PhysxMemoryWriteBuffer(); diff --git a/panda/src/physx/physxMeshPool.cxx b/panda/src/physx/physxMeshPool.cxx index b56918e26a..2e41b5262f 100644 --- a/panda/src/physx/physxMeshPool.cxx +++ b/panda/src/physx/physxMeshPool.cxx @@ -15,21 +15,14 @@ #include "physxMeshPool.h" #include "physxConvexMesh.h" #include "physxTriangleMesh.h" - -#if NX_USE_CLOTH_API #include "physxClothMesh.h" -#endif #include "physxFileStream.h" #include "virtualFileSystem.h" PhysxMeshPool::ConvexMeshes PhysxMeshPool::_convex_meshes; PhysxMeshPool::TriangleMeshes PhysxMeshPool::_triangle_meshes; - -#if NX_USE_CLOTH_API PhysxMeshPool::ClothMeshes PhysxMeshPool::_cloth_meshes; -#endif - //PhysxMeshPool::SoftbodyMeshes PhysxMeshPool::_softbody_meshes; //////////////////////////////////////////////////////////////////// @@ -131,7 +124,6 @@ load_triangle_mesh(const Filename &fn) { return mesh; } -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Function: PhysxMeshPool::load_cloth_mesh // Access: Published @@ -170,7 +162,6 @@ load_cloth_mesh(const Filename &fn) { return mesh; } -#endif //////////////////////////////////////////////////////////////////// // Function: PhysxMeshPool::release_convex_mesh @@ -210,7 +201,6 @@ release_triangle_mesh(PhysxTriangleMesh *mesh) { return false; } -#if NX_USE_CLOTH_API //////////////////////////////////////////////////////////////////// // Function: PhysxMeshPool::release_cloth_mesh // Access: Published @@ -229,7 +219,6 @@ release_cloth_mesh(PhysxClothMesh *mesh) { return false; } -#endif //////////////////////////////////////////////////////////////////// // Function: PhysxMeshPool::list_content @@ -277,7 +266,6 @@ list_contents(ostream &out) { } } -#if NX_USE_CLOTH_API // Cloth meshes { ClothMeshes::const_iterator it; @@ -290,7 +278,6 @@ list_contents(ostream &out) { << " references)\n"; } } -#endif // Summary NxPhysicsSDK *sdk = NxGetPhysicsSDK(); @@ -301,9 +288,7 @@ list_contents(ostream &out) { out << " Total number of triangle meshes: " << sdk->getNbTriangleMeshes() << " created, " << _triangle_meshes.size() << " registred\n"; -#if NX_USE_CLOTH_API out << " Total number of cloth meshes: " << sdk->getNbClothMeshes() << " created, " << _cloth_meshes.size() << " registred\n"; -#endif } diff --git a/panda/src/physx/physxMeshPool.h b/panda/src/physx/physxMeshPool.h index 16f6b1783d..096ea92099 100644 --- a/panda/src/physx/physxMeshPool.h +++ b/panda/src/physx/physxMeshPool.h @@ -25,10 +25,7 @@ class PhysxConvexMesh; class PhysxTriangleMesh; - -#if NX_USE_CLOTH_API class PhysxClothMesh; -#endif //////////////////////////////////////////////////////////////////// // Class : PhysxMeshPool @@ -46,16 +43,12 @@ PUBLISHED: static PhysxConvexMesh *load_convex_mesh(const Filename &filename); static PhysxTriangleMesh *load_triangle_mesh(const Filename &filename); -#if NX_USE_CLOTH_API static PhysxClothMesh *load_cloth_mesh(const Filename &filename); -#endif //static PhysxSoftBodyMesh *load_softbody_mesh(const Filename &filename); static bool release_convex_mesh(PhysxConvexMesh *mesh); static bool release_triangle_mesh(PhysxTriangleMesh *mesh); -#if NX_USE_CLOTH_API static bool release_cloth_mesh(PhysxClothMesh *mesh); -#endif //static bool release_softbody_mesh(PhysxSoftBodyMesh *mesh); static void list_contents(); @@ -70,10 +63,8 @@ private: typedef pmap TriangleMeshes; static TriangleMeshes _triangle_meshes; -#if NX_USE_CLOTH_API typedef pmap ClothMeshes; static ClothMeshes _cloth_meshes; -#endif //typedef pmap SoftbodyMeshes; //static SoftbodyMeshes _softbody_meshes;