From 09bddf4315626efcfe12f18e88ff6b2d76111692 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 7 Jan 2020 21:57:22 +0100 Subject: [PATCH] physx: remove support for NVIDIA PhysX Our support was stuck on an ancient version that has not been available for a while. If we were to continue support it should be done around the new PhysX 5.0 API, not 2.8.4. --- doc/INSTALL | 1 - makepanda/installer.nsi | 26 - makepanda/makepanda.py | 75 +- makepanda/makepanda.vcproj | 356 ---- makepanda/makepandacore.py | 50 - panda/metalibs/pandaphysx/pandaphysx.cxx | 19 - panda/metalibs/pandaphysx/pandaphysx.h | 14 - panda/src/pandabase/pandasymbols.h | 8 - panda/src/physx/config_physx.cxx | 178 -- panda/src/physx/config_physx.h | 38 - panda/src/physx/p3physx_composite.cxx | 129 -- panda/src/physx/physxActor.I | 60 - panda/src/physx/physxActor.cxx | 1412 --------------- panda/src/physx/physxActor.h | 222 --- panda/src/physx/physxActorDesc.I | 48 - panda/src/physx/physxActorDesc.cxx | 138 -- panda/src/physx/physxActorDesc.h | 61 - panda/src/physx/physxBodyDesc.I | 46 - panda/src/physx/physxBodyDesc.cxx | 330 ---- panda/src/physx/physxBodyDesc.h | 77 - panda/src/physx/physxBounds3.I | 28 - panda/src/physx/physxBounds3.cxx | 229 --- panda/src/physx/physxBounds3.h | 64 - panda/src/physx/physxBox.I | 28 - panda/src/physx/physxBox.cxx | 115 -- panda/src/physx/physxBox.h | 54 - panda/src/physx/physxBoxController.I | 28 - panda/src/physx/physxBoxController.cxx | 75 - panda/src/physx/physxBoxController.h | 67 - panda/src/physx/physxBoxControllerDesc.I | 47 - panda/src/physx/physxBoxControllerDesc.cxx | 36 - panda/src/physx/physxBoxControllerDesc.h | 46 - panda/src/physx/physxBoxForceFieldShape.I | 28 - panda/src/physx/physxBoxForceFieldShape.cxx | 83 - panda/src/physx/physxBoxForceFieldShape.h | 70 - panda/src/physx/physxBoxForceFieldShapeDesc.I | 48 - .../src/physx/physxBoxForceFieldShapeDesc.cxx | 37 - panda/src/physx/physxBoxForceFieldShapeDesc.h | 46 - panda/src/physx/physxBoxShape.I | 28 - panda/src/physx/physxBoxShape.cxx | 83 - panda/src/physx/physxBoxShape.h | 79 - panda/src/physx/physxBoxShapeDesc.I | 48 - panda/src/physx/physxBoxShapeDesc.cxx | 37 - panda/src/physx/physxBoxShapeDesc.h | 46 - panda/src/physx/physxCapsule.I | 37 - panda/src/physx/physxCapsule.cxx | 141 -- panda/src/physx/physxCapsule.h | 53 - panda/src/physx/physxCapsuleController.I | 28 - panda/src/physx/physxCapsuleController.cxx | 94 - panda/src/physx/physxCapsuleController.h | 80 - panda/src/physx/physxCapsuleControllerDesc.I | 47 - .../src/physx/physxCapsuleControllerDesc.cxx | 50 - panda/src/physx/physxCapsuleControllerDesc.h | 47 - panda/src/physx/physxCapsuleForceFieldShape.I | 28 - .../src/physx/physxCapsuleForceFieldShape.cxx | 96 - panda/src/physx/physxCapsuleForceFieldShape.h | 74 - .../physx/physxCapsuleForceFieldShapeDesc.I | 48 - .../physx/physxCapsuleForceFieldShapeDesc.cxx | 50 - .../physx/physxCapsuleForceFieldShapeDesc.h | 47 - panda/src/physx/physxCapsuleShape.I | 28 - panda/src/physx/physxCapsuleShape.cxx | 96 - panda/src/physx/physxCapsuleShape.h | 85 - panda/src/physx/physxCapsuleShapeDesc.I | 48 - panda/src/physx/physxCapsuleShapeDesc.cxx | 50 - panda/src/physx/physxCapsuleShapeDesc.h | 47 - panda/src/physx/physxCcdSkeleton.I | 47 - panda/src/physx/physxCcdSkeleton.cxx | 66 - panda/src/physx/physxCcdSkeleton.h | 72 - panda/src/physx/physxCcdSkeletonDesc.I | 52 - panda/src/physx/physxCcdSkeletonDesc.cxx | 177 -- panda/src/physx/physxCcdSkeletonDesc.h | 54 - panda/src/physx/physxCloth.I | 54 - panda/src/physx/physxCloth.cxx | 568 ------ panda/src/physx/physxCloth.h | 132 -- panda/src/physx/physxClothDesc.I | 48 - panda/src/physx/physxClothDesc.cxx | 298 ---- panda/src/physx/physxClothDesc.h | 77 - panda/src/physx/physxClothMesh.I | 47 - panda/src/physx/physxClothMesh.cxx | 66 - panda/src/physx/physxClothMesh.h | 71 - panda/src/physx/physxClothMeshDesc.I | 82 - panda/src/physx/physxClothMeshDesc.cxx | 193 -- panda/src/physx/physxClothMeshDesc.h | 59 - panda/src/physx/physxClothNode.I | 45 - panda/src/physx/physxClothNode.cxx | 215 --- panda/src/physx/physxClothNode.h | 85 - panda/src/physx/physxConstraintDominance.I | 46 - panda/src/physx/physxConstraintDominance.cxx | 50 - panda/src/physx/physxConstraintDominance.h | 53 - panda/src/physx/physxContactPair.I | 29 - panda/src/physx/physxContactPair.cxx | 136 -- panda/src/physx/physxContactPair.h | 77 - panda/src/physx/physxContactPoint.I | 29 - panda/src/physx/physxContactPoint.cxx | 96 - panda/src/physx/physxContactPoint.h | 78 - panda/src/physx/physxContactReport.I | 29 - panda/src/physx/physxContactReport.cxx | 91 - panda/src/physx/physxContactReport.h | 43 - panda/src/physx/physxController.I | 69 - panda/src/physx/physxController.cxx | 333 ---- panda/src/physx/physxController.h | 114 -- panda/src/physx/physxControllerDesc.I | 20 - panda/src/physx/physxControllerDesc.cxx | 115 -- panda/src/physx/physxControllerDesc.h | 53 - panda/src/physx/physxControllerReport.I | 47 - panda/src/physx/physxControllerReport.cxx | 112 -- panda/src/physx/physxControllerReport.h | 53 - panda/src/physx/physxControllerShapeHit.I | 85 - panda/src/physx/physxControllerShapeHit.cxx | 16 - panda/src/physx/physxControllerShapeHit.h | 68 - panda/src/physx/physxControllersHit.I | 45 - panda/src/physx/physxControllersHit.cxx | 16 - panda/src/physx/physxControllersHit.h | 62 - panda/src/physx/physxConvexForceFieldShape.I | 28 - .../src/physx/physxConvexForceFieldShape.cxx | 56 - panda/src/physx/physxConvexForceFieldShape.h | 67 - .../physx/physxConvexForceFieldShapeDesc.I | 48 - .../physx/physxConvexForceFieldShapeDesc.cxx | 24 - .../physx/physxConvexForceFieldShapeDesc.h | 45 - panda/src/physx/physxConvexMesh.I | 47 - panda/src/physx/physxConvexMesh.cxx | 66 - panda/src/physx/physxConvexMesh.h | 72 - panda/src/physx/physxConvexMeshDesc.I | 45 - panda/src/physx/physxConvexMeshDesc.cxx | 115 -- panda/src/physx/physxConvexMeshDesc.h | 48 - panda/src/physx/physxConvexShape.I | 28 - panda/src/physx/physxConvexShape.cxx | 56 - panda/src/physx/physxConvexShape.h | 67 - panda/src/physx/physxConvexShapeDesc.I | 48 - panda/src/physx/physxConvexShapeDesc.cxx | 24 - panda/src/physx/physxConvexShapeDesc.h | 45 - panda/src/physx/physxCylindricalJoint.I | 28 - panda/src/physx/physxCylindricalJoint.cxx | 66 - panda/src/physx/physxCylindricalJoint.h | 69 - panda/src/physx/physxCylindricalJointDesc.I | 48 - panda/src/physx/physxCylindricalJointDesc.cxx | 14 - panda/src/physx/physxCylindricalJointDesc.h | 41 - panda/src/physx/physxD6Joint.I | 28 - panda/src/physx/physxD6Joint.cxx | 106 -- panda/src/physx/physxD6Joint.h | 76 - panda/src/physx/physxD6JointDesc.I | 48 - panda/src/physx/physxD6JointDesc.cxx | 515 ------ panda/src/physx/physxD6JointDesc.h | 99 -- panda/src/physx/physxDebugGeomNode.I | 337 ---- panda/src/physx/physxDebugGeomNode.cxx | 138 -- panda/src/physx/physxDebugGeomNode.h | 112 -- panda/src/physx/physxDistanceJoint.I | 28 - panda/src/physx/physxDistanceJoint.cxx | 66 - panda/src/physx/physxDistanceJoint.h | 69 - panda/src/physx/physxDistanceJointDesc.I | 48 - panda/src/physx/physxDistanceJointDesc.cxx | 96 - panda/src/physx/physxDistanceJointDesc.h | 53 - panda/src/physx/physxEnums.cxx | 58 - panda/src/physx/physxEnums.h | 720 -------- panda/src/physx/physxFileStream.cxx | 165 -- panda/src/physx/physxFileStream.h | 57 - panda/src/physx/physxFixedJoint.I | 28 - panda/src/physx/physxFixedJoint.cxx | 66 - panda/src/physx/physxFixedJoint.h | 69 - panda/src/physx/physxFixedJointDesc.I | 48 - panda/src/physx/physxFixedJointDesc.cxx | 14 - panda/src/physx/physxFixedJointDesc.h | 42 - panda/src/physx/physxForceField.I | 48 - panda/src/physx/physxForceField.cxx | 143 -- panda/src/physx/physxForceField.h | 91 - panda/src/physx/physxForceFieldDesc.I | 47 - panda/src/physx/physxForceFieldDesc.cxx | 188 -- panda/src/physx/physxForceFieldDesc.h | 71 - panda/src/physx/physxForceFieldShape.I | 40 - panda/src/physx/physxForceFieldShape.cxx | 155 -- panda/src/physx/physxForceFieldShape.h | 87 - panda/src/physx/physxForceFieldShapeDesc.I | 28 - panda/src/physx/physxForceFieldShapeDesc.cxx | 88 - panda/src/physx/physxForceFieldShapeDesc.h | 53 - panda/src/physx/physxForceFieldShapeGroup.I | 50 - panda/src/physx/physxForceFieldShapeGroup.cxx | 192 -- panda/src/physx/physxForceFieldShapeGroup.h | 94 - .../src/physx/physxForceFieldShapeGroupDesc.I | 48 - .../physx/physxForceFieldShapeGroupDesc.cxx | 65 - .../src/physx/physxForceFieldShapeGroupDesc.h | 53 - panda/src/physx/physxGroupsMask.I | 131 -- panda/src/physx/physxGroupsMask.cxx | 140 -- panda/src/physx/physxGroupsMask.h | 64 - panda/src/physx/physxHeightField.I | 47 - panda/src/physx/physxHeightField.cxx | 70 - panda/src/physx/physxHeightField.h | 89 - panda/src/physx/physxHeightFieldDesc.I | 82 - panda/src/physx/physxHeightFieldDesc.cxx | 122 -- panda/src/physx/physxHeightFieldDesc.h | 58 - panda/src/physx/physxHeightFieldShape.I | 28 - panda/src/physx/physxHeightFieldShape.cxx | 56 - panda/src/physx/physxHeightFieldShape.h | 75 - panda/src/physx/physxHeightFieldShapeDesc.I | 38 - panda/src/physx/physxHeightFieldShapeDesc.cxx | 97 - panda/src/physx/physxHeightFieldShapeDesc.h | 51 - panda/src/physx/physxJoint.I | 53 - panda/src/physx/physxJoint.cxx | 294 ---- panda/src/physx/physxJoint.h | 97 - panda/src/physx/physxJointDesc.I | 28 - panda/src/physx/physxJointDesc.cxx | 220 --- panda/src/physx/physxJointDesc.h | 69 - panda/src/physx/physxJointDriveDesc.I | 39 - panda/src/physx/physxJointDriveDesc.cxx | 86 - panda/src/physx/physxJointDriveDesc.h | 48 - panda/src/physx/physxJointLimitDesc.I | 39 - panda/src/physx/physxJointLimitDesc.cxx | 68 - panda/src/physx/physxJointLimitDesc.h | 45 - panda/src/physx/physxJointLimitSoftDesc.I | 40 - panda/src/physx/physxJointLimitSoftDesc.cxx | 86 - panda/src/physx/physxJointLimitSoftDesc.h | 47 - panda/src/physx/physxKitchen.I | 33 - panda/src/physx/physxKitchen.cxx | 252 --- panda/src/physx/physxKitchen.h | 59 - .../physx/physxLinearInterpolationValues.I | 28 - .../physx/physxLinearInterpolationValues.cxx | 116 -- .../physx/physxLinearInterpolationValues.h | 55 - panda/src/physx/physxManager.I | 203 --- panda/src/physx/physxManager.cxx | 463 ----- panda/src/physx/physxManager.h | 141 -- panda/src/physx/physxMask.I | 38 - panda/src/physx/physxMask.cxx | 82 - panda/src/physx/physxMask.h | 53 - panda/src/physx/physxMaterial.I | 47 - panda/src/physx/physxMaterial.cxx | 315 ---- panda/src/physx/physxMaterial.h | 114 -- panda/src/physx/physxMaterialDesc.I | 46 - panda/src/physx/physxMaterialDesc.cxx | 201 --- panda/src/physx/physxMaterialDesc.h | 60 - panda/src/physx/physxMemoryReadBuffer.cxx | 94 - panda/src/physx/physxMemoryReadBuffer.h | 47 - panda/src/physx/physxMemoryWriteBuffer.cxx | 98 -- panda/src/physx/physxMemoryWriteBuffer.h | 49 - panda/src/physx/physxMeshHash.I | 70 - panda/src/physx/physxMeshHash.cxx | 241 --- panda/src/physx/physxMeshHash.h | 75 - panda/src/physx/physxMeshPool.I | 28 - panda/src/physx/physxMeshPool.cxx | 345 ---- panda/src/physx/physxMeshPool.h | 73 - panda/src/physx/physxMotorDesc.I | 39 - panda/src/physx/physxMotorDesc.cxx | 68 - panda/src/physx/physxMotorDesc.h | 47 - panda/src/physx/physxObject.I | 116 -- panda/src/physx/physxObject.cxx | 16 - panda/src/physx/physxObject.h | 85 - panda/src/physx/physxObjectCollection.I | 97 - panda/src/physx/physxObjectCollection.cxx | 14 - panda/src/physx/physxObjectCollection.h | 43 - panda/src/physx/physxOverlapReport.I | 28 - panda/src/physx/physxOverlapReport.cxx | 72 - panda/src/physx/physxOverlapReport.h | 58 - panda/src/physx/physxPlane.I | 37 - panda/src/physx/physxPlane.cxx | 155 -- panda/src/physx/physxPlane.h | 55 - panda/src/physx/physxPlaneShape.I | 28 - panda/src/physx/physxPlaneShape.cxx | 69 - panda/src/physx/physxPlaneShape.h | 87 - panda/src/physx/physxPlaneShapeDesc.I | 48 - panda/src/physx/physxPlaneShapeDesc.cxx | 28 - panda/src/physx/physxPlaneShapeDesc.h | 45 - panda/src/physx/physxPointInPlaneJoint.I | 28 - panda/src/physx/physxPointInPlaneJoint.cxx | 66 - panda/src/physx/physxPointInPlaneJoint.h | 71 - panda/src/physx/physxPointInPlaneJointDesc.I | 48 - .../src/physx/physxPointInPlaneJointDesc.cxx | 14 - panda/src/physx/physxPointInPlaneJointDesc.h | 41 - panda/src/physx/physxPointOnLineJoint.I | 28 - panda/src/physx/physxPointOnLineJoint.cxx | 66 - panda/src/physx/physxPointOnLineJoint.h | 71 - panda/src/physx/physxPointOnLineJointDesc.I | 48 - panda/src/physx/physxPointOnLineJointDesc.cxx | 14 - panda/src/physx/physxPointOnLineJointDesc.h | 41 - panda/src/physx/physxPrismaticJoint.I | 28 - panda/src/physx/physxPrismaticJoint.cxx | 66 - panda/src/physx/physxPrismaticJoint.h | 69 - panda/src/physx/physxPrismaticJointDesc.I | 48 - panda/src/physx/physxPrismaticJointDesc.cxx | 14 - panda/src/physx/physxPrismaticJointDesc.h | 41 - panda/src/physx/physxPulleyJoint.I | 28 - panda/src/physx/physxPulleyJoint.cxx | 140 -- panda/src/physx/physxPulleyJoint.h | 76 - panda/src/physx/physxPulleyJointDesc.I | 48 - panda/src/physx/physxPulleyJointDesc.cxx | 133 -- panda/src/physx/physxPulleyJointDesc.h | 57 - panda/src/physx/physxRay.I | 32 - panda/src/physx/physxRay.cxx | 76 - panda/src/physx/physxRay.h | 47 - panda/src/physx/physxRaycastHit.I | 29 - panda/src/physx/physxRaycastHit.cxx | 62 - panda/src/physx/physxRaycastHit.h | 47 - panda/src/physx/physxRaycastReport.I | 28 - panda/src/physx/physxRaycastReport.cxx | 77 - panda/src/physx/physxRaycastReport.h | 53 - panda/src/physx/physxRevoluteJoint.I | 28 - panda/src/physx/physxRevoluteJoint.cxx | 263 --- panda/src/physx/physxRevoluteJoint.h | 87 - panda/src/physx/physxRevoluteJointDesc.I | 48 - panda/src/physx/physxRevoluteJointDesc.cxx | 174 -- panda/src/physx/physxRevoluteJointDesc.h | 63 - panda/src/physx/physxScene.I | 77 - panda/src/physx/physxScene.cxx | 1553 ----------------- panda/src/physx/physxScene.h | 284 --- panda/src/physx/physxSceneDesc.I | 46 - panda/src/physx/physxSceneDesc.cxx | 218 --- panda/src/physx/physxSceneDesc.h | 63 - panda/src/physx/physxSceneStats2.I | 61 - panda/src/physx/physxSceneStats2.cxx | 31 - panda/src/physx/physxSceneStats2.h | 42 - panda/src/physx/physxSegment.I | 37 - panda/src/physx/physxSegment.cxx | 133 -- panda/src/physx/physxSegment.h | 52 - panda/src/physx/physxShape.I | 40 - panda/src/physx/physxShape.cxx | 412 ----- panda/src/physx/physxShape.h | 115 -- panda/src/physx/physxShapeDesc.I | 28 - panda/src/physx/physxShapeDesc.cxx | 249 --- panda/src/physx/physxShapeDesc.h | 71 - panda/src/physx/physxSoftBody.I | 54 - panda/src/physx/physxSoftBody.cxx | 785 --------- panda/src/physx/physxSoftBody.h | 213 --- panda/src/physx/physxSoftBodyDesc.I | 48 - panda/src/physx/physxSoftBodyDesc.cxx | 334 ---- panda/src/physx/physxSoftBodyDesc.h | 81 - panda/src/physx/physxSoftBodyMesh.I | 47 - panda/src/physx/physxSoftBodyMesh.cxx | 66 - panda/src/physx/physxSoftBodyMesh.h | 71 - panda/src/physx/physxSoftBodyMeshDesc.I | 61 - panda/src/physx/physxSoftBodyMeshDesc.cxx | 82 - panda/src/physx/physxSoftBodyMeshDesc.h | 55 - panda/src/physx/physxSoftBodyNode.I | 37 - panda/src/physx/physxSoftBodyNode.cxx | 393 ----- panda/src/physx/physxSoftBodyNode.h | 94 - panda/src/physx/physxSphere.I | 37 - panda/src/physx/physxSphere.cxx | 106 -- panda/src/physx/physxSphere.h | 50 - panda/src/physx/physxSphereForceFieldShape.I | 28 - .../src/physx/physxSphereForceFieldShape.cxx | 76 - panda/src/physx/physxSphereForceFieldShape.h | 72 - .../physx/physxSphereForceFieldShapeDesc.I | 48 - .../physx/physxSphereForceFieldShapeDesc.cxx | 32 - .../physx/physxSphereForceFieldShapeDesc.h | 45 - panda/src/physx/physxSphereShape.I | 28 - panda/src/physx/physxSphereShape.cxx | 76 - panda/src/physx/physxSphereShape.h | 80 - panda/src/physx/physxSphereShapeDesc.I | 48 - panda/src/physx/physxSphereShapeDesc.cxx | 32 - panda/src/physx/physxSphereShapeDesc.h | 45 - panda/src/physx/physxSphericalJoint.I | 28 - panda/src/physx/physxSphericalJoint.cxx | 115 -- panda/src/physx/physxSphericalJoint.h | 76 - panda/src/physx/physxSphericalJointDesc.I | 48 - panda/src/physx/physxSphericalJointDesc.cxx | 215 --- panda/src/physx/physxSphericalJointDesc.h | 66 - panda/src/physx/physxSpringDesc.I | 39 - panda/src/physx/physxSpringDesc.cxx | 68 - panda/src/physx/physxSpringDesc.h | 46 - panda/src/physx/physxTriangleMesh.I | 47 - panda/src/physx/physxTriangleMesh.cxx | 66 - panda/src/physx/physxTriangleMesh.h | 71 - panda/src/physx/physxTriangleMeshDesc.I | 59 - panda/src/physx/physxTriangleMeshDesc.cxx | 191 -- panda/src/physx/physxTriangleMeshDesc.h | 56 - panda/src/physx/physxTriangleMeshShape.I | 28 - panda/src/physx/physxTriangleMeshShape.cxx | 56 - panda/src/physx/physxTriangleMeshShape.h | 67 - panda/src/physx/physxTriangleMeshShapeDesc.I | 48 - .../src/physx/physxTriangleMeshShapeDesc.cxx | 24 - panda/src/physx/physxTriangleMeshShapeDesc.h | 45 - panda/src/physx/physxTriggerReport.I | 29 - panda/src/physx/physxTriggerReport.cxx | 83 - panda/src/physx/physxTriggerReport.h | 44 - panda/src/physx/physxUtilLib.I | 30 - panda/src/physx/physxUtilLib.cxx | 858 --------- panda/src/physx/physxUtilLib.h | 123 -- panda/src/physx/physxVehicle.I | 47 - panda/src/physx/physxVehicle.cxx | 94 - panda/src/physx/physxVehicle.h | 83 - panda/src/physx/physxVehicleDesc.I | 47 - panda/src/physx/physxVehicleDesc.cxx | 25 - panda/src/physx/physxVehicleDesc.h | 38 - panda/src/physx/physxWheel.I | 47 - panda/src/physx/physxWheel.cxx | 72 - panda/src/physx/physxWheel.h | 72 - panda/src/physx/physxWheelDesc.I | 49 - panda/src/physx/physxWheelDesc.cxx | 25 - panda/src/physx/physxWheelDesc.h | 39 - panda/src/physx/physxWheelShape.I | 28 - panda/src/physx/physxWheelShape.cxx | 267 --- panda/src/physx/physxWheelShape.h | 116 -- panda/src/physx/physxWheelShapeDesc.I | 38 - panda/src/physx/physxWheelShapeDesc.cxx | 178 -- panda/src/physx/physxWheelShapeDesc.h | 61 - panda/src/physx/physx_includes.h | 63 - 392 files changed, 1 insertion(+), 36523 deletions(-) delete mode 100644 panda/metalibs/pandaphysx/pandaphysx.cxx delete mode 100644 panda/metalibs/pandaphysx/pandaphysx.h delete mode 100644 panda/src/physx/config_physx.cxx delete mode 100644 panda/src/physx/config_physx.h delete mode 100644 panda/src/physx/p3physx_composite.cxx delete mode 100644 panda/src/physx/physxActor.I delete mode 100644 panda/src/physx/physxActor.cxx delete mode 100644 panda/src/physx/physxActor.h delete mode 100644 panda/src/physx/physxActorDesc.I delete mode 100644 panda/src/physx/physxActorDesc.cxx delete mode 100644 panda/src/physx/physxActorDesc.h delete mode 100644 panda/src/physx/physxBodyDesc.I delete mode 100644 panda/src/physx/physxBodyDesc.cxx delete mode 100644 panda/src/physx/physxBodyDesc.h delete mode 100644 panda/src/physx/physxBounds3.I delete mode 100644 panda/src/physx/physxBounds3.cxx delete mode 100644 panda/src/physx/physxBounds3.h delete mode 100644 panda/src/physx/physxBox.I delete mode 100644 panda/src/physx/physxBox.cxx delete mode 100644 panda/src/physx/physxBox.h delete mode 100644 panda/src/physx/physxBoxController.I delete mode 100644 panda/src/physx/physxBoxController.cxx delete mode 100644 panda/src/physx/physxBoxController.h delete mode 100644 panda/src/physx/physxBoxControllerDesc.I delete mode 100644 panda/src/physx/physxBoxControllerDesc.cxx delete mode 100644 panda/src/physx/physxBoxControllerDesc.h delete mode 100644 panda/src/physx/physxBoxForceFieldShape.I delete mode 100644 panda/src/physx/physxBoxForceFieldShape.cxx delete mode 100644 panda/src/physx/physxBoxForceFieldShape.h delete mode 100644 panda/src/physx/physxBoxForceFieldShapeDesc.I delete mode 100644 panda/src/physx/physxBoxForceFieldShapeDesc.cxx delete mode 100644 panda/src/physx/physxBoxForceFieldShapeDesc.h delete mode 100644 panda/src/physx/physxBoxShape.I delete mode 100644 panda/src/physx/physxBoxShape.cxx delete mode 100644 panda/src/physx/physxBoxShape.h delete mode 100644 panda/src/physx/physxBoxShapeDesc.I delete mode 100644 panda/src/physx/physxBoxShapeDesc.cxx delete mode 100644 panda/src/physx/physxBoxShapeDesc.h delete mode 100644 panda/src/physx/physxCapsule.I delete mode 100644 panda/src/physx/physxCapsule.cxx delete mode 100644 panda/src/physx/physxCapsule.h delete mode 100644 panda/src/physx/physxCapsuleController.I delete mode 100644 panda/src/physx/physxCapsuleController.cxx delete mode 100644 panda/src/physx/physxCapsuleController.h delete mode 100644 panda/src/physx/physxCapsuleControllerDesc.I delete mode 100644 panda/src/physx/physxCapsuleControllerDesc.cxx delete mode 100644 panda/src/physx/physxCapsuleControllerDesc.h delete mode 100644 panda/src/physx/physxCapsuleForceFieldShape.I delete mode 100644 panda/src/physx/physxCapsuleForceFieldShape.cxx delete mode 100644 panda/src/physx/physxCapsuleForceFieldShape.h delete mode 100644 panda/src/physx/physxCapsuleForceFieldShapeDesc.I delete mode 100644 panda/src/physx/physxCapsuleForceFieldShapeDesc.cxx delete mode 100644 panda/src/physx/physxCapsuleForceFieldShapeDesc.h delete mode 100644 panda/src/physx/physxCapsuleShape.I delete mode 100644 panda/src/physx/physxCapsuleShape.cxx delete mode 100644 panda/src/physx/physxCapsuleShape.h delete mode 100644 panda/src/physx/physxCapsuleShapeDesc.I delete mode 100644 panda/src/physx/physxCapsuleShapeDesc.cxx delete mode 100644 panda/src/physx/physxCapsuleShapeDesc.h delete mode 100644 panda/src/physx/physxCcdSkeleton.I delete mode 100644 panda/src/physx/physxCcdSkeleton.cxx delete mode 100644 panda/src/physx/physxCcdSkeleton.h delete mode 100644 panda/src/physx/physxCcdSkeletonDesc.I delete mode 100644 panda/src/physx/physxCcdSkeletonDesc.cxx delete mode 100644 panda/src/physx/physxCcdSkeletonDesc.h delete mode 100644 panda/src/physx/physxCloth.I delete mode 100644 panda/src/physx/physxCloth.cxx delete mode 100644 panda/src/physx/physxCloth.h delete mode 100644 panda/src/physx/physxClothDesc.I delete mode 100644 panda/src/physx/physxClothDesc.cxx delete mode 100644 panda/src/physx/physxClothDesc.h delete mode 100644 panda/src/physx/physxClothMesh.I delete mode 100644 panda/src/physx/physxClothMesh.cxx delete mode 100644 panda/src/physx/physxClothMesh.h delete mode 100644 panda/src/physx/physxClothMeshDesc.I delete mode 100644 panda/src/physx/physxClothMeshDesc.cxx delete mode 100644 panda/src/physx/physxClothMeshDesc.h delete mode 100644 panda/src/physx/physxClothNode.I delete mode 100644 panda/src/physx/physxClothNode.cxx delete mode 100644 panda/src/physx/physxClothNode.h delete mode 100644 panda/src/physx/physxConstraintDominance.I delete mode 100644 panda/src/physx/physxConstraintDominance.cxx delete mode 100644 panda/src/physx/physxConstraintDominance.h delete mode 100644 panda/src/physx/physxContactPair.I delete mode 100644 panda/src/physx/physxContactPair.cxx delete mode 100644 panda/src/physx/physxContactPair.h delete mode 100644 panda/src/physx/physxContactPoint.I delete mode 100644 panda/src/physx/physxContactPoint.cxx delete mode 100644 panda/src/physx/physxContactPoint.h delete mode 100644 panda/src/physx/physxContactReport.I delete mode 100644 panda/src/physx/physxContactReport.cxx delete mode 100644 panda/src/physx/physxContactReport.h delete mode 100644 panda/src/physx/physxController.I delete mode 100644 panda/src/physx/physxController.cxx delete mode 100644 panda/src/physx/physxController.h delete mode 100644 panda/src/physx/physxControllerDesc.I delete mode 100644 panda/src/physx/physxControllerDesc.cxx delete mode 100644 panda/src/physx/physxControllerDesc.h delete mode 100644 panda/src/physx/physxControllerReport.I delete mode 100644 panda/src/physx/physxControllerReport.cxx delete mode 100644 panda/src/physx/physxControllerReport.h delete mode 100644 panda/src/physx/physxControllerShapeHit.I delete mode 100644 panda/src/physx/physxControllerShapeHit.cxx delete mode 100644 panda/src/physx/physxControllerShapeHit.h delete mode 100644 panda/src/physx/physxControllersHit.I delete mode 100644 panda/src/physx/physxControllersHit.cxx delete mode 100644 panda/src/physx/physxControllersHit.h delete mode 100644 panda/src/physx/physxConvexForceFieldShape.I delete mode 100644 panda/src/physx/physxConvexForceFieldShape.cxx delete mode 100644 panda/src/physx/physxConvexForceFieldShape.h delete mode 100644 panda/src/physx/physxConvexForceFieldShapeDesc.I delete mode 100644 panda/src/physx/physxConvexForceFieldShapeDesc.cxx delete mode 100644 panda/src/physx/physxConvexForceFieldShapeDesc.h delete mode 100644 panda/src/physx/physxConvexMesh.I delete mode 100644 panda/src/physx/physxConvexMesh.cxx delete mode 100644 panda/src/physx/physxConvexMesh.h delete mode 100644 panda/src/physx/physxConvexMeshDesc.I delete mode 100644 panda/src/physx/physxConvexMeshDesc.cxx delete mode 100644 panda/src/physx/physxConvexMeshDesc.h delete mode 100644 panda/src/physx/physxConvexShape.I delete mode 100644 panda/src/physx/physxConvexShape.cxx delete mode 100644 panda/src/physx/physxConvexShape.h delete mode 100644 panda/src/physx/physxConvexShapeDesc.I delete mode 100644 panda/src/physx/physxConvexShapeDesc.cxx delete mode 100644 panda/src/physx/physxConvexShapeDesc.h delete mode 100644 panda/src/physx/physxCylindricalJoint.I delete mode 100644 panda/src/physx/physxCylindricalJoint.cxx delete mode 100644 panda/src/physx/physxCylindricalJoint.h delete mode 100644 panda/src/physx/physxCylindricalJointDesc.I delete mode 100644 panda/src/physx/physxCylindricalJointDesc.cxx delete mode 100644 panda/src/physx/physxCylindricalJointDesc.h delete mode 100644 panda/src/physx/physxD6Joint.I delete mode 100644 panda/src/physx/physxD6Joint.cxx delete mode 100644 panda/src/physx/physxD6Joint.h delete mode 100644 panda/src/physx/physxD6JointDesc.I delete mode 100644 panda/src/physx/physxD6JointDesc.cxx delete mode 100644 panda/src/physx/physxD6JointDesc.h delete mode 100644 panda/src/physx/physxDebugGeomNode.I delete mode 100644 panda/src/physx/physxDebugGeomNode.cxx delete mode 100644 panda/src/physx/physxDebugGeomNode.h delete mode 100644 panda/src/physx/physxDistanceJoint.I delete mode 100644 panda/src/physx/physxDistanceJoint.cxx delete mode 100644 panda/src/physx/physxDistanceJoint.h delete mode 100644 panda/src/physx/physxDistanceJointDesc.I delete mode 100644 panda/src/physx/physxDistanceJointDesc.cxx delete mode 100644 panda/src/physx/physxDistanceJointDesc.h delete mode 100644 panda/src/physx/physxEnums.cxx delete mode 100644 panda/src/physx/physxEnums.h delete mode 100644 panda/src/physx/physxFileStream.cxx delete mode 100644 panda/src/physx/physxFileStream.h delete mode 100644 panda/src/physx/physxFixedJoint.I delete mode 100644 panda/src/physx/physxFixedJoint.cxx delete mode 100644 panda/src/physx/physxFixedJoint.h delete mode 100644 panda/src/physx/physxFixedJointDesc.I delete mode 100644 panda/src/physx/physxFixedJointDesc.cxx delete mode 100644 panda/src/physx/physxFixedJointDesc.h delete mode 100644 panda/src/physx/physxForceField.I delete mode 100644 panda/src/physx/physxForceField.cxx delete mode 100644 panda/src/physx/physxForceField.h delete mode 100644 panda/src/physx/physxForceFieldDesc.I delete mode 100644 panda/src/physx/physxForceFieldDesc.cxx delete mode 100644 panda/src/physx/physxForceFieldDesc.h delete mode 100644 panda/src/physx/physxForceFieldShape.I delete mode 100644 panda/src/physx/physxForceFieldShape.cxx delete mode 100644 panda/src/physx/physxForceFieldShape.h delete mode 100644 panda/src/physx/physxForceFieldShapeDesc.I delete mode 100644 panda/src/physx/physxForceFieldShapeDesc.cxx delete mode 100644 panda/src/physx/physxForceFieldShapeDesc.h delete mode 100644 panda/src/physx/physxForceFieldShapeGroup.I delete mode 100644 panda/src/physx/physxForceFieldShapeGroup.cxx delete mode 100644 panda/src/physx/physxForceFieldShapeGroup.h delete mode 100644 panda/src/physx/physxForceFieldShapeGroupDesc.I delete mode 100644 panda/src/physx/physxForceFieldShapeGroupDesc.cxx delete mode 100644 panda/src/physx/physxForceFieldShapeGroupDesc.h delete mode 100644 panda/src/physx/physxGroupsMask.I delete mode 100644 panda/src/physx/physxGroupsMask.cxx delete mode 100644 panda/src/physx/physxGroupsMask.h delete mode 100644 panda/src/physx/physxHeightField.I delete mode 100644 panda/src/physx/physxHeightField.cxx delete mode 100644 panda/src/physx/physxHeightField.h delete mode 100644 panda/src/physx/physxHeightFieldDesc.I delete mode 100644 panda/src/physx/physxHeightFieldDesc.cxx delete mode 100644 panda/src/physx/physxHeightFieldDesc.h delete mode 100644 panda/src/physx/physxHeightFieldShape.I delete mode 100644 panda/src/physx/physxHeightFieldShape.cxx delete mode 100644 panda/src/physx/physxHeightFieldShape.h delete mode 100644 panda/src/physx/physxHeightFieldShapeDesc.I delete mode 100644 panda/src/physx/physxHeightFieldShapeDesc.cxx delete mode 100644 panda/src/physx/physxHeightFieldShapeDesc.h delete mode 100644 panda/src/physx/physxJoint.I delete mode 100644 panda/src/physx/physxJoint.cxx delete mode 100644 panda/src/physx/physxJoint.h delete mode 100644 panda/src/physx/physxJointDesc.I delete mode 100644 panda/src/physx/physxJointDesc.cxx delete mode 100644 panda/src/physx/physxJointDesc.h delete mode 100644 panda/src/physx/physxJointDriveDesc.I delete mode 100644 panda/src/physx/physxJointDriveDesc.cxx delete mode 100644 panda/src/physx/physxJointDriveDesc.h delete mode 100644 panda/src/physx/physxJointLimitDesc.I delete mode 100644 panda/src/physx/physxJointLimitDesc.cxx delete mode 100644 panda/src/physx/physxJointLimitDesc.h delete mode 100644 panda/src/physx/physxJointLimitSoftDesc.I delete mode 100644 panda/src/physx/physxJointLimitSoftDesc.cxx delete mode 100644 panda/src/physx/physxJointLimitSoftDesc.h delete mode 100644 panda/src/physx/physxKitchen.I delete mode 100644 panda/src/physx/physxKitchen.cxx delete mode 100644 panda/src/physx/physxKitchen.h delete mode 100644 panda/src/physx/physxLinearInterpolationValues.I delete mode 100644 panda/src/physx/physxLinearInterpolationValues.cxx delete mode 100644 panda/src/physx/physxLinearInterpolationValues.h delete mode 100644 panda/src/physx/physxManager.I delete mode 100644 panda/src/physx/physxManager.cxx delete mode 100644 panda/src/physx/physxManager.h delete mode 100644 panda/src/physx/physxMask.I delete mode 100644 panda/src/physx/physxMask.cxx delete mode 100644 panda/src/physx/physxMask.h delete mode 100644 panda/src/physx/physxMaterial.I delete mode 100644 panda/src/physx/physxMaterial.cxx delete mode 100644 panda/src/physx/physxMaterial.h delete mode 100644 panda/src/physx/physxMaterialDesc.I delete mode 100644 panda/src/physx/physxMaterialDesc.cxx delete mode 100644 panda/src/physx/physxMaterialDesc.h delete mode 100644 panda/src/physx/physxMemoryReadBuffer.cxx delete mode 100644 panda/src/physx/physxMemoryReadBuffer.h delete mode 100644 panda/src/physx/physxMemoryWriteBuffer.cxx delete mode 100644 panda/src/physx/physxMemoryWriteBuffer.h delete mode 100644 panda/src/physx/physxMeshHash.I delete mode 100644 panda/src/physx/physxMeshHash.cxx delete mode 100644 panda/src/physx/physxMeshHash.h delete mode 100644 panda/src/physx/physxMeshPool.I delete mode 100644 panda/src/physx/physxMeshPool.cxx delete mode 100644 panda/src/physx/physxMeshPool.h delete mode 100644 panda/src/physx/physxMotorDesc.I delete mode 100644 panda/src/physx/physxMotorDesc.cxx delete mode 100644 panda/src/physx/physxMotorDesc.h delete mode 100644 panda/src/physx/physxObject.I delete mode 100644 panda/src/physx/physxObject.cxx delete mode 100644 panda/src/physx/physxObject.h delete mode 100644 panda/src/physx/physxObjectCollection.I delete mode 100644 panda/src/physx/physxObjectCollection.cxx delete mode 100644 panda/src/physx/physxObjectCollection.h delete mode 100644 panda/src/physx/physxOverlapReport.I delete mode 100644 panda/src/physx/physxOverlapReport.cxx delete mode 100644 panda/src/physx/physxOverlapReport.h delete mode 100644 panda/src/physx/physxPlane.I delete mode 100644 panda/src/physx/physxPlane.cxx delete mode 100644 panda/src/physx/physxPlane.h delete mode 100644 panda/src/physx/physxPlaneShape.I delete mode 100644 panda/src/physx/physxPlaneShape.cxx delete mode 100644 panda/src/physx/physxPlaneShape.h delete mode 100644 panda/src/physx/physxPlaneShapeDesc.I delete mode 100644 panda/src/physx/physxPlaneShapeDesc.cxx delete mode 100644 panda/src/physx/physxPlaneShapeDesc.h delete mode 100644 panda/src/physx/physxPointInPlaneJoint.I delete mode 100644 panda/src/physx/physxPointInPlaneJoint.cxx delete mode 100644 panda/src/physx/physxPointInPlaneJoint.h delete mode 100644 panda/src/physx/physxPointInPlaneJointDesc.I delete mode 100644 panda/src/physx/physxPointInPlaneJointDesc.cxx delete mode 100644 panda/src/physx/physxPointInPlaneJointDesc.h delete mode 100644 panda/src/physx/physxPointOnLineJoint.I delete mode 100644 panda/src/physx/physxPointOnLineJoint.cxx delete mode 100644 panda/src/physx/physxPointOnLineJoint.h delete mode 100644 panda/src/physx/physxPointOnLineJointDesc.I delete mode 100644 panda/src/physx/physxPointOnLineJointDesc.cxx delete mode 100644 panda/src/physx/physxPointOnLineJointDesc.h delete mode 100644 panda/src/physx/physxPrismaticJoint.I delete mode 100644 panda/src/physx/physxPrismaticJoint.cxx delete mode 100644 panda/src/physx/physxPrismaticJoint.h delete mode 100644 panda/src/physx/physxPrismaticJointDesc.I delete mode 100644 panda/src/physx/physxPrismaticJointDesc.cxx delete mode 100644 panda/src/physx/physxPrismaticJointDesc.h delete mode 100644 panda/src/physx/physxPulleyJoint.I delete mode 100644 panda/src/physx/physxPulleyJoint.cxx delete mode 100644 panda/src/physx/physxPulleyJoint.h delete mode 100644 panda/src/physx/physxPulleyJointDesc.I delete mode 100644 panda/src/physx/physxPulleyJointDesc.cxx delete mode 100644 panda/src/physx/physxPulleyJointDesc.h delete mode 100644 panda/src/physx/physxRay.I delete mode 100644 panda/src/physx/physxRay.cxx delete mode 100644 panda/src/physx/physxRay.h delete mode 100644 panda/src/physx/physxRaycastHit.I delete mode 100644 panda/src/physx/physxRaycastHit.cxx delete mode 100644 panda/src/physx/physxRaycastHit.h delete mode 100644 panda/src/physx/physxRaycastReport.I delete mode 100644 panda/src/physx/physxRaycastReport.cxx delete mode 100644 panda/src/physx/physxRaycastReport.h delete mode 100644 panda/src/physx/physxRevoluteJoint.I delete mode 100644 panda/src/physx/physxRevoluteJoint.cxx delete mode 100644 panda/src/physx/physxRevoluteJoint.h delete mode 100644 panda/src/physx/physxRevoluteJointDesc.I delete mode 100644 panda/src/physx/physxRevoluteJointDesc.cxx delete mode 100644 panda/src/physx/physxRevoluteJointDesc.h delete mode 100644 panda/src/physx/physxScene.I delete mode 100644 panda/src/physx/physxScene.cxx delete mode 100644 panda/src/physx/physxScene.h delete mode 100644 panda/src/physx/physxSceneDesc.I delete mode 100644 panda/src/physx/physxSceneDesc.cxx delete mode 100644 panda/src/physx/physxSceneDesc.h delete mode 100644 panda/src/physx/physxSceneStats2.I delete mode 100644 panda/src/physx/physxSceneStats2.cxx delete mode 100644 panda/src/physx/physxSceneStats2.h delete mode 100644 panda/src/physx/physxSegment.I delete mode 100644 panda/src/physx/physxSegment.cxx delete mode 100644 panda/src/physx/physxSegment.h delete mode 100644 panda/src/physx/physxShape.I delete mode 100644 panda/src/physx/physxShape.cxx delete mode 100644 panda/src/physx/physxShape.h delete mode 100644 panda/src/physx/physxShapeDesc.I delete mode 100644 panda/src/physx/physxShapeDesc.cxx delete mode 100644 panda/src/physx/physxShapeDesc.h delete mode 100644 panda/src/physx/physxSoftBody.I delete mode 100644 panda/src/physx/physxSoftBody.cxx delete mode 100644 panda/src/physx/physxSoftBody.h delete mode 100644 panda/src/physx/physxSoftBodyDesc.I delete mode 100644 panda/src/physx/physxSoftBodyDesc.cxx delete mode 100644 panda/src/physx/physxSoftBodyDesc.h delete mode 100644 panda/src/physx/physxSoftBodyMesh.I delete mode 100644 panda/src/physx/physxSoftBodyMesh.cxx delete mode 100644 panda/src/physx/physxSoftBodyMesh.h delete mode 100644 panda/src/physx/physxSoftBodyMeshDesc.I delete mode 100644 panda/src/physx/physxSoftBodyMeshDesc.cxx delete mode 100644 panda/src/physx/physxSoftBodyMeshDesc.h delete mode 100644 panda/src/physx/physxSoftBodyNode.I delete mode 100644 panda/src/physx/physxSoftBodyNode.cxx delete mode 100644 panda/src/physx/physxSoftBodyNode.h delete mode 100644 panda/src/physx/physxSphere.I delete mode 100644 panda/src/physx/physxSphere.cxx delete mode 100644 panda/src/physx/physxSphere.h delete mode 100644 panda/src/physx/physxSphereForceFieldShape.I delete mode 100644 panda/src/physx/physxSphereForceFieldShape.cxx delete mode 100644 panda/src/physx/physxSphereForceFieldShape.h delete mode 100644 panda/src/physx/physxSphereForceFieldShapeDesc.I delete mode 100644 panda/src/physx/physxSphereForceFieldShapeDesc.cxx delete mode 100644 panda/src/physx/physxSphereForceFieldShapeDesc.h delete mode 100644 panda/src/physx/physxSphereShape.I delete mode 100644 panda/src/physx/physxSphereShape.cxx delete mode 100644 panda/src/physx/physxSphereShape.h delete mode 100644 panda/src/physx/physxSphereShapeDesc.I delete mode 100644 panda/src/physx/physxSphereShapeDesc.cxx delete mode 100644 panda/src/physx/physxSphereShapeDesc.h delete mode 100644 panda/src/physx/physxSphericalJoint.I delete mode 100644 panda/src/physx/physxSphericalJoint.cxx delete mode 100644 panda/src/physx/physxSphericalJoint.h delete mode 100644 panda/src/physx/physxSphericalJointDesc.I delete mode 100644 panda/src/physx/physxSphericalJointDesc.cxx delete mode 100644 panda/src/physx/physxSphericalJointDesc.h delete mode 100644 panda/src/physx/physxSpringDesc.I delete mode 100644 panda/src/physx/physxSpringDesc.cxx delete mode 100644 panda/src/physx/physxSpringDesc.h delete mode 100644 panda/src/physx/physxTriangleMesh.I delete mode 100644 panda/src/physx/physxTriangleMesh.cxx delete mode 100644 panda/src/physx/physxTriangleMesh.h delete mode 100644 panda/src/physx/physxTriangleMeshDesc.I delete mode 100644 panda/src/physx/physxTriangleMeshDesc.cxx delete mode 100644 panda/src/physx/physxTriangleMeshDesc.h delete mode 100644 panda/src/physx/physxTriangleMeshShape.I delete mode 100644 panda/src/physx/physxTriangleMeshShape.cxx delete mode 100644 panda/src/physx/physxTriangleMeshShape.h delete mode 100644 panda/src/physx/physxTriangleMeshShapeDesc.I delete mode 100644 panda/src/physx/physxTriangleMeshShapeDesc.cxx delete mode 100644 panda/src/physx/physxTriangleMeshShapeDesc.h delete mode 100644 panda/src/physx/physxTriggerReport.I delete mode 100644 panda/src/physx/physxTriggerReport.cxx delete mode 100644 panda/src/physx/physxTriggerReport.h delete mode 100644 panda/src/physx/physxUtilLib.I delete mode 100644 panda/src/physx/physxUtilLib.cxx delete mode 100644 panda/src/physx/physxUtilLib.h delete mode 100644 panda/src/physx/physxVehicle.I delete mode 100644 panda/src/physx/physxVehicle.cxx delete mode 100644 panda/src/physx/physxVehicle.h delete mode 100644 panda/src/physx/physxVehicleDesc.I delete mode 100644 panda/src/physx/physxVehicleDesc.cxx delete mode 100644 panda/src/physx/physxVehicleDesc.h delete mode 100644 panda/src/physx/physxWheel.I delete mode 100644 panda/src/physx/physxWheel.cxx delete mode 100644 panda/src/physx/physxWheel.h delete mode 100644 panda/src/physx/physxWheelDesc.I delete mode 100644 panda/src/physx/physxWheelDesc.cxx delete mode 100644 panda/src/physx/physxWheelDesc.h delete mode 100644 panda/src/physx/physxWheelShape.I delete mode 100644 panda/src/physx/physxWheelShape.cxx delete mode 100644 panda/src/physx/physxWheelShape.h delete mode 100644 panda/src/physx/physxWheelShapeDesc.I delete mode 100644 panda/src/physx/physxWheelShapeDesc.cxx delete mode 100644 panda/src/physx/physxWheelShapeDesc.h delete mode 100644 panda/src/physx/physx_includes.h diff --git a/doc/INSTALL b/doc/INSTALL index bbeca24ec7..5ca37886bc 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -146,7 +146,6 @@ it will show you the available command-line options: --use-swscale --no-swscale (enable/disable use of SWSCALE) --use-swresample --no-swresample (enable/disable use of SWRESAMPLE) --use-ode --no-ode (enable/disable use of ODE) - --use-physx --no-physx (enable/disable use of PHYSX) --use-bullet --no-bullet (enable/disable use of BULLET) --use-pandaphysics --no-pandaphysics (enable/disable use of PANDAPHYSICS) --use-speedtree --no-speedtree (enable/disable use of SPEEDTREE) diff --git a/makepanda/installer.nsi b/makepanda/installer.nsi index 767eee58b2..3ad99e7875 100644 --- a/makepanda/installer.nsi +++ b/makepanda/installer.nsi @@ -78,7 +78,6 @@ LangString DESC_SecFMOD ${LANG_ENGLISH} "Support for decoding and playing audio LangString DESC_SecFFMpeg ${LANG_ENGLISH} "Support for decoding video and audio via the FFMpeg library. Without this option, Panda3D will only be able to play .wav and .ogg audio files." LangString DESC_SecBullet ${LANG_ENGLISH} "Support for the Bullet physics engine." LangString DESC_SecODE ${LANG_ENGLISH} "Support for the Open Dynamics Engine to implement physics." -LangString DESC_SecPhysX ${LANG_ENGLISH} "Support for NVIDIA PhysX to implement physics." LangString DESC_SecTools ${LANG_ENGLISH} "Useful tools and model converters to help with Panda3D development. Recommended." LangString DESC_SecGroupPython ${LANG_ENGLISH} "Contains modules that provide Python support for Panda3D." LangString DESC_SecPyShared ${LANG_ENGLISH} "Contains the common Python code used by the Panda3D Python bindings." @@ -114,7 +113,6 @@ var MANPAGE !insertmacro !defineifexist HAVE_FFMPEG "${BUILT}\bin\libp3ffmpeg.dll" !insertmacro !defineifexist HAVE_BULLET "${BUILT}\bin\libpandabullet.dll" !insertmacro !defineifexist HAVE_ODE "${BUILT}\bin\libpandaode.dll" -!insertmacro !defineifexist HAVE_PHYSX "${BUILT}\bin\libpandaphysx.dll" !insertmacro !defineifexist HAVE_SAMPLES "${SOURCE}\samples" !insertmacro !defineifexist HAVE_MAX_PLUGINS "${BUILT}\plugins\*.dlo" !insertmacro !defineifexist HAVE_MAYA_PLUGINS "${BUILT}\plugins\*.mll" @@ -172,14 +170,6 @@ var MANPAGE SkipODEPyd: !endif - !ifdef HAVE_PHYSX - SectionGetFlags ${SecPhysX} $R0 - IntOp $R0 $R0 & ${SF_SELECTED} - StrCmp $R0 ${SF_SELECTED} 0 SkipPhysXPyd - File /nonfatal /r "${BUILT}\panda3d\physx${EXT_SUFFIX}" - SkipPhysXPyd: - !endif - SetOutPath $INSTDIR\pandac\input File /r "${BUILT}\pandac\input\*" SetOutPath $INSTDIR\Pmw @@ -319,19 +309,6 @@ SectionGroup "Panda3D Libraries" File "${BUILT}\bin\libpandaode.dll" SectionEnd !endif - - !ifdef HAVE_PHYSX - Section "NVIDIA PhysX" SecPhysX - ; Only enable in "Full" - SectionIn 2 - - SetOutPath "$INSTDIR\bin" - File "${BUILT}\bin\libpandaphysx.dll" - File /nonfatal /r "${BUILT}\bin\PhysX*.dll" - File /nonfatal /r "${BUILT}\bin\NxCharacter*.dll" - File /nonfatal /r "${BUILT}\bin\cudart*.dll" - SectionEnd - !endif SectionGroupEnd Section "Tools and utilities" SecTools @@ -892,9 +869,6 @@ SectionEnd !ifdef HAVE_ODE !insertmacro MUI_DESCRIPTION_TEXT ${SecODE} $(DESC_SecODE) !endif - !ifdef HAVE_PHYSX - !insertmacro MUI_DESCRIPTION_TEXT ${SecPhysX} $(DESC_SecPhysX) - !endif !insertmacro MUI_DESCRIPTION_TEXT ${SecTools} $(DESC_SecTools) !insertmacro MUI_DESCRIPTION_TEXT ${SecGroupPython} $(DESC_SecGroupPython) !insertmacro MUI_DESCRIPTION_TEXT ${SecPyShared} $(DESC_SecPyShared) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index f379ee2541..5de275d9d6 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -75,7 +75,7 @@ PkgListSet(["PYTHON", "DIRECT", # Python support "EIGEN", # Linear algebra acceleration "OPENAL", "FMODEX", # Audio playback "VORBIS", "OPUS", "FFMPEG", "SWSCALE", "SWRESAMPLE", # Audio decoding - "ODE", "PHYSX", "BULLET", "PANDAPHYSICS", # Physics + "ODE", "BULLET", "PANDAPHYSICS", # Physics "SPEEDTREE", # SpeedTree "ZLIB", "PNG", "JPEG", "TIFF", "OPENEXR", "SQUISH", # 2D Formats support ] + MAYAVERSIONS + MAXVERSIONS + [ "FCOLLADA", "ASSIMP", "EGG", # 3D Formats support @@ -464,14 +464,12 @@ SdkLocateMax() SdkLocateMacOSX(OSXTARGET) SdkLocatePython(False) SdkLocateWindows(WINDOWS_SDK) -SdkLocatePhysX() SdkLocateSpeedTree() SdkLocateAndroid() SdkAutoDisableDirectX() SdkAutoDisableMaya() SdkAutoDisableMax() -SdkAutoDisablePhysX() SdkAutoDisableSpeedTree() if not PkgSkip("PYTHON") and SDK["PYTHONVERSION"] == "python2.7": @@ -707,20 +705,6 @@ if (COMPILER == "MSVC"): LibName(pkg, SDK[pkg] + '/lib/mesh.lib') LibName(pkg, SDK[pkg] + '/lib/maxutil.lib') LibName(pkg, SDK[pkg] + '/lib/paramblk2.lib') - if (PkgSkip("PHYSX")==0): - if GetTargetArch() == 'x64': - LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader64.lib") - LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter64.lib") - else: - LibName("PHYSX", SDK["PHYSXLIBS"] + "/PhysXLoader.lib") - LibName("PHYSX", SDK["PHYSXLIBS"] + "/NxCharacter.lib") - - IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include") if (PkgSkip("SPEEDTREE")==0): if GetTargetArch() == 'x64': @@ -959,21 +943,6 @@ if (COMPILER=="GCC"): else: LibName(pkg, "-dylib_file /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") - if (PkgSkip("PHYSX")==0): - IncDirectory("PHYSX", SDK["PHYSX"] + "/Physics/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/PhysXLoader/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/NxCharacter/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/NxExtensions/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/Foundation/include") - IncDirectory("PHYSX", SDK["PHYSX"] + "/Cooking/include") - LibDirectory("PHYSX", SDK["PHYSXLIBS"]) - if (GetHost() == "darwin"): - LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCooking.a") - LibName("PHYSX", SDK["PHYSXLIBS"] + "/osxstatic/PhysXCore.a") - else: - LibName("PHYSX", "-lPhysXLoader") - LibName("PHYSX", "-lNxCharacter") - DefSymbol("WITHINPANDA", "WITHIN_PANDA", "1") if GetLinkAllStatic(): DefSymbol("ALWAYS", "LINK_ALL_STATIC") @@ -3045,10 +3014,6 @@ CopyAllHeaders('panda/metalibs/pandagles2') CopyAllHeaders('panda/metalibs/pandaphysics') CopyAllHeaders('panda/src/testbed') -if (PkgSkip("PHYSX")==0): - CopyAllHeaders('panda/src/physx') - CopyAllHeaders('panda/metalibs/pandaphysx') - if (PkgSkip("BULLET")==0): CopyAllHeaders('panda/src/bullet') CopyAllHeaders('panda/metalibs/pandabullet') @@ -4562,44 +4527,6 @@ if (PkgSkip("BULLET")==0): PyTargetAdd('bullet.pyd', input=COMMON_PANDA_LIBS) PyTargetAdd('bullet.pyd', opts=['WINUSER', 'BULLET']) -# -# DIRECTORY: panda/src/physx/ -# - -if (PkgSkip("PHYSX")==0): - OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX'] - TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx') - - OPTS=['DIR:panda/src/physx', 'PHYSX'] - IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"]) - TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES) - TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx']) - -# -# DIRECTORY: panda/metalibs/pandaphysx/ -# - -if (PkgSkip("PHYSX")==0): - OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'PYTHON'] - TargetAdd('pandaphysx_pandaphysx.obj', opts=OPTS, input='pandaphysx.cxx') - - TargetAdd('libpandaphysx.dll', input='pandaphysx_pandaphysx.obj') - TargetAdd('libpandaphysx.dll', input='p3physx_composite.obj') - TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'PYTHON']) - - OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX'] - PyTargetAdd('physx_module.obj', input='libpandaphysx.in') - PyTargetAdd('physx_module.obj', opts=OPTS) - PyTargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core']) - - PyTargetAdd('physx.pyd', input='physx_module.obj') - PyTargetAdd('physx.pyd', input='libpandaphysx_igate.obj') - PyTargetAdd('physx.pyd', input='libpandaphysx.dll') - PyTargetAdd('physx.pyd', input='libp3interrogatedb.dll') - PyTargetAdd('physx.pyd', input=COMMON_PANDA_LIBS) - PyTargetAdd('physx.pyd', opts=['WINUSER', 'PHYSX']) - # # DIRECTORY: panda/src/physics/ # diff --git a/makepanda/makepanda.vcproj b/makepanda/makepanda.vcproj index 06b9cd8f07..288a50784d 100644 --- a/makepanda/makepanda.vcproj +++ b/makepanda/makepanda.vcproj @@ -3125,362 +3125,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 085b911bc3..9e8902768d 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -2407,50 +2407,6 @@ def SdkLocateMacOSX(osxtarget = None): else: SDK["MACOSX"] = "" -# Latest first -PHYSXVERSIONINFO = [ - ("PHYSX284", "v2.8.4"), - ("PHYSX283", "v2.8.3"), - ("PHYSX281", "v2.8.1"), -] - -def SdkLocatePhysX(): - # First check for a physx directory in sdks. - dir = GetSdkDir("physx") - if (dir and os.path.isdir(dir)): - SDK["PHYSX"] = dir - SDK["PHYSXLIBS"] = dir + "/lib" - return - - if CrossCompiling(): - return - - # Try to find a PhysX installation on the system. - for (ver, key) in PHYSXVERSIONINFO: - if (GetHost() == "windows"): - folders = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\Folders" - for folder in ListRegistryValues(folders): - if folder.endswith("NVIDIA PhysX SDK\\%s\\SDKs\\" % key) or \ - folder.endswith("NVIDIA PhysX SDK\\%s_win\\SDKs\\" % key): - - SDK["PHYSX"] = folder - if GetTargetArch() == 'x64': - SDK["PHYSXLIBS"] = folder + "/lib/win64" - AddToPathEnv("PATH", folder + "/../Bin/win64/") - else: - SDK["PHYSXLIBS"] = folder + "/lib/win32" - AddToPathEnv("PATH", folder + "/../Bin/win32/") - - return - - elif (GetHost() == "linux"): - incpath = "/usr/include/PhysX/%s/SDKs" % key - libpath = "/usr/lib/PhysX/%s" % key - if (os.path.isdir(incpath) and os.path.isdir(libpath)): - SDK["PHYSX"] = incpath - SDK["PHYSXLIBS"] = libpath - return - def SdkLocateSpeedTree(): # Look for all of the SpeedTree SDK directories within the # sdks/win32/speedtree dir, and pick the highest-numbered one. @@ -2661,12 +2617,6 @@ def SdkAutoDisableMax(): WARNINGS.append("I have automatically added this command-line option: --no-"+version.lower()) PkgDisable(version) -def SdkAutoDisablePhysX(): - if ("PHYSX" not in SDK) and (PkgSkip("PHYSX")==0): - PkgDisable("PHYSX") - WARNINGS.append("I cannot locate SDK for PhysX") - WARNINGS.append("I have automatically added this command-line option: --no-physx") - def SdkAutoDisableSpeedTree(): if ("SPEEDTREE" not in SDK) and (PkgSkip("SPEEDTREE")==0): PkgDisable("SPEEDTREE") diff --git a/panda/metalibs/pandaphysx/pandaphysx.cxx b/panda/metalibs/pandaphysx/pandaphysx.cxx deleted file mode 100644 index 3e505f1d7d..0000000000 --- a/panda/metalibs/pandaphysx/pandaphysx.cxx +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @file pandaphysx.cxx - * @author pratt - * @date 2006-04-20 - */ - -#include "pandaphysx.h" -#include "config_physx.h" - -/** - * Initializes the library. This must be called at least once before any of - * the functions or classes in this library can be used. Normally it will be - * called by the static initializers and need not be called explicitly, but - * special cases exist. - */ -void -init_libpandaphysx() { - init_libphysx(); -} diff --git a/panda/metalibs/pandaphysx/pandaphysx.h b/panda/metalibs/pandaphysx/pandaphysx.h deleted file mode 100644 index 13de6c3c79..0000000000 --- a/panda/metalibs/pandaphysx/pandaphysx.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * @file pandaphysx.h - * @author pratt - * @date 2006-04-20 - */ - -#ifndef PANDAPHYSX_H -#define PANDAPHYSX_H - -#include "pandabase.h" - -EXPCL_PANDAPHYSX void init_libpandaphysx(); - -#endif diff --git a/panda/src/pandabase/pandasymbols.h b/panda/src/pandabase/pandasymbols.h index 9a8ffcc4dd..1d4d487edd 100644 --- a/panda/src/pandabase/pandasymbols.h +++ b/panda/src/pandabase/pandasymbols.h @@ -531,14 +531,6 @@ #define EXPTP_PANDAPHYSICS IMPORT_TEMPL #endif -#ifdef BUILDING_PANDAPHYSX - #define EXPCL_PANDAPHYSX EXPORT_CLASS - #define EXPTP_PANDAPHYSX EXPORT_TEMPL -#else - #define EXPCL_PANDAPHYSX IMPORT_CLASS - #define EXPTP_PANDAPHYSX IMPORT_TEMPL -#endif - #ifdef BUILDING_PANDASKEL #define EXPCL_PANDASKEL EXPORT_CLASS #define EXPTP_PANDASKEL EXPORT_TEMPL diff --git a/panda/src/physx/config_physx.cxx b/panda/src/physx/config_physx.cxx deleted file mode 100644 index 6a1b421eaf..0000000000 --- a/panda/src/physx/config_physx.cxx +++ /dev/null @@ -1,178 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file config_physx.cxx - * @author enn0x - * @date 2009-09-01 - */ - -#include "config_physx.h" -#include "pandaSystem.h" - -#include "physxActor.h" -#include "physxBoxController.h" -#include "physxBoxForceFieldShape.h" -#include "physxBoxShape.h" -#include "physxCapsuleController.h" -#include "physxCapsuleForceFieldShape.h" -#include "physxCapsuleShape.h" -#include "physxCcdSkeleton.h" -#include "physxCloth.h" -#include "physxClothMesh.h" -#include "physxClothNode.h" -#include "physxContactPair.h" -#include "physxContactPoint.h" -#include "physxController.h" -#include "physxControllerReport.h" -#include "physxControllerShapeHit.h" -#include "physxControllersHit.h" -#include "physxConvexMesh.h" -#include "physxConvexForceFieldShape.h" -#include "physxConvexShape.h" -#include "physxCylindricalJoint.h" -#include "physxD6Joint.h" -#include "physxDebugGeomNode.h" -#include "physxDistanceJoint.h" -#include "physxFixedJoint.h" -#include "physxForceField.h" -#include "physxForceFieldShape.h" -#include "physxForceFieldShapeGroup.h" -#include "physxHeightField.h" -#include "physxHeightFieldShape.h" -#include "physxJoint.h" -#include "physxMaterial.h" -#include "physxObject.h" -#include "physxPlaneShape.h" -#include "physxPointInPlaneJoint.h" -#include "physxPointOnLineJoint.h" -#include "physxPrismaticJoint.h" -#include "physxPulleyJoint.h" -#include "physxRevoluteJoint.h" -#include "physxScene.h" -#include "physxShape.h" -#include "physxSoftBody.h" -#include "physxSoftBodyMesh.h" -#include "physxSoftBodyNode.h" -#include "physxSphereForceFieldShape.h" -#include "physxSphereShape.h" -#include "physxSphericalJoint.h" -#include "physxTriangleMesh.h" -#include "physxTriangleMeshShape.h" -#include "physxVehicle.h" -#include "physxWheel.h" -#include "physxWheelShape.h" - -#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAPHYSX) - #error Buildsystem error: BUILDING_PANDAPHYSX not defined -#endif - -ConfigureDef(config_physx); -NotifyCategoryDef(physx, ""); - -ConfigureFn(config_physx) { - init_libphysx(); -} - -ConfigVariableBool physx_want_vrd -("physx-want-vrd", false, -PRC_DESC("Specified wether the manager should try to connect to the NVIDIA " - "PhysX visual debugger or not. Connection is established when " - "the first instance of PhysxManager is created.")); - -ConfigVariableString physx_vrd_host -("physx-vrd-host", "localhost", -PRC_DESC("Specified the host where the NVIDIA PhysX visual debugger is running " - "on. Only used if the config-varibale 'physx-want-visual-debugger' " - "is set to 'true'.")); - -ConfigVariableInt physx_vrd_port -("physx-visual-debugger-port", 5425, -PRC_DESC("Specified the port where the NVIDIA PhysX visual debugger is running " - "on. Only used if the config-varibale 'physx-want-visual-debugger' " - "is set to 'true'.")); - -ConfigVariableEnum physx_up_axis -("physx-up-axis", PhysxEnums::Z_up, -PRC_DESC("Set the up direction for controllers and heightfields.")); - -ConfigVariableInt physx_internal_threads -("physx-internal-threads", 0, -PRC_DESC("Specified the number of internal threads to be created by the " - "PhysX engine. The threads will be moved to different cores, if " - "possible. Default value is '0'. PhysX then runs in an external " - "thread, but no additional internal threads will be created.")); - -/** - * Initializes the library. This must be called at least once before any of - * the functions or classes in this library can be used. Normally it will be - * called by the static initializers and need not be called explicitly, but - * special cases exist. - */ -void -init_libphysx() { - static bool initialized = false; - if (initialized) { - return; - } - initialized = true; - - PhysxActor::init_type(); - PhysxBoxController::init_type(); - PhysxBoxForceFieldShape::init_type(); - PhysxBoxShape::init_type(); - PhysxCapsuleController::init_type(); - PhysxCapsuleForceFieldShape::init_type(); - PhysxCapsuleShape::init_type(); - PhysxCcdSkeleton::init_type(); - PhysxCloth::init_type(); - PhysxClothMesh::init_type(); - PhysxClothNode::init_type(); - PhysxContactPair::init_type(); - PhysxContactPoint::init_type(); - PhysxController::init_type(); - PhysxControllerShapeHit::init_type(); - PhysxControllersHit::init_type(); - PhysxConvexMesh::init_type(); - PhysxConvexForceFieldShape::init_type(); - PhysxConvexShape::init_type(); - PhysxCylindricalJoint::init_type(); - PhysxD6Joint::init_type(); - PhysxDebugGeomNode::init_type(); - PhysxDistanceJoint::init_type(); - PhysxFixedJoint::init_type(); - PhysxForceField::init_type(); - PhysxForceFieldShape::init_type(); - PhysxForceFieldShapeGroup::init_type(); - PhysxHeightField::init_type(); - PhysxHeightFieldShape::init_type(); - PhysxJoint::init_type(); - PhysxMaterial::init_type(); - PhysxObject::init_type(); - PhysxPlaneShape::init_type(); - PhysxPointInPlaneJoint::init_type(); - PhysxPointOnLineJoint::init_type(); - PhysxPrismaticJoint::init_type(); - PhysxPulleyJoint::init_type(); - PhysxRevoluteJoint::init_type(); - PhysxScene::init_type(); - PhysxShape::init_type(); - PhysxSoftBody::init_type(); - PhysxSoftBodyMesh::init_type(); - PhysxSoftBodyNode::init_type(); - PhysxSphereForceFieldShape::init_type(); - PhysxSphereShape::init_type(); - PhysxSphericalJoint::init_type(); - PhysxTriangleMesh::init_type(); - PhysxTriangleMeshShape::init_type(); - PhysxVehicle::init_type(); - PhysxWheel::init_type(); - PhysxWheelShape::init_type(); - - PandaSystem *ps = PandaSystem::get_global_ptr(); - ps->add_system("PhysX"); -} diff --git a/panda/src/physx/config_physx.h b/panda/src/physx/config_physx.h deleted file mode 100644 index 3c3925ec92..0000000000 --- a/panda/src/physx/config_physx.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file config_physx.h - * @author enn0x - * @date 2009-09-01 - */ - -#ifndef CONFIG_PHYSX_H -#define CONFIG_PHYSX_H - -#include "pandabase.h" -#include "notifyCategoryProxy.h" -#include "configVariableBool.h" -#include "configVariableEnum.h" -#include "configVariableInt.h" -#include "configVariableString.h" -#include "dconfig.h" - -#include "physxEnums.h" - -ConfigureDecl(config_physx, EXPCL_PANDAPHYSX, EXPTP_PANDAPHYSX); -NotifyCategoryDecl(physx, EXPCL_PANDAPHYSX, EXPTP_PANDAPHYSX); - -extern EXPCL_PANDAPHYSX ConfigVariableBool physx_want_vrd; -extern EXPCL_PANDAPHYSX ConfigVariableString physx_vrd_host; -extern EXPCL_PANDAPHYSX ConfigVariableInt physx_vrd_port; -extern EXPCL_PANDAPHYSX ConfigVariableInt physx_internal_threads; -extern EXPCL_PANDAPHYSX ConfigVariableEnum physx_up_axis; - -extern EXPCL_PANDAPHYSX void init_libphysx(); - -#endif // CONFIG_PHYSX_H diff --git a/panda/src/physx/p3physx_composite.cxx b/panda/src/physx/p3physx_composite.cxx deleted file mode 100644 index fed31a06d4..0000000000 --- a/panda/src/physx/p3physx_composite.cxx +++ /dev/null @@ -1,129 +0,0 @@ -#include "config_physx.cxx" -#include "physxActor.cxx" -#include "physxActorDesc.cxx" -#include "physxBodyDesc.cxx" -#include "physxBounds3.cxx" -#include "physxBox.cxx" -#include "physxBoxController.cxx" -#include "physxBoxControllerDesc.cxx" -#include "physxBoxForceFieldShape.cxx" -#include "physxBoxForceFieldShapeDesc.cxx" -#include "physxBoxShape.cxx" -#include "physxBoxShapeDesc.cxx" -#include "physxCapsule.cxx" -#include "physxCapsuleController.cxx" -#include "physxCapsuleControllerDesc.cxx" -#include "physxCapsuleForceFieldShape.cxx" -#include "physxCapsuleForceFieldShapeDesc.cxx" -#include "physxCapsuleShape.cxx" -#include "physxCapsuleShapeDesc.cxx" -#include "physxCcdSkeleton.cxx" -#include "physxCcdSkeletonDesc.cxx" -#include "physxCloth.cxx" -#include "physxClothDesc.cxx" -#include "physxClothMesh.cxx" -#include "physxClothMeshDesc.cxx" -#include "physxClothNode.cxx" -#include "physxContactPair.cxx" -#include "physxContactPoint.cxx" -#include "physxContactReport.cxx" -#include "physxController.cxx" -#include "physxControllerDesc.cxx" -#include "physxControllerReport.cxx" -#include "physxControllerShapeHit.cxx" -#include "physxControllersHit.cxx" -#include "physxConstraintDominance.cxx" -#include "physxConvexForceFieldShape.cxx" -#include "physxConvexForceFieldShapeDesc.cxx" -#include "physxConvexMesh.cxx" -#include "physxConvexMeshDesc.cxx" -#include "physxConvexShape.cxx" -#include "physxConvexShapeDesc.cxx" -#include "physxCylindricalJoint.cxx" -#include "physxCylindricalJointDesc.cxx" -#include "physxD6Joint.cxx" -#include "physxD6JointDesc.cxx" -#include "physxDebugGeomNode.cxx" -#include "physxDistanceJoint.cxx" -#include "physxDistanceJointDesc.cxx" -#include "physxEnums.cxx" -#include "physxFileStream.cxx" -#include "physxFixedJoint.cxx" -#include "physxFixedJointDesc.cxx" -#include "physxForceField.cxx" -#include "physxForceFieldDesc.cxx" -#include "physxForceFieldShape.cxx" -#include "physxForceFieldShapeDesc.cxx" -#include "physxForceFieldShapeGroup.cxx" -#include "physxForceFieldShapeGroupDesc.cxx" -#include "physxGroupsMask.cxx" -#include "physxHeightField.cxx" -#include "physxHeightFieldDesc.cxx" -#include "physxHeightFieldShape.cxx" -#include "physxHeightFieldShapeDesc.cxx" -#include "physxJoint.cxx" -#include "physxJointDesc.cxx" -#include "physxJointDriveDesc.cxx" -#include "physxJointLimitDesc.cxx" -#include "physxJointLimitSoftDesc.cxx" -#include "physxKitchen.cxx" -#include "physxLinearInterpolationValues.cxx" -#include "physxManager.cxx" -#include "physxMask.cxx" -#include "physxMaterial.cxx" -#include "physxMaterialDesc.cxx" -#include "physxMemoryReadBuffer.cxx" -#include "physxMemoryWriteBuffer.cxx" -#include "physxMeshHash.cxx" -#include "physxMeshPool.cxx" -#include "physxMotorDesc.cxx" -#include "physxObject.cxx" -#include "physxObjectCollection.cxx" -#include "physxOverlapReport.cxx" -#include "physxPlane.cxx" -#include "physxPlaneShape.cxx" -#include "physxPlaneShapeDesc.cxx" -#include "physxPointInPlaneJoint.cxx" -#include "physxPointInPlaneJointDesc.cxx" -#include "physxPointOnLineJoint.cxx" -#include "physxPointOnLineJointDesc.cxx" -#include "physxPrismaticJoint.cxx" -#include "physxPrismaticJointDesc.cxx" -#include "physxPulleyJoint.cxx" -#include "physxPulleyJointDesc.cxx" -#include "physxRay.cxx" -#include "physxRaycastHit.cxx" -#include "physxRaycastReport.cxx" -#include "physxRevoluteJoint.cxx" -#include "physxRevoluteJointDesc.cxx" -#include "physxScene.cxx" -#include "physxSceneDesc.cxx" -#include "physxSceneStats2.cxx" -#include "physxSegment.cxx" -#include "physxShape.cxx" -#include "physxShapeDesc.cxx" -#include "physxSoftBody.cxx" -#include "physxSoftBodyDesc.cxx" -#include "physxSoftBodyMesh.cxx" -#include "physxSoftBodyMeshDesc.cxx" -#include "physxSoftBodyNode.cxx" -#include "physxSphere.cxx" -#include "physxSphereForceFieldShape.cxx" -#include "physxSphereForceFieldShapeDesc.cxx" -#include "physxSphereShape.cxx" -#include "physxSphereShapeDesc.cxx" -#include "physxSphericalJoint.cxx" -#include "physxSphericalJointDesc.cxx" -#include "physxSpringDesc.cxx" -#include "physxTriangleMesh.cxx" -#include "physxTriangleMeshDesc.cxx" -#include "physxTriangleMeshShape.cxx" -#include "physxTriangleMeshShapeDesc.cxx" -#include "physxTriggerReport.cxx" -#include "physxUtilLib.cxx" -#include "physxVehicle.cxx" -#include "physxVehicleDesc.cxx" -#include "physxWheel.cxx" -#include "physxWheelDesc.cxx" -#include "physxWheelShape.cxx" -#include "physxWheelShapeDesc.cxx" diff --git a/panda/src/physx/physxActor.I b/panda/src/physx/physxActor.I deleted file mode 100644 index 10f4089eaf..0000000000 --- a/panda/src/physx/physxActor.I +++ /dev/null @@ -1,60 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxActor.I - * @author enn0x - * @date 2009-09-14 - */ - -/** - * - */ -INLINE PhysxActor:: -PhysxActor() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxActor:: -~PhysxActor() { - -} - -/** - * - */ -INLINE void PhysxActor:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxActor:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")"; - - if (!_np.is_empty()) { - out << " NP:" << _np; - } - - if (_controller) { - out << " C:0x" << _controller; - } - - out << "\n"; - - _shapes.ls(out, indent_level); -} diff --git a/panda/src/physx/physxActor.cxx b/panda/src/physx/physxActor.cxx deleted file mode 100644 index 2b3075e45a..0000000000 --- a/panda/src/physx/physxActor.cxx +++ /dev/null @@ -1,1412 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxActor.cxx - * @author enn0x - * @date 2009-09-14 - */ - -#include "physxActor.h" -#include "physxActorDesc.h" -#include "physxBodyDesc.h" -#include "physxShapeDesc.h" -#include "physxManager.h" - -TypeHandle PhysxActor::_type_handle; - -/** - * - */ -void PhysxActor:: -link(NxActor *actorPtr) { - - // Link self - _ptr = actorPtr; - _ptr->userData = this; - _error_type = ET_ok; - - set_name(actorPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_actors.add(this); - - // Link shapes - NxShape * const *shapes = _ptr->getShapes(); - NxU32 nShapes = _ptr->getNbShapes(); - - for (NxU32 i=0; i < nShapes; i++) { - PhysxShape *shape = PhysxShape::factory(shapes[i]->getType()); - shape->link(shapes[i]); - } -} - -/** - * - */ -void PhysxActor:: -unlink() { - - // Unlink shapes - NxShape * const *shapes = _ptr->getShapes(); - NxU32 nShapes = _ptr->getNbShapes(); - - for (NxU32 i=0; i < nShapes; i++) { - PhysxShape *shape = (PhysxShape *)shapes[i]->userData; - shape->unlink(); - } - - // Unlink self - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_actors.remove(this); -} - -/** - * - */ -void PhysxActor:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - _ptr->getScene().releaseActor(*_ptr); - _ptr = nullptr; -} - -/** - * - */ -void PhysxActor:: -link_controller(PhysxController *controller) { - - _controller = controller; -} - -/** - * Saves the body information of a dynamic actor to the passed body - * descriptor. - */ -bool PhysxActor:: -save_body_to_desc(PhysxBodyDesc &bodyDesc) const { - - nassertr(_error_type == ET_ok, false); - return _ptr->saveBodyToDesc(bodyDesc._desc); -} - -/** - * Saves the state of the actor to the passed descriptor. - */ -void PhysxActor:: -save_to_desc(PhysxActorDesc &actorDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(actorDesc._desc); -} - -/** - * Sets a name string for the object that can be retrieved with get_name(). - * This is for debugging and is not used by the engine. - */ -void PhysxActor:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - _ptr->setName(_name.c_str()); -} - -/** - * Retrieves the name string. - */ -const char *PhysxActor:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return _ptr->getName(); -} - -/** - * Updates the transform of an assigned NodePath. If the actor has been - * created by a PhysxController then this method will update the NodePath's - * transform from the controller's transform. - */ -void PhysxActor:: -update_transform(const LMatrix4f &m) { - - // Active transforms are update AFTER scene.fetchResults() has been called, - // and thus can contain removed objects. So either update transforms after - // scene.fetchResults() - which means poor performance - or check if an - // actor has been removed here in this method. - if (_error_type != ET_ok) return; - - if (_np.is_empty()) return; - - if (_controller) { - LVector3f hpr(_controller->get_h(), 0.0f, 0.0f); - LPoint3f pos = _controller->get_pos(); - _np.set_transform(_np.get_top(), TransformState::make_pos_hpr(pos, hpr)); - } - else { - _np.set_transform(_np.get_top(), TransformState::make_mat(m)); - } -} - -/** - * Retrieves the actors world space position. - */ -LPoint3f PhysxActor:: -get_global_pos() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - return PhysxManager::nxVec3_to_point3(_ptr->getGlobalPosition()); -} - -/** - * Retrieves the actors world space transform. - */ -LMatrix4f PhysxActor:: -get_global_mat() const { - - nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat()); - return PhysxManager::nxMat34_to_mat4(_ptr->getGlobalPose()); -} - -/** - * Retrieves the actors world space orientation. - */ -LQuaternionf PhysxActor:: -get_global_quat() const { - - nassertr(_error_type == ET_ok, LQuaternionf::zero()); - return PhysxManager::nxQuat_to_quat(_ptr->getGlobalOrientation()); -} - -/** - * Method for setting a dynamic actor's position in the world. Please see - * set_global_mat for some caveats. - */ -void PhysxActor:: -set_global_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - nassertv_always(!pos.is_nan()); - - _ptr->setGlobalPosition(PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * Method for setting a dynamic actor's transform matrix in the world. - * - * This method instantaneously changes the actor space to world space - * transformation. - * - * One should exercise restraint in making use of these methods. - * - * Static actors should not be moved at all. There are various internal data - * structures for static actors which may need to be recomputed when one - * moves. Also, moving static actors will not interact correctly with dynamic - * actors or joints. If you would like to directly control an actor's - * position and would like to have it correctly interact with dynamic bodies - * and joints, you should create a dynamic body with the BF_kinematic flag, - * and then use the move_global_*() commands to move it along a path! - * - * When briefly moving dynamic actors, one should not: - Move actors into - * other actors, thus causing interpenetration (an invalid physical state). - - * Move an actor that is connected by a joint to another away from the other - * (thus causing joint error). - When moving jointed actors the joints' cached - * transform information is destroyed and recreated next frame; thus this call - * is expensive for jointed actors. - */ -void PhysxActor:: -set_global_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - nassertv_always(!mat.is_nan()); - - _ptr->setGlobalPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * Method for setting a dynamic actor's orientation in the world. Please see - * set_global_mat for some caveats. - */ -void PhysxActor:: -set_global_hpr(float h, float p, float r) { - - nassertv(_error_type == ET_ok); - - LQuaternionf q; - q.set_hpr(LVector3f(h, p, r)); - _ptr->setGlobalOrientationQuat(PhysxManager::quat_to_nxQuat(q)); -} - -/** - * The move_global_* calls serve to move kinematically controlled dynamic - * actors through the game world. - * - * See move_global_mat() for more information. - * - * This call wakes the actor if it is sleeping. - */ -void PhysxActor:: -move_global_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - nassertv_always(!pos.is_nan()); - - _ptr->moveGlobalPosition(PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * The move_global_* calls serve to move kinematically controlled dynamic - * actors through the game world. - * - * You set a dynamic actor to be kinematic using the BF_KINEMATIC body flag, - * used either in the PhysBodyDesc or with set_body_flag(). - * - * The move command will result in a velocity that, when successfully carried - * out (i.e. the motion is not blocked due to joints or collisions) inside - * run*(), will move the body into the desired pose. After the move is - * carried out during a single time step, the velocity is returned to zero. - * Thus, you must continuously call this in every time step for kinematic - * actors so that they move along a path. - * - * These functions simply store the move destination until run*() is called, - * so consecutive calls will simply overwrite the stored target variable. - * - * This call wakes the actor if it is sleeping. - */ -void PhysxActor:: -move_global_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - nassertv_always(!mat.is_nan()); - - _ptr->moveGlobalPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * The move_global_* calls serve to move kinematically controlled dynamic - * actors through the game world. - * - * See move_global_mat() for more information. - * - * This call wakes the actor if it is sleeping. - */ -void PhysxActor:: -move_global_hpr(float h, float p, float r) { - - nassertv(_error_type == ET_ok); - - LQuaternionf q; - q.set_hpr(LVector3f(h, p, r)); - _ptr->moveGlobalOrientationQuat(PhysxManager::quat_to_nxQuat(q)); -} - -/** - * Attaches a node path to this actor. The node path's transform will be - * updated automatically if the actor's transform changes (and only then). - * - * Note: any non-uniform scale or shear set on the NodePath's transform will - * be overwritten at the time of the first update. - */ -void PhysxActor:: -attach_node_path(const NodePath &np) { - - nassertv(_error_type == ET_ok); - nassertv_always(!np.is_empty()); - - _np = NodePath(np); -} - -/** - * Detaches a previously assigned NodePath from this actor. The NodePath's - * transform will no longer be updated from the actor's transform. - */ -void PhysxActor:: -detach_node_path() { - - nassertv(_error_type == ET_ok); - - _np = NodePath(); -} - -/** - * Retrieves a previously attached NodePath. An empty NodePath will be - * returned if no NodePath has been attached to this actor. - */ -NodePath PhysxActor:: -get_node_path() const { - - nassertr(_error_type == ET_ok, NodePath::fail()); - - return _np; -} - -/** - * Retrieves the scene which this actor belongs to. - */ -PhysxScene *PhysxActor:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - - NxScene *scenePtr = &(_ptr->getScene()); - PhysxScene *scene = (PhysxScene *)(scenePtr->userData); - - return scene; -} - -/** - * Returns the number of shapes assigned to the actor. - */ -unsigned int PhysxActor:: -get_num_shapes() const { - - nassertr(_error_type == ET_ok, -1); - - return _ptr->getNbShapes(); -} - -/** - * Creates a new shape and adds it to the list of shapes of this actor. - * - * Mass properties of dynamic actors will not automatically be recomputed to - * reflect the new mass distribution implied by the shape. Follow this call - * with a call to update_mass_from_shapes() to do that. - */ -PhysxShape *PhysxActor:: -create_shape(PhysxShapeDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(),nullptr); - - PhysxShape *shape = PhysxShape::factory(desc.ptr()->getType()); - nassertr(shape, nullptr); - - NxShape *shapePtr = _ptr->createShape(*desc.ptr()); - nassertr(shapePtr, nullptr); - - shape->link(shapePtr); - - return shape; -} - -/** - * Retrieves an individual shape from the actor's array of shapes. Index must - * be in the range from zero to (number-of-shapes minus 1). - */ -PhysxShape *PhysxActor:: -get_shape(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbShapes(), nullptr); - - NxShape * const *shapes = _ptr->getShapes(); - NxShape *shapePtr = shapes[idx]; - PhysxShape *shape = (PhysxShape *)(shapePtr->userData); - - return shape; -} - -/** - * Retrieves an individual shape from the actor's array of shapes. The first - * shape for which the shape's name matches the specified name is returned, or - * NULL if no shape has a matching name. - */ -PhysxShape *PhysxActor:: -get_shape_by_name(const char *name) const { - - nassertr(_error_type == ET_ok, nullptr); - - NxShape * const *shapes = _ptr->getShapes(); - NxShape *shapePtr = nullptr; - NxU32 nShapes = _ptr->getNbShapes(); - - for (NxU32 i=0; i < nShapes; i++) { - shapePtr = shapes[i]; - - if (strcmp(shapePtr->getName(), name) == 0) { - return (PhysxShape *) shapePtr->userData; - } - } - - return nullptr; -} - -/** - * Applies a force (or impulse) defined in the global coordinate frame to the - * actor. - * - * This will not induce a torque. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_force(const LVector3f force, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!force.is_nan()); - - _ptr->addForce(PhysxManager::vec3_to_nxVec3(force), (NxForceMode)mode, wakeup); -} - -/** - * Applies a force (or impulse) defined in the global coordinate frame, acting - * at a particular point in global coordinates, to the actor. - * - * Note that if the force does not act along the center of mass of the actor, - * this will also add the corresponding torque. Because forces are reset at - * the end of every timestep, you can maintain a total external force on an - * object by calling this once every frame. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!force.is_nan()); - nassertv_always(!pos.is_nan()); - - _ptr->addForceAtPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup); -} - -/** - * Applies a force (or impulse) defined in the global coordinate frame, acting - * at a particular point in local coordinates, to the actor. - * - * Note that if the force does not act along the center of mass of the actor, - * this will also add the corresponding torque. Because forces are reset at - * the end of every timestep, you can maintain a total external force on an - * object by calling this once every frame. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!force.is_nan()); - nassertv_always(!pos.is_nan()); - - _ptr->addForceAtLocalPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup); -} - -/** - * Applies an impulsive torque defined in the global coordinate frame to the - * actor. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_torque(const LVector3f torque, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!torque.is_nan()); - - _ptr->addTorque(PhysxManager::vec3_to_nxVec3(torque), (NxForceMode)mode, wakeup); -} - -/** - * Applies a force (or impulse) defined in the actor local coordinate frame to - * the actor. This will not induce a torque. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_local_force(const LVector3f force, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!force.is_nan()); - - _ptr->addLocalForce(PhysxManager::vec3_to_nxVec3(force), (NxForceMode)mode, wakeup); -} - -/** - * Applies a force (or impulse) defined in the actor local coordinate frame, - * acting at a particular point in global coordinates, to the actor. - * - * Note that if the force does not act along the center of mass of the actor, - * this will also add the corresponding torque. Because forces are reset at - * the end of every timestep, you can maintain a total external force on an - * object by calling this once every frame. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_local_force_at_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!force.is_nan()); - nassertv_always(!pos.is_nan()); - - _ptr->addLocalForceAtPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup); -} - -/** - * Applies a force (or impulse) defined in the actor local coordinate frame, - * acting at a particular point in local coordinates, to the actor. - * - * Note that if the force does not act along the center of mass of the actor, - * this will also add the corresponding torque. Because forces are reset at - * the end of every timestep, you can maintain a total external force on an - * object by calling this once every frame. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_local_force_at_local_pos(const LVector3f force, const LPoint3f &pos, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!force.is_nan()); - nassertv_always(!pos.is_nan()); - - _ptr->addLocalForceAtLocalPos(PhysxManager::vec3_to_nxVec3(force), PhysxManager::point3_to_nxVec3(pos), (NxForceMode)mode, wakeup); -} - -/** - * Applies an impulsive torque defined in the actor local coordinate frame to - * the actor. - * - * Mode determines if the torque is to be conventional or impulsive. - * - * The actor must be dynamic. This call wakes the actor if it is sleeping and - * the wakeup parameter is true (default). - */ -void PhysxActor:: -add_local_torque(const LVector3f torque, PhysxForceMode mode, bool wakeup) { - - nassertv(_error_type == ET_ok); - nassertv_always(!torque.is_nan()); - - _ptr->addLocalTorque(PhysxManager::vec3_to_nxVec3(torque), (NxForceMode)mode, wakeup); -} - -/** - * Recomputes a dynamic actor's mass properties from its shapes. - * - * Given a constant density or total mass, the actors mass properties can be - * recomputed using the shapes attached to the actor. If the actor has no - * shapes, then only the totalMass parameter can be used. If all shapes in - * the actor are trigger shapes (non-physical), the call will fail. - * - * The mass of each shape is either the shape's local density (as specified in - * the PhysxShapeDesc; default 1.0) multiplied by the shape's volume or a - * directly specified shape mass. - * - * The inertia tensor, mass frame and center of mass will always be - * recomputed. If there are no shapes in the actor, the mass will be - * totalMass, and the mass frame will be set to the center of the actor. - * - * If you supply a non-zero total mass, the actor's mass and inertia will - * first be computed as above and then scaled to fit this total mass. - * - * If you supply a non-zero density, the actor's mass and inertia will first - * be computed as above and then scaled by this factor. - * - * Either totalMass or density must be non-zero. - * - * The actor must be dynamic. - */ -bool PhysxActor:: -update_mass_from_shapes(float density, float totalMass) { - - nassertr(_error_type == ET_ok, false); - return _ptr->updateMassFromShapes(density, totalMass); -} - -/** - * Computes the total kinetic (rotational and translational) energy of the - * object. The actor must be dynamic. - */ -float PhysxActor:: -compute_kinetic_energy() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->computeKineticEnergy(); -} - -/** - * Returns true if the actor is dynamic. - */ -bool PhysxActor:: -is_dynamic() const { - - nassertr(_error_type == ET_ok, false); - return _ptr->isDynamic(); -} - -/** - * Sets the collision group for all shapes of this actor. See - * PhysxShape.setGroup(). - */ -void PhysxActor:: -set_shape_group(unsigned int group) { - - nassertv(_error_type == ET_ok); - nassertv(group >= 0 && group < 32); - - NxShape * const *shapes = _ptr->getShapes(); - NxU32 nShapes = _ptr->getNbShapes(); - - for (NxU32 i=0; i < nShapes; i++) { - shapes[i]->setGroup( group ); - } -} - -/** - * Raise or lower individual BodyFlag flags. - */ -void PhysxActor:: -set_body_flag(PhysxBodyFlag flag, bool value) { - - if (value == true) { - _ptr->raiseBodyFlag((NxBodyFlag)flag); - } - else { - _ptr->clearBodyFlag((NxBodyFlag)flag); - } -} - -/** - * Return the specified BodyFlag flag. - */ -bool PhysxActor:: -get_body_flag(PhysxBodyFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return ptr()->readBodyFlag((NxBodyFlag)flag); -} - -/** - * Raise or lower individual ActorFlag flags. - */ -void PhysxActor:: -set_actor_flag(PhysxActorFlag flag, bool value) { - - if (value == true) { - _ptr->raiseActorFlag((NxActorFlag)flag); - } - else { - _ptr->clearActorFlag((NxActorFlag)flag); - } -} - -/** - * Return the specified ActorFlag flag. - */ -bool PhysxActor:: -get_actor_flag(PhysxActorFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return ptr()->readActorFlag((NxActorFlag)flag); -} - -/** - * Sets the actor's contact report flags. - * - * These flags are used to determine the kind of report that is generated for - * interactions with other actors. - * - * Please note: If the actor is part of an interacting pair for which the - * contact report generation is controlled already through any other mechanism - * (for example by use of PhysxScene::set_actor_pair_flags) then the union of - * all the specified contact report flags will be used to generate the report. - */ -void PhysxActor:: -set_contact_report_flag(PhysxContactPairFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - - NxU32 flags = _ptr->getContactReportFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setContactReportFlags(flags); -} - -/** - * Sets the force threshold for contact reports. The actor must be dynamic. - */ -void PhysxActor:: -set_contact_report_threshold(float threshold) { - - nassertv(_error_type == ET_ok); - nassertv(threshold >= 0.0f); - - _ptr->setContactReportThreshold(threshold); -} - -/** - * Assigns the actor to a user defined group of actors. The actor group must - * be an integer in between 0 and 0x7fff (32767). - * - * This is similar to NxShape groups, except those are only five bits and - * serve a different purpose. - * - * The PhysxScene::set_actor_group_pair_flags() lets you set certain behaviors - * for pairs of actor groups. - * - * By default every actor is created in group 0. - */ -void PhysxActor:: -set_group(unsigned int group) { - - nassertv(_error_type == ET_ok); - nassertv(group >= 0 && group < 0x8000); - - ptr()->setGroup(group); -} - -/** - * Retrieves the actor group this actor is assigned to. - */ -unsigned int PhysxActor:: -get_group() const { - - nassertr(_error_type == ET_ok, 0); - - return ptr()->getGroup(); -} - -/** - * Assigns dynamic actors a dominance group identifier. Dominance groups are - * integere in the range from 0 to 31. - * - * This is similar to shape groups, except those serve a different purpose. - * - * The PhysxScene::set_dominance_group_pair() lets you set certain behaviors - * for pairs of dominance groups. - * - * By default every actor is created in group 0. Static actors must stay in - * group 0; thus you can only call this on dynamic actors. - */ -void PhysxActor:: -set_dominance_group(unsigned int group) { - - nassertv(_error_type == ET_ok); - nassertv(group >= 0 && group < 32); - nassertv(is_dynamic() == true); - - _ptr->setDominanceGroup(group); -} - -/** - * Retrieves the dominance group of this actor. - */ -unsigned int PhysxActor:: -get_dominance_group() const { - - nassertr(_error_type == ET_ok, 0); - - return ptr()->getDominanceGroup(); -} - -/** - * Sets the angular damping coefficient. Zero represents no damping. The - * angular damping coefficient must be nonnegative. The actor must be - * dynamic. Default: 0.05 - */ -void PhysxActor:: -set_angular_damping(float angDamp) { - - nassertv(_error_type == ET_ok); - nassertv(angDamp >= 0.0f); - - _ptr->setAngularDamping(angDamp); -} - -/** - * Returns the angular damping coefficient. The actor must be dynamic. - */ -float PhysxActor:: -get_angular_damping() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getAngularDamping(); -} - -/** - * Sets the linear damping coefficient. Zero represents no damping. The - * damping coefficient must be nonnegative. The actor must be dynamic. - * Default: 0 - */ -void PhysxActor:: -set_linear_damping(float linDamp) { - - nassertv(_error_type == ET_ok); - nassertv(linDamp >= 0.0f); - - _ptr->setLinearDamping(linDamp); -} - -/** - * Retrieves the linear damping coefficient. The actor must be dynamic. - */ -float PhysxActor:: -get_linear_damping() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getLinearDamping(); -} - -/** - * Sets the linear velocity of the actor. - * - * Note that if you continuously set the velocity of an actor yourself, forces - * such as gravity or friction will not be able to manifest themselves, - * because forces directly influence only the velocity/momentum of an actor. - * - * The actor must be dynamic. - */ -void PhysxActor:: -set_linear_velocity(const LVector3f &linVel) { - - nassertv(_error_type == ET_ok); - nassertv(_ptr->isDynamic()); - - _ptr->setLinearVelocity(PhysxManager::vec3_to_nxVec3(linVel)); -} - -/** - * Sets the angular velocity of the actor. - * - * Note that if you continuously set the angular velocity of an actor - * yourself, forces such as friction will not be able to rotate the actor, - * because forces directly influence only the velocity/momentum. - * - * The actor must be dynamic. - */ -void PhysxActor:: -set_angular_velocity(const LVector3f &angVel) { - - nassertv(_error_type == ET_ok); - nassertv(_ptr->isDynamic()); - - _ptr->setAngularVelocity(PhysxManager::vec3_to_nxVec3(angVel)); -} - -/** - * Lets you set the maximum angular velocity permitted for this actor. - * - * Because for various internal computations, very quickly rotating actors - * introduce error into the simulation, which leads to undesired results. - * - * With PhysxManager::set_parameter(PP_max_angular_velocity) you can set the - * default maximum velocity for actors created after the call. Bodies' high - * angular velocities are clamped to this value. - * - * However, because some actors, such as car wheels, should be able to rotate - * quickly, you can override the default setting on a per-actor basis with the - * below call. Note that objects such as wheels which are approximated with - * spherical or other smooth collision primitives can be simulated with - * stability at a much higher angular velocity than, say, a box that has - * corners. - * - * The actor must be dynamic. - */ -void PhysxActor:: -set_max_angular_velocity(float maxAngVel) { - - nassertv(_error_type == ET_ok); - nassertv(_ptr->isDynamic()); - - _ptr->setMaxAngularVelocity(maxAngVel); -} - -/** - * Returns the linear velocity of an actor. The actor must be dynamic. - */ -LVector3f PhysxActor:: -get_linear_velocity() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getLinearVelocity()); -} - -/** - * Returns the angular velocity of the actor. The actor must be dynamic. - */ -LVector3f PhysxActor:: -get_angular_velocity() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getAngularVelocity()); -} - -/** - * Returns the maximum angular velocity permitted for this actor. - */ -float PhysxActor:: -get_max_angular_velocity() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getMaxAngularVelocity(); -} - -/** - * Computes the velocity of a point given in world coordinates if it were - * attached to the actor and moving with it. - * - * The actor must be dynamic. - */ -LVector3f PhysxActor:: -get_point_velocity(const LPoint3f &point) const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - nassertr_always(!point.is_nan(), LVector3f::zero()); - - NxVec3 nPoint = PhysxManager::point3_to_nxVec3(point); - return PhysxManager::nxVec3_to_vec3(_ptr->getPointVelocity(nPoint)); -} - -/** - * Computes the velocity of a point given in body local coordinates as if it - * were attached to the actor and moving with it. - * - * The actor must be dynamic. - */ -LVector3f PhysxActor:: -get_local_point_velocity(const LPoint3f &point) const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - nassertr_always(!point.is_nan(), LVector3f::zero()); - - NxVec3 nPoint = PhysxManager::point3_to_nxVec3(point); - return PhysxManager::nxVec3_to_vec3(_ptr->getLocalPointVelocity(nPoint)); -} - -/** - * Sets the linear momentum of the actor. Note that if you continuously set - * the linear momentum of an actor yourself, forces such as gravity or - * friction will not be able to manifest themselves, because forces directly - * influence only the velocity/momentum of a actor. The actor must be - * dynamic. - */ -void PhysxActor:: -set_linear_momentum(const LVector3f &momentum) { - - nassertv(_error_type == ET_ok); - _ptr->setLinearMomentum(PhysxManager::vec3_to_nxVec3(momentum)); -} - -/** - * Sets the angular momentum of the actor. Note that if you continuously set - * the angular velocity of an actor yourself, forces such as friction will not - * be able to rotate the actor, because forces directly influence only the - * velocity of actor. The actor must be dynamic. - */ -void PhysxActor:: -set_angular_momentum(const LVector3f &momentum) { - - nassertv(_error_type == ET_ok); - _ptr->setAngularMomentum(PhysxManager::vec3_to_nxVec3(momentum)); -} - -/** - * Retrieves the linear momentum of an actor. The momentum is equal to the - * velocity times the mass. The actor must be dynamic. - */ -LVector3f PhysxActor:: -get_linear_momentum() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getLinearMomentum()); -} - -/** - * Retrieves the angular momentum of an actor. The angular momentum is equal - * to the angular velocity times the global space inertia tensor. The actor - * must be dynamic. - */ -LVector3f PhysxActor:: -get_angular_momentum() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getAngularMomentum()); -} - -/** - * Sets the linear velocity below which an actor may go to sleep. Actors - * whose linear velocity is above this threshold will not be put to sleep. - * - * Setting the sleep angular/linear velocity only makes sense when the - * BF_energy_sleep_test is not set. - * - * The actor must be dynamic. - */ -void PhysxActor:: -set_sleep_linear_velocity(float threshold) { - - nassertv(_error_type == ET_ok); - _ptr->setSleepLinearVelocity(threshold); -} - -/** - * Sets the angular velocity below which an actor may go to sleep. Actors - * whose angular velocity is above this threshold will not be put to sleep. - * - * Setting the sleep angular/linear velocity only makes sense when the - * BF_energy_sleep_test is not set. - * - * The actor must be dynamic. - */ -void PhysxActor:: -set_sleep_angular_velocity(float threshold) { - - nassertv(_error_type == ET_ok); - _ptr->setSleepAngularVelocity(threshold); -} - -/** - * Sets the energy threshold below which an actor may go to sleep. Actors - * whose kinematic energy is above this threshold will not be put to sleep. - * - * Setting the sleep energy threshold only makes sense when the - * BF_energy_sleep_test is set. There are also other types of sleeping that - * uses the linear and angular velocities directly instead of the energy. - * - * The actor must be dynamic. - */ -void PhysxActor:: -set_sleep_energy_threshold(float threshold) { - - nassertv(_error_type == ET_ok); - _ptr->setSleepEnergyThreshold(threshold); -} - -/** - * Returns the linear velocity below which an actor may go to sleep. Actors - * whose linear velocity is above this threshold will not be put to sleep. - * The actor must be dynamic. - */ -float PhysxActor:: -get_sleep_linear_velocity() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSleepLinearVelocity(); -} - -/** - * Returns the angular velocity below which an actor may go to sleep. Actors - * whose angular velocity is above this threshold will not be put to sleep. - * The actor must be dynamic. - */ -float PhysxActor:: -get_sleep_angular_velocity() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSleepAngularVelocity(); -} - -/** - * Returns the energy below which an actor may go to sleep. Actors whose - * energy is above this threshold will not be put to sleep. The actor must be - * dynamic. - */ -float PhysxActor:: -get_sleep_energy_threshold() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSleepEnergyThreshold(); -} - -/** - * Returns true if this body is sleeping. - * - * When an actor does not move for a period of time, it is no longer simulated - * in order to save time. This state is called sleeping. However, because - * the object automatically wakes up when it is either touched by an awake - * object, or one of its properties is changed by the user, the entire sleep - * mechanism should be transparent to the user. - * - * The actor must be dynamic. - */ -bool PhysxActor:: -is_sleeping() const { - - nassertr(_error_type == ET_ok, false); - return _ptr->isSleeping(); -} - -/** - * Wakes up the actor if it is sleeping. - * - * The wakeCounterValue determines how long until the body is put to sleep, a - * value of zero means that the body is sleeping. wake_up(0) is equivalent to - * PhysxActor::put_to_sleep(). - * - * The actor must be dynamic. - */ -void PhysxActor:: -wake_up(float wakeCounterValue) { - - nassertv(_error_type == ET_ok); - _ptr->wakeUp(wakeCounterValue); -} - -/** - * Forces the actor to sleep. - * - * The actor will stay asleep until the next call to simulate, and will not - * wake up until then even when otherwise it would (for example a force is - * applied to it). It can however wake up during the next do_physics call. - * - * The actor must be dynamic. - */ -void PhysxActor:: -put_to_sleep() { - - nassertv(_error_type == ET_ok); - _ptr->putToSleep(); -} - -/** - * Sets the mass of a dynamic actor. - */ -void PhysxActor:: -set_mass(float mass) { - - nassertv(_error_type == ET_ok); - _ptr->setMass(mass); -} - -/** - * Returns the mass of the actor. - */ -float PhysxActor:: -get_mass() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getMass(); -} - -/** - * Sets the matrix of the center of mass relative to the actor. - */ -void PhysxActor:: -set_c_mass_offset_local_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassOffsetLocalPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * Sets the position of the center of mass relative to the actor. - */ -void PhysxActor:: -set_c_mass_offset_local_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassOffsetLocalPosition(PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * Sets the orientation of the center of mass relative to the actor. - */ -void PhysxActor:: -set_c_mass_offset_local_orientation(const LMatrix3f &mat) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassOffsetLocalOrientation(PhysxManager::mat3_to_nxMat33(mat)); -} - -/** - * Sets the matrix of the center of mass relative to world space. - */ -void PhysxActor:: -set_c_mass_offset_global_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassOffsetGlobalPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * Sets the position of the center of mass relative to world space. - */ -void PhysxActor:: -set_c_mass_offset_global_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassOffsetGlobalPosition(PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * Sets the orientation of the center of mass relative to world space. - */ -void PhysxActor:: -set_c_mass_offset_global_orientation(const LMatrix3f &mat) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassOffsetGlobalOrientation(PhysxManager::mat3_to_nxMat33(mat)); -} - -/** - * Moves the actor by setting the transform of the center of mass. - */ -void PhysxActor:: -set_c_mass_global_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassGlobalPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * Moves the actor by setting the position of the center of mass. - */ -void PhysxActor:: -set_c_mass_global_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassGlobalPosition(PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * Moves the actor by setting the orientation of the center of mass. - */ -void PhysxActor:: -set_c_mass_global_orientation(const LMatrix3f &mat) { - - nassertv(_error_type == ET_ok); - _ptr->setCMassGlobalOrientation(PhysxManager::mat3_to_nxMat33(mat)); -} - -/** - * Sets the inertia tensor, using a parameter specified in mass space - * coordinates. - */ -void PhysxActor:: -set_mass_space_inertia_tensor(const LVector3f &m) { - - nassertv(_error_type == ET_ok); - _ptr->setMassSpaceInertiaTensor(PhysxManager::vec3_to_nxVec3(m)); -} - -/** - * Returns the center of mass transform in world space. - */ -LMatrix4f PhysxActor:: -get_c_mass_global_mat() const { - - nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat()); - return PhysxManager::nxMat34_to_mat4(_ptr->getCMassGlobalPose()); -} - -/** - * Returns the center of mass position in world space. - */ -LPoint3f PhysxActor:: -get_c_mass_global_pos() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - return PhysxManager::nxVec3_to_point3(_ptr->getCMassGlobalPosition()); -} - -/** - * Returns the center of mass orientation in world space. - */ -LMatrix3f PhysxActor:: -get_c_mass_global_orientation() const { - - nassertr(_error_type == ET_ok, LMatrix3f::ident_mat()); - return PhysxManager::nxMat33_to_mat3(_ptr->getCMassGlobalOrientation()); -} - -/** - * Returns the center of mass transform relative to the actor. - */ -LMatrix4f PhysxActor:: -get_c_mass_local_mat() const { - - nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat()); - return PhysxManager::nxMat34_to_mat4(_ptr->getCMassLocalPose()); -} - -/** - * Returns the center of mass position relative to the actor. - */ -LPoint3f PhysxActor:: -get_c_mass_local_pos() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - return PhysxManager::nxVec3_to_point3(_ptr->getCMassLocalPosition()); -} - -/** - * Returns the center of mass orientation relative to the actor. - */ -LMatrix3f PhysxActor:: -get_c_mass_local_orientation() const { - - nassertr(_error_type == ET_ok, LMatrix3f::ident_mat()); - return PhysxManager::nxMat33_to_mat3(_ptr->getCMassLocalOrientation()); -} - -/** - * Returns the diagonal inertia tensor of the actor relative to the mass - * coordinate frame. - */ -LVector3f PhysxActor:: -get_mass_space_inertia_tensor() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getMassSpaceInertiaTensor()); -} - -/** - * Returns the inertia tensor of the actor relative to the world coordinate - * frame. - */ -LMatrix3f PhysxActor:: -get_global_inertia_tensor() const { - - nassertr(_error_type == ET_ok, LMatrix3f::ident_mat()); - return PhysxManager::nxMat33_to_mat3(_ptr->getGlobalInertiaTensor()); -} - -/** - * Returns the inverse of the inertia tensor of the actor relative to the - * world coordinate frame. - */ -LMatrix3f PhysxActor:: -get_global_inertia_tensor_inverse() const { - - nassertr(_error_type == ET_ok, LMatrix3f::ident_mat()); - return PhysxManager::nxMat33_to_mat3(_ptr->getGlobalInertiaTensorInverse()); -} diff --git a/panda/src/physx/physxActor.h b/panda/src/physx/physxActor.h deleted file mode 100644 index c91f4423c3..0000000000 --- a/panda/src/physx/physxActor.h +++ /dev/null @@ -1,222 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxActor.h - * @author enn0x - * @date 2009-09-14 - */ - -#ifndef PHYSXACTOR_H -#define PHYSXACTOR_H - -#include "pandabase.h" -#include "nodePath.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxObjectCollection.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxController; -class PhysxScene; -class PhysxShape; -class PhysxShapeDesc; -class PhysxActorDesc; -class PhysxBodyDesc; - -/** - * Actors are the main simulation objects. Actors are owned by a scene - * (PhysxScene). - * - * An actor may optionally encapsulate a dynamic rigid body by setting the - * body member of the actor's descriptor when it is created. Otherwise the - * actor will be static (fixed in the world). - * - * Instances of PhysxActor are created by calling PhysxScene::create_actor() - * and destroyed by calling PhysxActor::release(). - */ -class EXPCL_PANDAPHYSX PhysxActor : public PhysxObject, public PhysxEnums { - -PUBLISHED: - INLINE PhysxActor(); - INLINE ~PhysxActor(); - - bool save_body_to_desc(PhysxBodyDesc &bodyDesc) const; - void save_to_desc(PhysxActorDesc &actorDesc) const; - - void set_name(const char *name); - void set_global_pos(const LPoint3f &pos); - void set_global_mat(const LMatrix4f &mat); - void set_global_hpr(float h, float p, float r); - void set_body_flag(PhysxBodyFlag flag, bool value); - void set_actor_flag(PhysxActorFlag flag, bool value); - void set_contact_report_flag(PhysxContactPairFlag flag, bool value); - void set_contact_report_threshold(float threshold); - void set_group(unsigned int group); - void set_dominance_group(unsigned int group); - void set_shape_group( unsigned int group ); - - const char *get_name() const; - LPoint3f get_global_pos() const; - LMatrix4f get_global_mat() const; - LQuaternionf get_global_quat() const; - bool get_body_flag(PhysxBodyFlag flag) const; - bool get_actor_flag(PhysxActorFlag flag) const; - unsigned int get_group() const; - unsigned int get_dominance_group() const; - - bool is_dynamic() const; - float compute_kinetic_energy() const; - bool update_mass_from_shapes(float density, float totalMass); - - PhysxScene *get_scene() const; - - // NodePath - void attach_node_path(const NodePath &np); - void detach_node_path(); - NodePath get_node_path() const; - - // Shapes - unsigned int get_num_shapes() const; - PhysxShape *create_shape(PhysxShapeDesc &desc); - PhysxShape *get_shape(unsigned int idx) const; - PhysxShape *get_shape_by_name(const char *name) const; - MAKE_SEQ(get_shapes, get_num_shapes, get_shape); - - // Forces - void add_force(const LVector3f force, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_force_at_pos(const LVector3f force, const LPoint3f &pos, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_force_at_local_pos(const LVector3f force, const LPoint3f &pos, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_torque(const LVector3f torque, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_local_force(const LVector3f force, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_local_force_at_pos(const LVector3f force, const LPoint3f &pos, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_local_force_at_local_pos(const LVector3f force, const LPoint3f &pos, - PhysxForceMode mode=FM_force, bool wakeup=true); - void add_local_torque(const LVector3f torque, - PhysxForceMode mode=FM_force, bool wakeup=true); - - // Mass manipulation - void set_mass(float mass); - void set_c_mass_offset_local_mat(const LMatrix4f &mat); - void set_c_mass_offset_local_pos(const LPoint3f &pos); - void set_c_mass_offset_local_orientation(const LMatrix3f &mat); - void set_c_mass_offset_global_mat(const LMatrix4f &mat); - void set_c_mass_offset_global_pos(const LPoint3f &pos); - void set_c_mass_offset_global_orientation(const LMatrix3f &mat); - void set_c_mass_global_mat(const LMatrix4f &mat); - void set_c_mass_global_pos(const LPoint3f &pos); - void set_c_mass_global_orientation(const LMatrix3f &mat); - void set_mass_space_inertia_tensor(const LVector3f &m); - - float get_mass() const; - LMatrix4f get_c_mass_global_mat() const; - LPoint3f get_c_mass_global_pos() const; - LMatrix3f get_c_mass_global_orientation() const; - LMatrix4f get_c_mass_local_mat() const; - LPoint3f get_c_mass_local_pos() const; - LMatrix3f get_c_mass_local_orientation() const; - LVector3f get_mass_space_inertia_tensor() const; - LMatrix3f get_global_inertia_tensor() const; - LMatrix3f get_global_inertia_tensor_inverse() const; - - // Damping - void set_linear_damping(float linDamp); - void set_angular_damping(float angDamp); - float get_linear_damping() const; - float get_angular_damping() const; - - // Velocity - void set_linear_velocity(const LVector3f &linVel); - void set_angular_velocity(const LVector3f &angVel); - void set_max_angular_velocity(float maxAngVel); - - LVector3f get_linear_velocity() const; - LVector3f get_angular_velocity() const; - float get_max_angular_velocity() const; - - // Point Velocity - LVector3f get_point_velocity(const LPoint3f &point) const; - LVector3f get_local_point_velocity(const LPoint3f &point) const; - - // Momentum - void set_linear_momentum(const LVector3f &momentum); - void set_angular_momentum(const LVector3f &momentum); - LVector3f get_linear_momentum() const; - LVector3f get_angular_momentum() const; - - // Sleeping - void set_sleep_linear_velocity(float threshold); - void set_sleep_angular_velocity(float threshold); - void set_sleep_energy_threshold(float threshold); - float get_sleep_linear_velocity() const; - float get_sleep_angular_velocity() const; - float get_sleep_energy_threshold() const; - bool is_sleeping() const; - void wake_up(float wakeCounterValue=NX_SLEEP_INTERVAL); - void put_to_sleep(); - - // Kinematic - void move_global_pos(const LPoint3f &pos); - void move_global_mat(const LMatrix4f &mat); - void move_global_hpr(float h, float p, float r); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - void update_transform(const LMatrix4f &m); - -PUBLISHED: - void release(); - -public: - INLINE NxActor *ptr() const { return _ptr; }; - - void link_controller(PhysxController *controller); - void link(NxActor *ptr); - void unlink(); - - PhysxObjectCollection _shapes; - -private: - NxActor *_ptr; - NodePath _np; - PT(PhysxController) _controller; - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxActor", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxActor.I" - -#endif // PHYSXACTOR_H diff --git a/panda/src/physx/physxActorDesc.I b/panda/src/physx/physxActorDesc.I deleted file mode 100644 index 06dfb6b558..0000000000 --- a/panda/src/physx/physxActorDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxActorDesc.I - * @author enn0x - * @date 2009-09-05 - */ - -/** - * - */ -INLINE PhysxActorDesc:: -PhysxActorDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxActorDesc:: -~PhysxActorDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxActorDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxActorDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxActorDesc.cxx b/panda/src/physx/physxActorDesc.cxx deleted file mode 100644 index 53933cb9e9..0000000000 --- a/panda/src/physx/physxActorDesc.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxActorDesc.cxx - * @author enn0x - * @date 2009-09-05 - */ - -#include "physxActorDesc.h" -#include "physxBodyDesc.h" -#include "physxManager.h" - -/** - * Adds a shape to the list of collision shapes composing this actor. - */ -void PhysxActorDesc:: -add_shape(PhysxShapeDesc &desc) { - - _desc.shapes.push_back(desc.ptr()); -} - -/** - * Sets the optional debug name for the actor. - */ -void PhysxActorDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - _desc.name = _name.c_str(); -} - -/** - * Set the density used during mass/intertia computation. This value is used - * if the actor's shapes do not have a mass asigned. - */ -void PhysxActorDesc:: -set_density(float density) { - - _desc.density = density; -} - -/** - * Set the position of the actor in global space. - */ -void PhysxActorDesc:: -set_global_pos(const LPoint3f &pos) { - - _desc.globalPose.t = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * Set the position and orientation of the actor in global space. Scaling and - * shear arenot supported, even if the matrix contains a scale or shear. - */ -void PhysxActorDesc:: -set_global_mat(const LMatrix4f &mat) { - - _desc.globalPose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * Sets the orientation of the actor in global space by providing angles for - * heading, pitch and roll. - */ -void PhysxActorDesc:: -set_global_hpr(float h, float p, float r) { - - LQuaternionf q; - LMatrix3f rot; - NxMat34 m; - - q.set_hpr(LVector3f(h, p, r)); - q.extract_to_matrix(rot); - - _desc.globalPose.M = PhysxManager::mat3_to_nxMat33(rot); -} - -/** - * Sets the body descriptor for this actor. The actor will be dynmaic if a - * body descriptor is set, and static if no body descriptor is set. - */ -void PhysxActorDesc:: -set_body(PhysxBodyDesc &desc) { - - _desc.body = &(desc._desc); -} - -/** - * Gets the body descriptor for this actor. - */ -PhysxBodyDesc PhysxActorDesc:: -get_body() const { - assert(false /* Not implemented */); - - // PhysxBodyDesc value; value._desc = *(_desc.body); return value; - return PhysxBodyDesc(); -} - -/** - * Returns the optional debug name for this actor. - */ -const char *PhysxActorDesc:: -get_name() const { - - return _desc.name; -} - -/** - * Returns the actor's density. - */ -float PhysxActorDesc:: -get_density() const { - - return _desc.density; -} - -/** - * Returns the actor's position in global space. - */ -LPoint3f PhysxActorDesc:: -get_global_pos() const { - - return PhysxManager::nxVec3_to_point3(_desc.globalPose.t); -} - -/** - * Returns the actor's transform in global space. - */ -LMatrix4f PhysxActorDesc:: -get_global_mat() const { - - return PhysxManager::nxMat34_to_mat4(_desc.globalPose); -} diff --git a/panda/src/physx/physxActorDesc.h b/panda/src/physx/physxActorDesc.h deleted file mode 100644 index 339134de06..0000000000 --- a/panda/src/physx/physxActorDesc.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxActorDesc.h - * @author enn0x - * @date 2009-09-05 - */ - -#ifndef PHYSXACTORDESC_H -#define PHYSXACTORDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physx_includes.h" - -class PhysxBodyDesc; -class PhysxShapeDesc; - -/** - * Descriptor for PhysxActor. - */ -class EXPCL_PANDAPHYSX PhysxActorDesc { - -PUBLISHED: - INLINE PhysxActorDesc(); - INLINE ~PhysxActorDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void add_shape(PhysxShapeDesc &desc); - - void set_name(const char *name); - void set_density(float density); - void set_global_pos(const LPoint3f &pos); - void set_global_mat(const LMatrix4f &mat); - void set_global_hpr(float h, float p, float r); - void set_body(PhysxBodyDesc &desc); - - const char *get_name() const; - float get_density() const; - LPoint3f get_global_pos() const; - LMatrix4f get_global_mat() const; - PhysxBodyDesc get_body() const; - -public: - NxActorDesc _desc; - -private: - std::string _name; -}; - -#include "physxActorDesc.I" - -#endif // PHYSXACTORDESC_H diff --git a/panda/src/physx/physxBodyDesc.I b/panda/src/physx/physxBodyDesc.I deleted file mode 100644 index f223344c59..0000000000 --- a/panda/src/physx/physxBodyDesc.I +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBodyDesc.I - * @author enn0x - * @date 2009-09-05 - */ - -/** - * - */ -INLINE PhysxBodyDesc:: -PhysxBodyDesc() { - -} - -/** - * - */ -INLINE PhysxBodyDesc:: -~PhysxBodyDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxBodyDesc:: -set_to_default() { - - _desc.setToDefault(); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxBodyDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxBodyDesc.cxx b/panda/src/physx/physxBodyDesc.cxx deleted file mode 100644 index 7a5d8181b0..0000000000 --- a/panda/src/physx/physxBodyDesc.cxx +++ /dev/null @@ -1,330 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBodyDesc.cxx - * @author enn0x - * @date 2009-09-05 - */ - -#include "physxBodyDesc.h" - -/** - * Set the mass of body. - */ -void PhysxBodyDesc:: -set_mass(float mass) { - - _desc.mass = mass; -} - -/** - * Get the mass of body. - */ -float PhysxBodyDesc:: -get_mass() const { - - return _desc.mass; -} - -/** - * Set the linear damping applied to the body. - */ -void PhysxBodyDesc:: -set_linear_damping(float damping) { - - _desc.linearDamping = damping; -} - -/** - * Get the linear damping applied to the body. - */ -float PhysxBodyDesc:: -get_linear_damping() const { - - return _desc.linearDamping; -} - -/** - * Set the angular damping applied to the body. - */ -void PhysxBodyDesc:: -set_angular_damping(float damping) { - - _desc.angularDamping = damping; -} - -/** - * Get the angular damping applied to the body. - */ -float PhysxBodyDesc:: -get_angular_damping() const { - - return _desc.angularDamping; -} - -/** - * Set the linear Velocity of the body. - */ -void PhysxBodyDesc:: -set_linear_velocity(const LVector3f &velocity) { - - _desc.linearVelocity = PhysxManager::vec3_to_nxVec3(velocity); -} - -/** - * Get the linear Velocity of the body. - */ -LVector3f PhysxBodyDesc:: -get_linear_velocity() const { - - return PhysxManager::nxVec3_to_vec3(_desc.linearVelocity); -} - -/** - * Set the angular velocity of the body. - */ -void PhysxBodyDesc:: -set_angular_velocity(const LVector3f &velocity) { - - _desc.angularVelocity = PhysxManager::vec3_to_nxVec3(velocity); -} - -/** - * Get the angular velocity of the body. - */ -LVector3f PhysxBodyDesc:: -get_angular_velocity() const { - - return PhysxManager::nxVec3_to_vec3(_desc.angularVelocity); -} - -/** - * Set the maximum allowed angular velocity for this body. - */ -void PhysxBodyDesc:: -set_max_angular_velocity(float maximum) { - - _desc.maxAngularVelocity = maximum; -} - -/** - * Get the maximum allowed angular velocity for this body. - */ -float PhysxBodyDesc:: -get_max_angular_velocity() const { - - return _desc.maxAngularVelocity; -} - -/** - * Set the maximum linear velocity at which the body can go to sleep. - */ -void PhysxBodyDesc:: -set_sleep_linear_velocity(float velocity) { - - _desc.sleepLinearVelocity = velocity; -} - -/** - * Get the maximum linear velocity at which the body can go to sleep. - */ -float PhysxBodyDesc:: -get_sleep_linear_velocity() const { - - return _desc.sleepLinearVelocity; -} - -/** - * Set the maximum angular velocity at which body can go to sleep. - */ -void PhysxBodyDesc:: -set_sleep_angular_velocity(float velocity) { - - _desc.sleepAngularVelocity = velocity; -} - -/** - * Get the maximum angular velocity at which body can go to sleep. - */ -float PhysxBodyDesc:: -get_sleep_angular_velocity() const { - - return _desc.sleepAngularVelocity; -} - -/** - * Set the number of solver iterations performed when processing - * joint/contacts connected to this body. - */ -void PhysxBodyDesc:: -set_solver_iteration_count(unsigned int count) { - - _desc.solverIterationCount = count; -} - -/** - * Get the number of solver iterations performed when processing - * joint/contacts connected to this body. - */ -unsigned int PhysxBodyDesc:: -get_solver_iteration_count() const { - - return _desc.solverIterationCount; -} - -/** - * Set the threshold for the energy-based sleeping algorithm. Only used when - * the BF_energy_sleep_test flag is set. - */ -void PhysxBodyDesc:: -set_sleep_energy_threshold(float threshold) { - - _desc.sleepEnergyThreshold = threshold; -} - -/** - * Get the threshold for the energy-based sleeping algorithm. Only used when - * the BF_energy_sleep_test flag is set. - */ -float PhysxBodyDesc:: -get_sleep_energy_threshold() const { - - return _desc.sleepEnergyThreshold; -} - -/** - * Set the damping factor for bodies that are about to sleep. - */ -void PhysxBodyDesc:: -set_sleep_damping(float damping) { - - _desc.sleepDamping = damping; -} - -/** - * Get the damping factor for bodies that are about to sleep. - */ -float PhysxBodyDesc:: -get_sleep_damping() const { - - return _desc.sleepDamping; -} - -/** - * Set the position and orientation of the center of mass. - */ -void PhysxBodyDesc:: -set_mass_local_mat(const LMatrix4f &mat) { - - _desc.massLocalPose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * Get the position and orientation of the center of mass. - */ -LMatrix4f PhysxBodyDesc:: -get_mass_local_mat() const { - - return PhysxManager::nxMat34_to_mat4(_desc.massLocalPose); -} - -/** - * Set the diagonal mass space inertia tensor in bodies mass frame. - */ -void PhysxBodyDesc:: -set_mass_space_inertia(const LVector3f &inertia) { - - _desc.massSpaceInertia = PhysxManager::vec3_to_nxVec3(inertia); -} - -/** - * Get the diagonal mass space inertia tensor in bodies mass frame. - */ -LVector3f PhysxBodyDesc:: -get_mass_space_inertia() const { - - return PhysxManager::nxVec3_to_vec3(_desc.massSpaceInertia); -} - -/** - * Raise or lower individual body flags. - */ -void PhysxBodyDesc:: -set_flag(const PhysxBodyFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Returns the specified body flag. - */ -bool PhysxBodyDesc:: -get_flag(const PhysxBodyFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * When CCD is globally enabled, it is still not performed if the motion - * distance of all points on the body is below this threshold. - */ -void PhysxBodyDesc:: -set_ccd_motion_threshold(float threshold) { - - _desc.CCDMotionThreshold = threshold; -} - -/** - * - */ -float PhysxBodyDesc:: -get_ccd_motion_threshold() const { - - return _desc.CCDMotionThreshold; -} - -/** - * Set the body's initial wake up counter. - */ -void PhysxBodyDesc:: -set_wake_up_counter(float value) { - - _desc.wakeUpCounter = value; -} - -/** - * - */ -float PhysxBodyDesc:: -get_wake_up_counter() const { - - return _desc.wakeUpCounter; -} - -/** - * Set The force threshold for contact reports. - */ -void PhysxBodyDesc:: -set_contact_report_threshold(float threshold) { - - _desc.contactReportThreshold = threshold; -} - -/** - * - */ -float PhysxBodyDesc:: -get_contact_report_threshold() const { - - return _desc.contactReportThreshold; -} diff --git a/panda/src/physx/physxBodyDesc.h b/panda/src/physx/physxBodyDesc.h deleted file mode 100644 index 35fc2be5e3..0000000000 --- a/panda/src/physx/physxBodyDesc.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBodyDesc.h - * @author enn0x - * @date 2009-09-05 - */ - -#ifndef PHYSXBODYDESC_H -#define PHYSXBODYDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -/** - * Descriptor for the optional rigid body dynamic state of PhysxActor. - */ -class EXPCL_PANDAPHYSX PhysxBodyDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxBodyDesc(); - INLINE ~PhysxBodyDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_mass(float mass); - void set_linear_damping(float damping); - void set_angular_damping(float damping); - void set_linear_velocity(const LVector3f &velocity); - void set_angular_velocity(const LVector3f &velocity); - void set_max_angular_velocity(float maximum); - void set_sleep_linear_velocity(float velocity); - void set_sleep_angular_velocity(float velocity); - void set_solver_iteration_count(unsigned int count); - void set_sleep_energy_threshold(float threshold); - void set_sleep_damping(float damping); - void set_mass_local_mat(const LMatrix4f &mat); - void set_mass_space_inertia(const LVector3f &inertia); - void set_flag(PhysxBodyFlag flag, bool value); - void set_ccd_motion_threshold(float threshold); - void set_wake_up_counter(float value); - void set_contact_report_threshold(float threshold); - - float get_mass() const; - float get_linear_damping() const; - float get_angular_damping() const; - LVector3f get_linear_velocity() const; - LVector3f get_angular_velocity() const; - float get_max_angular_velocity() const; - float get_sleep_linear_velocity() const; - float get_sleep_angular_velocity() const; - unsigned int get_solver_iteration_count() const; - float get_sleep_energy_threshold() const; - float get_sleep_damping() const; - LMatrix4f get_mass_local_mat() const; - LVector3f get_mass_space_inertia() const; - bool get_flag(PhysxBodyFlag flag) const; - float get_ccd_motion_threshold() const; - float get_wake_up_counter() const; - float get_contact_report_threshold() const; - -public: - NxBodyDesc _desc; -}; - -#include "physxBodyDesc.I" - -#endif // PHYSXBODYDESC_H diff --git a/panda/src/physx/physxBounds3.I b/panda/src/physx/physxBounds3.I deleted file mode 100644 index d9d85775a6..0000000000 --- a/panda/src/physx/physxBounds3.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBounds3.I - * @author enn0x - * @date 2009-10-31 - */ - -/** - * - */ -INLINE PhysxBounds3:: -PhysxBounds3() { - -} - -/** - * - */ -INLINE PhysxBounds3:: -~PhysxBounds3() { - -} diff --git a/panda/src/physx/physxBounds3.cxx b/panda/src/physx/physxBounds3.cxx deleted file mode 100644 index 17cbdfa661..0000000000 --- a/panda/src/physx/physxBounds3.cxx +++ /dev/null @@ -1,229 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBounds3.cxx - * @author enn0x - * @date 2009-10-31 - */ - -#include "physxBounds3.h" -#include "physxManager.h" - -/** - * Returns the minimum corner of the bounding box. - */ -LPoint3f PhysxBounds3:: -get_max() const { - - return PhysxManager::nxVec3_to_point3(_bounds.max); -} - -/** - * Returns the maximum corner of the bounding box. - */ -LPoint3f PhysxBounds3:: -get_min() const { - - return PhysxManager::nxVec3_to_point3(_bounds.min); -} - -/** - * Returns the center of the bounding box. - */ -LPoint3f PhysxBounds3:: -get_center() const { - - NxVec3 center; - _bounds.getCenter(center); - return PhysxManager::nxVec3_to_point3(center); -} - -/** - * Returns the extents of the bounding box. - */ -LVector3f PhysxBounds3:: -get_dimensions() const { - - NxVec3 dims; - _bounds.getDimensions(dims); - return PhysxManager::nxVec3_to_vec3(dims); -} - -/** - * Sets the maximum corner of the bounding box. - */ -void PhysxBounds3:: -set_max(LPoint3f value) { - - nassertv(!value.is_nan()); - - _bounds.max = PhysxManager::point3_to_nxVec3(value); -} - -/** - * Sets the minimum corner of the bounding box. - */ -void PhysxBounds3:: -set_min(LPoint3f value) { - - nassertv(!value.is_nan()); - - _bounds.min = PhysxManager::point3_to_nxVec3(value); -} - -/** - * Sets this to the AABB (axis ligned bounding box) of the OBB (oriented - * bounding box). The OBB is described by orientation, translation and half - * dimensions. - */ -void PhysxBounds3:: -bounds_of_obb(const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims) { - - nassertv(!orientation.is_nan()); - nassertv(!translation.is_nan()); - nassertv(!half_dims.is_nan()); - - _bounds.boundsOfOBB(PhysxManager::mat3_to_nxMat33(orientation), - PhysxManager::point3_to_nxVec3(translation), - PhysxManager::vec3_to_nxVec3(half_dims)); -} - -/** - * Sets this to the union of this and b2. - */ -void PhysxBounds3:: -combine(const PhysxBounds3 &b2) { - - _bounds.combine(b2._bounds); -} - -/** - * Returns TRUE if these bounds contain the point v. - */ -bool PhysxBounds3:: -contain(const LPoint3f &p) const { - - nassertr(!p.is_nan(), false); - - return _bounds.contain(PhysxManager::point3_to_nxVec3(p)); -} - -/** - * Fattens the AABB in all three dimensions by the given distance. - */ -void PhysxBounds3:: -fatten(float distance) { - - _bounds.fatten(distance); -} - -/** - * Expands the volume to include the point v. - */ -void PhysxBounds3:: -include(const LPoint3f &p) { - - nassertv(!p.is_nan()); - _bounds.include(PhysxManager::point3_to_nxVec3(p)); -} - -/** - * Returns TRUE if the intersection of this and b is is not empty. - */ -bool PhysxBounds3:: -intersects(const PhysxBounds3 &b) const { - - return _bounds.intersects(b._bounds); -} - -/** - * Indicates whether the intersection of this and b is empty or not in the - * plane orthogonal to the axis passed (X = 0, Y = 1 or Z = 2). - */ -bool PhysxBounds3:: -intersects2d(const PhysxBounds3 &b, unsigned axis_to_ignore) const { - - return _bounds.intersects2D(b._bounds, axis_to_ignore); -} - -/** - * Returns TRUE if the bounding box is empty. - */ -bool PhysxBounds3:: -is_empty() const { - - return _bounds.isEmpty(); -} - -/** - * Scales the AABB by the given factor. - */ -void PhysxBounds3:: -scale(float scale) { - - _bounds.scale(scale); -} - -/** - * Setup this AABB from minimum corner and maximum corner. - */ -void PhysxBounds3:: -set(const LPoint3f &min, const LPoint3f &max) { - - nassertv(!min.is_nan()); - nassertv(!max.is_nan()); - - _bounds.set(PhysxManager::point3_to_nxVec3(min), - PhysxManager::point3_to_nxVec3(max)); -} - -/** - * Setup this AABB from center point and extents vector. - */ -void PhysxBounds3:: -set_center_extents(const LPoint3f ¢er, const LVector3f &extents) { - - nassertv(!center.is_nan()); - nassertv(!extents.is_nan()); - - _bounds.setCenterExtents(PhysxManager::point3_to_nxVec3(center), - PhysxManager::vec3_to_nxVec3(extents)); -} - -/** - * Sets empty to TRUE. - */ -void PhysxBounds3:: -set_empty() { - - _bounds.setEmpty(); -} - -/** - * Sets infinite bounds. - */ -void PhysxBounds3:: -set_infinite() { - - _bounds.setInfinite(); -} - -/** - * Transforms this volume as if it was an axis aligned bounding box, and then - * assigns the results' bounds to this. The orientation is applied first, - * then the translation. - */ -void PhysxBounds3:: -transform(const LMatrix3f &orientation, const LPoint3f &translation) { - - nassertv(!orientation.is_nan()); - nassertv(!translation.is_nan()); - - _bounds.transform(PhysxManager::mat3_to_nxMat33(orientation), - PhysxManager::point3_to_nxVec3(translation)); -} diff --git a/panda/src/physx/physxBounds3.h b/panda/src/physx/physxBounds3.h deleted file mode 100644 index 4d7ec50d26..0000000000 --- a/panda/src/physx/physxBounds3.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBounds3.h - * @author enn0x - * @date 2009-10-31 - */ - -#ifndef PHYSXBOUNDS3_H -#define PHYSXBOUNDS3_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" -#include "physx_includes.h" - -/** - * Represention of a axis aligned bounding box. The box is stored as minimum - * and maximum extent corners. Alternate representation would be center and - * dimensions. May be empty or nonempty. If not empty, min <= max has to - * hold. - */ -class EXPCL_PANDAPHYSX PhysxBounds3 { - -PUBLISHED: - INLINE PhysxBounds3(); - INLINE ~PhysxBounds3(); - - void bounds_of_obb(const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims); - void combine(const PhysxBounds3 &b2); - bool contain(const LPoint3f &p) const; - void fatten(float distance); - void include(const LPoint3f &v); - bool intersects(const PhysxBounds3 &b) const; - bool intersects2d(const PhysxBounds3 &b, unsigned axis_to_ignore) const; - bool is_empty() const; - void scale(float scale); - void set(const LPoint3f &min, const LPoint3f &max); - void set_center_extents(const LPoint3f ¢er, const LVector3f &extents); - void set_empty(); - void set_infinite(); - void transform(const LMatrix3f &orientation, const LPoint3f &translation); - - LPoint3f get_max() const; - LPoint3f get_min() const; - LPoint3f get_center() const; - LVector3f get_dimensions() const; - - void set_max(LPoint3f value); - void set_min(LPoint3f value); - -public: - NxBounds3 _bounds; -}; - -#include "physxBounds3.I" - -#endif // PHYSBOUNDS3_H diff --git a/panda/src/physx/physxBox.I b/panda/src/physx/physxBox.I deleted file mode 100644 index f668497b65..0000000000 --- a/panda/src/physx/physxBox.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBox.I - * @author enn0x - * @date 2009-10-31 - */ - -/** - * - */ -INLINE PhysxBox:: -PhysxBox() { - -} - -/** - * - */ -INLINE PhysxBox:: -~PhysxBox() { - -} diff --git a/panda/src/physx/physxBox.cxx b/panda/src/physx/physxBox.cxx deleted file mode 100644 index ba552d4021..0000000000 --- a/panda/src/physx/physxBox.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBox.cxx - * @author enn0x - * @date 2009-10-31 - */ - -#include "physxBox.h" -#include "physxManager.h" - -/** - * - */ -PhysxBox:: -PhysxBox(const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot) { - - _box = NxBox(PhysxManager::point3_to_nxVec3(center), - PhysxManager::vec3_to_nxVec3(extents), - PhysxManager::mat3_to_nxMat33(rot)); -} - -/** - * Returns TRUE if the box is valid. - */ -bool PhysxBox:: -is_valid() const { - - return _box.isValid(); -} - -/** - * Recomputes the box after an arbitrary transform by a 4x4 matrix. - */ -void PhysxBox:: -rotate(const LMatrix4f &m, PhysxBox &obb) const { - - nassertv(!m.is_nan()); - - _box.rotate(PhysxManager::mat4_to_nxMat34(m), obb._box); -} - -/** - * Setups an empty box. - */ -void PhysxBox:: -set_empty() { - - _box.setEmpty(); -} - -/** - * Return center of the box. - */ -LPoint3f PhysxBox:: -get_center() const { - - return PhysxManager::nxVec3_to_point3(_box.GetCenter()); -} - -/** - * Returns the extents (radii) of the box. - */ -LVector3f PhysxBox:: -get_extents() const { - - return PhysxManager::nxVec3_to_vec3(_box.GetExtents()); -} - -/** - * Return the rotation of the box. - */ -LMatrix3f PhysxBox:: -get_rot() const { - - return PhysxManager::nxMat33_to_mat3(_box.GetRot()); -} - -/** - * Sets the center of the box. - */ -void PhysxBox:: -set_center(LPoint3f center) { - - nassertv(!center.is_nan()); - - _box.center = PhysxManager::vec3_to_nxVec3(center); -} - -/** - * Sets the extents of the box. - */ -void PhysxBox:: -set_extents(LVector3f extents) { - - nassertv(!extents.is_nan()); - - _box.extents = PhysxManager::vec3_to_nxVec3(extents); -} - -/** - * Sets the rotation of the box. - */ -void PhysxBox:: -set_rot(LMatrix3f rot) { - - nassertv(!rot.is_nan()); - - _box.rot = PhysxManager::mat3_to_nxMat33(rot); -} diff --git a/panda/src/physx/physxBox.h b/panda/src/physx/physxBox.h deleted file mode 100644 index 8c3b7f684f..0000000000 --- a/panda/src/physx/physxBox.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBox.h - * @author enn0x - * @date 2009-10-31 - */ - -#ifndef PHYSXBOX_H -#define PHYSXBOX_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" -#include "physx_includes.h" - -/** - * Represents an oriented bounding box, as a center point, extents(radii) and - * a rotation. i.e. the center of the box is at the center point, the box is - * rotated around this point with the rotation and it is 2*extents in width, - * height and depth. - */ -class EXPCL_PANDAPHYSX PhysxBox { - -PUBLISHED: - INLINE PhysxBox(); - INLINE ~PhysxBox(); - PhysxBox(const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot); - - bool is_valid() const; - void rotate(const LMatrix4f &m, PhysxBox &obb) const; - void set_empty(); - - LPoint3f get_center() const; - LVector3f get_extents() const; - LMatrix3f get_rot() const; - - void set_center(LPoint3f center); - void set_extents(LVector3f extents); - void set_rot(LMatrix3f rot); - -public: - NxBox _box; -}; - -#include "physxBox.I" - -#endif // PHYSBOX_H diff --git a/panda/src/physx/physxBoxController.I b/panda/src/physx/physxBoxController.I deleted file mode 100644 index 1c6d3454b8..0000000000 --- a/panda/src/physx/physxBoxController.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxController.I - * @author enn0x - * @date 2009-09-24 - */ - -/** - * - */ -INLINE PhysxBoxController:: -PhysxBoxController() : PhysxController() { - -} - -/** - * - */ -INLINE PhysxBoxController:: -~PhysxBoxController() { - -} diff --git a/panda/src/physx/physxBoxController.cxx b/panda/src/physx/physxBoxController.cxx deleted file mode 100644 index e687114055..0000000000 --- a/panda/src/physx/physxBoxController.cxx +++ /dev/null @@ -1,75 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxController.cxx - * @author enn0x - * @date 2009-09-24 - */ - -#include "physxBoxController.h" -#include "physxManager.h" - -TypeHandle PhysxBoxController::_type_handle; - -/** - * - */ -void PhysxBoxController:: -link(NxController *controllerPtr) { - - nassertv(controllerPtr->getType() == NX_CONTROLLER_BOX); - - // Link self - _ptr = (NxBoxController *)controllerPtr; - _error_type = ET_ok; - - PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData; - scene->_controllers.add(this); - - // Link actor - PT(PhysxActor) actor = new PhysxActor(); - actor->link(_ptr->getActor()); - actor->link_controller(this); -} - -/** - * - */ -void PhysxBoxController:: -unlink() { - - // Unlink actor - PT(PhysxActor) actor = (PhysxActor *)ptr()->getActor()->userData; - actor->unlink(); - - // Unlink self - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData; - scene->_controllers.remove(this); -} - -/** - * Sets controller's extents. - */ -void PhysxBoxController:: -set_extents(const LVector3f &extents) { - - nassertv(_error_type == ET_ok); - _ptr->setExtents(PhysxManager::vec3_to_nxVec3(extents)); -} - -/** - * Returns controller's extents. - */ -LVector3f PhysxBoxController:: -get_extents() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getExtents()); -} diff --git a/panda/src/physx/physxBoxController.h b/panda/src/physx/physxBoxController.h deleted file mode 100644 index 27f3524a8c..0000000000 --- a/panda/src/physx/physxBoxController.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxController.h - * @author enn0x - * @date 2009-09-24 - */ - -#ifndef PHYSXBOXCONTROLLER_H -#define PHYSXBOXCONTROLLER_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxController.h" -#include "physx_includes.h" - -/** - * Box character controller. - */ -class EXPCL_PANDAPHYSX PhysxBoxController : public PhysxController { - -PUBLISHED: - INLINE PhysxBoxController(); - INLINE ~PhysxBoxController(); - - void set_extents(const LVector3f &extents); - LVector3f get_extents() const; - -public: - INLINE NxController *ptr() const { return (NxController *)_ptr; }; - - void link(NxController *controllerPtr); - void unlink(); - -private: - NxBoxController *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxController::init_type(); - register_type(_type_handle, "PhysxBoxController", - PhysxController::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxBoxController.I" - -#endif // PHYSXBOXCONTROLLER_H diff --git a/panda/src/physx/physxBoxControllerDesc.I b/panda/src/physx/physxBoxControllerDesc.I deleted file mode 100644 index 44ccbe3723..0000000000 --- a/panda/src/physx/physxBoxControllerDesc.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxControllerDesc.I - * @author enn0x - * @date 2009-09-22 - */ - -/** - * - */ -INLINE PhysxBoxControllerDesc:: -PhysxBoxControllerDesc() : PhysxControllerDesc() { - - _desc.upDirection = (NxHeightFieldAxis)physx_up_axis.get_value(); -} - -/** - * - */ -INLINE PhysxBoxControllerDesc:: -~PhysxBoxControllerDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxBoxControllerDesc:: -set_to_default() { - - _desc.setToDefault(); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxBoxControllerDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxBoxControllerDesc.cxx b/panda/src/physx/physxBoxControllerDesc.cxx deleted file mode 100644 index 7a05f5cad2..0000000000 --- a/panda/src/physx/physxBoxControllerDesc.cxx +++ /dev/null @@ -1,36 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxControllerDesc.cxx - * @author enn0x - * @date 2009-09-22 - */ - -#include "physxBoxControllerDesc.h" -#include "physxManager.h" - -/** - * Sets the dimensions of the box. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -void PhysxBoxControllerDesc:: -set_extents(const LVector3f &extents) { - - _desc.extents = PhysxManager::vec3_to_nxVec3(extents); -} - -/** - * Returns the dimensions of the box. - */ -LVector3f PhysxBoxControllerDesc:: -get_extents() const { - - return PhysxManager::nxVec3_to_vec3(_desc.extents); -} diff --git a/panda/src/physx/physxBoxControllerDesc.h b/panda/src/physx/physxBoxControllerDesc.h deleted file mode 100644 index 6ab4cf0f41..0000000000 --- a/panda/src/physx/physxBoxControllerDesc.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxControllerDesc.h - * @author enn0x - * @date 2009-09-22 - */ - -#ifndef PHYSXBOXCONTROLLERDESC_H -#define PHYSXBOXCONTROLLERDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxControllerDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for PhysxBoxController. - */ -class EXPCL_PANDAPHYSX PhysxBoxControllerDesc : public PhysxControllerDesc { - -PUBLISHED: - INLINE PhysxBoxControllerDesc(); - INLINE ~PhysxBoxControllerDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_extents(const LVector3f &extents); - - LVector3f get_extents() const; - -public: - NxControllerDesc *ptr() const { return (NxControllerDesc *)&_desc; }; - NxBoxControllerDesc _desc; -}; - -#include "physxBoxControllerDesc.I" - -#endif // PHYSXBOXCONTROLLERDESC_H diff --git a/panda/src/physx/physxBoxForceFieldShape.I b/panda/src/physx/physxBoxForceFieldShape.I deleted file mode 100644 index 2d57430194..0000000000 --- a/panda/src/physx/physxBoxForceFieldShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxForceFieldShape.I - * @author enn0x - * @date 2009-11-15 - */ - -/** - * - */ -INLINE PhysxBoxForceFieldShape:: -PhysxBoxForceFieldShape() : PhysxForceFieldShape() { - -} - -/** - * - */ -INLINE PhysxBoxForceFieldShape:: -~PhysxBoxForceFieldShape() { - -} diff --git a/panda/src/physx/physxBoxForceFieldShape.cxx b/panda/src/physx/physxBoxForceFieldShape.cxx deleted file mode 100644 index af874e3b4b..0000000000 --- a/panda/src/physx/physxBoxForceFieldShape.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxForceFieldShape.cxx - * @author enn0x - * @date 2009-11-15 - */ - -#include "physxBoxForceFieldShape.h" -#include "physxBoxForceFieldShapeDesc.h" -#include "physxManager.h" - -TypeHandle PhysxBoxForceFieldShape::_type_handle; - -/** - * - */ -void PhysxBoxForceFieldShape:: -link(NxForceFieldShape *shapePtr) { - - _ptr = shapePtr->isBox(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.add(this); -} - -/** - * - */ -void PhysxBoxForceFieldShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxBoxForceFieldShape:: -save_to_desc(PhysxBoxForceFieldShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Sets the box dimensions. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -void PhysxBoxForceFieldShape:: -set_dimensions(const LVector3f &vec) { - - nassertv(_error_type == ET_ok); - _ptr->setDimensions(PhysxManager::vec3_to_nxVec3(vec)); -} - -/** - * Retrieves the dimensions of the box. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -LVector3f PhysxBoxForceFieldShape:: -get_dimensions() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getDimensions()); -} diff --git a/panda/src/physx/physxBoxForceFieldShape.h b/panda/src/physx/physxBoxForceFieldShape.h deleted file mode 100644 index de77b03634..0000000000 --- a/panda/src/physx/physxBoxForceFieldShape.h +++ /dev/null @@ -1,70 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxForceFieldShape.h - * @author enn0x - * @date 2009-11-15 - */ - -#ifndef PHYSXBOXFORCEFIELDSHAPE_H -#define PHYSXBOXFORCEFIELDSHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxForceFieldShape.h" -#include "physx_includes.h" - -class PhysxBoxForceFieldShapeDesc; - -/** - * A box shaped region used to define a force field. - */ -class EXPCL_PANDAPHYSX PhysxBoxForceFieldShape : public PhysxForceFieldShape { -PUBLISHED: - INLINE PhysxBoxForceFieldShape(); - INLINE ~PhysxBoxForceFieldShape(); - - void save_to_desc(PhysxBoxForceFieldShapeDesc &shapeDesc) const; - - void set_dimensions(const LVector3f &dimensions); - LVector3f get_dimensions() const; - -public: - INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; }; - - void link(NxForceFieldShape *shapePtr); - void unlink(); - -private: - NxBoxForceFieldShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxForceFieldShape::init_type(); - register_type(_type_handle, "PhysxBoxForceFieldShape", - PhysxForceFieldShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxBoxForceFieldShape.I" - -#endif // PHYSXBOXFORCEFIELDSHAPE_H diff --git a/panda/src/physx/physxBoxForceFieldShapeDesc.I b/panda/src/physx/physxBoxForceFieldShapeDesc.I deleted file mode 100644 index 9310bdd25e..0000000000 --- a/panda/src/physx/physxBoxForceFieldShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxForceFieldShapeDesc.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxBoxForceFieldShapeDesc:: -PhysxBoxForceFieldShapeDesc() : PhysxForceFieldShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxBoxForceFieldShapeDesc:: -~PhysxBoxForceFieldShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxBoxForceFieldShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxBoxForceFieldShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxBoxForceFieldShapeDesc.cxx b/panda/src/physx/physxBoxForceFieldShapeDesc.cxx deleted file mode 100644 index af9a5093f7..0000000000 --- a/panda/src/physx/physxBoxForceFieldShapeDesc.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxForceFieldShapeDesc.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxBoxForceFieldShapeDesc.h" -#include "physxManager.h" - -/** - * Sets the dimensions of the box. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -void PhysxBoxForceFieldShapeDesc:: -set_dimensions(const LVector3f &dimensions) { - - nassertv(!dimensions.is_nan()); - _desc.dimensions = PhysxManager::vec3_to_nxVec3(dimensions); -} - -/** - * Returns the dimensions of the box. - */ -LVector3f PhysxBoxForceFieldShapeDesc:: -get_dimensions() const { - - return PhysxManager::nxVec3_to_vec3(_desc.dimensions); -} diff --git a/panda/src/physx/physxBoxForceFieldShapeDesc.h b/panda/src/physx/physxBoxForceFieldShapeDesc.h deleted file mode 100644 index c2db24cb1c..0000000000 --- a/panda/src/physx/physxBoxForceFieldShapeDesc.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxForceFieldShapeDesc.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXBOXFORCEFIELDSHAPEDESC_H -#define PHYSXBOXFORCEFIELDSHAPEDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxForceFieldShapeDesc.h" -#include "physx_includes.h" - -/** - * Descriptor for a box force field shape. - */ -class EXPCL_PANDAPHYSX PhysxBoxForceFieldShapeDesc : public PhysxForceFieldShapeDesc { - -PUBLISHED: - INLINE PhysxBoxForceFieldShapeDesc(); - INLINE ~PhysxBoxForceFieldShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_dimensions(const LVector3f &dimensions); - - LVector3f get_dimensions() const; - -public: - NxForceFieldShapeDesc *ptr() const { return (NxForceFieldShapeDesc *)&_desc; }; - NxBoxForceFieldShapeDesc _desc; -}; - -#include "physxBoxForceFieldShapeDesc.I" - -#endif // PHYSXBOXFORCEFIELDSHAPEDESC_H diff --git a/panda/src/physx/physxBoxShape.I b/panda/src/physx/physxBoxShape.I deleted file mode 100644 index c1ad718397..0000000000 --- a/panda/src/physx/physxBoxShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxShape.I - * @author enn0x - * @date 2009-09-16 - */ - -/** - * - */ -INLINE PhysxBoxShape:: -PhysxBoxShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxBoxShape:: -~PhysxBoxShape() { - -} diff --git a/panda/src/physx/physxBoxShape.cxx b/panda/src/physx/physxBoxShape.cxx deleted file mode 100644 index 0ec704bc02..0000000000 --- a/panda/src/physx/physxBoxShape.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxShape.cxx - * @author enn0x - * @date 2009-09-16 - */ - -#include "physxBoxShape.h" -#include "physxBoxShapeDesc.h" -#include "physxManager.h" - -TypeHandle PhysxBoxShape::_type_handle; - -/** - * - */ -void PhysxBoxShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isBox(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxBoxShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxBoxShape:: -save_to_desc(PhysxBoxShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Sets the box dimensions. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -void PhysxBoxShape:: -set_dimensions(const LVector3f &vec) { - - nassertv(_error_type == ET_ok); - _ptr->setDimensions(PhysxManager::vec3_to_nxVec3(vec)); -} - -/** - * Retrieves the dimensions of the box. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -LVector3f PhysxBoxShape:: -get_dimensions() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getDimensions()); -} diff --git a/panda/src/physx/physxBoxShape.h b/panda/src/physx/physxBoxShape.h deleted file mode 100644 index ffea96c96b..0000000000 --- a/panda/src/physx/physxBoxShape.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxShape.h - * @author enn0x - * @date 2009-09-16 - */ - -#ifndef PHYSXBOXSHAPE_H -#define PHYSXBOXSHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxBoxShapeDesc; - -/** - * A box shaped collision detection primitive. Each shape is owned by the - * actor which it is attached to. - * - * An instance can be created by calling the createShape() method of the - * PhysxActor object that will own it, with a PhysxBoxShapeDesc object as the - * parameter, or by adding the shape descriptor to the PhysxActorDesc class - * before creating the actor. - * - * The shape is deleted by calling release() on the shape itself. - */ -class EXPCL_PANDAPHYSX PhysxBoxShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxBoxShape(); - INLINE ~PhysxBoxShape(); - - void save_to_desc(PhysxBoxShapeDesc &shapeDesc) const; - - void set_dimensions(const LVector3f &dimensions); - LVector3f get_dimensions() const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxBoxShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxBoxShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxBoxShape.I" - -#endif // PHYSXBOXSHAPE_H diff --git a/panda/src/physx/physxBoxShapeDesc.I b/panda/src/physx/physxBoxShapeDesc.I deleted file mode 100644 index 977811b33d..0000000000 --- a/panda/src/physx/physxBoxShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxShapeDesc.I - * @author enn0x - * @date 2009-09-08 - */ - -/** - * - */ -INLINE PhysxBoxShapeDesc:: -PhysxBoxShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxBoxShapeDesc:: -~PhysxBoxShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxBoxShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxBoxShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxBoxShapeDesc.cxx b/panda/src/physx/physxBoxShapeDesc.cxx deleted file mode 100644 index 6d67f16e45..0000000000 --- a/panda/src/physx/physxBoxShapeDesc.cxx +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxShapeDesc.cxx - * @author enn0x - * @date 2009-09-08 - */ - -#include "physxBoxShapeDesc.h" -#include "physxManager.h" - -/** - * Sets the dimensions of the box. - * - * The dimensions are the 'radii' of the box, meaning 1/2 extents in x - * dimension, 1/2 extents in y dimension, 1/2 extents in z dimension. - */ -void PhysxBoxShapeDesc:: -set_dimensions(const LVector3f &dimensions) { - - nassertv(!dimensions.is_nan()); - _desc.dimensions = PhysxManager::vec3_to_nxVec3(dimensions); -} - -/** - * Returns the dimensions of the box. - */ -LVector3f PhysxBoxShapeDesc:: -get_dimensions() const { - - return PhysxManager::nxVec3_to_vec3(_desc.dimensions); -} diff --git a/panda/src/physx/physxBoxShapeDesc.h b/panda/src/physx/physxBoxShapeDesc.h deleted file mode 100644 index 319363b695..0000000000 --- a/panda/src/physx/physxBoxShapeDesc.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxBoxShapeDesc.h - * @author enn0x - * @date 2009-09-08 - */ - -#ifndef PHYSXBOXSHAPEDESC_H -#define PHYSXBOXSHAPEDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for PhysxBoxShape. - */ -class EXPCL_PANDAPHYSX PhysxBoxShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxBoxShapeDesc(); - INLINE ~PhysxBoxShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_dimensions(const LVector3f &dimensions); - - LVector3f get_dimensions() const; - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxBoxShapeDesc _desc; -}; - -#include "physxBoxShapeDesc.I" - -#endif // PHYSXBOXSHAPEDESC_H diff --git a/panda/src/physx/physxCapsule.I b/panda/src/physx/physxCapsule.I deleted file mode 100644 index 2bb2756a51..0000000000 --- a/panda/src/physx/physxCapsule.I +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsule.I - * @author enn0x - * @date 2009-10-31 - */ - -/** - * - */ -INLINE PhysxCapsule:: -PhysxCapsule() { - -} - -/** - * - */ -INLINE PhysxCapsule:: -PhysxCapsule(const PhysxSegment &segment, float radius) { - - _capsule = NxCapsule(segment._segment, radius); -} - -/** - * - */ -INLINE PhysxCapsule:: -~PhysxCapsule() { - -} diff --git a/panda/src/physx/physxCapsule.cxx b/panda/src/physx/physxCapsule.cxx deleted file mode 100644 index 86b7e08739..0000000000 --- a/panda/src/physx/physxCapsule.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsule.cxx - * @author enn0x - * @date 2009-10-31 - */ - -#include "physxCapsule.h" -#include "physxManager.h" - -/** - * Returns the capsule's radius. - */ -float PhysxCapsule:: -get_radius() const { - - return _capsule.radius; -} - -/** - * Sets the capsule's radius. - */ -void PhysxCapsule:: -set_radius(float radius) { - - _capsule.radius = radius; -} - -/** - * Returns the start point of the segment. - */ -LPoint3f PhysxCapsule:: -get_p0() const { - - return PhysxManager::nxVec3_to_vec3(_capsule.p0); -} - -/** - * Sets the start point of the segment. - */ -void PhysxCapsule:: -set_p0(LPoint3f p) { - - nassertv(!p.is_nan()); - - _capsule.p0 = PhysxManager::vec3_to_nxVec3(p); -} - -/** - * Returns the end point of the segment. - */ -LPoint3f PhysxCapsule:: -get_p1() const { - - return PhysxManager::nxVec3_to_vec3(_capsule.p1); -} - -/** - * Sets the end point of the segment. - */ -void PhysxCapsule:: -set_p1(LPoint3f p) { - - nassertv(!p.is_nan()); - - _capsule.p1 = PhysxManager::vec3_to_nxVec3(p); -} - -/** - * Returns the start point of the segment. - */ -LPoint3f PhysxCapsule:: -get_origin() const { - - return PhysxManager::nxVec3_to_point3(_capsule.getOrigin()); -} - -/** - * Returns the direction vector from the segment's start point to it's end - * point. - */ -void PhysxCapsule:: -compute_direction(LPoint3f &dir) const { - - nassertv(!dir.is_nan()); - - NxVec3 nDir = PhysxManager::point3_to_nxVec3(dir); - _capsule.computeDirection(nDir); - PhysxManager::update_point3_from_nxVec3(dir, nDir); -} - -/** - * Returns the distance from the segment's start point to it's end point. - */ -float PhysxCapsule:: -compute_length() const { - - return _capsule.computeLength(); -} - -/** - * Computes a point on the segment. - */ -void PhysxCapsule:: -compute_point(LPoint3f &p, float t) const { - - nassertv(!p.is_nan()); - - NxVec3 nP = PhysxManager::point3_to_nxVec3(p); - _capsule.computePoint(nP, t); - PhysxManager::update_point3_from_nxVec3(p, nP); -} - -/** - * Returns the square distance from the segment's start point to it's end - * point. - */ -float PhysxCapsule:: -compute_square_length() const { - - return _capsule.computeSquareLength(); -} - -/** - * Setup this capsule from origin (start point) and direction vector. - */ -void PhysxCapsule:: -set_origin_direction(const LPoint3f &origin, const LVector3f &direction) { - - nassertv(!origin.is_nan()); - nassertv(!direction.is_nan()); - - _capsule.setOriginDirection(PhysxManager::point3_to_nxVec3(origin), - PhysxManager::vec3_to_nxVec3(direction)); -} diff --git a/panda/src/physx/physxCapsule.h b/panda/src/physx/physxCapsule.h deleted file mode 100644 index 0658676aba..0000000000 --- a/panda/src/physx/physxCapsule.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsule.h - * @author enn0x - * @date 2009-10-31 - */ - -#ifndef PHYSXCAPSULE_H -#define PHYSXCAPSULE_H - -#include "pandabase.h" - -#include "config_physx.h" -#include "physxSegment.h" - -/** - * Represents a capsule. - */ -class EXPCL_PANDAPHYSX PhysxCapsule { - -PUBLISHED: - INLINE PhysxCapsule(); - INLINE PhysxCapsule(const PhysxSegment &segment, float radius); - INLINE ~PhysxCapsule(); - - void compute_direction(LPoint3f &dir) const; - float compute_length() const; - void compute_point(LPoint3f &p, float t) const; - float compute_square_length() const; - LPoint3f get_origin() const; - void set_origin_direction(const LPoint3f &origin, const LVector3f &direction); - - float get_radius() const; - LPoint3f get_p0() const; - LPoint3f get_p1() const; - - void set_radius(float value); - void set_p0(LPoint3f p); - void set_p1(LPoint3f p); - -public: - NxCapsule _capsule; -}; - -#include "physxCapsule.I" - -#endif // PHYSCAPSULE_H diff --git a/panda/src/physx/physxCapsuleController.I b/panda/src/physx/physxCapsuleController.I deleted file mode 100644 index fa8dba4e44..0000000000 --- a/panda/src/physx/physxCapsuleController.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleController.I - * @author enn0x - * @date 2009-09-24 - */ - -/** - * - */ -INLINE PhysxCapsuleController:: -PhysxCapsuleController() : PhysxController() { - -} - -/** - * - */ -INLINE PhysxCapsuleController:: -~PhysxCapsuleController() { - -} diff --git a/panda/src/physx/physxCapsuleController.cxx b/panda/src/physx/physxCapsuleController.cxx deleted file mode 100644 index 12f38ecb26..0000000000 --- a/panda/src/physx/physxCapsuleController.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleController.cxx - * @author enn0x - * @date 2009-09-24 - */ - -#include "physxCapsuleController.h" - -TypeHandle PhysxCapsuleController::_type_handle; - -/** - * - */ -void PhysxCapsuleController:: -link(NxController *controllerPtr) { - - nassertv(controllerPtr->getType() == NX_CONTROLLER_CAPSULE); - - // Link self - _ptr = (NxCapsuleController *)controllerPtr; - _error_type = ET_ok; - - PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData; - scene->_controllers.add(this); - - // Link actor - PT(PhysxActor) actor = new PhysxActor(); - actor->link(_ptr->getActor()); - actor->link_controller(this); -} - -/** - * - */ -void PhysxCapsuleController:: -unlink() { - - // Unlink actor - PT(PhysxActor) actor = (PhysxActor *)ptr()->getActor()->userData; - actor->unlink(); - - // Unlink self - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getActor()->getScene().userData; - scene->_controllers.remove(this); -} - -/** - * Resets the controller's radius. - */ -void PhysxCapsuleController:: -set_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setRadius(radius); -} - -/** - * Resets the controller's height. - */ -void PhysxCapsuleController:: -set_height(float height) { - - nassertv(_error_type == ET_ok); - _ptr->setHeight(height); -} - -/** - * Returns the controller's radius. - */ -float PhysxCapsuleController:: -get_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRadius(); -} - -/** - * Returns the controller's height. - */ -float PhysxCapsuleController:: -get_height() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getHeight(); -} diff --git a/panda/src/physx/physxCapsuleController.h b/panda/src/physx/physxCapsuleController.h deleted file mode 100644 index 0f9a2a6174..0000000000 --- a/panda/src/physx/physxCapsuleController.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleController.h - * @author enn0x - * @date 2009-09-24 - */ - -#ifndef PHYSXCAPSULECONTROLLER_H -#define PHYSXCAPSULECONTROLLER_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxController.h" -#include "physx_includes.h" - -/** - * A capsule character controller. - * - * The capsule is defined as a position, a vertical height, and a radius. The - * height is the same height as for PhysxCapsuleShape objects, i.e. the - * distance between the two sphere centers at the end of the capsule. In - * other words: - * - * p = pos (returned by controller) h = height r = radius - * - * p = center of capsule top sphere center = p.y + h*0.5 bottom sphere center - * = p.y - h*0.5 top capsule point = p.y + h*0.5 + r bottom capsule point = - * p.y - h*0.5 - r - */ -class EXPCL_PANDAPHYSX PhysxCapsuleController : public PhysxController { - -PUBLISHED: - INLINE PhysxCapsuleController(); - INLINE ~PhysxCapsuleController(); - - void set_radius(float radius); - void set_height(float height); - float get_radius() const; - float get_height() const; - -public: - INLINE NxController *ptr() const { return (NxController *)_ptr; }; - - void link(NxController *controllerPtr); - void unlink(); - -private: - NxCapsuleController *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxController::init_type(); - register_type(_type_handle, "PhysxCapsuleController", - PhysxController::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxCapsuleController.I" - -#endif // PHYSXCAPSULECONTROLLER_H diff --git a/panda/src/physx/physxCapsuleControllerDesc.I b/panda/src/physx/physxCapsuleControllerDesc.I deleted file mode 100644 index dc31f876d7..0000000000 --- a/panda/src/physx/physxCapsuleControllerDesc.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleControllerDesc.I - * @author enn0x - * @date 2009-09-22 - */ - -/** - * - */ -INLINE PhysxCapsuleControllerDesc:: -PhysxCapsuleControllerDesc() : PhysxControllerDesc() { - - _desc.upDirection = (NxHeightFieldAxis)physx_up_axis.get_value(); -} - -/** - * - */ -INLINE PhysxCapsuleControllerDesc:: -~PhysxCapsuleControllerDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxCapsuleControllerDesc:: -set_to_default() { - - _desc.setToDefault(); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxCapsuleControllerDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxCapsuleControllerDesc.cxx b/panda/src/physx/physxCapsuleControllerDesc.cxx deleted file mode 100644 index 9d4663949e..0000000000 --- a/panda/src/physx/physxCapsuleControllerDesc.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleControllerDesc.cxx - * @author enn0x - * @date 2009-09-22 - */ - -#include "physxCapsuleControllerDesc.h" - -/** - * Sets the radius of the capsule's hemispherical ends and its trunk. - */ -void PhysxCapsuleControllerDesc:: -set_radius(float radius) { - - _desc.radius = radius; -} - -/** - * Sets the distance between the two hemispherical ends of the capsule. - */ -void PhysxCapsuleControllerDesc:: -set_height(float height) { - - _desc.height = height; -} - -/** - * The radius of the capsule's hemispherical ends and its trunk. - */ -float PhysxCapsuleControllerDesc:: -get_radius() const { - - return _desc.radius; -} - -/** - * The distance between the two hemispherical ends of the capsule. - */ -float PhysxCapsuleControllerDesc:: -get_height() const { - - return _desc.height; -} diff --git a/panda/src/physx/physxCapsuleControllerDesc.h b/panda/src/physx/physxCapsuleControllerDesc.h deleted file mode 100644 index eda4930bf4..0000000000 --- a/panda/src/physx/physxCapsuleControllerDesc.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleControllerDesc.h - * @author enn0x - * @date 2009-09-22 - */ - -#ifndef PHYSXCAPSULECONTROLLERDESC_H -#define PHYSXCAPSULECONTROLLERDESC_H - -#include "pandabase.h" - -#include "physxControllerDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for PhysxCapsuleController. - */ -class EXPCL_PANDAPHYSX PhysxCapsuleControllerDesc : public PhysxControllerDesc { - -PUBLISHED: - INLINE PhysxCapsuleControllerDesc(); - INLINE ~PhysxCapsuleControllerDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_radius(float radius); - void set_height(float height); - - float get_radius() const; - float get_height() const; - -public: - NxControllerDesc *ptr() const { return (NxControllerDesc *)&_desc; }; - NxCapsuleControllerDesc _desc; -}; - -#include "physxCapsuleControllerDesc.I" - -#endif // PHYSXCAPSULECONTROLLERDESC_H diff --git a/panda/src/physx/physxCapsuleForceFieldShape.I b/panda/src/physx/physxCapsuleForceFieldShape.I deleted file mode 100644 index cacaabb431..0000000000 --- a/panda/src/physx/physxCapsuleForceFieldShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleForceFieldShape.I - * @author enn0x - * @date 2009-11-15 - */ - -/** - * - */ -INLINE PhysxCapsuleForceFieldShape:: -PhysxCapsuleForceFieldShape() : PhysxForceFieldShape() { - -} - -/** - * - */ -INLINE PhysxCapsuleForceFieldShape:: -~PhysxCapsuleForceFieldShape() { - -} diff --git a/panda/src/physx/physxCapsuleForceFieldShape.cxx b/panda/src/physx/physxCapsuleForceFieldShape.cxx deleted file mode 100644 index be0ce986e6..0000000000 --- a/panda/src/physx/physxCapsuleForceFieldShape.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleForceFieldShape.cxx - * @author enn0x - * @date 2009-11-15 - */ - -#include "physxCapsuleForceFieldShape.h" -#include "physxCapsuleForceFieldShapeDesc.h" - -TypeHandle PhysxCapsuleForceFieldShape::_type_handle; - -/** - * - */ -void PhysxCapsuleForceFieldShape:: -link(NxForceFieldShape *shapePtr) { - - _ptr = shapePtr->isCapsule(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.add(this); -} - -/** - * - */ -void PhysxCapsuleForceFieldShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxCapsuleForceFieldShape:: -save_to_desc(PhysxCapsuleForceFieldShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Alters the radius of the capsule. - */ -void PhysxCapsuleForceFieldShape:: -set_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setRadius(radius); -} - -/** - * Alters the height of the capsule. - */ -void PhysxCapsuleForceFieldShape:: -set_height(float height) { - - nassertv(_error_type == ET_ok); - _ptr->setHeight(height); -} - -/** - * Retrieves the radius of the capsule. - */ -float PhysxCapsuleForceFieldShape:: -get_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRadius(); -} - -/** - * Retrieves the height of the capsule. - */ -float PhysxCapsuleForceFieldShape:: -get_height() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getHeight(); -} diff --git a/panda/src/physx/physxCapsuleForceFieldShape.h b/panda/src/physx/physxCapsuleForceFieldShape.h deleted file mode 100644 index ec1417d6e7..0000000000 --- a/panda/src/physx/physxCapsuleForceFieldShape.h +++ /dev/null @@ -1,74 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleForceFieldShape.h - * @author enn0x - * @date 2009-11-15 - */ - -#ifndef PHYSXCAPSULEFORCEFIELDSHAPE_H -#define PHYSXCAPSULEFORCEFIELDSHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxForceFieldShape.h" -#include "physx_includes.h" - -class PhysxCapsuleForceFieldShapeDesc; - -/** - * A capsule shaped region used to define a force field. - */ -class EXPCL_PANDAPHYSX PhysxCapsuleForceFieldShape : public PhysxForceFieldShape { - -PUBLISHED: - INLINE PhysxCapsuleForceFieldShape(); - INLINE ~PhysxCapsuleForceFieldShape(); - - void save_to_desc(PhysxCapsuleForceFieldShapeDesc &shapeDesc) const; - - void set_radius(float radius); - void set_height(float height); - - float get_radius() const; - float get_height() const; - -public: - INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; }; - - void link(NxForceFieldShape *shapePtr); - void unlink(); - -private: - NxCapsuleForceFieldShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxForceFieldShape::init_type(); - register_type(_type_handle, "PhysxCapsuleForceFieldShape", - PhysxForceFieldShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxCapsuleForceFieldShape.I" - -#endif // PHYSXCAPSULEFORCEFIELDSHAPE_H diff --git a/panda/src/physx/physxCapsuleForceFieldShapeDesc.I b/panda/src/physx/physxCapsuleForceFieldShapeDesc.I deleted file mode 100644 index 48dec0531f..0000000000 --- a/panda/src/physx/physxCapsuleForceFieldShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleForceFieldShapeDesc.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxCapsuleForceFieldShapeDesc:: -PhysxCapsuleForceFieldShapeDesc() : PhysxForceFieldShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxCapsuleForceFieldShapeDesc:: -~PhysxCapsuleForceFieldShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxCapsuleForceFieldShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxCapsuleForceFieldShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxCapsuleForceFieldShapeDesc.cxx b/panda/src/physx/physxCapsuleForceFieldShapeDesc.cxx deleted file mode 100644 index 870602193d..0000000000 --- a/panda/src/physx/physxCapsuleForceFieldShapeDesc.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleForceFieldShapeDesc.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxCapsuleForceFieldShapeDesc.h" - -/** - * Sets the radius of the capsule's hemispherical ends and its trunk. - */ -void PhysxCapsuleForceFieldShapeDesc:: -set_radius(float radius) { - - _desc.radius = radius; -} - -/** - * Sets the distance between the two hemispherical ends of the capsule. - */ -void PhysxCapsuleForceFieldShapeDesc:: -set_height(float height) { - - _desc.height = height; -} - -/** - * The radius of the capsule's hemispherical ends and its trunk. - */ -float PhysxCapsuleForceFieldShapeDesc:: -get_radius() const { - - return _desc.radius; -} - -/** - * The distance between the two hemispherical ends of the capsule. - */ -float PhysxCapsuleForceFieldShapeDesc:: -get_height() const { - - return _desc.height; -} diff --git a/panda/src/physx/physxCapsuleForceFieldShapeDesc.h b/panda/src/physx/physxCapsuleForceFieldShapeDesc.h deleted file mode 100644 index 55756d6e1a..0000000000 --- a/panda/src/physx/physxCapsuleForceFieldShapeDesc.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleForceFieldShapeDesc.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXCAPSULEFORCEFIELDSHAPEDESC_H -#define PHYSXCAPSULEFORCEFIELDSHAPEDESC_H - -#include "pandabase.h" - -#include "physxForceFieldShapeDesc.h" -#include "physx_includes.h" - -/** - * Descriptor for a capsule force field shape. - */ -class EXPCL_PANDAPHYSX PhysxCapsuleForceFieldShapeDesc : public PhysxForceFieldShapeDesc { - -PUBLISHED: - INLINE PhysxCapsuleForceFieldShapeDesc(); - INLINE ~PhysxCapsuleForceFieldShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_radius(float radius); - void set_height(float height); - - float get_radius() const; - float get_height() const; - -public: - NxForceFieldShapeDesc *ptr() const { return (NxForceFieldShapeDesc *)&_desc; }; - NxCapsuleForceFieldShapeDesc _desc; -}; - -#include "physxCapsuleForceFieldShapeDesc.I" - -#endif // PHYSXCAPSULEFORCEFIELDSHAPEDESC_H diff --git a/panda/src/physx/physxCapsuleShape.I b/panda/src/physx/physxCapsuleShape.I deleted file mode 100644 index 9f686d592a..0000000000 --- a/panda/src/physx/physxCapsuleShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleShape.I - * @author enn0x - * @date 2009-09-16 - */ - -/** - * - */ -INLINE PhysxCapsuleShape:: -PhysxCapsuleShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxCapsuleShape:: -~PhysxCapsuleShape() { - -} diff --git a/panda/src/physx/physxCapsuleShape.cxx b/panda/src/physx/physxCapsuleShape.cxx deleted file mode 100644 index 29269dd4dd..0000000000 --- a/panda/src/physx/physxCapsuleShape.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleShape.cxx - * @author enn0x - * @date 2009-09-16 - */ - -#include "physxCapsuleShape.h" -#include "physxCapsuleShapeDesc.h" - -TypeHandle PhysxCapsuleShape::_type_handle; - -/** - * - */ -void PhysxCapsuleShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isCapsule(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxCapsuleShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxCapsuleShape:: -save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Alters the radius of the capsule. - */ -void PhysxCapsuleShape:: -set_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setRadius(radius); -} - -/** - * Alters the height of the capsule. - */ -void PhysxCapsuleShape:: -set_height(float height) { - - nassertv(_error_type == ET_ok); - _ptr->setHeight(height); -} - -/** - * Retrieves the radius of the capsule. - */ -float PhysxCapsuleShape:: -get_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRadius(); -} - -/** - * Retrieves the height of the capsule. - */ -float PhysxCapsuleShape:: -get_height() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getHeight(); -} diff --git a/panda/src/physx/physxCapsuleShape.h b/panda/src/physx/physxCapsuleShape.h deleted file mode 100644 index 5f01645e65..0000000000 --- a/panda/src/physx/physxCapsuleShape.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleShape.h - * @author enn0x - * @date 2009-09-16 - */ - -#ifndef PHYSXCAPSULESHAPE_H -#define PHYSXCAPSULESHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxCapsuleShapeDesc; - -/** - * A capsule shaped collision detection primitive, also known as a line swept - * sphere. 'radius' is the radius of the capsule's hemispherical ends and its - * trunk. 'height' is the distance between the two hemispherical ends of the - * capsule. The height is along the capsule's Y axis. Each shape is owned by - * an actor that it is attached to. - * - * An instance can be created by calling the createShape() method of the - * PhysxActor object that should own it, with a PhysxCapsuleShapeDesc object - * as the parameter, or by adding the shape descriptor into the PhysxActorDesc - * class before creating the actor. - * - * The shape is deleted by calling release() on the shape itself. - */ -class EXPCL_PANDAPHYSX PhysxCapsuleShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxCapsuleShape(); - INLINE ~PhysxCapsuleShape(); - - void save_to_desc(PhysxCapsuleShapeDesc &shapeDesc) const; - - void set_radius(float radius); - void set_height(float height); - - float get_radius() const; - float get_height() const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxCapsuleShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxCapsuleShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxCapsuleShape.I" - -#endif // PHYSXCAPSULESHAPE_H diff --git a/panda/src/physx/physxCapsuleShapeDesc.I b/panda/src/physx/physxCapsuleShapeDesc.I deleted file mode 100644 index 9b2c4f3f43..0000000000 --- a/panda/src/physx/physxCapsuleShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleShapeDesc.I - * @author enn0x - * @date 2009-09-11 - */ - -/** - * - */ -INLINE PhysxCapsuleShapeDesc:: -PhysxCapsuleShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxCapsuleShapeDesc:: -~PhysxCapsuleShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxCapsuleShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxCapsuleShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxCapsuleShapeDesc.cxx b/panda/src/physx/physxCapsuleShapeDesc.cxx deleted file mode 100644 index a44988a689..0000000000 --- a/panda/src/physx/physxCapsuleShapeDesc.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleShapeDesc.cxx - * @author enn0x - * @date 2009-09-11 - */ - -#include "physxCapsuleShapeDesc.h" - -/** - * Sets the radius of the capsule's hemispherical ends and its trunk. - */ -void PhysxCapsuleShapeDesc:: -set_radius(float radius) { - - _desc.radius = radius; -} - -/** - * Sets the distance between the two hemispherical ends of the capsule. - */ -void PhysxCapsuleShapeDesc:: -set_height(float height) { - - _desc.height = height; -} - -/** - * The radius of the capsule's hemispherical ends and its trunk. - */ -float PhysxCapsuleShapeDesc:: -get_radius() const { - - return _desc.radius; -} - -/** - * The distance between the two hemispherical ends of the capsule. - */ -float PhysxCapsuleShapeDesc:: -get_height() const { - - return _desc.height; -} diff --git a/panda/src/physx/physxCapsuleShapeDesc.h b/panda/src/physx/physxCapsuleShapeDesc.h deleted file mode 100644 index df6899b7e0..0000000000 --- a/panda/src/physx/physxCapsuleShapeDesc.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCapsuleShapeDesc.h - * @author enn0x - * @date 2009-09-11 - */ - -#ifndef PHYSXCAPSULESHAPEDESC_H -#define PHYSXCAPSULESHAPEDESC_H - -#include "pandabase.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for PhysxCapsuleShape. - */ -class EXPCL_PANDAPHYSX PhysxCapsuleShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxCapsuleShapeDesc(); - INLINE ~PhysxCapsuleShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_radius(float radius); - void set_height(float height); - - float get_radius() const; - float get_height() const; - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxCapsuleShapeDesc _desc; -}; - -#include "physxCapsuleShapeDesc.I" - -#endif // PHYSXCAPSULESHAPEDESC_H diff --git a/panda/src/physx/physxCcdSkeleton.I b/panda/src/physx/physxCcdSkeleton.I deleted file mode 100644 index a6b0ed7314..0000000000 --- a/panda/src/physx/physxCcdSkeleton.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCcdSkeleton.I - * @author enn0x - * @date 2012-05-01 - */ - -/** - * - */ -INLINE PhysxCcdSkeleton:: -PhysxCcdSkeleton() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxCcdSkeleton:: -~PhysxCcdSkeleton() { - -} - -/** - * - */ -INLINE void PhysxCcdSkeleton:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxCcdSkeleton:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxCcdSkeleton.cxx b/panda/src/physx/physxCcdSkeleton.cxx deleted file mode 100644 index e18ff74023..0000000000 --- a/panda/src/physx/physxCcdSkeleton.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCcdSkeleton.cxx - * @author enn0x - * @date 2012-05-01 - */ - -#include "physxCcdSkeleton.h" -#include "physxMeshPool.h" - -TypeHandle PhysxCcdSkeleton::_type_handle; - -/** - * - */ -void PhysxCcdSkeleton:: -link(NxCCDSkeleton *skeletonPtr) { - - // Link self - PhysxManager::get_global_ptr()->_ccd_skeletons.add(this); - _ptr = skeletonPtr; - _error_type = ET_ok; -} - -/** - * - */ -void PhysxCcdSkeleton:: -unlink() { - - // Unlink self - _error_type = ET_released; - PhysxManager::get_global_ptr()->_ccd_skeletons.remove(this); -} - -/** - * - */ -void PhysxCcdSkeleton:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxGetPhysicsSDK()->releaseCCDSkeleton(*_ptr); - _ptr = nullptr; - - // TODO PhysxMeshPool::release_ccd_skeleton(this); -} - -/** - * Returns the reference count for shared meshes. - */ -unsigned int PhysxCcdSkeleton:: -get_reference_count() const { - - nassertr(_error_type == ET_ok, 0); - - return _ptr->getReferenceCount(); -} diff --git a/panda/src/physx/physxCcdSkeleton.h b/panda/src/physx/physxCcdSkeleton.h deleted file mode 100644 index e8a0835741..0000000000 --- a/panda/src/physx/physxCcdSkeleton.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCcdSkeleton.h - * @author enn0x - * @date 2012-05-01 - */ - -#ifndef PHYSXCCDSKELETON_H -#define PHYSXCCDSKELETON_H - -#include "pandabase.h" - -#include "physxObject.h" -#include "physx_includes.h" - -/** - * A Convex Mesh. Internally represented as a list of convex polygons. The - * number of polygons is limited to 256. - */ -class EXPCL_PANDAPHYSX PhysxCcdSkeleton : public PhysxObject { - -PUBLISHED: - unsigned int get_reference_count() const; - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE PhysxCcdSkeleton(); - INLINE ~PhysxCcdSkeleton(); - - INLINE NxCCDSkeleton *ptr() const { return _ptr; }; - - void link(NxCCDSkeleton *meshPtr); - void unlink(); - -private: - NxCCDSkeleton *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxCcdSkeleton", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxCcdSkeleton.I" - -#endif // PHYSXCCDSKELETON_H diff --git a/panda/src/physx/physxCcdSkeletonDesc.I b/panda/src/physx/physxCcdSkeletonDesc.I deleted file mode 100644 index 271e1c94e9..0000000000 --- a/panda/src/physx/physxCcdSkeletonDesc.I +++ /dev/null @@ -1,52 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCcdSkeletonDesc.I - * @author enn0x - * @date 2012-05-01 - */ - -/** - * - */ -INLINE PhysxCcdSkeletonDesc:: -PhysxCcdSkeletonDesc() { - - _desc.flags = 0; - _desc.pointStrideBytes = sizeof(NxVec3); - _desc.triangleStrideBytes = 3*sizeof(NxU32); - _desc.points = nullptr; - _desc.triangles = nullptr; - - _vertices = nullptr; - _triangles = nullptr; -} - -/** - * - */ -INLINE PhysxCcdSkeletonDesc:: -~PhysxCcdSkeletonDesc() { - - if (_vertices) { - delete [] _vertices; - } - - if (_triangles) { - delete [] _triangles; - } -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxCcdSkeletonDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxCcdSkeletonDesc.cxx b/panda/src/physx/physxCcdSkeletonDesc.cxx deleted file mode 100644 index fb62f41466..0000000000 --- a/panda/src/physx/physxCcdSkeletonDesc.cxx +++ /dev/null @@ -1,177 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCcdSkeletonDesc.cxx - * @author enn0x - * @date 2012-05-01 - */ - -#include "physxCcdSkeletonDesc.h" -#include "physxManager.h" - -#include "nodePathCollection.h" -#include "geomNode.h" -#include "geomVertexReader.h" - -/** - * Sets the number of vertices to be stored within this triangle mesh. The - * function allocates memory for the vertices, but it does not set any - * vertices. - * - * This method must be called before any calls to set_vertex are done! - */ -void PhysxCcdSkeletonDesc:: -set_num_vertices(unsigned int numVertices) { - - if (_desc.points) { - delete [] _vertices; - } - - _vertices = new NxVec3[numVertices]; - - _desc.numVertices = numVertices; - _desc.points = _vertices; -} - -/** - * Sets a single vertex. You have to call the function set_num_vertices - * before you can call this function. - */ -void PhysxCcdSkeletonDesc:: -set_vertex(unsigned int idx, const LPoint3f &vert) { - - nassertv(_desc.numVertices > idx); - _vertices[idx] = PhysxManager::point3_to_nxVec3(vert); -} - -/** - * Sets the number of triangles to be stored in this triangle mesh. - * - * This method must be called before any calls to set_triangle are done! - */ -void PhysxCcdSkeletonDesc:: -set_num_triangles(unsigned int numTriangles) { - - if (_desc.triangles) { - delete [] _triangles; - } - - _triangles = new NxU32[3 * numTriangles]; - - _desc.numTriangles = numTriangles; - _desc.triangles = _triangles; -} - -/** - * Sets a single triangle, by providing the three indices i1, i2, i3. - */ -void PhysxCcdSkeletonDesc:: -set_triangle(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3) { - - nassertv(_desc.numTriangles > idx); - - idx = 3 * idx; - _triangles[idx] = i1; - _triangles[idx + 1] = i2; - _triangles[idx + 2] = i3; -} - -/** - * - */ -const NxSimpleTriangleMesh &PhysxCcdSkeletonDesc:: -get_desc() const { - - return _desc; -} - -/** - * A convenience method to set the mesh data from a NodePath in a single call. - * The method iterates over the NodePath geoms and collects data for the - * triangle mesh. - * - * Do not use the following function when using this one: - set_num_vertices - - * set_vertex - set_num_triangles - set_triangle - */ -void PhysxCcdSkeletonDesc:: -set_from_node_path(const NodePath &np) { - - pvector dataVertices; - pvector dataIndices; - - // Collect data from NodePath - NodePathCollection npc = np.find_all_matches( "**/+GeomNode" ); - for (int i=0; iget_num_geoms(); j++) { - CPT(Geom) geom = gnode->get_geom(j); - - // Vertices - CPT(GeomVertexData) vdata = geom->get_vertex_data(); - GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex()); - - while (!reader.is_at_end()) { - dataVertices.push_back(reader.get_data3f()); - } - - // Indices - for (int k=0; kget_num_primitives(); k++) { - - CPT(GeomPrimitive) prim = geom->get_primitive(k); - prim = prim->decompose(); - - for (int l=0; lget_num_primitives(); l++) { - - int s = prim->get_primitive_start(l); - int e = prim->get_primitive_end(l); - - for (int l=s; lget_vertex(l)); - } - } - } - } - } - - // Set descriptor members - int i; - - NxU32 numVertices = dataVertices.size(); - NxU32 numTriangles = dataIndices.size() / 3; - - _vertices = new NxVec3[numVertices]; - _triangles = new NxU32[3 * numTriangles]; - - i = 0; - pvector::const_iterator vit; - for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) { - LPoint3f v = *vit; - - _vertices[i].x = v.get_x(); - _vertices[i].y = v.get_y(); - _vertices[i].z = v.get_z(); - i++; - } - - i = 0; - pvector::const_iterator iit; - for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) { - NxU32 idx = *iit; - - _triangles[i] = idx; - i++; - } - - _desc.numVertices = numVertices; - _desc.points = _vertices; - _desc.numTriangles = numTriangles; - _desc.triangles = _triangles; -} diff --git a/panda/src/physx/physxCcdSkeletonDesc.h b/panda/src/physx/physxCcdSkeletonDesc.h deleted file mode 100644 index aa7fd0f893..0000000000 --- a/panda/src/physx/physxCcdSkeletonDesc.h +++ /dev/null @@ -1,54 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCcdSkeletonDesc.h - * @author enn0x - * @date 2012-05-01 - */ - -#ifndef PHYSXCCDSKELETONDESC_H -#define PHYSXCCDSKELETONDESC_H - -#include "pandabase.h" -#include "nodePath.h" -#include "luse.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxCcdSkeletonDesc { - -PUBLISHED: - INLINE PhysxCcdSkeletonDesc(); - INLINE ~PhysxCcdSkeletonDesc(); - - INLINE bool is_valid() const; - - void set_num_vertices(unsigned int n); - void set_vertex(unsigned int idx, const LPoint3f &vert); - - void set_num_triangles(unsigned int n); - void set_triangle(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3); - - void set_from_node_path(const NodePath &np); - -public: - const NxSimpleTriangleMesh &get_desc() const; - -private: - NxVec3 *_vertices; - NxU32 *_triangles; - NxSimpleTriangleMesh _desc; -}; - -#include "physxCcdSkeletonDesc.I" - -#endif // PHYSXCCDSKELETONDESC_H diff --git a/panda/src/physx/physxCloth.I b/panda/src/physx/physxCloth.I deleted file mode 100644 index 8ecec85332..0000000000 --- a/panda/src/physx/physxCloth.I +++ /dev/null @@ -1,54 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCloth.I - * @author enn0x - * @date 2010-03-30 - */ - -/** - * - */ -INLINE PhysxCloth:: -PhysxCloth() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxCloth:: -~PhysxCloth() { - -} - -/** - * - */ -INLINE void PhysxCloth:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxCloth:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")"; - - if (_node) { - out << " N:0x" << _node; - } - - out << "\n"; -} diff --git a/panda/src/physx/physxCloth.cxx b/panda/src/physx/physxCloth.cxx deleted file mode 100644 index 05e77b54b6..0000000000 --- a/panda/src/physx/physxCloth.cxx +++ /dev/null @@ -1,568 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCloth.cxx - * @author enn0x - * @date 2010-03-30 - */ - -#include "physxCloth.h" -#include "physxClothDesc.h" -#include "physxScene.h" -#include "physxGroupsMask.h" -#include "physxShape.h" -#include "physxManager.h" - -#include "boundingBox.h" - -TypeHandle PhysxCloth::_type_handle; - -/** - * - */ -void PhysxCloth:: -link(NxCloth *clothPtr) { - - // Link self - _ptr = clothPtr; - _error_type = ET_ok; - _ptr->userData = this; - - set_name(clothPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_cloths.add(this); -} - -/** - * - */ -void PhysxCloth:: -unlink() { - - // Unlink self - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_cloths.remove(this); - - _node = nullptr; -} - -/** - * - */ -void PhysxCloth:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - _ptr->getScene().releaseCloth(*_ptr); - _ptr = nullptr; -} - -/** - * - */ -void PhysxCloth:: -update() { - - if (_node) { - - // Update node mesh data - _node->update(); - - // Update node bounding volume - NxBounds3 bounds; - _ptr->getWorldBounds(bounds); - - BoundingBox bb(PhysxManager::nxVec3_to_point3(bounds.min), - PhysxManager::nxVec3_to_point3(bounds.max)); - _node->set_bounds(&bb); - } -} - -/** - * Returns the scene which this cloth belongs to. - */ -PhysxScene *PhysxCloth:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxScene *)_ptr->getScene().userData; -} - -/** - * - */ -PhysxClothNode *PhysxCloth:: -get_cloth_node() const { - - nassertr(_error_type == ET_ok, nullptr); - return _node; -} - -/** - * - */ -PhysxClothNode *PhysxCloth:: -create_cloth_node(const char *name) { - - nassertr(_error_type == ET_ok, nullptr); - - _node = new PhysxClothNode(name); - _node->allocate(this); - - return _node; -} - -/** - * Sets a name string for the object that can be retrieved with get_name(). - * This is for debugging and is not used by the engine. - */ -void PhysxCloth:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - _ptr->setName(_name.c_str()); -} - -/** - * Retrieves the name string. - */ -const char *PhysxCloth:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return _ptr->getName(); -} - -/** - * Sets which collision group this cloth is part of. Collision group must be - * between 0 and 31. - */ -void PhysxCloth:: -set_group(unsigned int group) { - - nassertv(_error_type == ET_ok); - nassertv(group >= 0 && group < 32); - _ptr->setGroup(group); -} - -/** - * Retrieves the collision group this cloth is part of. - */ -unsigned int PhysxCloth:: -get_group() const { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getGroup(); -} - -/** - * Sets the cloth thickness (must be positive). - */ -void PhysxCloth:: -set_thickness(float thickness) { - - nassertv(_error_type == ET_ok); - _ptr->setThickness(thickness); -} - -/** - * Gets the cloth thickness. - */ -float PhysxCloth:: -get_thickness() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getThickness(); -} - -/** - * Gets the cloth density. - */ -float PhysxCloth:: -get_density() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getDensity(); -} - -/** - * Gets the relative grid spacing for the broad phase. The cloth is - * represented by a set of world aligned cubical cells in broad phase. The - * size of these cells is determined by multiplying the length of the diagonal - * of the AABB of the initial soft body size with this constant. - */ -float PhysxCloth:: -get_relative_grid_spacing() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRelativeGridSpacing(); -} - -/** - * Gets the number of cloth particles. - */ -unsigned int PhysxCloth:: -get_num_particles() { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getNumberOfParticles(); -} - -/** - * Sets the value of a single flag. - */ -void PhysxCloth:: -set_flag(PhysxClothFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - - NxU32 flags = _ptr->getFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setFlags(flags); -} - -/** - * Retrieves the value of a single flag. - */ -bool PhysxCloth:: -get_flag(PhysxClothFlag flag) const { - - nassertr(_error_type == ET_ok, false); - - return (_ptr->getFlags() & flag) ? true : false; -} - -/** - * Sets 128-bit mask used for collision filtering. - */ -void PhysxCloth:: -set_groups_mask(const PhysxGroupsMask &mask) { - - nassertv(_error_type == ET_ok); - - NxGroupsMask _mask = mask.get_mask(); - _ptr->setGroupsMask(_mask); -} - -/** - * Gets the 128-bit groups mask used for collision filtering. - */ -PhysxGroupsMask PhysxCloth:: -get_groups_mask() const { - - PhysxGroupsMask mask; - - nassertr(_error_type == ET_ok, mask); - - NxGroupsMask _mask = _ptr->getGroupsMask(); - mask.set_mask(_mask); - - return mask; -} - -/** - * Returns true if this cloth is sleeping. - * - * When a cloth does not move for a period of time, it is no longer simulated - * in order to save time. This state is called sleeping. However, because - * the object automatically wakes up when it is either touched by an awake - * object, or one of its properties is changed by the user, the entire sleep - * mechanism should be transparent to the user. - */ -bool PhysxCloth:: -is_sleeping() const { - - nassertr(_error_type == ET_ok, false); - return _ptr->isSleeping(); -} - -/** - * Wakes up the cloth if it is sleeping. - * - * The wakeCounterValue determines how long until the body is put to sleep, a - * value of zero means that the body is sleeping. wake_up(0) is equivalent to - * PhysxCloth::put_to_sleep(). - */ -void PhysxCloth:: -wake_up(float wakeCounterValue) { - - nassertv(_error_type == ET_ok); - _ptr->wakeUp(wakeCounterValue); -} - -/** - * Forces the cloth to sleep. - * - * The cloth will stay asleep until the next call to simulate, and will not - * wake up until then even when otherwise it would (for example a force is - * applied to it). It can however wake up during the next do_physics call. - */ -void PhysxCloth:: -put_to_sleep() { - - nassertv(_error_type == ET_ok); - _ptr->putToSleep(); -} - -/** - * Sets the linear velocity below which an cloth may go to sleep. Cloths - * whose linear velocity is above this threshold will not be put to sleep. - * - * Setting the sleep angular/linear velocity only makes sense when the - * BF_energy_sleep_test is not set. - */ -void PhysxCloth:: -set_sleep_linear_velocity(float threshold) { - - nassertv(_error_type == ET_ok); - _ptr->setSleepLinearVelocity(threshold); -} - -/** - * Returns the linear velocity below which an soft body may go to sleep. - * cloths whose linear velocity is above this threshold will not be put to - * sleep. - */ -float PhysxCloth:: -get_sleep_linear_velocity() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSleepLinearVelocity(); -} - -/** - * Attaches a cloth vertex to a position in world space. - */ -void PhysxCloth:: -attach_vertex_to_global_pos(unsigned int vertexId, LPoint3f const &pos) { - - nassertv(_error_type == ET_ok); - nassertv(!pos.is_nan()); - - _ptr->attachVertexToGlobalPosition(vertexId, PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * Attaches the cloth to a shape. All cloth points currently inside the shape - * are attached. - * - * This method only works with primitive and convex shapes. Since the inside - * of a general triangle mesh is not clearly defined. - */ -void PhysxCloth:: -attach_to_shape(PhysxShape *shape) { - - nassertv(_error_type == ET_ok); - nassertv(shape); - - NxU32 attachmentFlags = 0; // --TODO-- - _ptr->attachToShape(shape->ptr(), attachmentFlags); -} - -/** - * Attaches the cloth to all shapes, currently colliding. - * - * This method only works with primitive and convex shapes. Since the inside - * of a general triangle mesh is not clearly defined. - */ -void PhysxCloth:: -attach_to_colliding_shapes() { - - nassertv(_error_type == ET_ok); - - NxU32 attachmentFlags = 0; // --TODO-- - _ptr->attachToCollidingShapes(attachmentFlags); -} - -/** - * Detaches the cloth from a shape it has been attached to before. - * - * If the cloth has not been attached to the shape before, the call has no - * effect. - */ -void PhysxCloth:: -detach_from_shape(PhysxShape *shape) { - - nassertv(_error_type == ET_ok); - nassertv(shape); - - _ptr->detachFromShape(shape->ptr()); -} - -/** - * Frees a previously attached cloth point. - */ -void PhysxCloth:: -free_vertex(unsigned int vertexId) { - - nassertv(_error_type == ET_ok); - _ptr->freeVertex(vertexId); -} - -/** - * Attaches a cloth vertex to a local position within a shape. - */ -void PhysxCloth:: -attach_vertex_to_shape(unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos) { - - nassertv(_error_type == ET_ok); - nassertv(!localPos.is_nan()); - nassertv(shape); - - NxU32 attachmentFlags = 0; // --TODO-- - _ptr->attachVertexToShape(vertexId, shape->ptr(), - PhysxManager::point3_to_nxVec3(localPos), - attachmentFlags); -} - -/** - * Return the attachment status of the given vertex. - */ -PhysxEnums::PhysxVertexAttachmentStatus PhysxCloth:: -get_vertex_attachment_status(unsigned int vertexId) const { - - nassertr(_error_type == ET_ok, VAS_none); - // --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), VAS_none); - - return (PhysxVertexAttachmentStatus) _ptr->getVertexAttachmentStatus(vertexId); -} - -/** - * Returns the pointer to an attached shape pointer of the given vertex. If - * the vertex is not attached or attached to a global position, NULL is - * returned. - */ -PhysxShape *PhysxCloth:: -get_vertex_attachment_shape(unsigned int vertexId) const { - - nassertr(_error_type == ET_ok, nullptr); - // --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), NULL); - - NxShape *shapePtr = _ptr->getVertexAttachmentShape(vertexId); - PhysxShape *shape = shapePtr ? (PhysxShape *)(shapePtr->userData) : nullptr; - - return shape; -} - -/** - * Returns the attachment position of the given vertex. If the vertex is - * attached to shape, the position local to the shape's pose is returned. If - * the vertex is not attached, the return value is undefined. - */ -LPoint3f PhysxCloth:: -get_vertex_attachment_pos(unsigned int vertexId) const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - // --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), - // LPoint3f::zero()); - - return PhysxManager::nxVec3_to_point3(_ptr->getVertexAttachmentPosition(vertexId)); -} - -/** - * Sets an external acceleration which affects all non attached particles of - * the cloth. - */ -void PhysxCloth:: -set_external_acceleration(LVector3f const &acceleration) { - - nassertv(_error_type == ET_ok); - nassertv_always(!acceleration.is_nan()); - - _ptr->setExternalAcceleration(PhysxManager::vec3_to_nxVec3(acceleration)); -} - -/** - * Sets an acceleration acting normal to the cloth surface at each vertex. - */ -void PhysxCloth:: -set_wind_acceleration(LVector3f const &acceleration) { - - nassertv(_error_type == ET_ok); - nassertv_always(!acceleration.is_nan()); - - _ptr->setWindAcceleration(PhysxManager::vec3_to_nxVec3(acceleration)); -} - -/** - * Retrieves the external acceleration which affects all non attached - * particles of the cloth. - */ -LVector3f PhysxCloth:: -get_external_acceleration() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getExternalAcceleration()); -} - -/** - * Retrieves the acceleration acting normal to the cloth surface at each - * vertex - */ -LVector3f PhysxCloth:: -get_wind_acceleration() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getWindAcceleration()); -} - -/** - * Applies a force (or impulse) defined in the global coordinate frame, to a - * particular vertex of the cloth. - */ -void PhysxCloth:: -add_force_at_vertex(LVector3f const &force, int vertexId, PhysxForceMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->addForceAtVertex(PhysxManager::vec3_to_nxVec3(force), - vertexId, - (NxForceMode) mode); -} - -/** - * Applies a radial force (or impulse) at a particular position. All vertices - * within radius will be affected with a quadratic drop-off. - */ -void PhysxCloth:: -add_force_at_pos(LPoint3f const &pos, float magnitude, float radius, PhysxForceMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->addForceAtPos(PhysxManager::point3_to_nxVec3(pos), - magnitude, - radius, - (NxForceMode) mode); -} - -/** - * Applies a directed force (or impulse) at a particular position. All - * vertices within radius will be affected with a quadratic drop-off. - */ -void PhysxCloth:: -add_directed_force_at_pos(LPoint3f const &pos, LVector3f const &force, float radius, PhysxForceMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->addDirectedForceAtPos(PhysxManager::point3_to_nxVec3(pos), - PhysxManager::vec3_to_nxVec3(force), - radius, - (NxForceMode) mode); -} diff --git a/panda/src/physx/physxCloth.h b/panda/src/physx/physxCloth.h deleted file mode 100644 index b1980a7607..0000000000 --- a/panda/src/physx/physxCloth.h +++ /dev/null @@ -1,132 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCloth.h - * @author enn0x - * @date 2010-03-30 - */ - -#ifndef PHYSXCLOTH_H -#define PHYSXCLOTH_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxObjectCollection.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxScene; -class PhysxGroupsMask; -class PhysxClothNode; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxCloth : public PhysxObject, public PhysxEnums { - -PUBLISHED: - INLINE PhysxCloth(); - INLINE ~PhysxCloth(); - - PhysxScene *get_scene() const; - PhysxClothNode *get_cloth_node() const; - PhysxClothNode *create_cloth_node(const char *name); - - void set_name(const char *name); - void set_group(unsigned int group); - void set_groups_mask(const PhysxGroupsMask &mask); - void set_flag(PhysxClothFlag flag, bool value); - void set_thickness(float thickness); - - const char *get_name() const; - unsigned int get_num_particles(); - unsigned int get_group() const; - PhysxGroupsMask get_groups_mask() const; - bool get_flag(PhysxClothFlag flag) const; - float get_thickness() const; - float get_density() const; - float get_relative_grid_spacing() const; - - // Attachment - void attach_vertex_to_global_pos(unsigned int vertexId, LPoint3f const &pos); - void free_vertex(unsigned int vertexId); - void attach_to_shape(PhysxShape *shape); - void attach_to_colliding_shapes(); - void detach_from_shape(PhysxShape *shape); - void attach_vertex_to_shape(unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos); - PhysxVertexAttachmentStatus get_vertex_attachment_status(unsigned int vertexId) const; - PhysxShape *get_vertex_attachment_shape(unsigned int vertexId) const; - LPoint3f get_vertex_attachment_pos(unsigned int vertexId) const; - - // Sleeping - bool is_sleeping() const; - void wake_up(float wakeCounterValue=NX_SLEEP_INTERVAL); - void put_to_sleep(); - void set_sleep_linear_velocity(float threshold); - float get_sleep_linear_velocity() const; - - // Forces - void set_external_acceleration(LVector3f const &acceleration); - LVector3f get_external_acceleration() const; - - void set_wind_acceleration(LVector3f const &acceleration); - LVector3f get_wind_acceleration() const; - - void add_force_at_vertex(LVector3f const &force, int vertexId, - PhysxForceMode mode=FM_force); - void add_force_at_pos(LPoint3f const &pos, float magnitude, float radius, - PhysxForceMode mode=FM_force); - void add_directed_force_at_pos(LPoint3f const &pos, LVector3f const &force, float radius, - PhysxForceMode mode=FM_force); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - void update(); - -PUBLISHED: - void release(); - -public: - INLINE NxCloth *ptr() const { return _ptr; }; - - void link(NxCloth *ptr); - void unlink(); - -private: - NxCloth *_ptr; - PT(PhysxClothNode) _node; - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxCloth", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxCloth.I" - -#endif // PHYSXCLOTH_H diff --git a/panda/src/physx/physxClothDesc.I b/panda/src/physx/physxClothDesc.I deleted file mode 100644 index ab8e40eae4..0000000000 --- a/panda/src/physx/physxClothDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothDesc.I - * @author enn0x - * @date 2010-03-30 - */ - -/** - * - */ -INLINE PhysxClothDesc:: -PhysxClothDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxClothDesc:: -~PhysxClothDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxClothDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxClothDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxClothDesc.cxx b/panda/src/physx/physxClothDesc.cxx deleted file mode 100644 index 3c1ffce57d..0000000000 --- a/panda/src/physx/physxClothDesc.cxx +++ /dev/null @@ -1,298 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothDesc.cxx - * @author enn0x - * @date 2010-03-30 - */ - -#include "physxClothDesc.h" -#include "physxClothMesh.h" -#include "physxManager.h" - -/** - * - */ -void PhysxClothDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - _desc.name = _name.c_str(); -} - -/** - * - */ -void PhysxClothDesc:: -set_global_pos(const LPoint3f &pos) { - - _desc.globalPose.t = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * - */ -void PhysxClothDesc:: -set_global_mat(const LMatrix4f &mat) { - - _desc.globalPose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * - */ -void PhysxClothDesc:: -set_global_hpr(float h, float p, float r) { - - LQuaternionf q; - LMatrix3f rot; - NxMat34 m; - - q.set_hpr(LVector3f(h, p, r)); - q.extract_to_matrix(rot); - - _desc.globalPose.M = PhysxManager::mat3_to_nxMat33(rot); -} - -/** - * - */ -void PhysxClothDesc:: -set_thickness(float thickness) { - - _desc.thickness = thickness; -} - -/** - * - */ -void PhysxClothDesc:: -set_density(float density) { - - _desc.density = density; -} - -/** - * - */ -void PhysxClothDesc:: -set_bending_stiffness(float stiffness) { - - _desc.bendingStiffness = stiffness; -} - -/** - * - */ -void PhysxClothDesc:: -set_stretching_stiffness(float stiffness) { - - _desc.stretchingStiffness = stiffness; -} - -/** - * - */ -void PhysxClothDesc:: -set_damping_coefficient(float damping) { - - _desc.dampingCoefficient = damping; -} - -/** - * - */ -void PhysxClothDesc:: -set_friction(float friction) { - - _desc.friction = friction; -} - -/** - * - */ -void PhysxClothDesc:: -set_pressure(float pressure) { - - _desc.pressure = pressure; -} - -/** - * - */ -void PhysxClothDesc:: -set_tear_factor(float tearFactor) { - - _desc.tearFactor = tearFactor; -} - -/** - * Raise or lower individual ClothFlag flags. - */ -void PhysxClothDesc:: -set_flag(PhysxClothFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Number of solver iterations. Small numbers make the simulation faster - * while the cloth gets less stiff. - */ -void PhysxClothDesc:: -set_solver_iterations(unsigned int iterations) { - - _desc.solverIterations = iterations; -} - -/** - * - */ -void PhysxClothDesc:: -set_cloth_mesh(PhysxClothMesh *mesh) { - - _desc.clothMesh = mesh->ptr(); -} - -/** - * - */ -const char *PhysxClothDesc:: -get_name() const { - - return _desc.name; -} - -/** - * - */ -LPoint3f PhysxClothDesc:: -get_global_pos() const { - - return PhysxManager::nxVec3_to_point3(_desc.globalPose.t); -} - -/** - * - */ -LMatrix4f PhysxClothDesc:: -get_global_mat() const { - - return PhysxManager::nxMat34_to_mat4(_desc.globalPose); -} - -/** - * - */ -float PhysxClothDesc:: -get_thickness() const { - - return _desc.thickness; -} - -/** - * - */ -float PhysxClothDesc:: -get_density() const { - - return _desc.density; -} - -/** - * - */ -float PhysxClothDesc:: -get_bending_stiffness() const { - - return _desc.bendingStiffness; -} - -/** - * - */ -float PhysxClothDesc:: -get_stretching_stiffness() const { - - return _desc.stretchingStiffness; -} - -/** - * - */ -float PhysxClothDesc:: -get_damping_coefficient() const { - - return _desc.dampingCoefficient; -} - -/** - * - */ -float PhysxClothDesc:: -get_friction() const { - - return _desc.friction; -} - -/** - * - */ -float PhysxClothDesc:: -get_pressure() const { - - return _desc.pressure; -} - -/** - * - */ -float PhysxClothDesc:: -get_tear_factor() const { - - return _desc.tearFactor; -} - -/** - * - */ -bool PhysxClothDesc:: -get_flag(PhysxClothFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * - */ -unsigned int PhysxClothDesc:: -get_solver_iterations() const { - - return _desc.solverIterations; -} - -/** - * Used by PhysScene to query the sizes of arrays to allocate for the user - * buffers in PhysxClothNode. - */ -/* -void PhysxClothDesc:: -get_mesh_numbers(NxU32 &numVertices, NxU32 &numTriangles) { - - NxClothMeshDesc meshDesc; - _desc.clothMesh->saveToDesc(meshDesc); - - numVertices = meshDesc.numVertices; - numTriangles = meshDesc.numTriangles; -} -*/ diff --git a/panda/src/physx/physxClothDesc.h b/panda/src/physx/physxClothDesc.h deleted file mode 100644 index dc40eed8aa..0000000000 --- a/panda/src/physx/physxClothDesc.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothDesc.h - * @author enn0x - * @date 2010-03-30 - */ - -#ifndef PHYSXCLOTHDESC_H -#define PHYSXCLOTHDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxClothMesh; - -/** - * Descriptor for PhysxCloth. - */ -class EXPCL_PANDAPHYSX PhysxClothDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxClothDesc(); - INLINE ~PhysxClothDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_cloth_mesh(PhysxClothMesh *mesh); - - void set_name(const char *name); - void set_global_pos(const LPoint3f &pos); - void set_global_mat(const LMatrix4f &mat); - void set_global_hpr(float h, float p, float r); - void set_thickness(float thickness); - void set_density(float density); - void set_bending_stiffness(float stiffness); - void set_stretching_stiffness(float stiffness); - void set_damping_coefficient(float damping); - void set_friction(float friction); - void set_pressure(float pressure); - void set_tear_factor(float tearFactor); - void set_solver_iterations(unsigned int interations); - void set_flag(PhysxClothFlag flag, bool value); - - const char *get_name() const; - LPoint3f get_global_pos() const; - LMatrix4f get_global_mat() const; - float get_thickness() const; - float get_density() const; - float get_bending_stiffness() const; - float get_stretching_stiffness() const; - float get_damping_coefficient() const; - float get_friction() const; - float get_pressure() const; - float get_tear_factor() const; - unsigned int get_solver_iterations() const; - bool get_flag(PhysxClothFlag flag) const; - -public: - NxClothDesc _desc; - -private: - std::string _name; -}; - -#include "physxClothDesc.I" - -#endif // PHYSXCLOTHDESC_H diff --git a/panda/src/physx/physxClothMesh.I b/panda/src/physx/physxClothMesh.I deleted file mode 100644 index 0c9ab0d103..0000000000 --- a/panda/src/physx/physxClothMesh.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothMesh.I - * @author enn0x - * @date 2010-03-28 - */ - -/** - * - */ -INLINE PhysxClothMesh:: -PhysxClothMesh() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxClothMesh:: -~PhysxClothMesh() { - -} - -/** - * - */ -INLINE void PhysxClothMesh:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxClothMesh:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxClothMesh.cxx b/panda/src/physx/physxClothMesh.cxx deleted file mode 100644 index 493b781a0a..0000000000 --- a/panda/src/physx/physxClothMesh.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothMesh.cxx - * @author enn0x - * @date 2010-03-28 - */ - -#include "physxClothMesh.h" -#include "physxMeshPool.h" - -TypeHandle PhysxClothMesh::_type_handle; - -/** - * - */ -void PhysxClothMesh:: -link(NxClothMesh *meshPtr) { - - // Link self - PhysxManager::get_global_ptr()->_cloth_meshes.add(this); - _ptr = meshPtr; - _error_type = ET_ok; -} - -/** - * - */ -void PhysxClothMesh:: -unlink() { - - // Unlink self - _error_type = ET_released; - PhysxManager::get_global_ptr()->_cloth_meshes.remove(this); -} - -/** - * - */ -void PhysxClothMesh:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxGetPhysicsSDK()->releaseClothMesh(*_ptr); - _ptr = nullptr; - - PhysxMeshPool::release_cloth_mesh(this); -} - -/** - * Returns the reference count for shared meshes. - */ -unsigned int PhysxClothMesh:: -get_reference_count() const { - - nassertr(_error_type == ET_ok, 0); - - return _ptr->getReferenceCount(); -} diff --git a/panda/src/physx/physxClothMesh.h b/panda/src/physx/physxClothMesh.h deleted file mode 100644 index 7cd0a5d167..0000000000 --- a/panda/src/physx/physxClothMesh.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothMesh.h - * @author enn0x - * @date 2010-03-28 - */ - -#ifndef PHYSXCLOTHMESH_H -#define PHYSXCLOTHMESH_H - -#include "pandabase.h" - -#include "physxObject.h" -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxClothMesh : public PhysxObject { - -PUBLISHED: - unsigned int get_reference_count() const; - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE PhysxClothMesh(); - INLINE ~PhysxClothMesh(); - - INLINE NxClothMesh *ptr() const { return _ptr; }; - - void link(NxClothMesh *meshPtr); - void unlink(); - -private: - NxClothMesh *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxClothMesh", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxClothMesh.I" - -#endif // PHYSXCLOTHMESH_H diff --git a/panda/src/physx/physxClothMeshDesc.I b/panda/src/physx/physxClothMeshDesc.I deleted file mode 100644 index 2cf02c8152..0000000000 --- a/panda/src/physx/physxClothMeshDesc.I +++ /dev/null @@ -1,82 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothMeshDesc.I - * @author enn0x - * @date 2010-03-28 - */ - -/** - * - */ -INLINE PhysxClothMeshDesc:: -PhysxClothMeshDesc() { - - _desc.flags = 0; - _desc.pointStrideBytes = sizeof(NxVec3); - _desc.triangleStrideBytes = 3*sizeof(NxU32); - _desc.points = nullptr; - _desc.triangles = nullptr; - - _points = nullptr; - _triangles = nullptr; - _texcoords = nullptr; -} - -/** - * - */ -INLINE PhysxClothMeshDesc:: -~PhysxClothMeshDesc() { - - if (_points) { - delete [] _points; - } - - if (_triangles) { - delete [] _triangles; - } - - if (_texcoords) { - delete [] _texcoords; - } -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxClothMeshDesc:: -is_valid() const { - - return _desc.isValid(); -} - -/** - * - */ -INLINE const NxClothMeshDesc &PhysxClothMeshDesc:: -get_desc() const { - - return _desc; -} - -/** - * - */ -INLINE const plist PhysxClothMeshDesc:: -get_texcoords() const { - - plist texcoords; - - for (unsigned int i=0; i < _desc.numVertices; i++) { - LPoint2f uv = _texcoords[i]; - texcoords.push_back(uv); - } - - return texcoords; -} diff --git a/panda/src/physx/physxClothMeshDesc.cxx b/panda/src/physx/physxClothMeshDesc.cxx deleted file mode 100644 index 9b234c7d2e..0000000000 --- a/panda/src/physx/physxClothMeshDesc.cxx +++ /dev/null @@ -1,193 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothMeshDesc.cxx - * @author enn0x - * @date 2010-03-28 - */ - -#include "physxClothMeshDesc.h" -#include "physxManager.h" - -#include "nodePathCollection.h" -#include "geomNode.h" -#include "geomVertexReader.h" - -/** - * Sets the number of vertices to be stored within this triangle mesh. The - * function allocates memory for the vertices, but it does not set any - * vertices. - * - * This method must be called before any calls to set_vertex are done! - */ -void PhysxClothMeshDesc:: -set_num_vertices(unsigned int numVertices) { - - // Vertices - if (_desc.points) { - delete [] _points; - } - - _points = new NxVec3[numVertices]; - - _desc.numVertices = numVertices; - _desc.points = _points; - - // Texture coordinates - if (_texcoords) { - delete [] _texcoords; - } - - _texcoords = new LPoint2f[numVertices]; -} - -/** - * Sets a single vertex. You have to call the function set_num_vertices - * before you can call this function. - */ -void PhysxClothMeshDesc:: -set_vertex(unsigned int idx, const LPoint3f &vert, const LPoint2f &texcoord) { - - nassertv(_desc.numVertices > idx); - - _points[idx] = PhysxManager::point3_to_nxVec3(vert); - _texcoords[idx] = texcoord; -} - -/** - * Sets the number of triangles to be stored in this triangle mesh. - * - * This method must be called before any calls to set_triangle are done! - */ -void PhysxClothMeshDesc:: -set_num_triangles(unsigned int numTriangles) { - - if (_desc.triangles) { - delete [] _triangles; - } - - _triangles = new NxU32[3 * numTriangles]; - - _desc.numTriangles = numTriangles; - _desc.triangles = _triangles; -} - -/** - * Sets a single triangle, by providing the three indices i1, i2, i3. - */ -void PhysxClothMeshDesc:: -set_triangle(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3) { - - nassertv(_desc.numTriangles > idx); - - idx = 3 * idx; - _triangles[idx] = i1; - _triangles[idx + 1] = i2; - _triangles[idx + 2] = i3; -} - -/** - * A convenience method to set the mesh data from a NodePath in a single call. - * The method iterates over the NodePath geoms and collects data for the - * triangle mesh. - * - * Do not use the following function when using this one: - set_num_vertices - - * set_vertex - set_num_triangles - set_triangle - */ -void PhysxClothMeshDesc:: -set_from_node_path(const NodePath &np) { - - pvector dataVertices; - pvector dataTexcoords; - pvector dataIndices; - - // Collect data from NodePath - NodePathCollection npc = np.find_all_matches( "**/+GeomNode" ); - for (int i=0; iget_num_geoms(); j++) { - CPT(Geom) geom = gnode->get_geom(j); - CPT(GeomVertexData) vdata = geom->get_vertex_data(); - GeomVertexReader reader; - - // Vertices - reader = GeomVertexReader(vdata, InternalName::get_vertex()); - while (!reader.is_at_end()) { - dataVertices.push_back(reader.get_data3f()); - } - - // Texcoords - reader = GeomVertexReader(vdata, InternalName::get_texcoord()); - while (!reader.is_at_end()) { - dataTexcoords.push_back(reader.get_data2f()); - } - - // Indices - for (int k=0; kget_num_primitives(); k++) { - - CPT(GeomPrimitive) prim = geom->get_primitive(k); - prim = prim->decompose(); - - for (int l=0; lget_num_primitives(); l++) { - - int s = prim->get_primitive_start(l); - int e = prim->get_primitive_end(l); - - for (int l=s; lget_vertex(l)); - } - } - } - } - } - - // Set descriptor members - int i; - - NxU32 numVertices = dataVertices.size(); - NxU32 numTriangles = dataIndices.size() / 3; - - _points = new NxVec3[numVertices]; - _triangles = new NxU32[3 * numTriangles]; - _texcoords = new LPoint2f[numVertices]; - - i = 0; - pvector::const_iterator vit; - for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) { - LPoint3f v = *vit; - - _points[i] = PhysxManager::point3_to_nxVec3(v); - i++; - } - - i = 0; - pvector::const_iterator tcit; - for (tcit=dataTexcoords.begin(); tcit!=dataTexcoords.end(); tcit++) { - LPoint2f tc = *tcit; - - _texcoords[i] = tc; - i++; - } - - i = 0; - pvector::const_iterator iit; - for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) { - NxU32 idx = *iit; - - _triangles[i] = idx; - i++; - } - - _desc.numVertices = numVertices; - _desc.points = _points; - _desc.numTriangles = numTriangles; - _desc.triangles = _triangles; -} diff --git a/panda/src/physx/physxClothMeshDesc.h b/panda/src/physx/physxClothMeshDesc.h deleted file mode 100644 index d2c5d79b1e..0000000000 --- a/panda/src/physx/physxClothMeshDesc.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothMeshDesc.h - * @author enn0x - * @date 2010-03-28 - */ - -#ifndef PHYSXCLOTHMESHDESC_H -#define PHYSXCLOTHMESHDESC_H - -#include "pandabase.h" -#include "luse.h" -#include "nodePath.h" -#include "plist.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxClothMeshDesc { - -PUBLISHED: - INLINE PhysxClothMeshDesc(); - INLINE ~PhysxClothMeshDesc(); - - INLINE bool is_valid() const; - - void set_num_vertices(unsigned int n); - void set_vertex(unsigned int idx, - const LPoint3f &vert, const LPoint2f &texcoord); - - void set_num_triangles(unsigned int n); - void set_triangle(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3); - - void set_from_node_path(const NodePath &np); - -public: - INLINE const NxClothMeshDesc &get_desc() const; - INLINE const plist get_texcoords() const; - -private: - NxClothMeshDesc _desc; - NxVec3 *_points; - NxU32 *_triangles; - - LPoint2f *_texcoords; -}; - -#include "physxClothMeshDesc.I" - -#endif // PHYSXCLOTHMESHDESC_H diff --git a/panda/src/physx/physxClothNode.I b/panda/src/physx/physxClothNode.I deleted file mode 100644 index a06bfcc3c3..0000000000 --- a/panda/src/physx/physxClothNode.I +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothNode.I - * @author enn0x - * @date 2010-04-05 - */ - -/** - * - */ -INLINE PhysxClothNode:: -PhysxClothNode(const char *name) : GeomNode(name) { - - _numVertices = 0; - - _vdata = new GeomVertexData("", GeomVertexFormat::get_v3n3t2(), Geom::UH_stream); - - _prim = new GeomTriangles(Geom::UH_stream); - _prim->set_shade_model(Geom::SM_uniform); - - _geom = new Geom(_vdata); - _geom->add_primitive(_prim); - - this->add_geom(_geom); - - _numTexcoords = 0; - _texcoords = nullptr; -} - -/** - * - */ -INLINE PhysxClothNode:: -~PhysxClothNode() { - - if (_texcoords) { - delete [] _texcoords; - } -} diff --git a/panda/src/physx/physxClothNode.cxx b/panda/src/physx/physxClothNode.cxx deleted file mode 100644 index e5b9ae104a..0000000000 --- a/panda/src/physx/physxClothNode.cxx +++ /dev/null @@ -1,215 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothNode.cxx - * @author enn0x - * @date 2010-04-05 - */ - -#include "physxClothNode.h" -#include "physxCloth.h" -#include "physxFileStream.h" - -#include "geomVertexFormat.h" -#include "geomVertexWriter.h" - -TypeHandle PhysxClothNode::_type_handle; - -/** - * - */ -void PhysxClothNode:: -allocate(PhysxCloth *cloth) { - - _cloth = cloth; - - // Retrieve number of vertices and triangles the hard way - NxClothMeshDesc meshDesc; - _cloth->ptr()->getClothMesh()->saveToDesc(meshDesc); - - NxU32 numVertices = meshDesc.numVertices; - NxU32 numTriangles = meshDesc.numTriangles; - - NxReal factor = 1.0f; // TODO: max(1.0f, factor); - - // Reserve more memory for vertices than the initial mesh takes because - // tearing creates new vertices - NxU32 maxVertices = factor * numVertices; - _mesh.verticesPosBegin = (NxVec3 *)malloc(sizeof(NxVec3) * maxVertices); - _mesh.verticesNormalBegin = (NxVec3 *)malloc(sizeof(NxVec3) * maxVertices); - _mesh.verticesPosByteStride = sizeof(NxVec3); - _mesh.verticesNormalByteStride = sizeof(NxVec3); - _mesh.maxVertices = maxVertices; - _mesh.numVerticesPtr = (NxU32 *)malloc(sizeof(NxU32)); - - // The number of triangles is constant, even if the cloth is torn - NxU32 maxIndices = 3 * numTriangles; - _mesh.indicesBegin = (NxU32 *)malloc(sizeof(NxU32) * maxIndices); - _mesh.indicesByteStride = sizeof(NxU32); - _mesh.maxIndices = maxIndices; - _mesh.numIndicesPtr = (NxU32 *)malloc(sizeof(NxU32)); - - NxU32 maxParentIndices = maxVertices; - _mesh.parentIndicesBegin = (NxU32 *)malloc(sizeof(NxU32)*maxParentIndices); - _mesh.parentIndicesByteStride = sizeof(NxU32); - _mesh.maxParentIndices = maxParentIndices; - _mesh.numParentIndicesPtr = (NxU32 *)malloc(sizeof(NxU32)); - - *(_mesh.numVerticesPtr) = 0; - *(_mesh.numIndicesPtr) = 0; - - _cloth->ptr()->setMeshData(_mesh); -} - -/** - * - */ -void PhysxClothNode:: -update() { - - NxU32 numVertices = *(_mesh.numVerticesPtr); - - if (numVertices == _numVertices) { - update_geom(); - } - else { - update_texcoords(); - create_geom(); - _numVertices = numVertices; - } -} - -/** - * - */ -void PhysxClothNode:: -create_geom() { - - _prim->clear_vertices(); - - GeomVertexWriter vwriter = GeomVertexWriter(_vdata, InternalName::get_vertex()); - GeomVertexWriter nwriter = GeomVertexWriter(_vdata, InternalName::get_normal()); - GeomVertexWriter twriter = GeomVertexWriter(_vdata, InternalName::get_texcoord()); - - // Vertices and normals - NxU32 numVertices = *(_mesh.numVerticesPtr); - NxVec3 *v = (NxVec3 *)_mesh.verticesPosBegin; - NxVec3 *n = (NxVec3 *)_mesh.verticesNormalBegin; - - for (unsigned int i=0; i < numVertices; i++) { - vwriter.add_data3f(v->x, v->y, v->z); - v++; - nwriter.add_data3f(n->x, n->y, n->z); - n++; - } - - // Texture coordinates - NxReal tex_u; - NxReal tex_v; - - if (_texcoords) { - for (unsigned int i=0; i < numVertices; i++) { - tex_u = _texcoords[2*i]; - tex_v = _texcoords[2*i+1]; - twriter.add_data2f(tex_u, tex_v); - } - } - - // Indices - NxU32 numIndices = *(_mesh.numIndicesPtr); - NxU32 *idx = (NxU32 *)_mesh.indicesBegin; - - for (unsigned int i=0; i < numIndices; i++) { - _prim->add_vertex(*idx); - idx++; - } - - _prim->close_primitive(); -} - -/** - * - */ -void PhysxClothNode:: -update_geom() { - - GeomVertexWriter vwriter = GeomVertexWriter(_vdata, InternalName::get_vertex()); - GeomVertexWriter nwriter = GeomVertexWriter(_vdata, InternalName::get_normal()); - - NxU32 numVertices = *(_mesh.numVerticesPtr); - NxVec3 *v = (NxVec3 *)_mesh.verticesPosBegin; - NxVec3 *n = (NxVec3 *)_mesh.verticesNormalBegin; - - for (unsigned int i=0; i < numVertices; i++) { - vwriter.set_data3f(v->x, v->y, v->z); - v++; - nwriter.set_data3f(n->x, n->y, n->z); - n++; - } -} - -/** - * - */ -void PhysxClothNode:: -update_texcoords() { - - if (!_texcoords) { - return; - } - - NxU32 numVertices = *(_mesh.numVerticesPtr); - NxU32 *parent = (NxU32 *)_mesh.parentIndicesBegin + _numTexcoords; - - for (NxU32 i=_numTexcoords; i < numVertices; i++, parent++) { - _texcoords[2*i] = _texcoords[2*(*parent)]; - _texcoords[2*i+1] = _texcoords[2*(*parent)+1]; - } - - _numTexcoords = numVertices; -} - -/** - * - */ -bool PhysxClothNode:: -set_texcoords(const Filename &filename) { - - if (filename.empty()) { - return false; - } - - Filename fn(filename); - fn.resolve_filename(get_model_path()); - - if (!filename.exists()) { - return false; - } - - PhysxFileStream fs(filename.c_str(), true); - - fs.readByte(); // N - fs.readByte(); // X - fs.readByte(); // X - fs.readByte(); // 1 - fs.readByte(); // T - fs.readByte(); // E - fs.readByte(); // X - fs.readByte(); // C - fs.readByte(); // 1 - - _numTexcoords = fs.readDword(); - _texcoords = new float[2 * _numTexcoords]; - - for (unsigned int i=0; i<_numTexcoords; i++) { - _texcoords[2*i] = fs.readFloat(); - _texcoords[2*i+1] = fs.readFloat(); - } - - return true; -} diff --git a/panda/src/physx/physxClothNode.h b/panda/src/physx/physxClothNode.h deleted file mode 100644 index 4f2535b949..0000000000 --- a/panda/src/physx/physxClothNode.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxClothNode.h - * @author enn0x - * @date 2010-04-05 - */ - -#ifndef PHYSXCLOTHNODE_H -#define PHYSXCLOTHNODE_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "geomNode.h" -#include "transformState.h" -#include "geom.h" -#include "geomVertexData.h" -#include "geomTriangles.h" -#include "filename.h" - -#include "physx_includes.h" - -class PhysxCloth; - -/** - * Renderable geometry which represents a cloth mesh. - */ -class EXPCL_PANDAPHYSX PhysxClothNode : public GeomNode { -PUBLISHED: - INLINE explicit PhysxClothNode(const char *name); - INLINE ~PhysxClothNode(); - - bool set_texcoords(const Filename &filename); - -public: - void allocate(PhysxCloth *cloth); - void update(); - -private: - void create_geom(); - void update_geom(); - void update_texcoords(); - - unsigned int _numVertices; - - NxMeshData _mesh; - - PT(GeomVertexData) _vdata; - PT(Geom) _geom; - PT(GeomTriangles) _prim; - - PT(PhysxCloth) _cloth; - - unsigned int _numTexcoords; - float *_texcoords; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - GeomNode::init_type(); - register_type(_type_handle, "PhysxClothNode", - GeomNode::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxClothNode.I" - -#endif // PHYSXCLOTHNODE_H diff --git a/panda/src/physx/physxConstraintDominance.I b/panda/src/physx/physxConstraintDominance.I deleted file mode 100644 index 0d79128d59..0000000000 --- a/panda/src/physx/physxConstraintDominance.I +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConstraintDominance.I - * @author enn0x - * @date 2009-12-22 - */ - -/** - * - */ -INLINE PhysxConstraintDominance:: -PhysxConstraintDominance(float d0, float d1) : _dominance(d0, d1) { - -} - -/** - * - */ -INLINE PhysxConstraintDominance:: -~PhysxConstraintDominance() { - -} - -/** - * - */ -INLINE NxConstraintDominance PhysxConstraintDominance:: -get_dominance() const { - - return _dominance; -} - -/** - * - */ -INLINE void PhysxConstraintDominance:: -set_dominance(NxConstraintDominance value) { - - _dominance = value; -} diff --git a/panda/src/physx/physxConstraintDominance.cxx b/panda/src/physx/physxConstraintDominance.cxx deleted file mode 100644 index 8227c9826f..0000000000 --- a/panda/src/physx/physxConstraintDominance.cxx +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConstraintDominance.cxx - * @author enn0x - * @date 2009-12-22 - */ - -#include "physxConstraintDominance.h" - -/** - * Retruns the first dominance factor. - */ -float PhysxConstraintDominance:: -get_0() const { - - return _dominance.dominance0; -} - -/** - * Returns the second dominance factor. - */ -float PhysxConstraintDominance:: -get_1() const { - - return _dominance.dominance1; -} - -/** - * Sets the first dominance factor. - */ -void PhysxConstraintDominance:: -set_0(float d0) { - - _dominance.dominance0 = d0; -} - -/** - * Sets the second dominance factor. - */ -void PhysxConstraintDominance:: -set_1(float d1) { - - _dominance.dominance1 = d1; -} diff --git a/panda/src/physx/physxConstraintDominance.h b/panda/src/physx/physxConstraintDominance.h deleted file mode 100644 index 9d35fd9111..0000000000 --- a/panda/src/physx/physxConstraintDominance.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConstraintDominance.h - * @author enn0x - * @date 2009-12-22 - */ - -#ifndef PHYSXCONSTRAINTDOMINANCE_H -#define PHYSXCONSTRAINTDOMINANCE_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -class PhysxShape; - -/** - * Expresses the dominance relationship of a constraint. For the time being - * only three settings are permitted:. (1.0f, 1.0f), (0.0f, 1.0f), and (1.0f, - * 0.0f). - * - * See PhysxScene::set_dominance_group_pair for a detailed explanation of - * dominance behaviour. - */ -class EXPCL_PANDAPHYSX PhysxConstraintDominance { - -PUBLISHED: - INLINE PhysxConstraintDominance(float d0, float d1); - INLINE ~PhysxConstraintDominance(); - - float get_0() const; - float get_1() const; - void set_0(float d0); - void set_1(float d1); - -public: - INLINE void set_dominance(NxConstraintDominance value); - INLINE NxConstraintDominance get_dominance() const; - -private: - NxConstraintDominance _dominance; -}; - -#include "physxConstraintDominance.I" - -#endif // PHYSXCONSTRAINTDOMINANCE_H diff --git a/panda/src/physx/physxContactPair.I b/panda/src/physx/physxContactPair.I deleted file mode 100644 index 479b691dbf..0000000000 --- a/panda/src/physx/physxContactPair.I +++ /dev/null @@ -1,29 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactPair.I - * @author enn0x - * @date 2009-12-19 - */ - -/** - * - */ -INLINE PhysxContactPair:: -PhysxContactPair(const NxContactPair pair) { - - _pair = pair; -} - -/** - * - */ -INLINE PhysxContactPair:: -~PhysxContactPair() { - -} diff --git a/panda/src/physx/physxContactPair.cxx b/panda/src/physx/physxContactPair.cxx deleted file mode 100644 index 9374709418..0000000000 --- a/panda/src/physx/physxContactPair.cxx +++ /dev/null @@ -1,136 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactPair.cxx - * @author enn0x - * @date 2009-12-19 - */ - -#include "physxContactPair.h" -#include "physxManager.h" -#include "physxActor.h" -#include "physxContactPoint.h" - -TypeHandle PhysxContactPair::_type_handle; - -/** - * Returns the first of the two actors that makes up this pair. - */ -PhysxActor *PhysxContactPair:: -get_actor_a() const { - - if (_pair.isDeletedActor[0]) { - physx_cat.warning() << "actor A has been deleted" << std::endl; - return nullptr; - } - - NxActor *actorPtr = _pair.actors[0]; - return (actorPtr == nullptr) ? nullptr : (PhysxActor *)actorPtr->userData; -} - -/** - * Returns the second of the two actors that make up his pair. - */ -PhysxActor *PhysxContactPair:: -get_actor_b() const { - - if (_pair.isDeletedActor[1]) { - physx_cat.warning() << "actor B has been deleted" << std::endl; - return nullptr; - } - - NxActor *actorPtr = _pair.actors[1]; - return (actorPtr == nullptr) ? nullptr : (PhysxActor *)actorPtr->userData; -} - -/** - * Returns true if the first of the two actors is deleted. - */ -bool PhysxContactPair:: -is_deleted_a() const { - - return _pair.isDeletedActor[0]; -} - -/** - * Returns true if the second of the two actors is deleted. - */ -bool PhysxContactPair:: -is_deleted_b() const { - - return _pair.isDeletedActor[1]; -} - -/** - * Returns the total contact normal force that was applied for this pair, to - * maintain nonpenetration constraints. - * - * You should set the ContactPairFlag CPF_notify_forces in order to receive - * this value. - * - * @see PhysxScene::set_actor_pair_flag - * @see PhysxScene::set_actor_group_pair_flag - */ -LVector3f PhysxContactPair:: -get_sum_normal_force() const { - - return PhysxManager::nxVec3_to_vec3(_pair.sumNormalForce); -} - -/** - * Returns the total tangential force that was applied for this pair. - * - * You should set the ContactPairFlag CPF_notify_forces in order to receive - * this value. - * - * @see PhysxScene::set_actor_pair_flag - * @see PhysxScene::set_actor_group_pair_flag - */ -LVector3f PhysxContactPair:: -get_sum_friction_force() const { - - return PhysxManager::nxVec3_to_vec3(_pair.sumFrictionForce); -} - -/** - * Returns the total number of contact points reported in this pair's contact - * stream. - * - * This method is a helper for iterating over the pair's contact stream. - */ -unsigned int PhysxContactPair:: -get_num_contact_points() { - - if (_contacts.size() == 0) { - NxContactStreamIterator it(_pair.stream); - while(it.goNextPair()) { - while(it.goNextPatch()) { - while(it.goNextPoint()) { - PhysxContactPoint cp; - cp.set(it); - _contacts.push_back(cp); - } - } - } - } - - return _contacts.size(); -} - -/** - * Returns an instance of PhysxContactPoint, which represents a single entry - * of this pair's contact stream. - * - * This method is a helper for iterating over the pair's contact stream. - */ -PhysxContactPoint PhysxContactPair:: -get_contact_point(unsigned int idx) const { - - nassertr(idx < _contacts.size(), PhysxContactPoint::empty()); - return _contacts[idx]; -} diff --git a/panda/src/physx/physxContactPair.h b/panda/src/physx/physxContactPair.h deleted file mode 100644 index dc48fba5b6..0000000000 --- a/panda/src/physx/physxContactPair.h +++ /dev/null @@ -1,77 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactPair.h - * @author enn0x - * @date 2009-12-19 - */ - -#ifndef PHYSXCONTACTPAIR_H -#define PHYSXCONTACTPAIR_H - -#include "pandabase.h" -#include "luse.h" -#include "typedReferenceCount.h" -#include "pvector.h" - -#include "config_physx.h" - -class PhysxShape; -class PhysxContactPoint; - -/** - * An instance of this class is send with contact reporting events. It - * contains detailed information on the contact. - */ -class EXPCL_PANDAPHYSX PhysxContactPair : public TypedReferenceCount { - -PUBLISHED: - INLINE ~PhysxContactPair(); - - bool is_deleted_a() const; - bool is_deleted_b() const; - PhysxActor *get_actor_a() const; - PhysxActor *get_actor_b() const; - LVector3f get_sum_normal_force() const; - LVector3f get_sum_friction_force() const; - - unsigned int get_num_contact_points(); - PhysxContactPoint get_contact_point(unsigned int idx) const; - MAKE_SEQ(get_contact_points, get_num_contact_points, get_contact_point); - -public: - INLINE PhysxContactPair(const NxContactPair pair); - -private: - NxContactPair _pair; - pvector _contacts; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - TypedReferenceCount::init_type(); - register_type(_type_handle, "PhysxContactPair", - TypedReferenceCount::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxContactPair.I" - -#endif // PHYSXCONTACTPAIR_H diff --git a/panda/src/physx/physxContactPoint.I b/panda/src/physx/physxContactPoint.I deleted file mode 100644 index d2dec89747..0000000000 --- a/panda/src/physx/physxContactPoint.I +++ /dev/null @@ -1,29 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactPoint.I - * @author enn0x - * @date 2009-12-20 - */ - -/** - * - */ -INLINE PhysxContactPoint:: -PhysxContactPoint() { - - // _hit = hit; -} - -/** - * - */ -INLINE PhysxContactPoint:: -~PhysxContactPoint() { - -} diff --git a/panda/src/physx/physxContactPoint.cxx b/panda/src/physx/physxContactPoint.cxx deleted file mode 100644 index b96150edda..0000000000 --- a/panda/src/physx/physxContactPoint.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactPoint.cxx - * @author enn0x - * @date 2009-12-20 - */ - -#include "physxContactPoint.h" -#include "physxManager.h" -#include "physxShape.h" - -TypeHandle PhysxContactPoint::_type_handle; - -/** - * - */ -void PhysxContactPoint:: -set(NxContactStreamIterator it) { - - _point = it.getPoint(); - _normal = it.getPatchNormal(); - _normal_force = it.getPointNormalForce(); - _separation = it.getSeparation(); - _feature_index0 = it.getFeatureIndex0(); - _feature_index1 = it.getFeatureIndex1(); -} - -/** - * - */ -PhysxContactPoint PhysxContactPoint:: -empty() { - - return PhysxContactPoint(); -} - - -/** - * Returns the contact point position. - */ -LPoint3f PhysxContactPoint:: -get_point() const { - - return PhysxManager::nxVec3_to_point3(_point); -} - -/** - * Retrieves the patch normal. - */ -LVector3f PhysxContactPoint:: -get_normal() const { - - return PhysxManager::nxVec3_to_vec3(_normal); -} - -/** - * Retrieves the point normal force. - */ -float PhysxContactPoint:: -get_normal_force() const { - - return _normal_force; -} - -/** - * Return the separation for the contact point. - */ -float PhysxContactPoint:: -get_separation() const { - - return _separation; -} - -/** - * Retrieves the feature index. - */ -unsigned int PhysxContactPoint:: -get_feature_index0() const { - - return _feature_index0; -} - -/** - * Retrieves the feature index. - */ -unsigned int PhysxContactPoint:: -get_feature_index1() const { - - return _feature_index1; -} diff --git a/panda/src/physx/physxContactPoint.h b/panda/src/physx/physxContactPoint.h deleted file mode 100644 index a5da16641a..0000000000 --- a/panda/src/physx/physxContactPoint.h +++ /dev/null @@ -1,78 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactPoint.h - * @author enn0x - * @date 2009-12-20 - */ - -#ifndef PHYSXCONTACTPOINT_H -#define PHYSXCONTACTPOINT_H - -#include "pandabase.h" -#include "luse.h" -#include "typedObject.h" - -#include "config_physx.h" - -class PhysxShape; - -/** - * A helper structure for iterating over contact streams reported by - * PhysxContactPair. - */ -class EXPCL_PANDAPHYSX PhysxContactPoint : public TypedObject { - -PUBLISHED: - INLINE PhysxContactPoint(); - INLINE ~PhysxContactPoint(); - - LPoint3f get_point() const; - LVector3f get_normal() const; - float get_normal_force() const; - float get_separation() const; - unsigned int get_feature_index0() const; - unsigned int get_feature_index1() const; - -public: - static PhysxContactPoint empty(); - - void set(NxContactStreamIterator it); - -private: - NxVec3 _point; - NxVec3 _normal; - NxReal _normal_force; - NxReal _separation; - NxU32 _feature_index0; - NxU32 _feature_index1; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - TypedReferenceCount::init_type(); - register_type(_type_handle, "PhysxContactPoint", - TypedReferenceCount::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxContactPoint.I" - -#endif // PHYSXCONTACTPOINT_H diff --git a/panda/src/physx/physxContactReport.I b/panda/src/physx/physxContactReport.I deleted file mode 100644 index 184ab2d56a..0000000000 --- a/panda/src/physx/physxContactReport.I +++ /dev/null @@ -1,29 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactReport.I - * @author enn0x - * @date 2009-09-19 - */ - -/** - * - */ -INLINE PhysxContactReport:: -PhysxContactReport() : NxUserContactReport() { - - _enabled = false; -} - -/** - * - */ -INLINE PhysxContactReport:: -~PhysxContactReport() { - -} diff --git a/panda/src/physx/physxContactReport.cxx b/panda/src/physx/physxContactReport.cxx deleted file mode 100644 index f7913a039a..0000000000 --- a/panda/src/physx/physxContactReport.cxx +++ /dev/null @@ -1,91 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactReport.cxx - * @author enn0x - * @date 2009-09-19 - */ - -#include "physxContactReport.h" -#include "physxContactPair.h" -#include "physxManager.h" - -#include "event.h" -#include "eventQueue.h" -#include "eventParameter.h" - -PStatCollector PhysxContactReport::_pcollector("App:PhysX:Contact Reporting"); - -/** - * - */ -void PhysxContactReport:: -enable() { - - _enabled = true; -} - -/** - * - */ -void PhysxContactReport:: -disable() { - - _enabled = false; -} - -/** - * - */ -bool PhysxContactReport:: -is_enabled() const { - - return _enabled; -} - -/** - * - */ -void PhysxContactReport:: -onContactNotify(NxContactPair &pair, NxU32 flags) { - - if (!_enabled) { - return; - } - - _pcollector.start(); - - Event *event; - if (flags & NX_NOTIFY_ON_START_TOUCH) { - event = new Event("physx-contact-start"); - } - else if (flags & NX_NOTIFY_ON_END_TOUCH) { - event = new Event("physx-contact-stop"); - } - else if (flags & NX_NOTIFY_ON_TOUCH) { - event = new Event("physx-contact-touch"); - } - else if (flags & NX_NOTIFY_ON_START_TOUCH_FORCE_THRESHOLD) { - event = new Event("physx-contact-start-force-threshold"); - } - else if (flags & NX_NOTIFY_ON_END_TOUCH_FORCE_THRESHOLD) { - event = new Event("physx-contact-stop-force-threshold"); - } - else if (flags & NX_NOTIFY_ON_TOUCH_FORCE_THRESHOLD) { - event = new Event("physx-contact-touch-force-threshold"); - } - else { - return; - } - - PT(PhysxContactPair) ppair = new PhysxContactPair(pair); - event->add_parameter(EventParameter(ppair)); - EventQueue::get_global_event_queue()->queue_event(event); - - _pcollector.stop(); -} diff --git a/panda/src/physx/physxContactReport.h b/panda/src/physx/physxContactReport.h deleted file mode 100644 index 45c760c36f..0000000000 --- a/panda/src/physx/physxContactReport.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxContactReport.h - * @author enn0x - * @date 2009-09-19 - */ - -#ifndef PHYSXCONTACTREPORT_H -#define PHYSXCONTACTREPORT_H - -#include "pandabase.h" -#include "pStatCollector.h" -#include "physx_includes.h" - -/** - * Implementation of the NxUserContactReport interface. - */ -class EXPCL_PANDAPHYSX PhysxContactReport : public NxUserContactReport { - -public: - INLINE PhysxContactReport(); - INLINE ~PhysxContactReport(); - - void enable(); - void disable(); - bool is_enabled() const; - - void onContactNotify(NxContactPair& pair, NxU32 flags); - -private: - bool _enabled; - static PStatCollector _pcollector; -}; - -#include "physxContactReport.I" - -#endif // PHYSXCONTACTREPORT_H diff --git a/panda/src/physx/physxController.I b/panda/src/physx/physxController.I deleted file mode 100644 index 58bd825c21..0000000000 --- a/panda/src/physx/physxController.I +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxController.I - * @author enn0x - * @date 2009-09-24 - */ - -/** - * - */ -INLINE PhysxController:: -PhysxController() : PhysxObject() { - - _speed = NxVec3(0.0f, 0.0f, 0.0f); - _omega = 0.0f; - _heading = 0.0f; - - _jumping = false; - _jump_time = 0.0f; - _jump_v0 = 0.0f; - - _sharpness = 1.0f; - _min_dist = 0.0001f; - - _up_vector = NxVec3(0.0f, 1.0f, 0.0f); - _up_axis = (NxHeightFieldAxis)physx_up_axis.get_value(); - - switch (_up_axis) { - case NX_Z: - _up_quat = NxQuat(90.0f, NxVec3(1.0f, 0.0f, 0.0f)); - break; - case NX_Y: - _up_quat = NxQuat(0.0f, NxVec3(1.0f, 0.0f, 0.0f)); - break; - default: - physx_cat.error() << "only y-up and z-up are permitted" << std::endl; - } - - _up_quat_inv = _up_quat; - _up_quat_inv.invert(); -} - -/** - * - */ -INLINE void PhysxController:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxController:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")"; - - out << " A:0x" << get_actor(); - out << "\n"; -} diff --git a/panda/src/physx/physxController.cxx b/panda/src/physx/physxController.cxx deleted file mode 100644 index 7787c4019e..0000000000 --- a/panda/src/physx/physxController.cxx +++ /dev/null @@ -1,333 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxController.cxx - * @author enn0x - * @date 2009-09-24 - */ - -#include "event.h" -#include "eventQueue.h" -#include "eventParameter.h" - -#include "physxController.h" -#include "physxManager.h" -#include "physxActor.h" -#include "physxBoxController.h" -#include "physxCapsuleController.h" - -TypeHandle PhysxController::_type_handle; - -/** - * - */ -void PhysxController:: -release() { - - nassertv(_error_type == ET_ok); - - NxControllerManager *cm = get_actor()->get_scene()->cm(); - unlink(); - cm->releaseController(*ptr()); -} - -/** - * - */ -PhysxController *PhysxController:: -factory(NxControllerType controllerType) { - - switch (controllerType) { - - case NX_CONTROLLER_BOX: - return new PhysxBoxController(); - - case NX_CONTROLLER_CAPSULE: - return new PhysxCapsuleController(); - - default: - break; - } - - physx_cat.error() << "Unknown controller type.\n"; - return nullptr; -} - - -/** - * Retrieves the actor which this controller is associated with. - */ -PhysxActor *PhysxController:: -get_actor() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxActor *)(ptr()->getActor()->userData); -} - -/** - * Sets the position of the controller is global space. This can be used for - * initial placement or for teleporting the character. - */ -void PhysxController:: -set_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - ptr()->setPosition(PhysxManager::point3_to_nxExtVec3(pos)); -} - -/** - * Retruns the position of the controller is global space. - */ -LPoint3f PhysxController:: -get_pos() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - return PhysxManager::nxExtVec3_to_point3(ptr()->getPosition()); -} - -/** - * Sharpness is used to smooth motion with a feedback filter, having a value - * between 0 (so smooth it doesn't move) and 1 (no smoothing = unfiltered - * motion). Sharpness can ease the motion curve when the auto-step feature is - * used with boxes. Default value is 1.0. - */ -void PhysxController:: -set_sharpness(float sharpness) { - - nassertv(_error_type == ET_ok); - nassertv(sharpness > 0.0f); - nassertv(sharpness <= 1.0f); - - _sharpness = sharpness; -} - -/** - * Returns the sharpness used to ease the motion curve when the auto-step - * feature is used. Default value is 1.0. - */ -float PhysxController:: -get_sharpness() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _sharpness; -} - -/** - * Enable/Disable collisions for this controller and actor. - */ -void PhysxController:: -set_collision(bool enable) { - - nassertv(_error_type == ET_ok); - ptr()->setCollision(enable); -} - -/** - * Sets the the minimum travelled distance to consider when moving the - * controller. If travelled distance is smaller, the character doesn't move. - * This is used to stop the recursive motion algorithm when remaining distance - * to travel is small. The default value is 0.0001. - */ -void PhysxController:: -set_min_distance(float min_dist) { - - nassertv(_error_type == ET_ok); - nassertv(min_dist > 0.0f); - - _min_dist = min_dist; -} - -/** - * Sets the step height/offset for the controller. - */ -void PhysxController:: -set_step_offset(float offset) { - - nassertv(_error_type == ET_ok); - nassertv(offset > 0.0f); - - ptr()->setStepOffset(offset); -} - -/** - * Sets the linear speed of the controller in global space. - */ -void PhysxController:: -set_global_speed(const LVector3f &speed) { - - nassertv(_error_type == ET_ok); - nassertv_always(!speed.is_nan()); - - _speed = NxVec3(speed.get_x(), speed.get_y(), speed.get_z()); -} - -/** - * Sets the linear speed of the controller in local coordinates. - */ -void PhysxController:: -set_local_speed(const LVector3f &speed) { - - nassertv(_error_type == ET_ok); - nassertv_always(!speed.is_nan()); - - NodePath np = get_actor()->get_node_path(); - nassertv(!np.is_empty()); - - NxQuat q = ptr()->getActor()->getGlobalOrientationQuat(); - NxVec3 s = NxVec3(speed.get_x(), speed.get_y(), speed.get_z()); - _speed = (q * _up_quat_inv).rot(s); -} - -/** - * Sets the angular velocity (degrees per second) of the controller. The - * angular velocity is used to compute the new heading when updating the - * controller. - */ -void PhysxController:: -set_omega(float omega) { - - nassertv(_error_type == ET_ok); - _omega = omega; -} - -/** - * Sets the heading of the controller is global space. Note: only heading is - * supported. Pitch and roll are constrained by PhysX in order to alyways - * keep the character upright. - */ -void PhysxController:: -set_h(float heading) { - - nassertv(_error_type == ET_ok); - - _heading = heading; - NxQuat q(_heading, _up_vector); - ptr()->getActor()->moveGlobalOrientationQuat(_up_quat * q); -} - -/** - * Returns the heading of the controller in global space. - */ -float PhysxController:: -get_h() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _heading; -} - -/** - * The character controller uses caching in order to speed up collision - * testing, this caching can not detect when static objects have changed in - * the scene. You need to call this method when such changes have been made. - */ -void PhysxController:: -report_scene_changed() { - - nassertv(_error_type == ET_ok); - ptr()->reportSceneChanged(); -} - -/** - * - */ -void PhysxController:: -update_controller(float dt) { - - nassertv(_error_type == ET_ok); - - // Speed - NxU32 mask = 0xFFFFFFFF; - NxU32 collision_flags; - NxVec3 gravity; - - ptr()->getActor()->getScene().getGravity(gravity); - - NxVec3 d = (_speed + gravity) * dt; - - NxReal heightDelta = get_jump_height(dt, gravity); - if (heightDelta != 0.0f) { - ((_up_axis == NX_Z) ? d.z : d.y) += heightDelta; - } - - ptr()->move(d, mask, _min_dist, collision_flags, _sharpness); - - if (collision_flags & NXCC_COLLISION_DOWN) { - stop_jump(); - } - - // Omega - if (_omega != 0.0f) { - NxReal delta = _omega * dt; - _heading += delta; - NxQuat q(_heading, _up_vector); - ptr()->getActor()->moveGlobalOrientationQuat(_up_quat * q); - } - - // Reset speed and omega - _speed.zero(); - _omega = 0.0f; -} - -/** - * - */ -NxReal PhysxController:: -get_jump_height(float dt, NxVec3 &gravity) { - - if (_jumping == false) { - return 0.0f; - } - - _jump_time += dt; - - float G = (_up_axis == NX_Z) ? gravity.z : gravity.y; - float h = 2.0f * G * _jump_time * _jump_time + _jump_v0 * _jump_time; - return (h - G) * dt; -} - -/** - * Enters the jump mode. The parameter is the intial upward velocity of the - * character. - */ -void PhysxController:: -start_jump(float v0) { - - nassertv(_error_type == ET_ok); - - if (_jumping == true) { - return; - } - - _jumping = true; - _jump_time = 0.0f; - _jump_v0 = v0; -} - -/** - * Leaves the jump mode. This method is automatically called if a ground - * collision is detected. Usually users need not call this method. - */ -void PhysxController:: -stop_jump() { - - nassertv(_error_type == ET_ok); - - if (_jumping == false) { - return; - } - - _jumping = false; - - // NxVec3 v = ptr()->getActor()->getLinearVelocity(); double velocity = - // (_up_axis == NX_Z) ? v.z : v.y; - - Event *event = new Event("physx-controller-down"); - event->add_parameter(EventParameter(this)); - // event->add_parameter(EventParameter(velocity)); - EventQueue::get_global_event_queue()->queue_event(event); -} diff --git a/panda/src/physx/physxController.h b/panda/src/physx/physxController.h deleted file mode 100644 index dc520c3913..0000000000 --- a/panda/src/physx/physxController.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxController.h - * @author enn0x - * @date 2009-09-24 - */ - -#ifndef PHYSXCONTROLLER_H -#define PHYSXCONTROLLER_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxActor; - -/** - * Abstract base class for character controllers. - */ -class EXPCL_PANDAPHYSX PhysxController : public PhysxObject, public PhysxEnums { - -PUBLISHED: - void release(); - - PhysxActor *get_actor() const; - - void set_pos(const LPoint3f &pos); - void set_sharpness(float sharpness); - void set_collision(bool enable); - void set_min_distance(float min_dist); - void set_step_offset(float offset); - - LPoint3f get_pos() const; - float get_sharpness() const; - - void set_global_speed(const LVector3f &speed); - void set_local_speed(const LVector3f &speed); - void set_omega(float omega); - void set_h(float heading); - float get_h() const; - - void report_scene_changed(); - void start_jump(float v0); - void stop_jump(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - void update_controller(float dt); - - static PhysxController *factory(NxControllerType shapeType); - - virtual NxController *ptr() const = 0; - - virtual void link(NxController *controllerPtr) = 0; - virtual void unlink() = 0; - -protected: - INLINE PhysxController(); - -private: - NxReal get_jump_height(float dt, NxVec3 &gravity); - - float _sharpness; - float _min_dist; - - bool _jumping; - float _jump_time; - float _jump_v0; - - float _omega; - float _heading; - NxVec3 _speed; - - NxVec3 _up_vector; - NxQuat _up_quat; - NxQuat _up_quat_inv; - NxHeightFieldAxis _up_axis; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxController", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxController.I" - -#endif // PHYSXCONTROLLER_H diff --git a/panda/src/physx/physxControllerDesc.I b/panda/src/physx/physxControllerDesc.I deleted file mode 100644 index bedc5a3fd1..0000000000 --- a/panda/src/physx/physxControllerDesc.I +++ /dev/null @@ -1,20 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerDesc.I - * @author enn0x - * @date 2009-09-22 - */ - -/** - * - */ -INLINE PhysxControllerDesc:: -PhysxControllerDesc() { - -} diff --git a/panda/src/physx/physxControllerDesc.cxx b/panda/src/physx/physxControllerDesc.cxx deleted file mode 100644 index 9e3427125f..0000000000 --- a/panda/src/physx/physxControllerDesc.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerDesc.cxx - * @author enn0x - * @date 2009-09-22 - */ - -#include "physxControllerDesc.h" -#include "physxManager.h" - -/** - * Set the position of the character. - */ -void PhysxControllerDesc:: -set_pos(const LPoint3f &pos) { - - ptr()->position = PhysxManager::point3_to_nxExtVec3(pos); -} - -/** - * Sets the maximum slope which the character can walk up. In general it is - * desirable to limit where the character can walk, in particular it is - * unrealistic for the character to be able to climb arbitary slopes. The - * value is expressed in degrees. Default: 45.0 degrees. - */ -void PhysxControllerDesc:: -set_slope_limit(float slopeLimit) { - - ptr()->slopeLimit = cosf(NxMath::degToRad(slopeLimit)); -} - -/** - * Sets the skin width used by the controller. A "skin" around the controller - * is necessary to avoid numerical precision issues. This is dependant on the - * scale of the users world, but should be a small, positive non zero value. - * Default: 0.1 - */ -void PhysxControllerDesc:: -set_skin_width(float skinWidth) { - - ptr()->skinWidth = skinWidth; -} - -/** - * Defines the maximum height of an obstacle which the character can climb. A - * small value will mean that the character gets stuck and cannot walk up - * stairs etc, a value which is too large will mean that the character can - * climb over unrealistically high obstacles. Default: 0.5 - */ -void PhysxControllerDesc:: -set_step_offset(float stepOffset) { - - ptr()->stepOffset = stepOffset; -} - -/** - * The interaction flag controls if a character controller collides with other - * controllers. The default is to collide with other controllers. - */ -void PhysxControllerDesc:: -set_interaction_flag(bool interactionFlag) { - - ptr()->interactionFlag = (NxCCTInteractionFlag)interactionFlag; -} - -/** - * Returns the position of the character. - */ -LPoint3f PhysxControllerDesc:: -get_pos() const { - - return PhysxManager::nxExtVec3_to_point3(ptr()->position); -} - -/** - * Returns the maximum slope which the character can walk up. - */ -float PhysxControllerDesc:: -get_slope_limit() const { - - return NxMath::radToDeg(acosf(ptr()->slopeLimit)); -} - -/** - * Returns the skin width used by the controller. - */ -float PhysxControllerDesc:: -get_skin_width() const { - - return ptr()->skinWidth; -} - -/** - * Returns the maximum height of an obstacle which the character can climb. - */ -float PhysxControllerDesc:: -get_step_offset() const { - - return ptr()->stepOffset; -} - -/** - * Returns the interaction flag. - */ -bool PhysxControllerDesc:: -get_interaction_flag() const { - - return (ptr()->interactionFlag) ? true : false; -} diff --git a/panda/src/physx/physxControllerDesc.h b/panda/src/physx/physxControllerDesc.h deleted file mode 100644 index 4624938ffd..0000000000 --- a/panda/src/physx/physxControllerDesc.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerDesc.h - * @author enn0x - * @date 2009-09-22 - */ - -#ifndef PHYSXCONTROLLERDESC_H -#define PHYSXCONTROLLERDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physx_includes.h" - -/** - * Descriptor class for a character controller. - */ -class EXPCL_PANDAPHYSX PhysxControllerDesc { -PUBLISHED: - virtual ~PhysxControllerDesc() {}; - - virtual void set_to_default() = 0; - virtual bool is_valid() const = 0; - - void set_pos(const LPoint3f &pos); - void set_slope_limit(float slopeLimit); - void set_skin_width(float skinWidth); - void set_step_offset(float setpOffset); - void set_interaction_flag(bool interactionFlag); - - LPoint3f get_pos() const; - float get_slope_limit() const; - float get_skin_width() const; - float get_step_offset() const; - bool get_interaction_flag() const; - -public: - virtual NxControllerDesc *ptr() const = 0; - -protected: - INLINE PhysxControllerDesc(); -}; - -#include "physxControllerDesc.I" - -#endif // PHYSXCONTROLLERDESC_H diff --git a/panda/src/physx/physxControllerReport.I b/panda/src/physx/physxControllerReport.I deleted file mode 100644 index 5fa057f572..0000000000 --- a/panda/src/physx/physxControllerReport.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerReport.I - * @author enn0x - * @date 2009-09-24 - */ - -/** - * - */ -INLINE PhysxControllerReport:: -PhysxControllerReport() : NxUserControllerHitReport() { - - _enabled = false; -} - -/** - * - */ -INLINE PhysxControllerReport:: -~PhysxControllerReport() { - -} - -/** - * - */ -INLINE void PhysxControllerReport:: -set_shape_hit_callback(PT(CallbackObject) cbobj) { - - _shape_hit_cbobj = cbobj; -} - -/** - * - */ -INLINE void PhysxControllerReport:: -set_controller_hit_callback(PT(CallbackObject) cbobj) { - - _controller_hit_cbobj = cbobj; -} diff --git a/panda/src/physx/physxControllerReport.cxx b/panda/src/physx/physxControllerReport.cxx deleted file mode 100644 index a9b570fcda..0000000000 --- a/panda/src/physx/physxControllerReport.cxx +++ /dev/null @@ -1,112 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerReport.cxx - * @author enn0x - * @date 2009-09-24 - */ - -#include "physxControllerReport.h" - -PStatCollector PhysxControllerReport::_pcollector("App:PhysX:Controller Reporting"); - -/** - * - */ -void PhysxControllerReport:: -enable() { - - _enabled = true; - - _shape_hit_cbobj = nullptr; - _controller_hit_cbobj = nullptr; -} - -/** - * - */ -void PhysxControllerReport:: -disable() { - - _enabled = false; -} - -/** - * - */ -bool PhysxControllerReport:: -is_enabled() const { - - return _enabled; -} - -/** - * - */ -NxControllerAction PhysxControllerReport:: -onShapeHit( const NxControllerShapeHit& hit ) { - - if (!_enabled) { - return NX_ACTION_NONE; - } - - _pcollector.start(); - - if (_shape_hit_cbobj) { - // Callback - PhysxControllerShapeHit cbdata(hit); - _shape_hit_cbobj->do_callback(&cbdata); - } - else { - // Default implementation - if (1 && hit.shape) { - NxActor& actor = hit.shape->getActor(); - if (actor.isDynamic() && !actor.readBodyFlag(NX_BF_KINEMATIC)) { - if (hit.dir.z == 0.0f) { - NxF32 controllerMass = hit.controller->getActor()->getMass(); - NxF32 coeff = actor.getMass() * hit.length * controllerMass; - actor.addForceAtLocalPos(hit.dir*coeff, NxVec3(0,0,0), NX_IMPULSE); - } - } - } - } - - _pcollector.stop(); - - return NX_ACTION_NONE; -} - -/** - * - */ -NxControllerAction PhysxControllerReport:: -onControllerHit(const NxControllersHit& hit) { - - if (!_enabled) { - return NX_ACTION_NONE; - } - - _pcollector.start(); - - if (_controller_hit_cbobj) { - // Callback - PhysxControllersHit cbdata(hit); - _controller_hit_cbobj->do_callback(&cbdata); - } - else { - // Default implementation - if (1 && hit.other) { - // For now other controllers are unpushable. --TODO-- return - // NX_ACTION_PUSH; is not implemented! - } - } - - _pcollector.stop(); - - return NX_ACTION_NONE; -} diff --git a/panda/src/physx/physxControllerReport.h b/panda/src/physx/physxControllerReport.h deleted file mode 100644 index ae2b1808af..0000000000 --- a/panda/src/physx/physxControllerReport.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerReport.h - * @author enn0x - * @date 2009-09-24 - */ - -#ifndef PHYSXCONTROLLERREPORT_H -#define PHYSXCONTROLLERREPORT_H - -#include "pandabase.h" -#include "callbackObject.h" -#include "pStatCollector.h" - -#include "physx_includes.h" - -/** - * Implementation of the NxUserControllerHitReport interface. - */ -class EXPCL_PANDAPHYSX PhysxControllerReport : public NxUserControllerHitReport { - -public: - INLINE PhysxControllerReport(); - INLINE ~PhysxControllerReport(); - - void enable(); - void disable(); - bool is_enabled() const; - - INLINE void set_shape_hit_callback(PT(CallbackObject) cbobj); - INLINE void set_controller_hit_callback(PT(CallbackObject) cbobj); - - virtual NxControllerAction onShapeHit(const NxControllerShapeHit& hit); - virtual NxControllerAction onControllerHit(const NxControllersHit& hit); - -private: - bool _enabled; - - PT(CallbackObject) _shape_hit_cbobj; - PT(CallbackObject) _controller_hit_cbobj; - - static PStatCollector _pcollector; -}; - -#include "physxControllerReport.I" - -#endif // PHYSXCONTROLLERREPORT_H diff --git a/panda/src/physx/physxControllerShapeHit.I b/panda/src/physx/physxControllerShapeHit.I deleted file mode 100644 index b6500ca736..0000000000 --- a/panda/src/physx/physxControllerShapeHit.I +++ /dev/null @@ -1,85 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerShapeHit.I - * @author enn0x - * @date 2012-11-28 - */ - -/** - * - */ -INLINE PhysxControllerShapeHit:: -PhysxControllerShapeHit(const NxControllerShapeHit &hit) : - _hit(hit) { - -} - -/** - * - */ -INLINE PhysxController *PhysxControllerShapeHit:: -get_controller() const { - - if (_hit.controller) { - return (PhysxController *)(_hit.controller->getUserData()); - } - else { - return nullptr; - } -} - -/** - * - */ -INLINE PhysxShape *PhysxControllerShapeHit:: -get_shape() const { - - if (_hit.shape) { - return (PhysxShape *)(_hit.shape->userData); - } - else { - return nullptr; - } -} - -/** - * - */ -INLINE LPoint3 PhysxControllerShapeHit:: -get_world_pos() const { - - return PhysxManager::nxExtVec3_to_point3(_hit.worldPos); -} - -/** - * - */ -INLINE LVector3 PhysxControllerShapeHit:: -get_world_normal() const { - - return PhysxManager::nxVec3_to_vec3(_hit.worldNormal); -} - -/** - * - */ -INLINE LVector3 PhysxControllerShapeHit:: -get_dir() const { - - return PhysxManager::nxVec3_to_vec3(_hit.dir); -} - -/** - * - */ -INLINE PN_stdfloat PhysxControllerShapeHit:: -get_length() const { - - return (PN_stdfloat)_hit.length; -} diff --git a/panda/src/physx/physxControllerShapeHit.cxx b/panda/src/physx/physxControllerShapeHit.cxx deleted file mode 100644 index d00d66dc64..0000000000 --- a/panda/src/physx/physxControllerShapeHit.cxx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerShapeHit.cxx - * @author enn0x - * @date 2012-11-28 - */ - -#include "physxControllerShapeHit.h" - -TypeHandle PhysxControllerShapeHit::_type_handle; diff --git a/panda/src/physx/physxControllerShapeHit.h b/panda/src/physx/physxControllerShapeHit.h deleted file mode 100644 index b1af192007..0000000000 --- a/panda/src/physx/physxControllerShapeHit.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllerShapeHit.h - * @author enn0x - * @date 2012-11-28 - */ - -#ifndef PHYSXCONTROLLERSHAPEHIT -#define PHYSXCONTROLLERSHAPEHIT - -#include "pandabase.h" -#include "callbackData.h" -#include "callbackObject.h" - -#include "physx_includes.h" -#include "physxManager.h" - -class PhysxController; -class PhysxShape; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxControllerShapeHit : public CallbackData { - -PUBLISHED: - INLINE PhysxControllerShapeHit(const NxControllerShapeHit &hit); - - INLINE PhysxController *get_controller() const; - INLINE PhysxShape *get_shape() const; - INLINE LPoint3 get_world_pos() const; - INLINE LVector3 get_world_normal() const; - INLINE LVector3 get_dir() const; - INLINE PN_stdfloat get_length() const; - -private: - const NxControllerShapeHit &_hit; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - CallbackData::init_type(); - register_type(_type_handle, "PhysxControllerShapeHit", - CallbackData::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxControllerShapeHit.I" - -#endif // PHYSXCONTROLLERSHAPEHIT diff --git a/panda/src/physx/physxControllersHit.I b/panda/src/physx/physxControllersHit.I deleted file mode 100644 index e3d9aea411..0000000000 --- a/panda/src/physx/physxControllersHit.I +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllersHit.I - * @author enn0x - * @date 2012-11-28 - */ - -/** - * - */ -INLINE PhysxControllersHit:: -PhysxControllersHit(const NxControllersHit &hit) : - _hit(hit) { - -} - -/** - * - */ -INLINE PhysxController *PhysxControllersHit:: -get_controller() const { - - NxController *controllerPtr = _hit.controller; - PhysxController *controller = controllerPtr ? (PhysxController *)controllerPtr : nullptr; - - return controller; -} - -/** - * - */ -INLINE PhysxController *PhysxControllersHit:: -get_other() const { - - NxController *otherPtr = _hit.other; - PhysxController *other = otherPtr ? (PhysxController *)otherPtr : nullptr; - - return other; -} diff --git a/panda/src/physx/physxControllersHit.cxx b/panda/src/physx/physxControllersHit.cxx deleted file mode 100644 index 88c468a224..0000000000 --- a/panda/src/physx/physxControllersHit.cxx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllersHit.cxx - * @author enn0x - * @date 2012-11-28 - */ - -#include "physxControllersHit.h" - -TypeHandle PhysxControllersHit::_type_handle; diff --git a/panda/src/physx/physxControllersHit.h b/panda/src/physx/physxControllersHit.h deleted file mode 100644 index 9538f7eb23..0000000000 --- a/panda/src/physx/physxControllersHit.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxControllersHit.h - * @author enn0x - * @date 2012-11-28 - */ - -#ifndef PHYSXCONTROLLERSHIT -#define PHYSXCONTROLLERSHIT - -#include "pandabase.h" -#include "callbackData.h" -#include "callbackObject.h" - -#include "physx_includes.h" - -class PhysxController; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxControllersHit : public CallbackData { - -PUBLISHED: - INLINE PhysxControllersHit(const NxControllersHit &hit); - - INLINE PhysxController *get_controller() const; - INLINE PhysxController *get_other() const; - -private: - const NxControllersHit &_hit; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - CallbackData::init_type(); - register_type(_type_handle, "PhysxControllersHit", - CallbackData::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxControllersHit.I" - -#endif // PHYSXCONTROLLERSHIT diff --git a/panda/src/physx/physxConvexForceFieldShape.I b/panda/src/physx/physxConvexForceFieldShape.I deleted file mode 100644 index 4ae8f37b1a..0000000000 --- a/panda/src/physx/physxConvexForceFieldShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexForceFieldShape.I - * @author enn0x - * @date 2009-11-15 - */ - -/** - * - */ -INLINE PhysxConvexForceFieldShape:: -PhysxConvexForceFieldShape() : PhysxForceFieldShape() { - -} - -/** - * - */ -INLINE PhysxConvexForceFieldShape:: -~PhysxConvexForceFieldShape() { - -} diff --git a/panda/src/physx/physxConvexForceFieldShape.cxx b/panda/src/physx/physxConvexForceFieldShape.cxx deleted file mode 100644 index bf89f9c485..0000000000 --- a/panda/src/physx/physxConvexForceFieldShape.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexForceFieldShape.cxx - * @author enn0x - * @date 2009-11-15 - */ - -#include "physxConvexForceFieldShape.h" -#include "physxConvexForceFieldShapeDesc.h" - -TypeHandle PhysxConvexForceFieldShape::_type_handle; - -/** - * - */ -void PhysxConvexForceFieldShape:: -link(NxForceFieldShape *shapePtr) { - - _ptr = shapePtr->isConvex(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.add(this); -} - -/** - * - */ -void PhysxConvexForceFieldShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxConvexForceFieldShape:: -save_to_desc(PhysxConvexForceFieldShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} diff --git a/panda/src/physx/physxConvexForceFieldShape.h b/panda/src/physx/physxConvexForceFieldShape.h deleted file mode 100644 index 6b39c23715..0000000000 --- a/panda/src/physx/physxConvexForceFieldShape.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexForceFieldShape.h - * @author enn0x - * @date 2009-11-15 - */ - -#ifndef PHYSXCONVEXFORCEFIELDSHAPE_H -#define PHYSXCONVEXFORCEFIELDSHAPE_H - -#include "pandabase.h" - -#include "physxForceFieldShape.h" -#include "physx_includes.h" - -class PhysxConvexForceFieldShapeDesc; - -/** - * A convex shaped region used to define force field. - */ -class EXPCL_PANDAPHYSX PhysxConvexForceFieldShape : public PhysxForceFieldShape { - -PUBLISHED: - INLINE PhysxConvexForceFieldShape(); - INLINE ~PhysxConvexForceFieldShape(); - - void save_to_desc(PhysxConvexForceFieldShapeDesc &shapeDesc) const; - -public: - INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; }; - - void link(NxForceFieldShape *shapePtr); - void unlink(); - -private: - NxConvexForceFieldShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxForceFieldShape::init_type(); - register_type(_type_handle, "PhysxConvexForceFieldShape", - PhysxForceFieldShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxConvexForceFieldShape.I" - -#endif // PHYSXCONVEXFORCEFIELDSHAPE_H diff --git a/panda/src/physx/physxConvexForceFieldShapeDesc.I b/panda/src/physx/physxConvexForceFieldShapeDesc.I deleted file mode 100644 index 3396efada6..0000000000 --- a/panda/src/physx/physxConvexForceFieldShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexForceFieldShapeDesc.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxConvexForceFieldShapeDesc:: -PhysxConvexForceFieldShapeDesc() : PhysxForceFieldShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxConvexForceFieldShapeDesc:: -~PhysxConvexForceFieldShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxConvexForceFieldShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxConvexForceFieldShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxConvexForceFieldShapeDesc.cxx b/panda/src/physx/physxConvexForceFieldShapeDesc.cxx deleted file mode 100644 index d6f47f1507..0000000000 --- a/panda/src/physx/physxConvexForceFieldShapeDesc.cxx +++ /dev/null @@ -1,24 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexForceFieldShapeDesc.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxConvexForceFieldShapeDesc.h" -#include "physxConvexMesh.h" - -/** - * Sets the convex mesh for this force field shape. - */ -void PhysxConvexForceFieldShapeDesc:: -set_mesh(PhysxConvexMesh *mesh) { - - _desc.meshData = mesh->ptr(); -} diff --git a/panda/src/physx/physxConvexForceFieldShapeDesc.h b/panda/src/physx/physxConvexForceFieldShapeDesc.h deleted file mode 100644 index 5a42a4b95b..0000000000 --- a/panda/src/physx/physxConvexForceFieldShapeDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexForceFieldShapeDesc.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXCONVEXFORCEFIELDSHAPEDESC_H -#define PHYSXCONVEXFORCEFIELDSHAPEDESC_H - -#include "pandabase.h" - -#include "physxForceFieldShapeDesc.h" -#include "physx_includes.h" - -class PhysxConvexMesh; - -/** - * A descriptor for a convex force field shape. - */ -class EXPCL_PANDAPHYSX PhysxConvexForceFieldShapeDesc : public PhysxForceFieldShapeDesc { - -PUBLISHED: - INLINE PhysxConvexForceFieldShapeDesc(); - INLINE ~PhysxConvexForceFieldShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_mesh(PhysxConvexMesh *mesh); - -public: - NxForceFieldShapeDesc *ptr() const { return (NxForceFieldShapeDesc *)&_desc; }; - NxConvexForceFieldShapeDesc _desc; -}; - -#include "physxConvexForceFieldShapeDesc.I" - -#endif // PHYSXCONVEXFORCEFIELDSHAPEDESC_H diff --git a/panda/src/physx/physxConvexMesh.I b/panda/src/physx/physxConvexMesh.I deleted file mode 100644 index c97e48ce32..0000000000 --- a/panda/src/physx/physxConvexMesh.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexMesh.I - * @author enn0x - * @date 2009-10-13 - */ - -/** - * - */ -INLINE PhysxConvexMesh:: -PhysxConvexMesh() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxConvexMesh:: -~PhysxConvexMesh() { - -} - -/** - * - */ -INLINE void PhysxConvexMesh:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxConvexMesh:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxConvexMesh.cxx b/panda/src/physx/physxConvexMesh.cxx deleted file mode 100644 index f703533856..0000000000 --- a/panda/src/physx/physxConvexMesh.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexMesh.cxx - * @author enn0x - * @date 2009-10-13 - */ - -#include "physxConvexMesh.h" -#include "physxMeshPool.h" - -TypeHandle PhysxConvexMesh::_type_handle; - -/** - * - */ -void PhysxConvexMesh:: -link(NxConvexMesh *meshPtr) { - - // Link self - PhysxManager::get_global_ptr()->_convex_meshes.add(this); - _ptr = meshPtr; - _error_type = ET_ok; -} - -/** - * - */ -void PhysxConvexMesh:: -unlink() { - - // Unlink self - _error_type = ET_released; - PhysxManager::get_global_ptr()->_convex_meshes.remove(this); -} - -/** - * - */ -void PhysxConvexMesh:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxGetPhysicsSDK()->releaseConvexMesh(*_ptr); - _ptr = nullptr; - - PhysxMeshPool::release_convex_mesh(this); -} - -/** - * Returns the reference count for shared meshes. - */ -unsigned int PhysxConvexMesh:: -get_reference_count() const { - - nassertr(_error_type == ET_ok, 0); - - return _ptr->getReferenceCount(); -} diff --git a/panda/src/physx/physxConvexMesh.h b/panda/src/physx/physxConvexMesh.h deleted file mode 100644 index 17f8fcd9cf..0000000000 --- a/panda/src/physx/physxConvexMesh.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexMesh.h - * @author enn0x - * @date 2009-10-13 - */ - -#ifndef PHYSXCONVEXMESH_H -#define PHYSXCONVEXMESH_H - -#include "pandabase.h" - -#include "physxObject.h" -#include "physx_includes.h" - -/** - * A Convex Mesh. Internally represented as a list of convex polygons. The - * number of polygons is limited to 256. - */ -class EXPCL_PANDAPHYSX PhysxConvexMesh : public PhysxObject { - -PUBLISHED: - unsigned int get_reference_count() const; - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE PhysxConvexMesh(); - INLINE ~PhysxConvexMesh(); - - INLINE NxConvexMesh *ptr() const { return _ptr; }; - - void link(NxConvexMesh *meshPtr); - void unlink(); - -private: - NxConvexMesh *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxConvexMesh", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxConvexMesh.I" - -#endif // PHYSXCONVEXMESH_H diff --git a/panda/src/physx/physxConvexMeshDesc.I b/panda/src/physx/physxConvexMeshDesc.I deleted file mode 100644 index 1611726ecb..0000000000 --- a/panda/src/physx/physxConvexMeshDesc.I +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexMeshDesc.I - * @author enn0x - * @date 2009-10-11 - */ - -/** - * - */ -INLINE PhysxConvexMeshDesc:: -PhysxConvexMeshDesc() { - - _desc.flags = NX_CF_COMPUTE_CONVEX; - _desc.pointStrideBytes = sizeof(NxVec3); - _desc.points = nullptr; - - _vertices = nullptr; -} - -/** - * - */ -INLINE PhysxConvexMeshDesc:: -~PhysxConvexMeshDesc() { - - if (_vertices) { - delete [] _vertices; - } -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxConvexMeshDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxConvexMeshDesc.cxx b/panda/src/physx/physxConvexMeshDesc.cxx deleted file mode 100644 index 0e0cd09f6b..0000000000 --- a/panda/src/physx/physxConvexMeshDesc.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexMeshDesc.cxx - * @author enn0x - * @date 2009-10-11 - */ - -#include "physxConvexMeshDesc.h" -#include "physxManager.h" - -#include "nodePathCollection.h" -#include "geomNode.h" -#include "geomVertexReader.h" - -/** - * Sets the number of vertices to be stored within this convex mesh. The - * function allocates memory for the vertices, but it does not set any - * vertices. - * - * This method must be called before any calls to set_vertex are done! - * - * The number of vertices in a single convex mesh has to be smaller than 256. - */ -void PhysxConvexMeshDesc:: -set_num_vertices(unsigned int numVertices) { - - nassertv_always(numVertices < 256); - - if (_desc.points) { - delete [] _vertices; - } - - _vertices = new NxVec3[numVertices]; - - _desc.numVertices = numVertices; - _desc.points = _vertices; -} - -/** - * Sets a single vertex. You have to call the function set_num_vertices - * before you can call this function. - */ -void PhysxConvexMeshDesc:: -set_vertex(unsigned int idx, const LPoint3f &vert) { - - nassertv(_desc.numVertices > idx); - _vertices[idx] = PhysxManager::point3_to_nxVec3(vert); -} - -/** - * - */ -const NxConvexMeshDesc &PhysxConvexMeshDesc:: -get_desc() const { - - return _desc; -} - -/** - * A convenience method to set the mesh data from a NodePath in a single call. - * The method iterates over the NodePath geoms and collects data for the - * convex mesh. - * - * Do not use the following function when using this one: - set_num_vertices - - * set_vertex - */ -void PhysxConvexMeshDesc:: -set_from_node_path(const NodePath &np) { - - pvector dataVertices; - - // Collect data from NodePath - NodePathCollection npc = np.find_all_matches( "**/+GeomNode" ); - for (int i=0; iget_num_geoms(); j++) { - CPT(Geom) geom = gnode->get_geom(j); - CPT(GeomVertexData) vdata = geom->get_vertex_data(); - GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex()); - - while (!reader.is_at_end()) { - dataVertices.push_back(reader.get_data3f()); - } - } - } - - // Set descriptor members - int i; - - NxU32 numVertices = dataVertices.size(); - - _vertices = new NxVec3[numVertices]; - - i = 0; - pvector::const_iterator it; - for (it=dataVertices.begin(); it!=dataVertices.end(); it++) { - LPoint3f v = *it; - - _vertices[i].x = v.get_x(); - _vertices[i].y = v.get_y(); - _vertices[i].z = v.get_z(); - i++; - } - - _desc.numVertices = numVertices; - _desc.points = _vertices; -} diff --git a/panda/src/physx/physxConvexMeshDesc.h b/panda/src/physx/physxConvexMeshDesc.h deleted file mode 100644 index c1f62be8ba..0000000000 --- a/panda/src/physx/physxConvexMeshDesc.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexMeshDesc.h - * @author enn0x - * @date 2009-10-11 - */ - -#ifndef PHYSXCONVEXMESHDESC_H -#define PHYSXCONVEXMESHDESC_H - -#include "pandabase.h" -#include "luse.h" -#include "nodePath.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxConvexMeshDesc { - -PUBLISHED: - INLINE PhysxConvexMeshDesc(); - INLINE ~PhysxConvexMeshDesc(); - - INLINE bool is_valid() const; - - void set_num_vertices(unsigned int n); - void set_vertex(unsigned int idx, const LPoint3f &vert); - void set_from_node_path(const NodePath &np); - -public: - const NxConvexMeshDesc &get_desc() const; - -private: - NxVec3 *_vertices; - NxConvexMeshDesc _desc; -}; - -#include "physxConvexMeshDesc.I" - -#endif // PHYSXCONVEXMESHDESC_H diff --git a/panda/src/physx/physxConvexShape.I b/panda/src/physx/physxConvexShape.I deleted file mode 100644 index 1540cbb7da..0000000000 --- a/panda/src/physx/physxConvexShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexShape.I - * @author enn0x - * @date 2009-10-14 - */ - -/** - * - */ -INLINE PhysxConvexShape:: -PhysxConvexShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxConvexShape:: -~PhysxConvexShape() { - -} diff --git a/panda/src/physx/physxConvexShape.cxx b/panda/src/physx/physxConvexShape.cxx deleted file mode 100644 index 73acc06b87..0000000000 --- a/panda/src/physx/physxConvexShape.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexShape.cxx - * @author enn0x - * @date 2009-10-14 - */ - -#include "physxConvexShape.h" -#include "physxConvexShapeDesc.h" - -TypeHandle PhysxConvexShape::_type_handle; - -/** - * - */ -void PhysxConvexShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isConvexMesh(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxConvexShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxConvexShape:: -save_to_desc(PhysxConvexShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} diff --git a/panda/src/physx/physxConvexShape.h b/panda/src/physx/physxConvexShape.h deleted file mode 100644 index 8ff196ae68..0000000000 --- a/panda/src/physx/physxConvexShape.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexShape.h - * @author enn0x - * @date 2009-10-14 - */ - -#ifndef PHYSXCONVEXSHAPE_H -#define PHYSXCONVEXSHAPE_H - -#include "pandabase.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxConvexShapeDesc; - -/** - * A shapes which is used to represent an instance of an convex mesh. - */ -class EXPCL_PANDAPHYSX PhysxConvexShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxConvexShape(); - INLINE ~PhysxConvexShape(); - - void save_to_desc(PhysxConvexShapeDesc &shapeDesc) const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxConvexShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxConvexShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxConvexShape.I" - -#endif // PHYSXCONVEXSHAPE_H diff --git a/panda/src/physx/physxConvexShapeDesc.I b/panda/src/physx/physxConvexShapeDesc.I deleted file mode 100644 index 60e025a3b6..0000000000 --- a/panda/src/physx/physxConvexShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexShapeDesc.I - * @author enn0x - * @date 2009-10-14 - */ - -/** - * - */ -INLINE PhysxConvexShapeDesc:: -PhysxConvexShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxConvexShapeDesc:: -~PhysxConvexShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxConvexShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxConvexShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxConvexShapeDesc.cxx b/panda/src/physx/physxConvexShapeDesc.cxx deleted file mode 100644 index 89b4d0b9b5..0000000000 --- a/panda/src/physx/physxConvexShapeDesc.cxx +++ /dev/null @@ -1,24 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexShapeDesc.cxx - * @author enn0x - * @date 2009-10-14 - */ - -#include "physxConvexShapeDesc.h" -#include "physxConvexMesh.h" - -/** - * - */ -void PhysxConvexShapeDesc:: -set_mesh(PhysxConvexMesh *mesh) { - - _desc.meshData = mesh->ptr(); -} diff --git a/panda/src/physx/physxConvexShapeDesc.h b/panda/src/physx/physxConvexShapeDesc.h deleted file mode 100644 index 456bcdce4b..0000000000 --- a/panda/src/physx/physxConvexShapeDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxConvexShapeDesc.h - * @author enn0x - * @date 2009-10-14 - */ - -#ifndef PHYSXCONVEXSHAPEDESC_H -#define PHYSXCONVEXSHAPEDESC_H - -#include "pandabase.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -class PhysxConvexMesh; - -/** - * Descriptor class for PhysxConvexShape. - */ -class EXPCL_PANDAPHYSX PhysxConvexShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxConvexShapeDesc(); - INLINE ~PhysxConvexShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_mesh(PhysxConvexMesh *mesh); - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxConvexShapeDesc _desc; -}; - -#include "physxConvexShapeDesc.I" - -#endif // PHYSXCONVEXSHAPEDESC_H diff --git a/panda/src/physx/physxCylindricalJoint.I b/panda/src/physx/physxCylindricalJoint.I deleted file mode 100644 index 92f5e58f3e..0000000000 --- a/panda/src/physx/physxCylindricalJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCylindricalJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxCylindricalJoint:: -PhysxCylindricalJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxCylindricalJoint:: -~PhysxCylindricalJoint() { - -} diff --git a/panda/src/physx/physxCylindricalJoint.cxx b/panda/src/physx/physxCylindricalJoint.cxx deleted file mode 100644 index 037668db54..0000000000 --- a/panda/src/physx/physxCylindricalJoint.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCylindricalJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxCylindricalJoint.h" -#include "physxCylindricalJointDesc.h" - -TypeHandle PhysxCylindricalJoint::_type_handle; - -/** - * - */ -void PhysxCylindricalJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isCylindricalJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxCylindricalJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxCylindricalJoint:: -save_to_desc(PhysxCylindricalJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxCylindricalJoint:: -load_from_desc(const PhysxCylindricalJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} diff --git a/panda/src/physx/physxCylindricalJoint.h b/panda/src/physx/physxCylindricalJoint.h deleted file mode 100644 index a7b4cbc2a4..0000000000 --- a/panda/src/physx/physxCylindricalJoint.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCylindricalJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXCYLINDRICALJOINT_H -#define PHYSXCYLINDRICALJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxCylindricalJointDesc; - -/** - * Cylindrical Joints permit relative translational movement between two - * bodies along an axis, and also relative rotation along the axis. - */ -class EXPCL_PANDAPHYSX PhysxCylindricalJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxCylindricalJoint(); - INLINE ~PhysxCylindricalJoint(); - - void save_to_desc(PhysxCylindricalJointDesc &jointDesc) const; - void load_from_desc(const PhysxCylindricalJointDesc &jointDesc); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxCylindricalJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxCylindricalJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxCylindricalJoint.I" - -#endif // PHYSXCYLINDRICALJOINT_H diff --git a/panda/src/physx/physxCylindricalJointDesc.I b/panda/src/physx/physxCylindricalJointDesc.I deleted file mode 100644 index 1fd4d9eb9b..0000000000 --- a/panda/src/physx/physxCylindricalJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCylindricalJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxCylindricalJointDesc:: -PhysxCylindricalJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxCylindricalJointDesc:: -~PhysxCylindricalJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxCylindricalJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxCylindricalJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxCylindricalJointDesc.cxx b/panda/src/physx/physxCylindricalJointDesc.cxx deleted file mode 100644 index 699f3858c6..0000000000 --- a/panda/src/physx/physxCylindricalJointDesc.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCylindricalJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxCylindricalJointDesc.h" diff --git a/panda/src/physx/physxCylindricalJointDesc.h b/panda/src/physx/physxCylindricalJointDesc.h deleted file mode 100644 index 9c382b90d3..0000000000 --- a/panda/src/physx/physxCylindricalJointDesc.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxCylindricalJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXCYLINDRICALJOINTDESC_H -#define PHYSXCYLINDRICALJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for sliding joint. See PhysxCylindricalJoint. - */ -class EXPCL_PANDAPHYSX PhysxCylindricalJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxCylindricalJointDesc(); - INLINE ~PhysxCylindricalJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxCylindricalJointDesc _desc; -}; - -#include "physxCylindricalJointDesc.I" - -#endif // PHYSXCYLINDRICALJOINTDESC_H diff --git a/panda/src/physx/physxD6Joint.I b/panda/src/physx/physxD6Joint.I deleted file mode 100644 index 3306488395..0000000000 --- a/panda/src/physx/physxD6Joint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxD6Joint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxD6Joint:: -PhysxD6Joint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxD6Joint:: -~PhysxD6Joint() { - -} diff --git a/panda/src/physx/physxD6Joint.cxx b/panda/src/physx/physxD6Joint.cxx deleted file mode 100644 index a95abddcf5..0000000000 --- a/panda/src/physx/physxD6Joint.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxD6Joint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxD6Joint.h" -#include "physxD6JointDesc.h" - -TypeHandle PhysxD6Joint::_type_handle; - -/** - * - */ -void PhysxD6Joint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isD6Joint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxD6Joint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxD6Joint:: -save_to_desc(PhysxD6JointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxD6Joint:: -load_from_desc(const PhysxD6JointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} - -/** - * - */ -void PhysxD6Joint:: -set_drive_angular_velocity(const LVector3f &v) { - - nassertv(_error_type == ET_ok); - _ptr->setDriveAngularVelocity(PhysxManager::vec3_to_nxVec3(v)); -} - -/** - * - */ -void PhysxD6Joint:: -set_drive_linear_velocity(const LVector3f &v) { - - nassertv(_error_type == ET_ok); - _ptr->setDriveLinearVelocity(PhysxManager::vec3_to_nxVec3(v)); -} - -/** - * - */ -void PhysxD6Joint:: -set_drive_orientation(const LQuaternionf &quat) { - - nassertv(_error_type == ET_ok); - _ptr->setDriveOrientation(PhysxManager::quat_to_nxQuat(quat)); -} - -/** - * - */ -void PhysxD6Joint:: -set_drive_position(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - _ptr->setDrivePosition(PhysxManager::point3_to_nxVec3(pos)); -} diff --git a/panda/src/physx/physxD6Joint.h b/panda/src/physx/physxD6Joint.h deleted file mode 100644 index 56ad3ea24a..0000000000 --- a/panda/src/physx/physxD6Joint.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxD6Joint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXD6JOINT_H -#define PHYSXD6JOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxD6JointDesc; - -/** - * A D6 joint is a general constraint between two actors. It allows the user - * to individually define the linear and rotational degrees of freedom. It - * also allows the user to configure the joint with limits and driven degrees - * of freedom as they wish. - */ -class EXPCL_PANDAPHYSX PhysxD6Joint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxD6Joint(); - INLINE ~PhysxD6Joint(); - - void save_to_desc(PhysxD6JointDesc &jointDesc) const; - void load_from_desc(const PhysxD6JointDesc &jointDesc); - - void set_drive_angular_velocity(const LVector3f &v); - void set_drive_linear_velocity(const LVector3f &v); - void set_drive_orientation(const LQuaternionf &quat); - void set_drive_position(const LPoint3f &pos); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxD6Joint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxD6Joint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxD6Joint.I" - -#endif // PHYSXD6JOINT_H diff --git a/panda/src/physx/physxD6JointDesc.I b/panda/src/physx/physxD6JointDesc.I deleted file mode 100644 index fdcf297db3..0000000000 --- a/panda/src/physx/physxD6JointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxD6JointDesc.I - * @author enn0x - * @date 2009-10-01 - */ - -/** - * - */ -INLINE PhysxD6JointDesc:: -PhysxD6JointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxD6JointDesc:: -~PhysxD6JointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxD6JointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxD6JointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxD6JointDesc.cxx b/panda/src/physx/physxD6JointDesc.cxx deleted file mode 100644 index 74b10a70d5..0000000000 --- a/panda/src/physx/physxD6JointDesc.cxx +++ /dev/null @@ -1,515 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxD6JointDesc.cxx - * @author enn0x - * @date 2009-10-01 - */ - -#include "physxD6JointDesc.h" -#include "physxManager.h" -#include "physxJointDriveDesc.h" -#include "physxJointLimitSoftDesc.h" - -/** - * - */ -void PhysxD6JointDesc:: -set_x_motion(PhysxD6JointMotion xMotion) { - - _desc.xMotion = (NxD6JointMotion)xMotion; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_y_motion(PhysxD6JointMotion yMotion) { - - _desc.yMotion = (NxD6JointMotion)yMotion; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_z_motion(PhysxD6JointMotion zMotion) { - - _desc.zMotion = (NxD6JointMotion)zMotion; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_swing1_motion(PhysxD6JointMotion swing1Motion) { - - _desc.swing1Motion = (NxD6JointMotion)swing1Motion; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_swing2_motion(PhysxD6JointMotion swing2Motion) { - - _desc.swing2Motion = (NxD6JointMotion)swing2Motion; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_twist_motion(PhysxD6JointMotion twistMotion) { - - _desc.twistMotion = (NxD6JointMotion)twistMotion; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_x_drive(const PhysxJointDriveDesc &drive) { - - _desc.xDrive = drive._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_y_drive(const PhysxJointDriveDesc &drive) { - - _desc.yDrive = drive._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_z_drive(const PhysxJointDriveDesc &drive) { - - _desc.zDrive = drive._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_swing_drive(const PhysxJointDriveDesc &drive) { - - _desc.swingDrive = drive._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_twist_drive(const PhysxJointDriveDesc &drive) { - - _desc.twistDrive = drive._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_slerp_drive(const PhysxJointDriveDesc &drive) { - - _desc.slerpDrive = drive._desc; -} - -/** - * Sets or clears a single D6JointFlag flag. - */ -void PhysxD6JointDesc:: -set_flag(PhysxD6JointFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * - */ -void PhysxD6JointDesc:: -set_linear_limit(const PhysxJointLimitSoftDesc &limit) { - - _desc.linearLimit = limit._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_swing1_limit(const PhysxJointLimitSoftDesc &limit) { - - _desc.swing1Limit = limit._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_swing2_limit(const PhysxJointLimitSoftDesc &limit) { - - _desc.swing2Limit = limit._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_twist_limit_low(const PhysxJointLimitSoftDesc &limit) { - - _desc.twistLimit.low = limit._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_twist_limit_high(const PhysxJointLimitSoftDesc &limit) { - - _desc.twistLimit.high = limit._desc; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_projection_distance(float distance) { - - _desc.projectionDistance = distance; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_projection_angle(float angle) { - - _desc.projectionAngle = angle; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_gear_ratio(float ratio) { - - _desc.gearRatio = ratio; -} - -/** - * - */ -void PhysxD6JointDesc:: -set_drive_position(const LPoint3f &pos) { - - nassertv(!pos.is_nan()); - _desc.drivePosition = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * - */ -void PhysxD6JointDesc:: -set_drive_linear_velocity(const LVector3f &v) { - - nassertv(!v.is_nan()); - _desc.driveLinearVelocity = PhysxManager::vec3_to_nxVec3(v); -} - -/** - * - */ -void PhysxD6JointDesc:: -set_drive_angular_velocity(const LVector3f &v) { - - nassertv(!v.is_nan()); - _desc.driveAngularVelocity = PhysxManager::vec3_to_nxVec3(v); -} - -/** - * - */ -void PhysxD6JointDesc:: -set_drive_orientation(const LQuaternionf &quat) { - - _desc.driveOrientation = PhysxManager::quat_to_nxQuat(quat); -} - -/** - * Use this to enable joint projection. Default is PM_none. - */ -void PhysxD6JointDesc:: -set_projection_mode(PhysxProjectionMode mode) { - - _desc.projectionMode = (NxJointProjectionMode)mode; -} - -/** - * - */ -PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc:: -get_x_motion() const { - - return (PhysxD6JointMotion)_desc.xMotion; -} - -/** - * - */ -PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc:: -get_y_motion() const { - - return (PhysxD6JointMotion)_desc.yMotion; -} - -/** - * - */ -PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc:: -get_z_motion() const { - - return (PhysxD6JointMotion)_desc.zMotion; -} - -/** - * - */ -PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc:: -get_swing1_motion() const { - - return (PhysxD6JointMotion)_desc.swing1Motion; -} - -/** - * - */ -PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc:: -get_swing2_motion() const { - - return (PhysxD6JointMotion)_desc.swing2Motion; -} - -/** - * - */ -PhysxEnums::PhysxD6JointMotion PhysxD6JointDesc:: -get_twist_motion() const { - - return (PhysxD6JointMotion)_desc.twistMotion; -} - -/** - * - */ -PhysxJointDriveDesc PhysxD6JointDesc:: -get_x_drive() const { - - PhysxJointDriveDesc value; - value._desc = _desc.xDrive; - return value; -} - -/** - * - */ -PhysxJointDriveDesc PhysxD6JointDesc:: -get_y_drive() const { - - PhysxJointDriveDesc value; - value._desc = _desc.yDrive; - return value; -} - -/** - * - */ -PhysxJointDriveDesc PhysxD6JointDesc:: -get_z_drive() const { - - PhysxJointDriveDesc value; - value._desc = _desc.zDrive; - return value; -} - -/** - * - */ -PhysxJointDriveDesc PhysxD6JointDesc:: -get_swing_drive() const { - - PhysxJointDriveDesc value; - value._desc = _desc.swingDrive; - return value; -} - -/** - * - */ -PhysxJointDriveDesc PhysxD6JointDesc:: -get_twist_drive() const { - - PhysxJointDriveDesc value; - value._desc = _desc.twistDrive; - return value; -} - -/** - * - */ -PhysxJointDriveDesc PhysxD6JointDesc:: -get_slerp_drive() const { - - PhysxJointDriveDesc value; - value._desc = _desc.slerpDrive; - return value; -} - -/** - * - */ -bool PhysxD6JointDesc:: -get_flag(PhysxD6JointFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * - */ -PhysxJointLimitSoftDesc PhysxD6JointDesc:: -get_linear_limit() const { - - PhysxJointLimitSoftDesc value; - value._desc = _desc.linearLimit; - return value; -} - -/** - * - */ -PhysxJointLimitSoftDesc PhysxD6JointDesc:: -get_swing1_limit() const { - - PhysxJointLimitSoftDesc value; - value._desc = _desc.swing1Limit; - return value; -} - -/** - * - */ -PhysxJointLimitSoftDesc PhysxD6JointDesc:: -get_swing2_limit() const { - - PhysxJointLimitSoftDesc value; - value._desc = _desc.swing2Limit; - return value; -} - -/** - * - */ -PhysxJointLimitSoftDesc PhysxD6JointDesc:: -get_twist_limit_low() const { - - PhysxJointLimitSoftDesc value; - value._desc = _desc.twistLimit.low; - return value; -} - -/** - * - */ -PhysxJointLimitSoftDesc PhysxD6JointDesc:: -get_twist_limit_high() const { - - PhysxJointLimitSoftDesc value; - value._desc = _desc.twistLimit.high; - return value; -} - -/** - * - */ -float PhysxD6JointDesc:: -get_projection_distance() const { - - return _desc.projectionDistance; -} - -/** - * - */ -float PhysxD6JointDesc:: -get_projection_angle() const { - - return _desc.projectionAngle; -} - -/** - * - */ -float PhysxD6JointDesc:: -get_gear_ratio() const { - - return _desc.gearRatio; -} - -/** - * - */ -LPoint3f PhysxD6JointDesc:: -get_drive_position() const { - - return PhysxManager::nxVec3_to_point3(_desc.drivePosition); -} - -/** - * - */ -LVector3f PhysxD6JointDesc:: -get_drive_linear_velocity() const { - - return PhysxManager::nxVec3_to_vec3(_desc.driveLinearVelocity); -} - -/** - * - */ -LVector3f PhysxD6JointDesc:: -get_drive_angular_velocity() const { - - return PhysxManager::nxVec3_to_vec3(_desc.driveAngularVelocity); -} - -/** - * - */ -LQuaternionf PhysxD6JointDesc:: -get_drive_orientation() const { - - return PhysxManager::nxQuat_to_quat(_desc.driveOrientation); -} - -/** - * - */ -PhysxEnums::PhysxProjectionMode PhysxD6JointDesc:: -get_projection_mode() const { - - return (PhysxProjectionMode)_desc.projectionMode; -} diff --git a/panda/src/physx/physxD6JointDesc.h b/panda/src/physx/physxD6JointDesc.h deleted file mode 100644 index 9273aa5b51..0000000000 --- a/panda/src/physx/physxD6JointDesc.h +++ /dev/null @@ -1,99 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxD6JointDesc.h - * @author enn0x - * @date 2009-10-01 - */ - -#ifndef PHYSXD6JOINTDESC_H -#define PHYSXD6JOINTDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -class PhysxJointDriveDesc; -class PhysxJointLimitSoftDesc; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxD6JointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxD6JointDesc(); - INLINE ~PhysxD6JointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_flag(PhysxD6JointFlag flag, bool value); - void set_projection_distance(float distance); - void set_projection_angle(float angle); - void set_gear_ratio(float ratio); - void set_drive_position(const LPoint3f &pos); - void set_drive_linear_velocity(const LVector3f &v); - void set_drive_angular_velocity(const LVector3f &v); - void set_drive_orientation(const LQuaternionf &quat); - void set_projection_mode(PhysxProjectionMode mode); - void set_x_motion(PhysxD6JointMotion xMotion); - void set_y_motion(PhysxD6JointMotion yMotion); - void set_z_motion(PhysxD6JointMotion zMotion); - void set_swing1_motion(PhysxD6JointMotion xMotion); - void set_swing2_motion(PhysxD6JointMotion yMotion); - void set_twist_motion(PhysxD6JointMotion zMotion); - void set_x_drive(const PhysxJointDriveDesc &drive); - void set_y_drive(const PhysxJointDriveDesc &drive); - void set_z_drive(const PhysxJointDriveDesc &drive); - void set_swing_drive(const PhysxJointDriveDesc &drive); - void set_twist_drive(const PhysxJointDriveDesc &drive); - void set_slerp_drive(const PhysxJointDriveDesc &drive); - void set_linear_limit(const PhysxJointLimitSoftDesc &limit); - void set_swing1_limit(const PhysxJointLimitSoftDesc &limit); - void set_swing2_limit(const PhysxJointLimitSoftDesc &limit); - void set_twist_limit_low(const PhysxJointLimitSoftDesc &limit); - void set_twist_limit_high(const PhysxJointLimitSoftDesc &limit); - - bool get_flag(PhysxD6JointFlag flag) const; - float get_projection_distance() const; - float get_projection_angle() const; - float get_gear_ratio() const; - LPoint3f get_drive_position() const; - LVector3f get_drive_linear_velocity() const; - LVector3f get_drive_angular_velocity() const; - LQuaternionf get_drive_orientation() const; - PhysxProjectionMode get_projection_mode() const; - PhysxD6JointMotion get_x_motion() const; - PhysxD6JointMotion get_y_motion() const; - PhysxD6JointMotion get_z_motion() const; - PhysxD6JointMotion get_swing1_motion() const; - PhysxD6JointMotion get_swing2_motion() const; - PhysxD6JointMotion get_twist_motion() const; - PhysxJointDriveDesc get_x_drive() const; - PhysxJointDriveDesc get_y_drive() const; - PhysxJointDriveDesc get_z_drive() const; - PhysxJointDriveDesc get_swing_drive() const; - PhysxJointDriveDesc get_twist_drive() const; - PhysxJointDriveDesc get_slerp_drive() const; - PhysxJointLimitSoftDesc get_linear_limit() const; - PhysxJointLimitSoftDesc get_swing1_limit() const; - PhysxJointLimitSoftDesc get_swing2_limit() const; - PhysxJointLimitSoftDesc get_twist_limit_low() const; - PhysxJointLimitSoftDesc get_twist_limit_high() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxD6JointDesc _desc; -}; - -#include "physxD6JointDesc.I" - -#endif // PHYSXD6JOINTDESC_H diff --git a/panda/src/physx/physxDebugGeomNode.I b/panda/src/physx/physxDebugGeomNode.I deleted file mode 100644 index 699d7b550a..0000000000 --- a/panda/src/physx/physxDebugGeomNode.I +++ /dev/null @@ -1,337 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDebugGeomNode.I - * @author enn0x - * @date 2009-09-15 - */ - -/** - * - */ -INLINE PhysxDebugGeomNode:: -PhysxDebugGeomNode() : GeomNode("debug") { - - _scale = 1.0f; - - _vdata = new GeomVertexData("", GeomVertexFormat::get_v3c4(), Geom::UH_stream); - - // Lines - _prim_lines = new GeomLines(Geom::UH_stream); - _prim_lines->set_shade_model(Geom::SM_uniform); - - _geom_lines = new Geom(_vdata); - _geom_lines->add_primitive(_prim_lines); - - this->add_geom(_geom_lines); - - // Triangles - _prim_triangles = new GeomTriangles(Geom::UH_stream); - _prim_triangles->set_shade_model(Geom::SM_uniform); - - _geom_triangles = new Geom(_vdata); - _geom_triangles->add_primitive(_prim_triangles); - - this->add_geom(_geom_triangles); -} - -/** - * - */ -INLINE PhysxDebugGeomNode:: -~PhysxDebugGeomNode() { - -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_world_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_WORLD_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_body_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_BODY_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_body_mass_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_BODY_MASS_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_body_lin_velocity(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_BODY_LIN_VELOCITY, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_body_ang_velocity(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_BODY_ANG_VELOCITY, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_body_joint_groups(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_BODY_JOINT_GROUPS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_joint_local_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_JOINT_LOCAL_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_joint_world_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_JOINT_WORLD_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_joint_limits(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_JOINT_LIMITS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_contact_point(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_CONTACT_POINT, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_contact_normal(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_CONTACT_NORMAL, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_contact_error(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_CONTACT_ERROR, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_contact_force(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_CONTACT_FORCE, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_actor_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_ACTOR_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_aabbs(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_AABBS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_shapes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_SHAPES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_axes(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_AXES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_compounds(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_COMPOUNDS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_vnormals(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_VNORMALS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_fnormals(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_FNORMALS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_edges(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_EDGES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_spheres(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_SPHERES, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_static(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_STATIC, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_dynamic(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_DYNAMIC, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_free(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_FREE, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_ccd(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_CCD, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_collision_skeletons(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_COLLISION_SKELETONS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_cloth_mesh(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_CLOTH_MESH, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_cloth_validbounds(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_CLOTH_VALIDBOUNDS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_softbody_mesh(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_SOFTBODY_MESH, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_softbody_validbounds(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_SOFTBODY_VALIDBOUNDS, value); -} - -/** - * - */ -INLINE void PhysxDebugGeomNode:: -visualize_force_fields(bool value) { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZE_FORCE_FIELDS, value); -} diff --git a/panda/src/physx/physxDebugGeomNode.cxx b/panda/src/physx/physxDebugGeomNode.cxx deleted file mode 100644 index a2684b0ea6..0000000000 --- a/panda/src/physx/physxDebugGeomNode.cxx +++ /dev/null @@ -1,138 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDebugGeomNode.cxx - * @author enn0x - * @date 2009-09-15 - */ - -#include "physxDebugGeomNode.h" - -#include "geomVertexFormat.h" -#include "geomVertexWriter.h" - -TypeHandle PhysxDebugGeomNode::_type_handle; - -/** - * - */ -void PhysxDebugGeomNode:: -update(NxScene *scenePtr) { - - if (get_num_parents() == 0) { - return; - } - - const NxDebugRenderable *renderable = scenePtr->getDebugRenderable(); - if (!renderable) { - remove_all_geoms(); - physx_cat.warning() << "Could no get debug renderable." << std::endl; - return; - } - - GeomVertexWriter vwriter = GeomVertexWriter(_vdata, InternalName::get_vertex()); - GeomVertexWriter cwriter = GeomVertexWriter(_vdata, InternalName::get_color()); - - int v = 0; - - _prim_lines->clear_vertices(); - _prim_triangles->clear_vertices(); - - // Lines - { - NxU32 n = renderable->getNbLines(); - const NxDebugLine *lines = renderable->getLines(); - - for (NxU32 i=0; i>8)&0xff) / 255.0f; - NxF32 r = NxF32((lines[i].color>>16)&0xff) / 255.0f; - - NxVec3 p0 = lines[i].p0; - NxVec3 p1 = lines[i].p1; - - cwriter.add_data4f(r, g, b, 1.0f); - vwriter.add_data3f(p0.x, p0.y, p0.z); - _prim_lines->add_vertex(v++); - - cwriter.add_data4f(r, g, b, 1.0f); - vwriter.add_data3f(p1.x, p1.y, p1.z); - _prim_lines->add_vertex(v++); - } - - } - - // Triangles - { - NxU32 n = renderable->getNbTriangles(); - const NxDebugTriangle *triangles = renderable->getTriangles(); - - for (NxU32 i=0; i>8)&0xff) / 255.0f; - NxF32 r = NxF32((triangles[i].color>>16)&0xff) / 255.0f; - - NxVec3 p0 = triangles[i].p0; - NxVec3 p1 = triangles[i].p1; - NxVec3 p2 = triangles[i].p2; - - cwriter.add_data4f(r, g, b, 1.0f); - vwriter.add_data3f(p0.x, p0.y, p0.z); - _prim_triangles->add_vertex(v++); - - cwriter.add_data4f(r, g, b, 1.0f); - vwriter.add_data3f(p1.x, p1.y, p1.z); - _prim_triangles->add_vertex(v++); - - cwriter.add_data4f(r, g, b, 1.0f); - vwriter.add_data3f(p2.x, p2.y, p2.z); - _prim_triangles->add_vertex(v++); - } - } - - _prim_lines->close_primitive(); - _prim_triangles->close_primitive(); - - if (physx_cat.is_spam()) { - physx_cat.spam() << "Updated PhysxDebugGeomNode geometry\n"; - } -} - -/** - * - */ -void PhysxDebugGeomNode:: -on() { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZATION_SCALE, _scale); -} - -/** - * - */ -void PhysxDebugGeomNode:: -off() { - - NxGetPhysicsSDK()->setParameter(NX_VISUALIZATION_SCALE, 0.0f); -} - -/** - * - */ -void PhysxDebugGeomNode:: -toggle() { - - if (NxGetPhysicsSDK()->getParameter(NX_VISUALIZATION_SCALE) == 0.0f) { - on(); - } - else { - off(); - } -} diff --git a/panda/src/physx/physxDebugGeomNode.h b/panda/src/physx/physxDebugGeomNode.h deleted file mode 100644 index b3c2d67a18..0000000000 --- a/panda/src/physx/physxDebugGeomNode.h +++ /dev/null @@ -1,112 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDebugGeomNode.h - * @author enn0x - * @date 2009-09-15 - */ - -#ifndef PHYSXDEBUGGEOMNODE_H -#define PHYSXDEBUGGEOMNODE_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "geomNode.h" -#include "transformState.h" -#include "geom.h" -#include "geomVertexData.h" -#include "geomLines.h" -#include "geomTriangles.h" - -#include "physx_includes.h" - -class PhysxScene; - -/** - * Renderable geometry which represents visualizations of physics objects. - * Intended to help with debugging code. - */ -class EXPCL_PANDAPHYSX PhysxDebugGeomNode : public GeomNode { - -PUBLISHED: - INLINE PhysxDebugGeomNode(); - INLINE ~PhysxDebugGeomNode(); - - void on(); - void off(); - void toggle(); - - INLINE void visualize_world_axes(bool value); - INLINE void visualize_body_axes(bool value); - INLINE void visualize_body_mass_axes(bool value); - INLINE void visualize_body_lin_velocity(bool value); - INLINE void visualize_body_ang_velocity(bool value); - INLINE void visualize_body_joint_groups(bool value); - INLINE void visualize_joint_local_axes(bool value); - INLINE void visualize_joint_world_axes(bool value); - INLINE void visualize_joint_limits(bool value); - INLINE void visualize_contact_point(bool value); - INLINE void visualize_contact_normal(bool value); - INLINE void visualize_contact_error(bool value); - INLINE void visualize_contact_force(bool value); - INLINE void visualize_actor_axes(bool value); - INLINE void visualize_collision_aabbs(bool value); - INLINE void visualize_collision_shapes(bool value); - INLINE void visualize_collision_axes(bool value); - INLINE void visualize_collision_compounds(bool value); - INLINE void visualize_collision_vnormals(bool value); - INLINE void visualize_collision_fnormals(bool value); - INLINE void visualize_collision_edges(bool value); - INLINE void visualize_collision_spheres(bool value); - INLINE void visualize_collision_static(bool value); - INLINE void visualize_collision_dynamic(bool value); - INLINE void visualize_collision_free(bool value); - INLINE void visualize_collision_ccd(bool value); - INLINE void visualize_collision_skeletons(bool value); - INLINE void visualize_cloth_mesh(bool value); - INLINE void visualize_cloth_validbounds(bool value); - INLINE void visualize_softbody_mesh(bool value); - INLINE void visualize_softbody_validbounds(bool value); - INLINE void visualize_force_fields(bool value); - -public: - void update(NxScene *scenePtr); - -private: - float _scale; - - PT(GeomVertexData) _vdata; - PT(Geom) _geom_lines; - PT(GeomLines) _prim_lines; - PT(Geom) _geom_triangles; - PT(GeomTriangles) _prim_triangles; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - GeomNode::init_type(); - register_type(_type_handle, "PhysxDebugGeomNode", - GeomNode::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxDebugGeomNode.I" - -#endif // PHYSXDEBUGGEOMNODE_H diff --git a/panda/src/physx/physxDistanceJoint.I b/panda/src/physx/physxDistanceJoint.I deleted file mode 100644 index dbc414413b..0000000000 --- a/panda/src/physx/physxDistanceJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDistanceJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxDistanceJoint:: -PhysxDistanceJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxDistanceJoint:: -~PhysxDistanceJoint() { - -} diff --git a/panda/src/physx/physxDistanceJoint.cxx b/panda/src/physx/physxDistanceJoint.cxx deleted file mode 100644 index f24baa7c87..0000000000 --- a/panda/src/physx/physxDistanceJoint.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDistanceJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxDistanceJoint.h" -#include "physxDistanceJointDesc.h" - -TypeHandle PhysxDistanceJoint::_type_handle; - -/** - * - */ -void PhysxDistanceJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isDistanceJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxDistanceJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxDistanceJoint:: -save_to_desc(PhysxDistanceJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxDistanceJoint:: -load_from_desc(const PhysxDistanceJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} diff --git a/panda/src/physx/physxDistanceJoint.h b/panda/src/physx/physxDistanceJoint.h deleted file mode 100644 index a3be65fb03..0000000000 --- a/panda/src/physx/physxDistanceJoint.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDistanceJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXDISTANCEJOINT_H -#define PHYSXDISTANCEJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxDistanceJointDesc; - -/** - * A distance joint maintains a certain distance between two points on two - * actors. - */ -class EXPCL_PANDAPHYSX PhysxDistanceJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxDistanceJoint(); - INLINE ~PhysxDistanceJoint(); - - void save_to_desc(PhysxDistanceJointDesc &jointDesc) const; - void load_from_desc(const PhysxDistanceJointDesc &jointDesc); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxDistanceJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxDistanceJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxDistanceJoint.I" - -#endif // PHYSXDISTANCEJOINT_H diff --git a/panda/src/physx/physxDistanceJointDesc.I b/panda/src/physx/physxDistanceJointDesc.I deleted file mode 100644 index 1fb6570661..0000000000 --- a/panda/src/physx/physxDistanceJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDistanceJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxDistanceJointDesc:: -PhysxDistanceJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxDistanceJointDesc:: -~PhysxDistanceJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxDistanceJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxDistanceJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxDistanceJointDesc.cxx b/panda/src/physx/physxDistanceJointDesc.cxx deleted file mode 100644 index 657dfa2347..0000000000 --- a/panda/src/physx/physxDistanceJointDesc.cxx +++ /dev/null @@ -1,96 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDistanceJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxDistanceJointDesc.h" -#include "physxSpringDesc.h" - -/** - * Sets the maximum rest length of the rope or rod between the two anchor - * points. - */ -void PhysxDistanceJointDesc:: -set_max_distance(float distance) { - - _desc.maxDistance = distance; -} - -/** - * Sets the minimum rest length of the rope or rod between the two anchor - * points - */ -void PhysxDistanceJointDesc:: -set_min_distance(float distance) { - - _desc.minDistance = distance; -} - -/** - * Makes the joint springy. The spring.targetValue is not used. - */ -void PhysxDistanceJointDesc:: -set_spring(const PhysxSpringDesc &spring) { - - _desc.spring = spring._desc; -} - -/** - * Sets or clears a single DistanceJointFlag flag. - */ -void PhysxDistanceJointDesc:: -set_flag(PhysxDistanceJointFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * - */ -float PhysxDistanceJointDesc:: -get_max_distance() const { - - return _desc.maxDistance; -} - -/** - * - */ -float PhysxDistanceJointDesc:: -get_min_distance() const { - - return _desc.minDistance; -} - -/** - * - */ -PhysxSpringDesc PhysxDistanceJointDesc:: -get_spring() const { - - PhysxSpringDesc value; - value._desc = _desc.spring; - return value; -} - -/** - * Return a single DistanceJointFlag flag. - */ -bool PhysxDistanceJointDesc:: -get_flag(PhysxDistanceJointFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} diff --git a/panda/src/physx/physxDistanceJointDesc.h b/panda/src/physx/physxDistanceJointDesc.h deleted file mode 100644 index 6d74797a56..0000000000 --- a/panda/src/physx/physxDistanceJointDesc.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxDistanceJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXDISTANCEJOINTDESC_H -#define PHYSXDISTANCEJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -class PhysxSpringDesc; - -/** - * Descriptor class for distance joint. See PhysxDistanceJoint. - */ -class EXPCL_PANDAPHYSX PhysxDistanceJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxDistanceJointDesc(); - INLINE ~PhysxDistanceJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_max_distance(float distance); - void set_min_distance(float distance); - void set_spring(const PhysxSpringDesc &spring); - void set_flag(PhysxDistanceJointFlag flag, bool value); - - float get_max_distance() const; - float get_min_distance() const; - bool get_flag(PhysxDistanceJointFlag flag) const; - PhysxSpringDesc get_spring() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxDistanceJointDesc _desc; -}; - -#include "physxDistanceJointDesc.I" - -#endif // PHYSXDISTANCEJOINTDESC_H diff --git a/panda/src/physx/physxEnums.cxx b/panda/src/physx/physxEnums.cxx deleted file mode 100644 index 87a0222bc3..0000000000 --- a/panda/src/physx/physxEnums.cxx +++ /dev/null @@ -1,58 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxEnums.cxx - * @author enn0x - * @date 2009-09-23 - */ - -#include "physxEnums.h" - -#include "string_utils.h" -#include "config_putil.h" - -std::ostream & -operator << (std::ostream &out, PhysxEnums::PhysxUpAxis axis) { - - switch (axis) { - case PhysxEnums::X_up: - return out << "x"; - - case PhysxEnums::Y_up: - return out << "y"; - - case PhysxEnums::Z_up: - return out << "z"; - } - - return out << "**invalid PhysxEnums::PhysxUpAxis value: (" << (int)axis << ")**"; -} - -std::istream & -operator >> (std::istream &in, PhysxEnums::PhysxUpAxis &axis) { - - std::string word; - in >> word; - - if (cmp_nocase(word, "x") == 0) { - axis = PhysxEnums::X_up; - } - else if (cmp_nocase(word, "y") == 0) { - axis = PhysxEnums::Y_up; - } - else if (cmp_nocase(word, "z") == 0) { - axis = PhysxEnums::Z_up; - } - else { - physx_cat->error() - << "Invalid up-axis string: " << word << "\n"; - axis = PhysxEnums::Z_up; - } - - return in; -} diff --git a/panda/src/physx/physxEnums.h b/panda/src/physx/physxEnums.h deleted file mode 100644 index 313cb677b2..0000000000 --- a/panda/src/physx/physxEnums.h +++ /dev/null @@ -1,720 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxEnums.h - * @author enn0x - * @date 2009-09-23 - */ - -#ifndef PHYSXENUMS_H -#define PHYSXENUMS_H - -#include "pandabase.h" - -#include "physx_includes.h" - -#ifdef CPPPARSER - -// PhysxParameter -#define NX_PENALTY_FORCE 0 -#define NX_SKIN_WIDTH 1 -#define NX_DEFAULT_SLEEP_LIN_VEL_SQUARED 2 -#define NX_DEFAULT_SLEEP_ANG_VEL_SQUARED 3 -#define NX_BOUNCE_THRESHOLD 4 -#define NX_DYN_FRICT_SCALING 5 -#define NX_STA_FRICT_SCALING 6 -#define NX_MAX_ANGULAR_VELOCITY 7 -#define NX_CONTINUOUS_CD 8 -#define NX_VISUALIZATION_SCALE 9 -#define NX_VISUALIZE_WORLD_AXES 10 -#define NX_VISUALIZE_BODY_AXES 11 -#define NX_VISUALIZE_BODY_MASS_AXES 12 -#define NX_VISUALIZE_BODY_LIN_VELOCITY 13 -#define NX_VISUALIZE_BODY_ANG_VELOCITY 14 -#define NX_VISUALIZE_BODY_JOINT_GROUPS 22 -#define NX_VISUALIZE_JOINT_LOCAL_AXES 27 -#define NX_VISUALIZE_JOINT_WORLD_AXES 28 -#define NX_VISUALIZE_JOINT_LIMITS 29 -#define NX_VISUALIZE_CONTACT_POINT 33 -#define NX_VISUALIZE_CONTACT_NORMAL 34 -#define NX_VISUALIZE_CONTACT_ERROR 35 -#define NX_VISUALIZE_CONTACT_FORCE 36 -#define NX_VISUALIZE_ACTOR_AXES 37 -#define NX_VISUALIZE_COLLISION_AABBS 38 -#define NX_VISUALIZE_COLLISION_SHAPES 39 -#define NX_VISUALIZE_COLLISION_AXES 40 -#define NX_VISUALIZE_COLLISION_COMPOUNDS 41 -#define NX_VISUALIZE_COLLISION_VNORMALS 42 -#define NX_VISUALIZE_COLLISION_FNORMALS 43 -#define NX_VISUALIZE_COLLISION_EDGES 44 -#define NX_VISUALIZE_COLLISION_SPHERES 45 -#define NX_VISUALIZE_COLLISION_STATIC 47 -#define NX_VISUALIZE_COLLISION_DYNAMIC 48 -#define NX_VISUALIZE_COLLISION_FREE 49 -#define NX_VISUALIZE_COLLISION_CCD 50 -#define NX_VISUALIZE_COLLISION_SKELETONS 51 -#define NX_VISUALIZE_FLUID_EMITTERS 52 -#define NX_VISUALIZE_FLUID_POSITION 53 -#define NX_VISUALIZE_FLUID_VELOCITY 54 -#define NX_VISUALIZE_FLUID_KERNEL_RADIUS 55 -#define NX_VISUALIZE_FLUID_BOUNDS 56 -#define NX_VISUALIZE_FLUID_PACKETS 57 -#define NX_VISUALIZE_FLUID_MOTION_LIMIT 58 -#define NX_VISUALIZE_FLUID_DYN_COLLISION 59 -#define NX_VISUALIZE_FLUID_STC_COLLISION 60 -#define NX_VISUALIZE_FLUID_MESH_PACKETS 61 -#define NX_VISUALIZE_FLUID_DRAINS 62 -#define NX_VISUALIZE_FLUID_PACKET_DATA 90 -#define NX_VISUALIZE_CLOTH_MESH 63 -#define NX_VISUALIZE_CLOTH_COLLISIONS 64 -#define NX_VISUALIZE_CLOTH_SELFCOLLISIONS 65 -#define NX_VISUALIZE_CLOTH_WORKPACKETS 66 -#define NX_VISUALIZE_CLOTH_SLEEP 67 -#define NX_VISUALIZE_CLOTH_SLEEP_VERTEX 94 -#define NX_VISUALIZE_CLOTH_TEARABLE_VERTICES 80 -#define NX_VISUALIZE_CLOTH_TEARING 81 -#define NX_VISUALIZE_CLOTH_ATTACHMENT 82 -#define NX_VISUALIZE_CLOTH_VALIDBOUNDS 92 -#define NX_VISUALIZE_SOFTBODY_MESH 83 -#define NX_VISUALIZE_SOFTBODY_COLLISIONS 84 -#define NX_VISUALIZE_SOFTBODY_WORKPACKETS 85 -#define NX_VISUALIZE_SOFTBODY_SLEEP 86 -#define NX_VISUALIZE_SOFTBODY_SLEEP_VERTEX 95 -#define NX_VISUALIZE_SOFTBODY_TEARABLE_VERTICES 87 -#define NX_VISUALIZE_SOFTBODY_TEARING 88 -#define NX_VISUALIZE_SOFTBODY_ATTACHMENT 89 -#define NX_VISUALIZE_SOFTBODY_VALIDBOUNDS 93 -#define NX_ADAPTIVE_FORCE 68 -#define NX_COLL_VETO_JOINTED 69 -#define NX_TRIGGER_TRIGGER_CALLBACK 70 -#define NX_SELECT_HW_ALGO 71 -#define NX_VISUALIZE_ACTIVE_VERTICES 72 -#define NX_CCD_EPSILON 73 -#define NX_SOLVER_CONVERGENCE_THRESHOLD 74 -#define NX_BBOX_NOISE_LEVEL 75 -#define NX_IMPLICIT_SWEEP_CACHE_SIZE 76 -#define NX_DEFAULT_SLEEP_ENERGY 77 -#define NX_CONSTANT_FLUID_MAX_PACKETS 78 -#define NX_CONSTANT_FLUID_MAX_PARTICLES_PER_STEP 79 -#define NX_VISUALIZE_FORCE_FIELDS 91 -#define NX_ASYNCHRONOUS_MESH_CREATION 96 -#define NX_FORCE_FIELD_CUSTOM_KERNEL_EPSILON 97 -#define NX_IMPROVED_SPRING_SOLVER 98 - -#if NX_SDK_VERSION_NUMBER > 281 -#define NX_FAST_MASSIVE_BP_VOLUME_DELETION 99 -#define NX_LEGACY_JOINT_DRIVE 100 -#endif /* NX_SDK_VERSION_NUMBER > 281 */ - -// PhysxActorFlag -#define NX_AF_DISABLE_COLLISION 1<<0 -#define NX_AF_DISABLE_RESPONSE 1<<1 -#define NX_AF_LOCK_COM 1<<2 -#define NX_AF_FLUID_DISABLE_COLLISION 1<<3 -#define NX_AF_CONTACT_MODIFICATION 1<<4 -#define NX_AF_FORCE_CONE_FRICTION 1<<5 -#define NX_AF_USER_ACTOR_PAIR_FILTERING 1<<6 - -// PhysxBodyFlag -#define NX_BF_DISABLE_GRAVITY 1<<0 -#define NX_BF_FROZEN_POS_X 1<<1 -#define NX_BF_FROZEN_POS_Y 1<<2 -#define NX_BF_FROZEN_POS_Z 1<<3 -#define NX_BF_FROZEN_ROT_X 1<<4 -#define NX_BF_FROZEN_ROT_Y 1<<5 -#define NX_BF_FROZEN_ROT_Z 1<<6 -#define NX_BF_FROZEN_POS 256 -#define NX_BF_FROZEN_ROT 131072 -#define NX_BF_FROZEN 131328 -#define NX_BF_KINEMATIC 1<<7 -#define NX_BF_VISUALIZATION 1<<8 -#define NX_BF_FILTER_SLEEP_VEL 1<<10 -#define NX_BF_ENERGY_SLEEP_TEST 1<<11 - -// PhysxBroadPhaseType -#define NX_BP_TYPE_SAP_SINGLE 0 -#define NX_BP_TYPE_SAP_MULTI 1 - -// PhysxClothFlag -#define NX_CLF_PRESSURE 1<<0 -#define NX_CLF_STATIC 1<<1 -#define NX_CLF_DISABLE_COLLISION 1<<2 -#define NX_CLF_SELFCOLLISION 1<<3 -#define NX_CLF_VISUALIZATION 1<<4 -#define NX_CLF_GRAVITY 1<<5 -#define NX_CLF_BENDING 1<<6 -#define NX_CLF_BENDING_ORTHO 1<<7 -#define NX_CLF_DAMPING 1<<8 -#define NX_CLF_COLLISION_TWOWAY 1<<9 -#define NX_CLF_TRIANGLE_COLLISION 1<<11 -#define NX_CLF_TEARABLE 1<<12 -#define NX_CLF_HARDWARE 1<<13 -#define NX_CLF_COMDAMPING 1<<14 -#define NX_CLF_VALIDBOUNDS 1<<15 -#define NX_CLF_FLUID_COLLISION 1<<16 -#define NX_CLF_DISABLE_DYNAMIC_CCD 1<<17 -#define NX_CLF_ADHERE 1<<18 - -// PhysxContactPairFlag -#define NX_IGNORE_PAIR 1<<0 -#define NX_NOTIFY_ON_START_TOUCH 1<<1 -#define NX_NOTIFY_ON_END_TOUCH 1<<2 -#define NX_NOTIFY_ON_TOUCH 1<<3 -#define NX_NOTIFY_ON_IMPACT 1<<4 -#define NX_NOTIFY_ON_ROLL 1<<5 -#define NX_NOTIFY_ON_SLIDE 1<<6 -#define NX_NOTIFY_FORCES 1<<7 -#define NX_NOTIFY_ON_START_TOUCH_FORCE_THRESHOLD 1<<8 -#define NX_NOTIFY_ON_END_TOUCH_FORCE_THRESHOLD 1<<9 -#define NX_NOTIFY_ON_TOUCH_FORCE_THRESHOLD 1<<10 -#define NX_NOTIFY_CONTACT_MODIFICATION 1<<16 - -// PhysxCombineMode -#define NX_CM_AVERAGE 0 -#define NX_CM_MIN 1 -#define NX_CM_MULTIPLY 2 -#define NX_CM_MAX 3 - -// PhysxD6JointDriveType -#define NX_D6JOINT_DRIVE_POSITION 1<<0 -#define NX_D6JOINT_DRIVE_VELOCITY 1<<1 - -// PhysxD6JointFlag -#define NX_D6JOINT_SLERP_DRIVE 1<<0 -#define NX_D6JOINT_GEAR_ENABLED 1<<1 - -// PhysxD6JointMotion -#define NX_D6JOINT_MOTION_LOCKED 0 -#define NX_D6JOINT_MOTION_LIMITED 1 -#define NX_D6JOINT_MOTION_FREE 2 - -// PhysxDistanceJointFlag -#define NX_DJF_MAX_DISTANCE_ENABLED 1<<0 -#define NX_DJF_MIN_DISTANCE_ENABLED 1<<1 -#define NX_DJF_SPRING_ENABLED 1<<2 - -// PhysxFilterOp -#define NX_FILTEROP_AND 0 -#define NX_FILTEROP_OR 1 -#define NX_FILTEROP_XOR 2 -#define NX_FILTEROP_NAND 3 -#define NX_FILTEROP_NOR 4 -#define NX_FILTEROP_NXOR 5 -#define NX_FILTEROP_SWAP_AND 6 - -// PhysxForceFieldCoordinates -#define NX_FFC_CARTESIAN 0 -#define NX_FFC_SPHERICAL 1 -#define NX_FFC_CYLINDRICAL 2 -#define NX_FFC_TOROIDAL 3 - -// PhysxForceFieldShapeGroupFlag -#define NX_FFSG_EXCLUDE_GROUP 1 - -// PhysxMaterialFlag -#define NX_MF_ANISOTROPIC 1<<0 -#define NX_MF_DISABLE_FRICTION 1<<4 -#define NX_MF_DISABLE_STRONG_FRICTION 1<<5 - -// PhysxForceMode -#define NX_FORCE 0 -#define NX_IMPULSE 1 -#define NX_VELOCITY_CHANGE 2 -#define NX_SMOOTH_IMPULSE 3 -#define NX_SMOOTH_VELOCITY_CHANGE 4 -#define NX_ACCELERATION 5 - -// PhysxJointFlag -#define NX_JF_COLLISION_ENABLED 1<<0 -#define NX_JF_VISUALIZATION 1<<1 - -// PhysxProjectionMode -#define NX_JPM_NONE 0 -#define NX_JPM_POINT_MINDIST 1 -#define NX_JPM_LINEAR_MINDIST 2 - -// PhysxPruningStructure -#define NX_PRUNING_NONE 0 -#define NX_PRUNING_OCTREE 1 -#define NX_PRUNING_QUADTREE 2 -#define NX_PRUNING_DYNAMIC_AABB_TREE 3 -#define NX_PRUNING_STATIC_AABB_TREE 4 - -// PhysxPulleyJointFlag -#define NX_PJF_IS_RIGID 1<<0 -#define NX_PJF_MOTOR_ENABLED 1<<1 - -// PhysxRevoluteJointFlag -#define NX_RJF_LIMIT_ENABLED 1<<0 -#define NX_RJF_MOTOR_ENABLED 1<<1 -#define NX_RJF_SPRING_ENABLED 1<<2 - -// PhysxSceneFlag -#define NX_SF_DISABLE_SSE 0x1 -#define NX_SF_DISABLE_COLLISIONS 0x2 -#define NX_SF_SIMULATE_SEPARATE_THREAD 0x4 -#define NX_SF_ENABLE_MULTITHREAD 0x8 -#define NX_SF_ENABLE_ACTIVETRANSFORMS 0x10 -#define NX_SF_RESTRICTED_SCENE 0x20 -#define NX_SF_DISABLE_SCENE_MUTEX 0x40 -#define NX_SF_FORCE_CONE_FRICTION 0x80 -#define NX_SF_SEQUENTIAL_PRIMARY 0x80*2 -#define NX_SF_FLUID_PERFORMANCE_HINT 0x80*4 -#define NX_SF_ALTERNATIVE_FLUID_TRIANGLE_COLLISION 0x80*8 -#define NX_SF_MULTITHREADED_FORCEFIELD 0x80*16 - -// PhysxShapeFlag -#define NX_TRIGGER_ON_ENTER 1<<0 -#define NX_TRIGGER_ON_LEAVE 1<<1 -#define NX_TRIGGER_ON_STAY 1<<2 -#define NX_TRIGGER_ENABLE 7 -#define NX_SF_VISUALIZATION 1<<3 -#define NX_SF_DISABLE_COLLISION 1<<4 -#define NX_SF_FEATURE_INDICES 1<<5 -#define NX_SF_DISABLE_RAYCASTING 1<<6 -#define NX_SF_POINT_CONTACT_FORCE 1<<7 -#define NX_SF_FLUID_DRAIN 1<<8 -#define NX_SF_FLUID_DISABLE_COLLISION 1<<10 -#define NX_SF_FLUID_TWOWAY 1<<11 -#define NX_SF_DISABLE_RESPONSE 1<<12 -#define NX_SF_DYNAMIC_DYNAMIC_CCD 1<<13 -#define NX_SF_DISABLE_SCENE_QUERIES 1<<14 -#define NX_SF_CLOTH_DRAIN 1<<15 -#define NX_SF_CLOTH_DISABLE_COLLISION 1<<16 -#define NX_SF_CLOTH_TWOWAY 1<<17 -#define NX_SF_SOFTBODY_DRAIN 1<<18 -#define NX_SF_SOFTBODY_DISABLE_COLLISION 1<<19 -#define NX_SF_SOFTBODY_TWOWAY 1<<20 - -// PhysxShapesType -#define NX_STATIC_SHAPES 1<<0 -#define NX_DYNAMIC_SHAPES 1<<1 -#define NX_ALL_SHAPES (1<<0|1<<1) - -// PhysxSoftBodyFlag -#define NX_SBF_STATIC 1<<1 -#define NX_SBF_DISABLE_COLLISION 1<<2 -#define NX_SBF_SELFCOLLISION 1<<3 -#define NX_SBF_VISUALIZATION 1<<4 -#define NX_SBF_GRAVITY 1<<5 -#define NX_SBF_VOLUME_CONSERVATION 1<<6 -#define NX_SBF_DAMPING 1<<7 -#define NX_SBF_COLLISION_TWOWAY 1<<8 -#define NX_SBF_TEARABLE 1<<9 -#define NX_SBF_HARDWARE 1<<10 -#define NX_SBF_COMDAMPING 1<<11 -#define NX_SBF_VALIDBOUNDS 1<<12 -#define NX_SBF_FLUID_COLLISION 1<<13 -#define NX_SBF_DISABLE_DYNAMIC_CCD 1<<14 -#define NX_SBF_ADHERE 1<<15 - -// PhysxSphericalJointFlag -#define NX_SJF_TWIST_LIMIT_ENABLED 1<<0 -#define NX_SJF_SWING_LIMIT_ENABLED 1<<1 -#define NX_SJF_TWIST_SPRING_ENABLED 1<<2 -#define NX_SJF_SWING_SPRING_ENABLED 1<<3 -#define NX_SJF_JOINT_SPRING_ENABLED 1<<4 -#define NX_SJF_PERPENDICULAR_DIR_CONSTRAINTS 1<<5 - -// PhysxUpAxis -#define NX_X 1 -#define NX_Y 2 -#define NX_Z 3 - -// PhysxVertexAttachmentStatus -#define NX_CLOTH_VERTEX_ATTACHMENT_NONE 0 -#define NX_CLOTH_VERTEX_ATTACHMENT_GLOBAL 1 -#define NX_CLOTH_VERTEX_ATTACHMENT_SHAPE 2 - -// PhysxWheelShapeFlag -#define NX_WF_WHEEL_AXIS_CONTACT_NORMAL 1<<0 -#define NX_WF_INPUT_LAT_SLIPVELOCITY 1<<1 -#define NX_WF_INPUT_LNG_SLIPVELOCITY 1<<2 -#define NX_WF_UNSCALED_SPRING_BEHAVIOR 1<<3 -#define NX_WF_AXLE_SPEED_OVERRIDE 1<<4 -#define NX_WF_EMULATE_LEGACY_WHEEL 1<<5 -#define NX_WF_CLAMPED_FRICTION 1<<6 - -#endif // CPPPARSER - -// PhysxWheelFlag -#define NX_WF_STEERABLE_INPUT 1<<0 -#define NX_WF_STEERABLE_AUTO 1<<1 -#define NX_WF_AFFECTED_BY_HANDBRAKE 1<<2 -#define NX_WF_ACCELERATED 1<<3 - -/** - * This class exists just to provide scoping for the enums shared by PhysX - * classes. - */ -class EXPCL_PANDAPHYSX PhysxEnums { -PUBLISHED: - - enum PhysxParameter { - P_penalty_force = NX_PENALTY_FORCE, - P_skin_width = NX_SKIN_WIDTH, - P_default_sleep_lin_vel_squared = NX_DEFAULT_SLEEP_LIN_VEL_SQUARED, - P_default_sleep_ang_vel_squared = NX_DEFAULT_SLEEP_ANG_VEL_SQUARED, - P_bounce_threshold = NX_BOUNCE_THRESHOLD, - P_dyn_frict_scaling = NX_DYN_FRICT_SCALING, - P_sta_frict_scaling = NX_STA_FRICT_SCALING, - P_max_angular_velocity = NX_MAX_ANGULAR_VELOCITY, - P_continuous_cd = NX_CONTINUOUS_CD, - P_visualization_scale = NX_VISUALIZATION_SCALE, - P_adaptive_force = NX_ADAPTIVE_FORCE, - P_coll_veta_jointed = NX_COLL_VETO_JOINTED, - P_trigger_trigger_callback = NX_TRIGGER_TRIGGER_CALLBACK, - P_select_hw_algo = NX_SELECT_HW_ALGO, - P_ccd_epsilon = NX_CCD_EPSILON, - P_solver_convergence_threshold = NX_SOLVER_CONVERGENCE_THRESHOLD, - P_bbox_noise_level = NX_BBOX_NOISE_LEVEL, - P_implicit_sweep_cache_size = NX_IMPLICIT_SWEEP_CACHE_SIZE, - P_default_sleep_energy = NX_DEFAULT_SLEEP_ENERGY, - P_constant_fluid_max_packets = NX_CONSTANT_FLUID_MAX_PACKETS, - P_constant_fluid_max_particles_per_step = NX_CONSTANT_FLUID_MAX_PARTICLES_PER_STEP, - P_asynchronous_mesh_creation = NX_ASYNCHRONOUS_MESH_CREATION, - P_force_field_custom_kernel_epsilon = NX_FORCE_FIELD_CUSTOM_KERNEL_EPSILON, - P_improved_spring_solver = NX_IMPROVED_SPRING_SOLVER, - -#if NX_SDK_VERSION_NUMBER > 281 - P_fast_massive_bp_volume_deletion = NX_FAST_MASSIVE_BP_VOLUME_DELETION, - P_legacy_joint_drive = NX_LEGACY_JOINT_DRIVE, -#endif - - P_visualize_world_axes = NX_VISUALIZE_WORLD_AXES, - P_visualize_body_axes = NX_VISUALIZE_BODY_AXES, - P_visualize_body_mass_axes = NX_VISUALIZE_BODY_MASS_AXES, - P_visualize_body_lin_velocity = NX_VISUALIZE_BODY_LIN_VELOCITY, - P_visualize_body_ang_velocity = NX_VISUALIZE_BODY_ANG_VELOCITY, - P_visualize_body_joint_groups = NX_VISUALIZE_BODY_JOINT_GROUPS, - P_visualize_joint_local_axes = NX_VISUALIZE_JOINT_LOCAL_AXES, - P_visualize_joint_world_axes = NX_VISUALIZE_JOINT_WORLD_AXES, - P_visualize_joint_limits = NX_VISUALIZE_JOINT_LIMITS, - P_visualize_contact_point = NX_VISUALIZE_CONTACT_POINT, - P_visualize_contact_normal = NX_VISUALIZE_CONTACT_NORMAL, - P_visualize_contact_error = NX_VISUALIZE_CONTACT_ERROR, - P_visualize_contact_force = NX_VISUALIZE_CONTACT_FORCE, - P_visualize_actor_axes = NX_VISUALIZE_ACTOR_AXES, - P_visualize_collision_aabbs = NX_VISUALIZE_COLLISION_AABBS, - P_visualize_collision_shapes = NX_VISUALIZE_COLLISION_SHAPES, - P_visualize_collision_axes = NX_VISUALIZE_COLLISION_AXES, - P_visualize_collision_compounds = NX_VISUALIZE_COLLISION_COMPOUNDS, - P_visualize_collision_vnormals = NX_VISUALIZE_COLLISION_VNORMALS, - P_visualize_collision_fnormals = NX_VISUALIZE_COLLISION_FNORMALS, - P_visualize_collision_edges = NX_VISUALIZE_COLLISION_EDGES, - P_visualize_collision_spheres = NX_VISUALIZE_COLLISION_SPHERES, - P_visualize_collision_static = NX_VISUALIZE_COLLISION_STATIC, - P_visualize_collision_dynamic = NX_VISUALIZE_COLLISION_DYNAMIC, - P_visualize_collision_free = NX_VISUALIZE_COLLISION_FREE, - P_visualize_collision_ccd = NX_VISUALIZE_COLLISION_CCD, - P_visualize_collision_skeletons = NX_VISUALIZE_COLLISION_SKELETONS, - P_visualize_fluid_emitters = NX_VISUALIZE_FLUID_EMITTERS, - P_visualize_fluid_position = NX_VISUALIZE_FLUID_POSITION, - P_visualize_fluid_velocity = NX_VISUALIZE_FLUID_VELOCITY, - P_visualize_fluid_kernel_radius = NX_VISUALIZE_FLUID_KERNEL_RADIUS, - P_visualize_fluid_bounds = NX_VISUALIZE_FLUID_BOUNDS, - P_visualize_fluid_packets = NX_VISUALIZE_FLUID_PACKETS, - P_visualize_fluid_motion_limit = NX_VISUALIZE_FLUID_MOTION_LIMIT, - P_visualize_fluid_dyn_collision = NX_VISUALIZE_FLUID_DYN_COLLISION, - P_visualize_fluid_stc_collision = NX_VISUALIZE_FLUID_STC_COLLISION, - P_visualize_fluid_mesh_packets = NX_VISUALIZE_FLUID_MESH_PACKETS, - P_visualize_fluid_drains = NX_VISUALIZE_FLUID_DRAINS, - P_visualize_fluid_packet_data = NX_VISUALIZE_FLUID_PACKET_DATA, - P_visualize_cloth_mesh = NX_VISUALIZE_CLOTH_MESH, - P_visualize_cloth_collisions = NX_VISUALIZE_CLOTH_COLLISIONS, - P_visualize_cloth_selfcollisions = NX_VISUALIZE_CLOTH_SELFCOLLISIONS, - P_visualize_cloth_workpackets = NX_VISUALIZE_CLOTH_WORKPACKETS, - P_visualize_cloth_sleep = NX_VISUALIZE_CLOTH_SLEEP, - P_visualize_cloth_sleep_vertex = NX_VISUALIZE_CLOTH_SLEEP_VERTEX, - P_visualize_cloth_tearable_vertices = NX_VISUALIZE_CLOTH_TEARABLE_VERTICES, - P_visualize_cloth_tearing = NX_VISUALIZE_CLOTH_TEARING, - P_visualize_cloth_attachment = NX_VISUALIZE_CLOTH_ATTACHMENT, - P_visualize_cloth_validbounds = NX_VISUALIZE_CLOTH_VALIDBOUNDS, - P_visualize_softbody_mesh = NX_VISUALIZE_SOFTBODY_MESH, - P_visualize_softbody_collisions = NX_VISUALIZE_SOFTBODY_COLLISIONS, - P_visualize_softbody_workpackets = NX_VISUALIZE_SOFTBODY_WORKPACKETS, - P_visualize_softbody_sleep = NX_VISUALIZE_SOFTBODY_SLEEP, - P_visualize_softbody_sleep_vertex = NX_VISUALIZE_SOFTBODY_SLEEP_VERTEX, - P_visualize_softbody_tearable_vertices = NX_VISUALIZE_SOFTBODY_TEARABLE_VERTICES, - P_visualize_softbody_tearing = NX_VISUALIZE_SOFTBODY_TEARING, - P_visualize_softbody_attachment = NX_VISUALIZE_SOFTBODY_ATTACHMENT, - P_visualize_softbody_validbounds = NX_VISUALIZE_SOFTBODY_VALIDBOUNDS, - P_visualize_active_vertices = NX_VISUALIZE_ACTIVE_VERTICES, - P_visualize_force_fields = NX_VISUALIZE_FORCE_FIELDS, - }; - - enum PhysxActorFlag { - AF_disable_collision = NX_AF_DISABLE_COLLISION, - AF_disable_response = NX_AF_DISABLE_RESPONSE, - AF_lock_com = NX_AF_LOCK_COM, - AF_fluid_disable_collision = NX_AF_FLUID_DISABLE_COLLISION, - AF_contact_modification = NX_AF_CONTACT_MODIFICATION, - AF_force_cone_friction = NX_AF_FORCE_CONE_FRICTION, - AF_user_actor_pair_filtering = NX_AF_USER_ACTOR_PAIR_FILTERING - }; - - enum PhysxBodyFlag { - BF_disable_gravity = NX_BF_DISABLE_GRAVITY, - Bf_frozen_pos_x = NX_BF_FROZEN_POS_X, - BF_frozen_pos_y = NX_BF_FROZEN_POS_Y, - BF_frozen_pos_z = NX_BF_FROZEN_POS_Z, - BF_frozen_rot_x = NX_BF_FROZEN_ROT_X, - BF_frozen_rot_y = NX_BF_FROZEN_ROT_Y, - BF_frozen_rot_z = NX_BF_FROZEN_ROT_Z, - BF_frozen_pos = NX_BF_FROZEN_POS, - BF_frozen_rot = NX_BF_FROZEN_ROT, - BF_frozen = NX_BF_FROZEN, - BF_kinematic = NX_BF_KINEMATIC, - BF_visualization = NX_BF_VISUALIZATION, - BF_filter_sleep_vel = NX_BF_FILTER_SLEEP_VEL, - BF_energy_sleep_test = NX_BF_ENERGY_SLEEP_TEST - }; - - enum PhysxBroadPhaseType { - BPT_sap_single = NX_BP_TYPE_SAP_SINGLE, - BPT_sap_multi = NX_BP_TYPE_SAP_MULTI - }; - - enum PhysxClothFlag { - CLF_pressure = NX_CLF_PRESSURE, - CLF_static = NX_CLF_STATIC, - CLF_disable_collision = NX_CLF_DISABLE_COLLISION, - CLF_selfcollision = NX_CLF_SELFCOLLISION, - CLF_visualization = NX_CLF_VISUALIZATION, - CLF_gravity = NX_CLF_GRAVITY, - CLF_bending = NX_CLF_BENDING, - CLF_bending_ortho = NX_CLF_BENDING_ORTHO, - CLF_damping = NX_CLF_DAMPING, - CLF_collision_twoway = NX_CLF_COLLISION_TWOWAY, - CLF_triangle_collision = NX_CLF_TRIANGLE_COLLISION, - CLF_tearable = NX_CLF_TEARABLE, - CLF_hardware = NX_CLF_HARDWARE, - CLF_comdamping = NX_CLF_COMDAMPING, - CLF_validbounds = NX_CLF_VALIDBOUNDS, - CLF_fluid_collision = NX_CLF_FLUID_COLLISION, - CLF_disable_dynamic_ccd = NX_CLF_DISABLE_DYNAMIC_CCD, - CLF_adhere = NX_CLF_ADHERE - }; - - enum PhysxContactPairFlag { - CPF_ignore_pair = NX_IGNORE_PAIR, - CPF_notify_on_start_touch = NX_NOTIFY_ON_START_TOUCH, - CPF_notify_on_end_touch = NX_NOTIFY_ON_END_TOUCH, - CPF_notify_on_touch = NX_NOTIFY_ON_TOUCH, - CPF_notify_on_impact = NX_NOTIFY_ON_IMPACT, - CPF_notify_on_roll = NX_NOTIFY_ON_ROLL, - CPF_notify_on_slide = NX_NOTIFY_ON_SLIDE, - CPF_notify_forces = NX_NOTIFY_FORCES, - CPF_notify_on_start_touch_threshold = NX_NOTIFY_ON_START_TOUCH_FORCE_THRESHOLD, - CPF_notify_on_end_touch_threshold = NX_NOTIFY_ON_END_TOUCH_FORCE_THRESHOLD, - CPF_notify_on_touch_threshold = NX_NOTIFY_ON_TOUCH_FORCE_THRESHOLD, - CPF_notify_contact_modifications = NX_NOTIFY_CONTACT_MODIFICATION - }; - - enum PhysxCombineMode { - CM_average = NX_CM_AVERAGE, - CM_min = NX_CM_MIN, - CM_multiply = NX_CM_MULTIPLY, - CM_max = NX_CM_MAX - }; - - enum PhysxD6JointDriveType { - D6_joint_drive_position = NX_D6JOINT_DRIVE_POSITION, - D6_joint_drive_velocity = NX_D6JOINT_DRIVE_VELOCITY - }; - - enum PhysxD6JointFlag { - D6_joint_slerp_drive = NX_D6JOINT_SLERP_DRIVE, - D6_joint_gear_disabled = NX_D6JOINT_GEAR_ENABLED - }; - - enum PhysxD6JointMotion { - D6_joint_motion_locked = NX_D6JOINT_MOTION_LOCKED, - D6_joint_motion_limited = NX_D6JOINT_MOTION_LIMITED, - D6_joint_motion_free = NX_D6JOINT_MOTION_FREE - }; - - enum PhysxDistanceJointFlag { - DJF_max_distance_enabled = NX_DJF_MAX_DISTANCE_ENABLED, - DJF_mix_distance_enabled = NX_DJF_MIN_DISTANCE_ENABLED, - DJF_spring_enabled = NX_DJF_SPRING_ENABLED - }; - - enum PhysxFilterOp { - FO_and = NX_FILTEROP_AND, - FO_or = NX_FILTEROP_OR, - FO_xor = NX_FILTEROP_XOR, - FO_nand = NX_FILTEROP_NAND, - FO_nor = NX_FILTEROP_NOR, - FO_nxor = NX_FILTEROP_NXOR, - FO_swap_and = NX_FILTEROP_SWAP_AND - }; - - enum PhysxForceFieldCoordinates { - FFC_cartesian, - FFC_spherical, - FFC_cylindrical, - FFC_toroidal, - }; - - enum PhysxForceFieldShapeGroupFlag { - FFSG_exclude_group = NX_FFSG_EXCLUDE_GROUP - }; - - enum PhysxForceMode { - FM_force = NX_FORCE, - FM_impulse = NX_IMPULSE, - FM_velocity_change = NX_VELOCITY_CHANGE, - FM_smooth_impulse = NX_SMOOTH_IMPULSE, - FM_smooth_velocity_change = NX_SMOOTH_VELOCITY_CHANGE, - FM_acceleration = NX_ACCELERATION - }; - - enum PhysxJointFlag { - JF_collision_enabled = NX_JF_COLLISION_ENABLED, - JF_visualization = NX_JF_VISUALIZATION - }; - - enum PhysxMaterialFlag { - MF_anisotropic = NX_MF_ANISOTROPIC, - MF_disable_friction = NX_MF_DISABLE_FRICTION, - MF_disable_strong_friction = NX_MF_DISABLE_STRONG_FRICTION - }; - - enum PhysxProjectionMode { - PM_none = NX_JPM_NONE, - PM_point_mindist = NX_JPM_POINT_MINDIST, - PM_linear_mindist = NX_JPM_LINEAR_MINDIST - }; - - enum PhysxPruningStructure { - PS_none = NX_PRUNING_NONE, - PS_octree = NX_PRUNING_OCTREE, - PS_quadtree = NX_PRUNING_QUADTREE, - PS_dynamic_aabb_tree = NX_PRUNING_DYNAMIC_AABB_TREE, - PS_static_aabb_tree = NX_PRUNING_STATIC_AABB_TREE - }; - - enum PhysxPulleyJointFlag { - PJF_is_rigid = NX_PJF_IS_RIGID, - PJF_motor_enabled = NX_PJF_MOTOR_ENABLED - }; - - enum PhysxRevoluteJointFlag { - RJF_limit_enabled = NX_RJF_LIMIT_ENABLED, - RJF_motor_enabled = NX_RJF_MOTOR_ENABLED, - RJF_spring_enabled = NX_RJF_SPRING_ENABLED - }; - - enum PhysxSceneFlag { - SF_disable_sse = NX_SF_DISABLE_SSE, - SF_disable_collisions = NX_SF_DISABLE_COLLISIONS, - SF_restricted_scene = NX_SF_RESTRICTED_SCENE, - SF_disable_scene_mutex = NX_SF_DISABLE_SCENE_MUTEX, - SF_force_cone_friction = NX_SF_FORCE_CONE_FRICTION, - SF_sequential_primary = NX_SF_SEQUENTIAL_PRIMARY, - SF_fluid_performance_hint = NX_SF_FLUID_PERFORMANCE_HINT, - // SF_alternative_fluid_triangle_collision = - // NX_SF_ALTERNATIVE_FLUID_TRIANGLE_COLLISION, SF_multithreaded_forcefield - // = NX_SF_MULTITHREADED_FORCEFIELD, SF_simulate_separate_thread = - // NX_SF_SIMULATE_SEPARATE_THREAD, SF_enable_multithread = - // NX_SF_ENABLE_MULTITHREAD, - }; - - enum PhysxShapeFlag { - SF_trigger_on_enter = NX_TRIGGER_ON_ENTER, - SF_trigger_on_leave = NX_TRIGGER_ON_LEAVE, - SF_trigger_on_stay = NX_TRIGGER_ON_STAY, - SF_trigger_enable = NX_TRIGGER_ENABLE, - SF_visualization = NX_SF_VISUALIZATION, - SF_disable_collision = NX_SF_DISABLE_COLLISION, - SF_disable_raycasting = NX_SF_DISABLE_RAYCASTING, - SF_disable_response = NX_SF_DISABLE_RESPONSE, - SF_disable_scene_queries = NX_SF_DISABLE_SCENE_QUERIES, - SF_point_contact_force = NX_SF_POINT_CONTACT_FORCE, - SF_feature_indices = NX_SF_FEATURE_INDICES, - SF_dynamic_dynamic_ccd = NX_SF_DYNAMIC_DYNAMIC_CCD, - SF_fluid_drain = NX_SF_FLUID_DRAIN, - SF_fluid_disable_collision = NX_SF_FLUID_DISABLE_COLLISION, - SF_fluid_twoway = NX_SF_FLUID_TWOWAY, - SF_cloth_drain = NX_SF_CLOTH_DRAIN, - SF_cloth_disable_collision = NX_SF_CLOTH_DISABLE_COLLISION, - SF_cloth_twoway = NX_SF_CLOTH_TWOWAY, - SF_softbody_drain = NX_SF_SOFTBODY_DRAIN, - SF_softbody_disable_collision = NX_SF_SOFTBODY_DISABLE_COLLISION, - SF_softbody_twoway = NX_SF_SOFTBODY_TWOWAY - }; - - enum PhysxSoftBodyFlag { - SBF_static = NX_SBF_STATIC, - SBF_disable_collision = NX_SBF_DISABLE_COLLISION, - SBF_selfcollision = NX_SBF_SELFCOLLISION, - SBF_visualization = NX_SBF_VISUALIZATION, - SBF_gravity = NX_SBF_GRAVITY, - SBF_volume_conservtion = NX_SBF_VOLUME_CONSERVATION, - SBF_damping = NX_SBF_DAMPING, - SBF_collision_twoway = NX_SBF_COLLISION_TWOWAY, - SBF_tearable = NX_SBF_TEARABLE, - SBF_hardware = NX_SBF_HARDWARE, - SBF_comdamping = NX_SBF_COMDAMPING, - SBF_validbounds = NX_SBF_VALIDBOUNDS, - SBF_fluid_collision = NX_SBF_FLUID_COLLISION, - SBF_disable_dynamic_ccd = NX_SBF_DISABLE_DYNAMIC_CCD, - SBF_adhere = NX_SBF_ADHERE - }; - - enum PhysxShapesType { - ST_static = NX_STATIC_SHAPES , - ST_dynamic = NX_DYNAMIC_SHAPES , - ST_all = NX_ALL_SHAPES - }; - - enum PhysxSphericalJointFlag { - SJF_twist_limit_enabled = NX_SJF_TWIST_LIMIT_ENABLED, - SJF_swing_limit_enabled = NX_SJF_SWING_LIMIT_ENABLED, - SJF_twist_spring_enabled = NX_SJF_TWIST_SPRING_ENABLED, - SJF_swing_spring_enabled = NX_SJF_SWING_SPRING_ENABLED, - SJF_joint_spring_enabled = NX_SJF_JOINT_SPRING_ENABLED, - SJF_perpendicular_dir_constraints = NX_SJF_PERPENDICULAR_DIR_CONSTRAINTS - }; - - enum PhysxUpAxis { - X_up = NX_X, - Y_up = NX_Y, - Z_up = NX_Z - }; - - enum PhysxVertexAttachmentStatus { - VAS_none = NX_CLOTH_VERTEX_ATTACHMENT_NONE, - VAS_global = NX_CLOTH_VERTEX_ATTACHMENT_GLOBAL, - VAS_shape = NX_CLOTH_VERTEX_ATTACHMENT_SHAPE - }; - - enum PhysxWheelFlag { - WF_steerable_input = NX_WF_STEERABLE_INPUT, - WF_steerable_auto = NX_WF_STEERABLE_AUTO, - WF_affected_by_handbrake = NX_WF_AFFECTED_BY_HANDBRAKE, - WF_accelerated = NX_WF_ACCELERATED - }; - - enum PhysxWheelShapeFlag { - WSF_wheel_axis_contact_normal = NX_WF_WHEEL_AXIS_CONTACT_NORMAL, - WSF_input_lat_slipvelocity = NX_WF_INPUT_LAT_SLIPVELOCITY, - WSF_input_lng_slipvelocity = NX_WF_INPUT_LNG_SLIPVELOCITY, - WSF_unscaled_spring_behavior = NX_WF_UNSCALED_SPRING_BEHAVIOR, - WSF_axle_speed_override = NX_WF_AXLE_SPEED_OVERRIDE, - WSF_emulate_legacy_wheel = NX_WF_EMULATE_LEGACY_WHEEL, - WSF_clamped_friction = NX_WF_CLAMPED_FRICTION - }; - -}; - -EXPCL_PANDAPHYSX std::ostream &operator << (std::ostream &out, PhysxEnums::PhysxUpAxis axis); -EXPCL_PANDAPHYSX std::istream &operator >> (std::istream &in, PhysxEnums::PhysxUpAxis &axis); - -#endif diff --git a/panda/src/physx/physxFileStream.cxx b/panda/src/physx/physxFileStream.cxx deleted file mode 100644 index 61ee73c1c9..0000000000 --- a/panda/src/physx/physxFileStream.cxx +++ /dev/null @@ -1,165 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFileStream.cxx - * @author enn0x - * @date 2009-10-11 - */ - -#include "physxFileStream.h" - -#include - -#include "virtualFileSystem.h" - -/** - * - */ -PhysxFileStream::PhysxFileStream(const Filename &fn, bool load) : _fp(nullptr), _vf(nullptr), _in(nullptr) -{ - if (load) { - _vf = VirtualFileSystem::get_global_ptr()->get_file(fn); - _in = _vf->open_read_file(true); - } - else { - _fp = fopen(fn.c_str(), "wb"); - } -} - -/** - * - */ -PhysxFileStream::~PhysxFileStream() -{ - if (_fp) fclose(_fp); - if (_vf) _vf->close_read_file(_in); -} - -/** - * - */ -NxU8 PhysxFileStream::readByte() const -{ - NxU8 b; - _in->read((char *)&b, sizeof(NxU8)); - NX_ASSERT(!(_in->bad())); - return b; -} - -/** - * - */ -NxU16 PhysxFileStream::readWord() const -{ - NxU16 w; - _in->read((char *)&w, sizeof(NxU16)); - NX_ASSERT(!(_in->bad())); - return w; -} - -/** - * - */ -NxU32 PhysxFileStream::readDword() const -{ - NxU32 d; - _in->read((char *)&d, sizeof(NxU32)); - NX_ASSERT(!(_in->bad())); - return d; -} - -/** - * - */ -float PhysxFileStream::readFloat() const -{ - NxReal f; - _in->read((char *)&f, sizeof(NxReal)); - NX_ASSERT(!(_in->bad())); - return f; -} - -/** - * - */ -double PhysxFileStream::readDouble() const -{ - NxF64 f; - _in->read((char *)&f, sizeof(NxF64)); - NX_ASSERT(!(_in->bad())); - return f; -} - -/** - * - */ -void PhysxFileStream::readBuffer(void *buffer, NxU32 size) const -{ - _in->read((char *)buffer, size); - NX_ASSERT(!(_in->bad())); -} - -/** - * - */ -NxStream &PhysxFileStream::storeByte(NxU8 b) -{ - size_t w = fwrite(&b, sizeof(NxU8), 1, _fp); - NX_ASSERT(w); - return *this; -} - -/** - * - */ -NxStream &PhysxFileStream::storeWord(NxU16 w) -{ - size_t ww = fwrite(&w, sizeof(NxU16), 1, _fp); - NX_ASSERT(ww); - return *this; -} - -/** - * - */ -NxStream &PhysxFileStream::storeDword(NxU32 d) -{ - size_t w = fwrite(&d, sizeof(NxU32), 1, _fp); - NX_ASSERT(w); - return *this; -} - -/** - * - */ -NxStream &PhysxFileStream::storeFloat(NxReal f) -{ - size_t w = fwrite(&f, sizeof(NxReal), 1, _fp); - NX_ASSERT(w); - return *this; -} - -/** - * - */ -NxStream &PhysxFileStream::storeDouble(NxF64 f) -{ - size_t w = fwrite(&f, sizeof(NxF64), 1, _fp); - NX_ASSERT(w); - return *this; -} - -/** - * - */ -NxStream &PhysxFileStream::storeBuffer(const void *buffer, NxU32 size) -{ - size_t w = fwrite(buffer, size, 1, _fp); - NX_ASSERT(w); - return *this; -} diff --git a/panda/src/physx/physxFileStream.h b/panda/src/physx/physxFileStream.h deleted file mode 100644 index 3e9f4752e9..0000000000 --- a/panda/src/physx/physxFileStream.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFileStream.h - * @author enn0x - * @date 2009-10-11 - */ - -#ifndef PHYSXFILESTREAM_H -#define PHYSXFILESTREAM_H - -#include "pandabase.h" -#include "virtualFile.h" -#include "filename.h" -#include - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxFileStream : public NxStream { - -public: - PhysxFileStream(const Filename &fn, bool load); - virtual ~PhysxFileStream(); - - virtual NxU8 readByte() const; - virtual NxU16 readWord() const; - virtual NxU32 readDword() const; - virtual float readFloat() const; - virtual double readDouble() const; - virtual void readBuffer(void *buffer, NxU32 size) const; - - virtual NxStream &storeByte(NxU8 b); - virtual NxStream &storeWord(NxU16 w); - virtual NxStream &storeDword(NxU32 d); - virtual NxStream &storeFloat(NxReal f); - virtual NxStream &storeDouble(NxF64 f); - virtual NxStream &storeBuffer(const void *buffer, NxU32 size); - -private: - - // write - FILE* _fp; - - // read - PT(VirtualFile) _vf; - std::istream *_in; -}; - -#endif // PHYSXFILESTREAM_H diff --git a/panda/src/physx/physxFixedJoint.I b/panda/src/physx/physxFixedJoint.I deleted file mode 100644 index e19b8e494c..0000000000 --- a/panda/src/physx/physxFixedJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFixedJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxFixedJoint:: -PhysxFixedJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxFixedJoint:: -~PhysxFixedJoint() { - -} diff --git a/panda/src/physx/physxFixedJoint.cxx b/panda/src/physx/physxFixedJoint.cxx deleted file mode 100644 index e3257eb22c..0000000000 --- a/panda/src/physx/physxFixedJoint.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFixedJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxFixedJoint.h" -#include "physxFixedJointDesc.h" - -TypeHandle PhysxFixedJoint::_type_handle; - -/** - * - */ -void PhysxFixedJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isFixedJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxFixedJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxFixedJoint:: -save_to_desc(PhysxFixedJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxFixedJoint:: -load_from_desc(const PhysxFixedJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} diff --git a/panda/src/physx/physxFixedJoint.h b/panda/src/physx/physxFixedJoint.h deleted file mode 100644 index 75b409452f..0000000000 --- a/panda/src/physx/physxFixedJoint.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFixedJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXFIXEDJOINT_H -#define PHYSXFIXEDJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxFixedJointDesc; - -/** - * A fixed joint permits no relative movement between two bodies. ie the - * bodies are glued together. - */ -class EXPCL_PANDAPHYSX PhysxFixedJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxFixedJoint(); - INLINE ~PhysxFixedJoint(); - - void save_to_desc(PhysxFixedJointDesc &jointDesc) const; - void load_from_desc(const PhysxFixedJointDesc &jointDesc); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxFixedJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxFixedJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxFixedJoint.I" - -#endif // PHYSXFIXEDJOINT_H diff --git a/panda/src/physx/physxFixedJointDesc.I b/panda/src/physx/physxFixedJointDesc.I deleted file mode 100644 index 58dcf5b03b..0000000000 --- a/panda/src/physx/physxFixedJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFixedJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxFixedJointDesc:: -PhysxFixedJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxFixedJointDesc:: -~PhysxFixedJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxFixedJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxFixedJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxFixedJointDesc.cxx b/panda/src/physx/physxFixedJointDesc.cxx deleted file mode 100644 index 62d3cc3458..0000000000 --- a/panda/src/physx/physxFixedJointDesc.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFixedJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxFixedJointDesc.h" diff --git a/panda/src/physx/physxFixedJointDesc.h b/panda/src/physx/physxFixedJointDesc.h deleted file mode 100644 index 337f62b39d..0000000000 --- a/panda/src/physx/physxFixedJointDesc.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxFixedJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXFIXEDJOINTDESC_H -#define PHYSXFIXEDJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for fixed joint. A fixed joint permits no relative - * movement between two bodies, i. e. the bodies are glued together. - */ -class EXPCL_PANDAPHYSX PhysxFixedJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxFixedJointDesc(); - INLINE ~PhysxFixedJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxFixedJointDesc _desc; -}; - -#include "physxFixedJointDesc.I" - -#endif // PHYSXFIXEDJOINTDESC_H diff --git a/panda/src/physx/physxForceField.I b/panda/src/physx/physxForceField.I deleted file mode 100644 index 01dbd645ef..0000000000 --- a/panda/src/physx/physxForceField.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceField.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxForceField:: -PhysxForceField() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxForceField:: -~PhysxForceField() { - -} - -/** - * - */ -INLINE void PhysxForceField:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxForceField:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxForceField.cxx b/panda/src/physx/physxForceField.cxx deleted file mode 100644 index 26149e72e0..0000000000 --- a/panda/src/physx/physxForceField.cxx +++ /dev/null @@ -1,143 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceField.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxForceField.h" -#include "physxForceFieldDesc.h" -#include "physxForceFieldShapeGroup.h" -#include "physxScene.h" - -TypeHandle PhysxForceField::_type_handle; - -/** - * - */ -void PhysxForceField:: -link(NxForceField *fieldPtr) { - - // Link self - _ptr = fieldPtr; - _ptr->userData = this; - _error_type = ET_ok; - - set_name(fieldPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_forcefields.add(this); - - // Link include shape group - PhysxForceFieldShapeGroup *group = new PhysxForceFieldShapeGroup(); - group->link(&(_ptr->getIncludeShapeGroup())); -} - -/** - * - */ -void PhysxForceField:: -unlink() { - - // Unlink inlcude shape group - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)(_ptr->getIncludeShapeGroup().userData); - group->unlink(); - - // Unlink self - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_forcefields.remove(this); -} - -/** - * - */ -void PhysxForceField:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - _ptr->getScene().releaseForceField(*_ptr); - _ptr = nullptr; -} - -/** - * - */ -void PhysxForceField:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - _ptr->setName(_name.c_str()); -} - -/** - * - */ -const char *PhysxForceField:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return _ptr->getName(); -} - -/** - * - */ -PhysxScene *PhysxForceField:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxScene *)(_ptr->getScene().userData); -} - -/** - * - */ -PhysxForceFieldShapeGroup *PhysxForceField:: -get_include_shape_group() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxForceFieldShapeGroup *)(_ptr->getIncludeShapeGroup().userData); -} - -/** - * - */ -unsigned int PhysxForceField:: -get_num_shape_groups() const { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getNbShapeGroups(); -} - -/** - * - */ -PhysxForceFieldShapeGroup *PhysxForceField:: -get_shape_group(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbShapeGroups(), nullptr); - - NxForceFieldShapeGroup *groupPtr; - NxU32 nGroups = _ptr->getNbShapeGroups(); - - _ptr->resetShapeGroupsIterator(); - for (NxU32 i=0; i <= idx; i++) { - groupPtr = _ptr->getNextShapeGroup(); - } - - return (PhysxForceFieldShapeGroup *)(groupPtr->userData); -} diff --git a/panda/src/physx/physxForceField.h b/panda/src/physx/physxForceField.h deleted file mode 100644 index e1dbb85084..0000000000 --- a/panda/src/physx/physxForceField.h +++ /dev/null @@ -1,91 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceField.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXFORCEFIELD_H -#define PHYSXFORCEFIELD_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxObject.h" -#include "physx_includes.h" - -class PhysxScene; -class PhysxForceFieldDesc; -class PhysxForceFieldShapeGroup; - -/** - * A force field effector. Instances of this object automate the application - * of forces onto rigid bodies, fluid, soft bodies and cloth. Force fields - * allow you to implement for example gusts of wind, dust devils, vacuum - * cleaners or anti-gravity zones. - */ -class EXPCL_PANDAPHYSX PhysxForceField : public PhysxObject { - -PUBLISHED: - INLINE PhysxForceField(); - INLINE ~PhysxForceField(); - - // void load_from_desc(const PhysxForceFieldDesc &materialDesc); void - // save_to_desc(PhysxForceFieldDesc &materialDesc) const; - - void set_name(const char *name); - - const char *get_name() const; - PhysxScene *get_scene() const; - PhysxForceFieldShapeGroup *get_include_shape_group() const; - - unsigned int get_num_shape_groups() const; - PhysxForceFieldShapeGroup *get_shape_group(unsigned int idx) const; - MAKE_SEQ(get_shape_groups, get_num_shape_groups, get_shape_group); - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE NxForceField *ptr() const { return _ptr; }; - - void link(NxForceField *ptr); - void unlink(); - -private: - NxForceField *_ptr; - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxForceField", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxForceField.I" - -#endif // PHYSXFORCEFIELD_H diff --git a/panda/src/physx/physxForceFieldDesc.I b/panda/src/physx/physxForceFieldDesc.I deleted file mode 100644 index 3ccdc80214..0000000000 --- a/panda/src/physx/physxForceFieldDesc.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldDesc.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxForceFieldDesc:: -PhysxForceFieldDesc() { - -} - -/** - * - */ -INLINE PhysxForceFieldDesc:: -~PhysxForceFieldDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxForceFieldDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxForceFieldDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxForceFieldDesc.cxx b/panda/src/physx/physxForceFieldDesc.cxx deleted file mode 100644 index 4f8bd1b428..0000000000 --- a/panda/src/physx/physxForceFieldDesc.cxx +++ /dev/null @@ -1,188 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldDesc.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxForceFieldDesc.h" -#include "physxForceFieldShapeDesc.h" -#include "physxForceFieldShapeGroup.h" -#include "physxManager.h" -#include "physxActor.h" - -/** - * - */ -void PhysxForceFieldDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - _desc.name = _name.c_str(); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_pos(const LPoint3f &pos) { - - _desc.pose.t = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_mat(const LMatrix4f &mat) { - - _desc.pose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_hpr(float h, float p, float r) { - - LQuaternionf q; - LMatrix3f rot; - NxMat34 m; - - q.set_hpr(LVector3f(h, p, r)); - q.extract_to_matrix(rot); - - _desc.pose.M = PhysxManager::mat3_to_nxMat33(rot); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_constant(const LVector3f &constant) { - - _kernel.constant = PhysxManager::vec3_to_nxVec3(constant); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_position_target(const LPoint3f &target) { - - _kernel.positionTarget = PhysxManager::point3_to_nxVec3(target); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_velocity_target(const LVector3f &target) { - - _kernel.velocityTarget = PhysxManager::vec3_to_nxVec3(target); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_torus_radius(float radius) { - - _kernel.torusRadius = radius; -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_falloff_linear(const LVector3f &falloff) { - - _kernel.falloffLinear = PhysxManager::vec3_to_nxVec3(falloff); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_falloff_quadratic(const LVector3f &falloff) { - - _kernel.falloffQuadratic = PhysxManager::vec3_to_nxVec3(falloff); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_noise(const LVector3f &noise) { - - _kernel.noise = PhysxManager::vec3_to_nxVec3(noise); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_position_multiplier(const LMatrix3f &multiplier) { - - _kernel.positionMultiplier = PhysxManager::mat3_to_nxMat33(multiplier); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_kernel_velocity_multiplier(const LMatrix3f &multiplier) { - - _kernel.velocityMultiplier = PhysxManager::mat3_to_nxMat33(multiplier); -} - -/** - * - */ -void PhysxForceFieldDesc:: -create_kernel(NxScene *scenePtr) { - - _desc.kernel = scenePtr->createForceFieldLinearKernel(_kernel); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_coordinates(PhysxForceFieldCoordinates coordinates) { - - _desc.coordinates = (NxForceFieldCoordinates) coordinates; -} - -/** - * - */ -void PhysxForceFieldDesc:: -add_include_group_shape(PhysxForceFieldShapeDesc &desc) { - - _desc.includeGroupShapes.push_back(desc.ptr()); -} - -/** - * - */ -void PhysxForceFieldDesc:: -add_shape_group(PhysxForceFieldShapeGroup *group) { - - _desc.shapeGroups.push_back(group->ptr()); -} - -/** - * - */ -void PhysxForceFieldDesc:: -set_actor(PhysxActor *actor) { - - _desc.actor = actor->ptr(); -} diff --git a/panda/src/physx/physxForceFieldDesc.h b/panda/src/physx/physxForceFieldDesc.h deleted file mode 100644 index f7974acd19..0000000000 --- a/panda/src/physx/physxForceFieldDesc.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldDesc.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXFORCEFIELDDESC_H -#define PHYSXFORCEFIELDDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxActor; -class PhysxForceFieldShapeDesc; -class PhysxForceFieldShapeGroup; - -/** - * Descriptor class for force fields. - */ -class EXPCL_PANDAPHYSX PhysxForceFieldDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxForceFieldDesc(); - INLINE ~PhysxForceFieldDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_name(const char *name); - void set_pos(const LPoint3f &pos); - void set_mat(const LMatrix4f &mat); - void set_hpr(float h, float p, float r); - void set_coordinates(PhysxForceFieldCoordinates coordinates); - void set_actor(PhysxActor *actor); - - void set_kernel_constant(const LVector3f &constant); - void set_kernel_position_target(const LPoint3f &target); - void set_kernel_position_multiplier(const LMatrix3f &multiplier); - void set_kernel_velocity_target(const LVector3f &target); - void set_kernel_velocity_multiplier(const LMatrix3f &multiplier); - void set_kernel_torus_radius(float radius); - void set_kernel_falloff_linear(const LVector3f &falloff); - void set_kernel_falloff_quadratic(const LVector3f &falloff); - void set_kernel_noise(const LVector3f &noise); - - void add_include_group_shape(PhysxForceFieldShapeDesc &shapeDesc); - void add_shape_group(PhysxForceFieldShapeGroup *group); - -public: - void create_kernel(NxScene *scenePtr); - - NxForceFieldDesc _desc; - NxForceFieldLinearKernelDesc _kernel; - -private: - std::string _name; -}; - -#include "physxForceFieldDesc.I" - -#endif // PHYSXFORCEFIELDDESC_H diff --git a/panda/src/physx/physxForceFieldShape.I b/panda/src/physx/physxForceFieldShape.I deleted file mode 100644 index a58a90136f..0000000000 --- a/panda/src/physx/physxForceFieldShape.I +++ /dev/null @@ -1,40 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShape.I - * @author enn0x - * @date 2009-11-15 - */ - -/** - * - */ -INLINE PhysxForceFieldShape:: -PhysxForceFieldShape() : PhysxObject() { - -} - -/** - * - */ -INLINE void PhysxForceFieldShape:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxForceFieldShape:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxForceFieldShape.cxx b/panda/src/physx/physxForceFieldShape.cxx deleted file mode 100644 index fe5cdfb316..0000000000 --- a/panda/src/physx/physxForceFieldShape.cxx +++ /dev/null @@ -1,155 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShape.cxx - * @author enn0x - * @date 2009-11-15 - */ - -#include "physxForceFieldShape.h" -#include "physxForceFieldShapeGroup.h" -#include "physxForceField.h" -#include "physxBoxForceFieldShape.h" -#include "physxCapsuleForceFieldShape.h" -#include "physxSphereForceFieldShape.h" -#include "physxConvexForceFieldShape.h" -#include "physxManager.h" - -TypeHandle PhysxForceFieldShape::_type_handle; - -/** - * - */ -void PhysxForceFieldShape:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - ptr()->getShapeGroup().releaseShape(*ptr()); -} - -/** - * - */ -PhysxForceFieldShape *PhysxForceFieldShape:: -factory(NxShapeType shapeType) { - - switch (shapeType) { - - case NX_SHAPE_SPHERE: - return new PhysxSphereForceFieldShape(); - - case NX_SHAPE_BOX: - return new PhysxBoxForceFieldShape(); - - case NX_SHAPE_CAPSULE: - return new PhysxCapsuleForceFieldShape(); - - case NX_SHAPE_CONVEX: - return new PhysxConvexForceFieldShape(); - } - - physx_cat.error() << "Unknown shape type.\n"; - return nullptr; -} - -/** - * Returns the owning force field if this is a shape of an include group, else - * NULL will be returned. - */ -PhysxForceField *PhysxForceFieldShape:: -get_force_field() const { - - nassertr(_error_type == ET_ok, nullptr); - - NxForceField *fieldPtr = ptr()->getForceField(); - if (fieldPtr == nullptr) { - return nullptr; - } - return (PhysxForceField *)(fieldPtr->userData); -} - -/** - * Returns the owning force field shape group. - */ -PhysxForceFieldShapeGroup *PhysxForceFieldShape:: -get_shape_group() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxForceFieldShapeGroup *)(ptr()->getShapeGroup().userData); -} - -/** - * Sets a name string for this object. The name can be retrieved again with - * get_name(). - */ -void PhysxForceFieldShape:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - ptr()->setName(_name.c_str()); -} - -/** - * Returns the name string. - */ -const char *PhysxForceFieldShape:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return ptr()->getName(); -} - -/** - * Sets the force field shape's transform. - */ -void PhysxForceFieldShape:: -set_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - - ptr()->setPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * Returns the force field shape's transform. - */ -LMatrix4f PhysxForceFieldShape:: -get_mat() const { - - nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat()); - - return PhysxManager::nxMat34_to_mat4(ptr()->getPose()); -} - -/** - * Sets the force field shape's translation. - */ -void PhysxForceFieldShape:: -set_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - - NxMat34 pose = ptr()->getPose(); - pose.t = PhysxManager::point3_to_nxVec3(pos); - ptr()->setPose(pose); -} - -/** - * Returns the force field shape's translation. - */ -LPoint3f PhysxForceFieldShape:: -get_pos() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - - return PhysxManager::nxVec3_to_point3(ptr()->getPose().t); -} diff --git a/panda/src/physx/physxForceFieldShape.h b/panda/src/physx/physxForceFieldShape.h deleted file mode 100644 index 3e6a43fe20..0000000000 --- a/panda/src/physx/physxForceFieldShape.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShape.h - * @author enn0x - * @date 2009-11-15 - */ - -#ifndef PHYSXFORCEFIELDSHAPE_H -#define PHYSXFORCEFIELDSHAPE_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxForceField; -class PhysxForceFieldShapeGroup; - -/** - * Abstract base class for force field shapes. - */ -class EXPCL_PANDAPHYSX PhysxForceFieldShape : public PhysxObject, public PhysxEnums { - -PUBLISHED: - void release(); - - PhysxForceField *get_force_field() const; - PhysxForceFieldShapeGroup *get_shape_group() const; - - void set_name(const char *name); - void set_mat(const LMatrix4f &mat); - void set_pos(const LPoint3f &pos); - - const char *get_name() const; - LMatrix4f get_mat() const; - LPoint3f get_pos() const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - static PhysxForceFieldShape *factory(NxShapeType shapeType); - - virtual NxForceFieldShape *ptr() const = 0; - - virtual void link(NxForceFieldShape *shapePtr) = 0; - virtual void unlink() = 0; - -protected: - INLINE PhysxForceFieldShape(); - -private: - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxForceFieldShape", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxForceFieldShape.I" - -#endif // PHYSXFORCEFIELDSHAPE_H diff --git a/panda/src/physx/physxForceFieldShapeDesc.I b/panda/src/physx/physxForceFieldShapeDesc.I deleted file mode 100644 index f763262bdc..0000000000 --- a/panda/src/physx/physxForceFieldShapeDesc.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeDesc.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxForceFieldShapeDesc:: -PhysxForceFieldShapeDesc() { - -} - -/** - * - */ -INLINE PhysxForceFieldShapeDesc:: -~PhysxForceFieldShapeDesc() { - -} diff --git a/panda/src/physx/physxForceFieldShapeDesc.cxx b/panda/src/physx/physxForceFieldShapeDesc.cxx deleted file mode 100644 index 4ac5f94cb8..0000000000 --- a/panda/src/physx/physxForceFieldShapeDesc.cxx +++ /dev/null @@ -1,88 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeDesc.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxForceFieldShapeDesc.h" -#include "physxManager.h" - -/** - * Sets a possible debug name. - */ -void PhysxForceFieldShapeDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - ptr()->name = _name.c_str(); -} - -/** - * - */ -void PhysxForceFieldShapeDesc:: -set_pos(const LPoint3f &pos) { - - nassertv(!pos.is_nan()); - ptr()->pose.t = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * - */ -void PhysxForceFieldShapeDesc:: -set_mat(const LMatrix4f &mat) { - - nassertv(!mat.is_nan()); - ptr()->pose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * - */ -void PhysxForceFieldShapeDesc:: -set_hpr(float h, float p, float r) { - - LQuaternionf q; - LMatrix3f rot; - NxMat34 m; - - q.set_hpr(LVector3f(h, p, r)); - q.extract_to_matrix(rot); - - ptr()->pose.M = PhysxManager::mat3_to_nxMat33(rot); -} - -/** - * - */ -const char *PhysxForceFieldShapeDesc:: -get_name() const { - - return ptr()->name; -} - -/** - * - */ -LPoint3f PhysxForceFieldShapeDesc:: -get_pos() const { - - return PhysxManager::nxVec3_to_point3(ptr()->pose.t); -} - -/** - * - */ -LMatrix4f PhysxForceFieldShapeDesc:: -get_mat() const { - - return PhysxManager::nxMat34_to_mat4(ptr()->pose); -} diff --git a/panda/src/physx/physxForceFieldShapeDesc.h b/panda/src/physx/physxForceFieldShapeDesc.h deleted file mode 100644 index fd5ab6dc1c..0000000000 --- a/panda/src/physx/physxForceFieldShapeDesc.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeDesc.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXFORCEFIELDSHAPEDESC_H -#define PHYSXFORCEFIELDSHAPEDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physx_includes.h" - -/** - * Abstract base class for descriptors for force field shapes descriptors. - */ -class EXPCL_PANDAPHYSX PhysxForceFieldShapeDesc { - -PUBLISHED: - virtual void set_to_default() = 0; - virtual bool is_valid() const = 0; - - void set_name(const char *name); - void set_pos(const LPoint3f &pos); - void set_mat(const LMatrix4f &mat); - void set_hpr(float h, float p, float r); - - const char *get_name() const; - LPoint3f get_pos() const; - LMatrix4f get_mat() const; - -public: - virtual NxForceFieldShapeDesc *ptr() const = 0; - -private: - std::string _name; - -protected: - INLINE PhysxForceFieldShapeDesc(); - INLINE ~PhysxForceFieldShapeDesc(); -}; - -#include "physxForceFieldShapeDesc.I" - -#endif // PHYSXFORCEFIELDSHAPEDESC_H diff --git a/panda/src/physx/physxForceFieldShapeGroup.I b/panda/src/physx/physxForceFieldShapeGroup.I deleted file mode 100644 index 7d65ae2d18..0000000000 --- a/panda/src/physx/physxForceFieldShapeGroup.I +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeGroup.I - * @author enn0x - * @date 2009-11-11 - */ - -/** - * - */ -INLINE PhysxForceFieldShapeGroup:: -PhysxForceFieldShapeGroup() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxForceFieldShapeGroup:: -~PhysxForceFieldShapeGroup() { - -} - -/** - * - */ -INLINE void PhysxForceFieldShapeGroup:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxForceFieldShapeGroup:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")\n"; - - _shapes.ls(out, indent_level); -} diff --git a/panda/src/physx/physxForceFieldShapeGroup.cxx b/panda/src/physx/physxForceFieldShapeGroup.cxx deleted file mode 100644 index 8819fbfd19..0000000000 --- a/panda/src/physx/physxForceFieldShapeGroup.cxx +++ /dev/null @@ -1,192 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeGroup.cxx - * @author enn0x - * @date 2009-11-11 - */ - -#include "physxForceFieldShapeGroup.h" -#include "physxForceFieldShapeGroupDesc.h" -#include "physxForceField.h" -#include "physxForceFieldShape.h" - -TypeHandle PhysxForceFieldShapeGroup::_type_handle; - -/** - * - */ -void PhysxForceFieldShapeGroup:: -link(NxForceFieldShapeGroup *groupPtr) { - - // Link self - _ptr = groupPtr; - _ptr->userData = this; - _error_type = ET_ok; - - set_name(groupPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_ffgroups.add(this); - - // Link shapes - NxU32 nShapes = _ptr->getNbShapes(); - _ptr->resetShapesIterator(); - for (NxU32 i=0; i < nShapes; i++) { - NxForceFieldShape *shapePtr = _ptr->getNextShape(); - PhysxForceFieldShape *shape = PhysxForceFieldShape::factory(shapePtr->getType()); - shape->link(shapePtr); - } -} - -/** - * - */ -void PhysxForceFieldShapeGroup:: -unlink() { - - // Unlink shapes - NxU32 nShapes = _ptr->getNbShapes(); - _ptr->resetShapesIterator(); - for (NxU32 i=0; i < nShapes; i++) { - NxForceFieldShape *shapePtr = _ptr->getNextShape(); - PhysxForceFieldShape *shape = (PhysxForceFieldShape *)shapePtr->userData; - shape->unlink(); - } - - // Unlink self - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_ffgroups.remove(this); -} - -/** - * Releases the force field shape. - */ -void PhysxForceFieldShapeGroup:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - _ptr->getScene().releaseForceFieldShapeGroup(*_ptr); - _ptr = nullptr; -} - -/** - * Returns the scene that owns this force field shape group. - */ -PhysxScene *PhysxForceFieldShapeGroup:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxScene *)(_ptr->getScene().userData); -} - -/** - * Returns the force field of this group if this is an include group. If not - * NULL will be returned. - */ -PhysxForceField *PhysxForceFieldShapeGroup:: -get_force_field() const { - - nassertr(_error_type == ET_ok, nullptr); - - if (_ptr->getForceField() == nullptr) { - return nullptr; - } - else { - return (PhysxForceField *)(_ptr->getForceField()->userData); - } -} - -/** - * Saves the state of the force field shape group object to a descriptor. - */ -void PhysxForceFieldShapeGroup:: -save_to_desc(PhysxForceFieldShapeGroupDesc &groupDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(groupDesc._desc); -} - -/** - * Sets a name string for the object that can be retrieved with get_name(). - * This is for debugging and is not used by the engine. - */ -void PhysxForceFieldShapeGroup:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - _ptr->setName(_name.c_str()); -} - -/** - * Returns the name string. - */ -const char *PhysxForceFieldShapeGroup:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return _ptr->getName(); -} - -/** - * Returns the number of shapes assigned to the force field shape group. - */ -unsigned int PhysxForceFieldShapeGroup:: -get_num_shapes() const { - - nassertr(_error_type == ET_ok, -1); - - return _ptr->getNbShapes(); -} - -/** - * Creates a force field shape and adds it to the group. - */ -PhysxForceFieldShape *PhysxForceFieldShapeGroup:: -create_shape(PhysxForceFieldShapeDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(),nullptr); - - PhysxForceFieldShape *shape = PhysxForceFieldShape::factory(desc.ptr()->getType()); - nassertr(shape, nullptr); - - NxForceFieldShape *shapePtr = _ptr->createShape(*desc.ptr()); - nassertr(shapePtr, nullptr); - - shape->link(shapePtr); - - return shape; -} - -/** - * Returns the i-th shape in the force field group. - */ -PhysxForceFieldShape *PhysxForceFieldShapeGroup:: -get_shape(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbShapes(), nullptr); - - NxForceFieldShape *shapePtr; - NxU32 nShapes = _ptr->getNbShapes(); - - _ptr->resetShapesIterator(); - for (NxU32 i=0; i <= idx; i++) { - shapePtr = _ptr->getNextShape(); - } - - return (PhysxForceFieldShape *)(shapePtr->userData); -} diff --git a/panda/src/physx/physxForceFieldShapeGroup.h b/panda/src/physx/physxForceFieldShapeGroup.h deleted file mode 100644 index c23b6de828..0000000000 --- a/panda/src/physx/physxForceFieldShapeGroup.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeGroup.h - * @author enn0x - * @date 2009-11-11 - */ - -#ifndef PHYSXFORCEFIELDSHAPEGROUP_H -#define PHYSXFORCEFIELDSHAPEGROUP_H - -#include "pandabase.h" - -#include "physxObject.h" -#include "physxEnums.h" - -#include "physx_includes.h" - -class PhysxScene; -class PhysxForceField; -class PhysxForceFieldShape; -class PhysxForceFieldShapeDesc; -class PhysxForceFieldShapeGroupDesc; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxForceFieldShapeGroup : public PhysxObject, public PhysxEnums { - -PUBLISHED: - INLINE PhysxForceFieldShapeGroup(); - INLINE ~PhysxForceFieldShapeGroup(); - - void save_to_desc(PhysxForceFieldShapeGroupDesc &groupDesc) const; - - PhysxScene *get_scene() const; - PhysxForceField *get_force_field() const; - const char *get_name() const; - - void set_name(const char *name); - - // Shapes - unsigned int get_num_shapes() const; - PhysxForceFieldShape *create_shape(PhysxForceFieldShapeDesc &desc); - PhysxForceFieldShape *get_shape(unsigned int idx) const; - MAKE_SEQ(get_shapes, get_num_shapes, get_shape); - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE NxForceFieldShapeGroup *ptr() const { return _ptr; }; - - void link(NxForceFieldShapeGroup *ptr); - void unlink(); - - PhysxObjectCollection _shapes; - -private: - NxForceFieldShapeGroup *_ptr; - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxForceFieldShapeGroup", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxForceFieldShapeGroup.I" - -#endif // PHYSXFORCEFIELDSHAPEGROUP_H diff --git a/panda/src/physx/physxForceFieldShapeGroupDesc.I b/panda/src/physx/physxForceFieldShapeGroupDesc.I deleted file mode 100644 index ed9561d2ad..0000000000 --- a/panda/src/physx/physxForceFieldShapeGroupDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeGroupDesc.I - * @author enn0x - * @date 2009-11-11 - */ - -/** - * - */ -INLINE PhysxForceFieldShapeGroupDesc:: -PhysxForceFieldShapeGroupDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxForceFieldShapeGroupDesc:: -~PhysxForceFieldShapeGroupDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxForceFieldShapeGroupDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxForceFieldShapeGroupDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxForceFieldShapeGroupDesc.cxx b/panda/src/physx/physxForceFieldShapeGroupDesc.cxx deleted file mode 100644 index 974c668824..0000000000 --- a/panda/src/physx/physxForceFieldShapeGroupDesc.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeGroupDesc.cxx - * @author enn0x - * @date 2009-11-11 - */ - -#include "physxForceFieldShapeGroupDesc.h" - -/** - * Adds a shape to the list of force field shapes composing this shape group. - */ -void PhysxForceFieldShapeGroupDesc:: -add_shape(PhysxForceFieldShapeDesc &desc) { - - _desc.shapes.push_back(desc.ptr()); -} - -/** - * Sets the optional debug name for the force field shape group. - */ -void PhysxForceFieldShapeGroupDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - _desc.name = _name.c_str(); -} - -/** - * Returns the optional debug name for this force field shape group. - */ -const char *PhysxForceFieldShapeGroupDesc:: -get_name() const { - - return _desc.name; -} - -/** - * Raise or lower individual force field shape group flags. - */ -void PhysxForceFieldShapeGroupDesc:: -set_flag(const PhysxForceFieldShapeGroupFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Returns the specified force field shape group flag. - */ -bool PhysxForceFieldShapeGroupDesc:: -get_flag(const PhysxForceFieldShapeGroupFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} diff --git a/panda/src/physx/physxForceFieldShapeGroupDesc.h b/panda/src/physx/physxForceFieldShapeGroupDesc.h deleted file mode 100644 index fab6c8d0f5..0000000000 --- a/panda/src/physx/physxForceFieldShapeGroupDesc.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxForceFieldShapeGroupDesc.h - * @author enn0x - * @date 2009-11-11 - */ - -#ifndef PHYSXFORCEFIELDSHAPEGROUPDESC_H -#define PHYSXFORCEFIELDSHAPEGROUPDESC_H - -#include "pandabase.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxForceFieldShapeDesc; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxForceFieldShapeGroupDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxForceFieldShapeGroupDesc(); - INLINE ~PhysxForceFieldShapeGroupDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void add_shape(PhysxForceFieldShapeDesc &desc); - - void set_name(const char *name); - void set_flag(PhysxForceFieldShapeGroupFlag flag, bool value); - - const char *get_name() const; - bool get_flag(PhysxForceFieldShapeGroupFlag flag) const; - -public: - NxForceFieldShapeGroupDesc _desc; - -private: - std::string _name; -}; - -#include "physxForceFieldShapeGroupDesc.I" - -#endif // PHYSXFORCEFIELDSHAPEGROUPDESC_H diff --git a/panda/src/physx/physxGroupsMask.I b/panda/src/physx/physxGroupsMask.I deleted file mode 100644 index 7ac7b7c609..0000000000 --- a/panda/src/physx/physxGroupsMask.I +++ /dev/null @@ -1,131 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxGroupsMask.I - * @author enn0x - * @date 2009-10-21 - */ - -/** - * - */ -INLINE PhysxGroupsMask:: -PhysxGroupsMask() { - - _mask.bits0 = 0x00000000; - _mask.bits1 = 0x00000000; - _mask.bits2 = 0x00000000; - _mask.bits3 = 0x00000000; -} - -/** - * - */ -INLINE PhysxGroupsMask:: -PhysxGroupsMask(NxGroupsMask mask) - : _mask(mask) { - -} - -/** - * - */ -INLINE PhysxGroupsMask:: -~PhysxGroupsMask() { - -} - -/** - * - */ -INLINE NxGroupsMask PhysxGroupsMask:: -get_mask() const { - - return _mask; -} - -/** - * - */ -INLINE void PhysxGroupsMask:: -set_mask(NxGroupsMask mask) { - - _mask = mask; -} - -/** - * - */ -INLINE unsigned int PhysxGroupsMask:: -get_bits0() const { - - return _mask.bits0; -} - -/** - * - */ -INLINE void PhysxGroupsMask:: -set_bits0(unsigned int bits) { - - _mask.bits0 = (NxU32) bits; -} - -/** - * - */ -INLINE unsigned int PhysxGroupsMask:: -get_bits1() const { - - return _mask.bits1; -} - -/** - * - */ -INLINE void PhysxGroupsMask:: -set_bits1(unsigned int bits) { - - _mask.bits1 = (NxU32) bits; -} - -/** - * - */ -INLINE unsigned int PhysxGroupsMask:: -get_bits2() const { - - return _mask.bits2; -} - -/** - * - */ -INLINE void PhysxGroupsMask:: -set_bits2(unsigned int bits) { - - _mask.bits2 = (NxU32) bits; -} - -/** - * - */ -INLINE unsigned int PhysxGroupsMask:: -get_bits3() const { - - return _mask.bits3; -} - -/** - * - */ -INLINE void PhysxGroupsMask:: -set_bits3(unsigned int bits) { - - _mask.bits3 = (NxU32) bits; -} diff --git a/panda/src/physx/physxGroupsMask.cxx b/panda/src/physx/physxGroupsMask.cxx deleted file mode 100644 index 6591ab2583..0000000000 --- a/panda/src/physx/physxGroupsMask.cxx +++ /dev/null @@ -1,140 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxGroupsMask.cxx - * @author enn0x - * @date 2009-10-21 - */ - -#include "physxGroupsMask.h" - -using std::string; - -/** - * Returns a PhysxGroupsMask whose bits are all on. - */ -PhysxGroupsMask PhysxGroupsMask:: -all_on() { - - PhysxGroupsMask mask; - mask._mask.bits0 = 0xffffffff; - mask._mask.bits1 = 0xffffffff; - mask._mask.bits2 = 0xffffffff; - mask._mask.bits3 = 0xffffffff; - return mask; -} - -/** - * Returns a PhysxGroupsMask whose bits are all off. - */ -PhysxGroupsMask PhysxGroupsMask:: -all_off() { - - PhysxGroupsMask mask; - - mask._mask.bits0 = 0x0000000; - mask._mask.bits1 = 0x0000000; - mask._mask.bits2 = 0x0000000; - mask._mask.bits3 = 0x0000000; - - return mask; -} - -/** - * Sets the nth bit on. Index must be in the range [0, 127]. - */ -void PhysxGroupsMask:: -set_bit(unsigned int idx) { - - nassertv_always(idx >= 0 && idx <= 127); - - NxU32 bits = 1 << (idx % 32); - - if (idx < 32) { - _mask.bits0 |= bits; - } - else if (idx < 64) { - _mask.bits1 |= bits; - } - else if (idx < 96) { - _mask.bits2 |= bits; - } - else { - _mask.bits3 |= bits; - } -} - -/** - * Sets the nth bit off. Index must be in the range [0, 127]. - */ -void PhysxGroupsMask:: -clear_bit(unsigned int idx) { - - nassertv_always(idx >= 0 && idx <= 127); - - NxU32 bits = 1 << (idx % 32); - - if (idx < 32) { - _mask.bits0 = _mask.bits0 & ~bits; - } - else if (idx < 64) { - _mask.bits1 = _mask.bits1 & ~bits; - } - else if (idx < 96) { - _mask.bits2 = _mask.bits2 & ~bits; - } - else { - _mask.bits3 = _mask.bits3 & ~bits; - } -} - -/** - * Returns true if the nth bit is set, false if it is cleared. Index must be - * in the range [0, 127]. - */ -bool PhysxGroupsMask:: -get_bit(unsigned int idx) const { - - nassertr_always(idx >= 0 && idx <= 127, false); - - NxU32 bits = 1 << (idx % 32); - - if (idx < 32) { - return (_mask.bits0 & bits) ? true : false; - } - else if (idx < 64) { - return (_mask.bits1 & bits) ? true : false; - } - else if (idx < 96) { - return (_mask.bits2 & bits) ? true : false; - } - else { - return (_mask.bits3 & bits) ? true : false; - } -} - -/** - * Writes the PhysxGroupsMask out as a list of ones and zeros. - */ -void PhysxGroupsMask:: -output(std::ostream &out) const { - - string name0; - string name1; - string name2; - string name3; - - for (int i=0; i<32; i++) { - name0 += (_mask.bits0 & (1 << i)) ? '1' : '0'; - name1 += (_mask.bits1 & (1 << i)) ? '1' : '0'; - name2 += (_mask.bits2 & (1 << i)) ? '1' : '0'; - name3 += (_mask.bits3 & (1 << i)) ? '1' : '0'; - } - - out << "/" << name0 << "-" << name1 << "-" << name2 << "-" << name3 << "/"; -} diff --git a/panda/src/physx/physxGroupsMask.h b/panda/src/physx/physxGroupsMask.h deleted file mode 100644 index bd1bfb129b..0000000000 --- a/panda/src/physx/physxGroupsMask.h +++ /dev/null @@ -1,64 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxGroupsMask.h - * @author enn0x - * @date 2009-10-21 - */ - -#ifndef PHYSXGROUPSMASK_H -#define PHYSXGROUPSMASK_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * 128-bit bitmask class. - */ -class EXPCL_PANDAPHYSX PhysxGroupsMask { - -PUBLISHED: - INLINE PhysxGroupsMask(); - INLINE PhysxGroupsMask(NxGroupsMask mask); - INLINE ~PhysxGroupsMask(); - - void set_bit(unsigned int idx); - void clear_bit(unsigned int idx); - bool get_bit(unsigned int idx) const; - - void output(std::ostream &out) const; - - static PhysxGroupsMask all_on(); - static PhysxGroupsMask all_off(); - - INLINE unsigned int get_bits0() const; - INLINE unsigned int get_bits1() const; - INLINE unsigned int get_bits2() const; - INLINE unsigned int get_bits3() const; - - INLINE void set_bits0( unsigned int bits ); - INLINE void set_bits1( unsigned int bits ); - INLINE void set_bits2( unsigned int bits ); - INLINE void set_bits3( unsigned int bits ); - -public: - INLINE NxGroupsMask get_mask() const; - INLINE void set_mask(NxGroupsMask mask); - - NxGroupsMask _mask; -}; - -INLINE std::ostream &operator << (std::ostream &out, const PhysxGroupsMask &mask) { - mask.output(out); - return out; -} - -#include "physxGroupsMask.I" - -#endif // PHYSXGROUPSMASK_H diff --git a/panda/src/physx/physxHeightField.I b/panda/src/physx/physxHeightField.I deleted file mode 100644 index 1f71266a8f..0000000000 --- a/panda/src/physx/physxHeightField.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightField.I - * @author enn0x - * @date 2009-10-15 - */ - -/** - * - */ -INLINE PhysxHeightField:: -PhysxHeightField() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxHeightField:: -~PhysxHeightField() { - -} - -/** - * - */ -INLINE void PhysxHeightField:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxHeightField:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxHeightField.cxx b/panda/src/physx/physxHeightField.cxx deleted file mode 100644 index 4234eaf9e6..0000000000 --- a/panda/src/physx/physxHeightField.cxx +++ /dev/null @@ -1,70 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightField.cxx - * @author enn0x - * @date 2009-10-15 - */ - -#include "physxHeightField.h" - -TypeHandle PhysxHeightField::_type_handle; - -/** - * - */ -void PhysxHeightField:: -link(NxHeightField *hfPtr) { - - PhysxManager::get_global_ptr()->_heightfields.add(this); - _ptr = hfPtr; - _error_type = ET_ok; -} - -/** - * - */ -void PhysxHeightField:: -unlink() { - - _error_type = ET_released; - PhysxManager::get_global_ptr()->_heightfields.remove(this); -} - -/** - * - */ -void PhysxHeightField:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxGetPhysicsSDK()->releaseHeightField(*_ptr); - _ptr = nullptr; -} - -/** - * - */ -float PhysxHeightField:: -get_height(float x, float y) const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getHeight(x, y); -} - -/** - * Returns the reference count for shared meshes. - */ -unsigned int PhysxHeightField:: -get_reference_count() const { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getReferenceCount(); -} diff --git a/panda/src/physx/physxHeightField.h b/panda/src/physx/physxHeightField.h deleted file mode 100644 index 3741533d1b..0000000000 --- a/panda/src/physx/physxHeightField.h +++ /dev/null @@ -1,89 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightField.h - * @author enn0x - * @date 2009-10-15 - */ - -#ifndef PHYSXHEIGHTFIELD_H -#define PHYSXHEIGHTFIELD_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxContactReport.h" -#include "physxControllerReport.h" -#include "physxTriggerReport.h" -#include "physx_includes.h" - -/** - * A height field object. Height fields work in a similar way as triangle - * meshes specified to act as height fields, with some important differences: - * - * Triangle meshes can be made of nonuniform geometry, while height fields are - * regular, rectangular grids. This means that with PhysxHeightField, you - * sacrifice flexibility in return for improved performance and decreased - * memory consumption. - * - * Height fields are referenced by shape instances of type - * PhysxHeightFieldShape. - * - * To create an instance of this class call - * PhysxManager::create_height_field(), and PhysxHeightField::release() to - * release it. This is only possible once you have released all of its - * PhysxHeightFiedShape instances before. - */ -class EXPCL_PANDAPHYSX PhysxHeightField : public PhysxObject { - -PUBLISHED: - void release(); - - unsigned int get_reference_count() const; - float get_height(float x, float y) const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE PhysxHeightField(); - INLINE ~PhysxHeightField(); - - INLINE NxHeightField *ptr() const { return _ptr; }; - - void link(NxHeightField *ptr); - void unlink(); - -private: - NxHeightField *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxHeightField", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxHeightField.I" - -#endif // PHYSXHEIGHTFIELD_H diff --git a/panda/src/physx/physxHeightFieldDesc.I b/panda/src/physx/physxHeightFieldDesc.I deleted file mode 100644 index daf9ebc58c..0000000000 --- a/panda/src/physx/physxHeightFieldDesc.I +++ /dev/null @@ -1,82 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldDesc.I - * @author enn0x - * @date 2009-10-15 - */ - -/** - * - */ -INLINE PhysxHeightFieldDesc:: -PhysxHeightFieldDesc() { - - _samples = nullptr; - _desc.setToDefault(); -} - -/** - * - */ -INLINE PhysxHeightFieldDesc:: -~PhysxHeightFieldDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxHeightFieldDesc:: -set_to_default() { - - _desc.setToDefault(); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxHeightFieldDesc:: -is_valid() const { - - return _desc.isValid(); -} - -/** - * - */ -INLINE void PhysxHeightFieldDesc:: -set_size(unsigned int num_rows, unsigned int num_columns) { - - if (_samples) { - unset_size(); - } - - _desc.format = NX_HF_S16_TM; - _desc.nbRows = (NxU32) num_rows; - _desc.nbColumns = (NxU32) num_columns; - _desc.sampleStride = sizeof(NxU32); - - _samples = new NxU32[_desc.nbColumns * _desc.nbRows]; - _desc.samples = _samples; - -} - -/** - * Releases the memory allocated for the height field samples. - */ -INLINE void PhysxHeightFieldDesc:: -unset_size() { - - if (_samples) { - _desc.nbRows = (NxU32) 0; - _desc.nbColumns = (NxU32) 0; - _desc.samples = nullptr; - delete[] _samples; - } -} diff --git a/panda/src/physx/physxHeightFieldDesc.cxx b/panda/src/physx/physxHeightFieldDesc.cxx deleted file mode 100644 index 5d9340c882..0000000000 --- a/panda/src/physx/physxHeightFieldDesc.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldDesc.cxx - * @author enn0x - * @date 2009-10-15 - */ - -#include "physxHeightFieldDesc.h" - -/** - * - */ -void PhysxHeightFieldDesc:: -set_convex_edge_threshold(float threshold) { - - _desc.convexEdgeThreshold = threshold; -} - -/** - * - */ -void PhysxHeightFieldDesc:: -set_thickness(float thickness) { - - _desc.thickness = thickness; -} - -/** - * - */ -void PhysxHeightFieldDesc:: -set_image(const PNMImage &image, unsigned short materialIndex) { - - NxU32 _32K = 32767; // (1<<15)-1; - NxU32 _64K = 65535; // (1<<16)-1; - - NxU32 nbRows = image.get_x_size(); - NxU32 nbColumns = image.get_y_size(); - - set_size(nbRows, nbColumns); - - NxU8 *currentByte = (NxU8 *)(_desc.samples); - - for (NxU32 row=0; row < nbRows; row++) { - for (NxU32 column=0; column < nbColumns; column++) { - - NxHeightFieldSample* currentSample = (NxHeightFieldSample *)currentByte; - - NxReal fvalue = image.get_bright(row, column); - NxI16 ivalue = (NxI16)((fvalue - 0.5f) * _32K); - - currentSample->height = (NxI16)ivalue; - currentSample->tessFlag = (NxU8)0; - currentSample->materialIndex0 = (NxU8)materialIndex; - currentSample->materialIndex1 = (NxU8)materialIndex; - - currentByte += _desc.sampleStride; - } - } -} - -/** - * - */ -void PhysxHeightFieldDesc:: -set_material_index(unsigned int row, unsigned int column, unsigned short materialIndex0, unsigned short materialIndex1) { - - nassertv(_desc.samples); - nassertv(row < _desc.nbRows); - nassertv(column < _desc.nbColumns); - - NxU32 idx = row * _desc.nbColumns + column; - NxU8 *byte = (NxU8 *)_desc.samples + _desc.sampleStride * idx; - NxHeightFieldSample* sample = (NxHeightFieldSample *)byte; - - // NxHeightFieldSample* sample = ((NxHeightFieldSample *)_desc.samples) + - // idx; - - sample->materialIndex0 = (NxU8)materialIndex0; - sample->materialIndex1 = (NxU8)materialIndex1; -} - -/** - * - */ -void PhysxHeightFieldDesc:: -set_height(unsigned int row, unsigned int column, short height) { - - nassertv(_desc.samples); - nassertv(row < _desc.nbRows); - nassertv(column < _desc.nbColumns); - - NxU32 idx = row * _desc.nbColumns + column; - NxU8 *byte = (NxU8 *)_desc.samples + _desc.sampleStride * idx; - NxHeightFieldSample* sample = (NxHeightFieldSample *)byte; - - sample->height = (NxI16)height; -} - -/** - * - */ -void PhysxHeightFieldDesc:: -set_tess_flag(unsigned int row, unsigned int column, unsigned short value) { - - nassertv(_desc.samples); - nassertv(row < _desc.nbRows); - nassertv(column < _desc.nbColumns); - - NxU32 idx = row * _desc.nbColumns + column; - NxU8 *byte = (NxU8 *)_desc.samples + _desc.sampleStride * idx; - NxHeightFieldSample* sample = (NxHeightFieldSample *)byte; - - nassertv(value < 2); - sample->tessFlag = (NxU8)value; -} diff --git a/panda/src/physx/physxHeightFieldDesc.h b/panda/src/physx/physxHeightFieldDesc.h deleted file mode 100644 index 1a70eff4a6..0000000000 --- a/panda/src/physx/physxHeightFieldDesc.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldDesc.h - * @author enn0x - * @date 2009-10-15 - */ - -#ifndef PHYSXHEIGHTFIELDDESC_H -#define PHYSXHEIGHTFIELDDESC_H - -#include "pandabase.h" -#include "pnmImage.h" - -#include "physx_includes.h" - -/** - * Descriptor class for height fields. The height field data is copied when a - * PhysxHeightField object is created from this descriptor. After the call - * the user may discard the original height data (e.g. release the PNGImage). - */ -class EXPCL_PANDAPHYSX PhysxHeightFieldDesc { - -PUBLISHED: - INLINE PhysxHeightFieldDesc(); - INLINE ~PhysxHeightFieldDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - INLINE void set_size(unsigned int num_rows, unsigned int num_columns); - - void set_image(const PNMImage &image, unsigned short materialIndex=0); - void set_thickness(float thickness); - void set_convex_edge_threshold(float threshold); - - void set_height(unsigned int row, unsigned int column, short height); - void set_tess_flag(unsigned int row, unsigned int column, unsigned short value); - void set_material_index(unsigned int row, unsigned int column, - unsigned short materialIndex0, unsigned short materialIndex1); - -public: - NxHeightFieldDesc _desc; - -private: - NxU32 *_samples; - - INLINE void unset_size(); -}; - -#include "physxHeightFieldDesc.I" - -#endif // PHYSXHEIGHTFIELDDESC_H diff --git a/panda/src/physx/physxHeightFieldShape.I b/panda/src/physx/physxHeightFieldShape.I deleted file mode 100644 index 03b52be971..0000000000 --- a/panda/src/physx/physxHeightFieldShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldShape.I - * @author enn0x - * @date 2009-10-15 - */ - -/** - * - */ -INLINE PhysxHeightFieldShape:: -PhysxHeightFieldShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxHeightFieldShape:: -~PhysxHeightFieldShape() { - -} diff --git a/panda/src/physx/physxHeightFieldShape.cxx b/panda/src/physx/physxHeightFieldShape.cxx deleted file mode 100644 index 87b8ef7581..0000000000 --- a/panda/src/physx/physxHeightFieldShape.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldShape.cxx - * @author enn0x - * @date 2009-10-15 - */ - -#include "physxHeightFieldShape.h" -#include "physxHeightFieldShapeDesc.h" - -TypeHandle PhysxHeightFieldShape::_type_handle; - -/** - * - */ -void PhysxHeightFieldShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isHeightField(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxHeightFieldShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxHeightFieldShape:: -save_to_desc(PhysxHeightFieldShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} diff --git a/panda/src/physx/physxHeightFieldShape.h b/panda/src/physx/physxHeightFieldShape.h deleted file mode 100644 index 671d0e7366..0000000000 --- a/panda/src/physx/physxHeightFieldShape.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldShape.h - * @author enn0x - * @date 2009-10-15 - */ - -#ifndef PHYSXHEIGHTFIELDSHAPE_H -#define PHYSXHEIGHTFIELDSHAPE_H - -#include "pandabase.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxHeightFieldShapeDesc; - -/** - * This class is a shape instance of a height field object of type - * PhysxHeightField. Each shape is owned by an actor that it is attached to. - * - * An instance can be created by calling the createShape() method of the - * PhysxActor object that should own it, with a PhysxHeightFieldShapeDesc - * object as the parameter, or by adding the shape descriptor into the - * PhysxActorDesc class before creating the actor. - * - * The shape is deleted by calling release() on the shape itself. - */ -class EXPCL_PANDAPHYSX PhysxHeightFieldShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxHeightFieldShape(); - INLINE ~PhysxHeightFieldShape(); - - void save_to_desc(PhysxHeightFieldShapeDesc &shapeDesc) const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxHeightFieldShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxHeightFieldShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxHeightFieldShape.I" - -#endif // PHYSXHEIGHTFIELDSHAPE_H diff --git a/panda/src/physx/physxHeightFieldShapeDesc.I b/panda/src/physx/physxHeightFieldShapeDesc.I deleted file mode 100644 index 70a1db5cd9..0000000000 --- a/panda/src/physx/physxHeightFieldShapeDesc.I +++ /dev/null @@ -1,38 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldShapeDesc.I - * @author enn0x - * @date 2009-10-15 - */ - -/** - * - */ -INLINE PhysxHeightFieldShapeDesc:: -PhysxHeightFieldShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxHeightFieldShapeDesc:: -~PhysxHeightFieldShapeDesc() { - -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxHeightFieldShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxHeightFieldShapeDesc.cxx b/panda/src/physx/physxHeightFieldShapeDesc.cxx deleted file mode 100644 index 3f6a7b63f9..0000000000 --- a/panda/src/physx/physxHeightFieldShapeDesc.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldShapeDesc.cxx - * @author enn0x - * @date 2009-10-15 - */ - -#include "physxHeightFieldShapeDesc.h" -#include "physxHeightField.h" - -/** - * (re)sets the structure to the default. - */ -void PhysxHeightFieldShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); - - _desc.shapeFlags = NX_SF_FEATURE_INDICES | NX_SF_VISUALIZATION; - _desc.meshFlags = NX_MESH_SMOOTH_SPHERE_COLLISIONS; - _desc.materialIndexHighBits = (NxMaterialIndex)0; - _desc.holeMaterial = (NxMaterialIndex)0; - _desc.localPose = PhysxManager::mat4_to_nxMat34(LMatrix4f::y_to_z_up_mat()); -} - -/** - * Sets the the material index that designates holes in the height field. - * This number is compared directly to sample materials. Consequently the - * high 9 bits must be zero. Default value is 0. - */ -void PhysxHeightFieldShapeDesc:: -set_hole_material(unsigned short index) { - - _desc.holeMaterial = (NxMaterialIndex)index; -} - -/** - * Sets the high 9 bits of this number are used to complete the material - * indices in the samples. The remaining low 7 bits must be zero. Default - * value is 0. - */ -void PhysxHeightFieldShapeDesc:: -set_material_index_high_bits(unsigned short index) { - - _desc.materialIndexHighBits = (NxMaterialIndex)index; -} - -/** - * Returns the the material index that designates holes in the height field. - */ -unsigned short PhysxHeightFieldShapeDesc:: -get_hole_material() const { - - return (unsigned short)_desc.holeMaterial; -} - -/** - * Returns the high 9 bits of this number are used to complete the material - * indices in the samples. - */ -unsigned short PhysxHeightFieldShapeDesc:: -get_material_index_hight_bits() const { - - return (unsigned short)_desc.materialIndexHighBits; -} - -/** - * - */ -void PhysxHeightFieldShapeDesc:: -set_dimensions(const LVector3f &dimensions) { - - NxU32 _64K = 65535; // (1<<16)-1; - - NxU32 nbRows = _desc.heightField->getNbRows(); - NxU32 nbColumns = _desc.heightField->getNbColumns(); - - _desc.rowScale = dimensions.get_x() / nbRows; - _desc.columnScale = dimensions.get_y() / nbColumns; - _desc.heightScale = dimensions.get_z() / _64K; -} - -/** - * - */ -void PhysxHeightFieldShapeDesc:: -set_height_field(const PhysxHeightField &hf) { - - _desc.heightField = hf.ptr(); -} diff --git a/panda/src/physx/physxHeightFieldShapeDesc.h b/panda/src/physx/physxHeightFieldShapeDesc.h deleted file mode 100644 index 985efc721e..0000000000 --- a/panda/src/physx/physxHeightFieldShapeDesc.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxHeightFieldShapeDesc.h - * @author enn0x - * @date 2009-10-15 - */ - -#ifndef PHYSXHEIGHTFIELDSHAPEDESC_H -#define PHYSXHEIGHTFIELDSHAPEDESC_H - -#include "pandabase.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -class PhysxHeightField; - -/** - * Descriptor class for PhysxHeightFieldShape. - */ -class EXPCL_PANDAPHYSX PhysxHeightFieldShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxHeightFieldShapeDesc(); - INLINE ~PhysxHeightFieldShapeDesc(); - - void set_to_default(); - INLINE bool is_valid() const; - - void set_height_field(const PhysxHeightField &hf); - void set_dimensions(const LVector3f &dimensions); - void set_hole_material(unsigned short index); - void set_material_index_high_bits(unsigned short index); - - unsigned short get_hole_material() const; - unsigned short get_material_index_hight_bits() const; - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxHeightFieldShapeDesc _desc; -}; - -#include "physxHeightFieldShapeDesc.I" - -#endif // PHYSXHEIGHTFIELDSHAPEDESC_H diff --git a/panda/src/physx/physxJoint.I b/panda/src/physx/physxJoint.I deleted file mode 100644 index 663f2b3253..0000000000 --- a/panda/src/physx/physxJoint.I +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxJoint:: -PhysxJoint() : PhysxObject() { - -} - -/** - * - */ -INLINE void PhysxJoint:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxJoint:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")"; - - NxActor *actorPtr[2]; - ptr()->getActors(&actorPtr[0], &actorPtr[1]); - - if (actorPtr[0]) { - out << " A1:0x" << actorPtr[0]->userData; - } - - if (actorPtr[1]) { - out << " A2:0x" << actorPtr[1]->userData; - } - - out << "\n"; -} diff --git a/panda/src/physx/physxJoint.cxx b/panda/src/physx/physxJoint.cxx deleted file mode 100644 index 0af47ee6e0..0000000000 --- a/panda/src/physx/physxJoint.cxx +++ /dev/null @@ -1,294 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxJoint.h" -#include "physxManager.h" -#include "physxActor.h" -#include "physxScene.h" -#include "physxCylindricalJoint.h" -#include "physxDistanceJoint.h" -#include "physxFixedJoint.h" -#include "physxPointInPlaneJoint.h" -#include "physxPointOnLineJoint.h" -#include "physxPrismaticJoint.h" -#include "physxPulleyJoint.h" -#include "physxRevoluteJoint.h" -#include "physxSphericalJoint.h" -#include "physxD6Joint.h" - -TypeHandle PhysxJoint::_type_handle; - -/** - * - */ -void PhysxJoint:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - ptr()->getScene().releaseJoint(*ptr()); -} - -/** - * - */ -PhysxJoint *PhysxJoint:: -factory(NxJointType shapeType) { - - switch (shapeType) { - - case NX_JOINT_PRISMATIC: - return new PhysxPrismaticJoint(); - - case NX_JOINT_REVOLUTE: - return new PhysxRevoluteJoint(); - - case NX_JOINT_CYLINDRICAL: - return new PhysxCylindricalJoint(); - - case NX_JOINT_SPHERICAL: - return new PhysxSphericalJoint(); - - case NX_JOINT_POINT_ON_LINE: - return new PhysxPointOnLineJoint(); - - case NX_JOINT_POINT_IN_PLANE: - return new PhysxPointInPlaneJoint(); - - case NX_JOINT_DISTANCE: - return new PhysxDistanceJoint(); - - case NX_JOINT_PULLEY: - return new PhysxPulleyJoint(); - - case NX_JOINT_FIXED: - return new PhysxFixedJoint(); - - case NX_JOINT_D6: - return new PhysxD6Joint(); - } - - physx_cat.error() << "Unknown joint type.\n"; - return nullptr; -} - -/** - * Sets a name string for this object. The name can be retrieved again with - * get_name(). This is for debugging and is not used by the physics engine. - */ -void PhysxJoint:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - ptr()->setName(_name.c_str()); -} - -/** - * Returns the name string. - */ -const char *PhysxJoint:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return ptr()->getName(); -} - -/** - * Retrieves the actor which this joint is associated with. - */ -PhysxActor *PhysxJoint:: -get_actor(unsigned int idx) const { - - nassertr_always(idx < 2, nullptr); - nassertr(_error_type == ET_ok, nullptr); - - NxActor *actorPtr[2]; - ptr()->getActors(&actorPtr[0], &actorPtr[1]); - return (PhysxActor *)(actorPtr[idx]->userData); -} - -/** - * Retrieves the scene which this joint is associated with. - */ -PhysxScene *PhysxJoint:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxScene *)(ptr()->getScene().userData); -} - -/** - * Sets the point where the two actors are attached, specified in global - * coordinates. - */ -void PhysxJoint:: -set_global_anchor(const LPoint3f &anchor) { - - nassertv(_error_type == ET_ok); - ptr()->setGlobalAnchor(PhysxManager::point3_to_nxVec3(anchor)); -} - -/** - * Retrieves the joint anchor. - */ -LPoint3f PhysxJoint:: -get_global_anchor() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - return PhysxManager::nxVec3_to_point3(ptr()->getGlobalAnchor()); -} - -/** - * Sets the direction of the joint's primary axis, specified in global - * coordinates. - */ -void PhysxJoint:: -set_global_axis(const LVector3f &axis) { - - nassertv(_error_type == ET_ok); - ptr()->setGlobalAxis(PhysxManager::vec3_to_nxVec3(axis)); -} - -/** - * Retrieves the joint axis. - */ -LVector3f PhysxJoint:: -get_global_axis() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(ptr()->getGlobalAxis()); -} - -/** - * Sets the maximum force magnitude that the joint is able to withstand - * without breaking. - * - * If the joint force rises above this threshold, the joint breaks, and - * becomes disabled. - * - * There are two values, one for linear forces, and one for angular forces. - * Both values are used directly as a value for the maximum impulse tolerated - * by the joint constraints. - * - * Both force values are NX_MAX_REAL by default. This setting makes the joint - * unbreakable. The values should always be nonnegative. - * - * The distinction between maxForce and maxTorque is dependent on how the - * joint is implemented internally, which may not be obvious. For example - * what appears to be an angular degree of freedom may be constrained - * indirectly by a linear constraint. - * - * So in most practical applications the user should set both maxTorque and - * maxForce to low values. - */ -void PhysxJoint:: -set_breakable(float maxForce, float maxTorque) { - - nassertv(_error_type == ET_ok); - ptr()->setBreakable(maxForce, maxTorque); -} - -/** - * Switch between acceleration and force based spring. - */ -void PhysxJoint:: -set_use_acceleration_spring(bool value) { - - nassertv(_error_type == ET_ok); - ptr()->setUseAccelerationSpring(value); -} - -/** - * Checks whether acceleration spring is used. - */ -bool PhysxJoint:: -get_use_acceleration_spring() const { - - nassertr(_error_type == ET_ok, false); - return ptr()->getUseAccelerationSpring(); -} - -/** - * Sets the solver extrapolation factor. - */ -void PhysxJoint:: -set_solver_extrapolation_factor(float factor) { - - nassertv(_error_type == ET_ok); - ptr()->setSolverExtrapolationFactor(factor); -} - -/** - * Retrieves the solver extrapolation factor. - */ -float PhysxJoint:: -get_solver_extrapolation_factor() const { - - nassertr(_error_type == ET_ok, false); - return ptr()->getSolverExtrapolationFactor(); -} - -/** - * Sets the limit point. The point is specified in the global coordinate - * frame. - * - * All types of joints may be limited with the same system: You may elect a - * point attached to one of the two actors to act as the limit point. You may - * also specify several planes attached to the other actor. - * - * The points and planes move together with the actor they are attached to. - * - * The simulation then makes certain that the pair of actors only move - * relative to each other so that the limit point stays on the positive side - * of all limit planes. - * - * The default limit point is (0,0,0) in the local frame of actor2. Calling - * this deletes all existing limit planes - */ -void PhysxJoint:: -set_limit_point(const LPoint3f &pos, bool isOnActor2) { - - nassertv(_error_type == ET_ok); - ptr()->setLimitPoint(PhysxManager::point3_to_nxVec3(pos), isOnActor2); -} - -/** - * Adds a limit plane. The parameters are given in global coordinates. The - * plane is affixed to the actor that does not have the limit point. - * - * The normal of the plane points toward the positive side of the plane, and - * thus toward the limit point. If the normal points away from the limit - * point at the time of this call, the method returns false and the limit - * plane is ignored. - */ -void PhysxJoint:: -add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution) { - - nassertv(_error_type == ET_ok); - ptr()->addLimitPlane(PhysxManager::vec3_to_nxVec3(normal), - PhysxManager::point3_to_nxVec3(pointInPlane), - restitution); -} - -/** - * Deletes all limit planes added to the joint. - */ -void PhysxJoint:: -purge_limit_planes() { - - nassertv(_error_type == ET_ok); - ptr()->purgeLimitPlanes(); -} diff --git a/panda/src/physx/physxJoint.h b/panda/src/physx/physxJoint.h deleted file mode 100644 index adb536e2fb..0000000000 --- a/panda/src/physx/physxJoint.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXJOINT_H -#define PHYSXJOINT_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxActor; -class PhysxScene; - -/** - * Abstract base class for the different types of joints. All joints are used - * to connect two dynamic actors, or an actor and the environment. - */ -class EXPCL_PANDAPHYSX PhysxJoint : public PhysxObject, public PhysxEnums { - -PUBLISHED: - void release(); - - PhysxActor *get_actor(unsigned int idx) const; - PhysxScene *get_scene() const; - - void purge_limit_planes(); - - void set_name(const char *name); - void set_global_anchor(const LPoint3f &anchor); - void set_global_axis(const LVector3f &axis); - void set_breakable(float maxForce, float maxTorque); - void set_solver_extrapolation_factor(float factor); - void set_use_acceleration_spring(bool value); - void set_limit_point(const LPoint3f &pos, bool isOnActor2=true); - void add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f); - - const char *get_name() const; - LPoint3f get_global_anchor() const; - LVector3f get_global_axis() const; - float get_solver_extrapolation_factor() const; - bool get_use_acceleration_spring() const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - static PhysxJoint *factory(NxJointType shapeType); - - virtual NxJoint *ptr() const = 0; - - virtual void link(NxJoint *shapePtr) = 0; - virtual void unlink() = 0; - -protected: - INLINE PhysxJoint(); - -private: - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxJoint", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxJoint.I" - -#endif // PHYSXJOINT_H diff --git a/panda/src/physx/physxJointDesc.I b/panda/src/physx/physxJointDesc.I deleted file mode 100644 index dc511cfecc..0000000000 --- a/panda/src/physx/physxJointDesc.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxJointDesc:: -PhysxJointDesc() { - -} - -/** - * - */ -INLINE PhysxJointDesc:: -~PhysxJointDesc() { - -} diff --git a/panda/src/physx/physxJointDesc.cxx b/panda/src/physx/physxJointDesc.cxx deleted file mode 100644 index dc0eeb1196..0000000000 --- a/panda/src/physx/physxJointDesc.cxx +++ /dev/null @@ -1,220 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxJointDesc.h" -#include "physxManager.h" - -/** - * Sets a possible debug name. - */ -void PhysxJointDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - ptr()->name = _name.c_str(); -} - -/** - * Set a possible debug name. - */ -void PhysxJointDesc:: -set_max_force(float force) { - - ptr()->maxForce = force; -} - -/** - * Set the maximum angular force (torque) that the joint can withstand before - * breaking, must be positive. - */ -void PhysxJointDesc:: -set_max_torque(float torque) { - - ptr()->maxTorque = torque; -} - -/** - * Set the extrapolation factor for solving joint constraints. - */ -void PhysxJointDesc:: -set_solver_extrapolation_factor(float factor) { - - ptr()->solverExtrapolationFactor = factor; -} - -/** - * Set the two actors connected by the joint. idx must be either 0 or 1. - */ -void PhysxJointDesc:: -set_actor(unsigned int idx, const PhysxActor &actor) { - - nassertv_always(idx < 2); - ptr()->actor[idx] = actor.ptr(); -} - -/** - * Set the X axis of joint space, in actor[i]'s space, orthogonal to - * localAxis[i]. idx must be either 0 or 1. - */ -void PhysxJointDesc:: -set_local_normal(unsigned int idx, const LVector3f &normal) { - - nassertv_always(idx < 2); - ptr()->localNormal[idx] = PhysxManager::vec3_to_nxVec3(normal); -} - -/** - * Set the Z axis of joint space, in actor[i]'s space. This is the primary - * axis of the joint. idx must be either 0 or 1. - */ -void PhysxJointDesc:: -set_local_axis(unsigned int idx, const LVector3f &axis) { - - nassertv_always(idx < 2); - ptr()->localAxis[idx] = PhysxManager::vec3_to_nxVec3(axis); -} - -/** - * Set the attachment point of joint in actor[i]'s space. idx must be either - * 0 or 1. - */ -void PhysxJointDesc:: -set_local_anchor(unsigned int idx, const LPoint3f &anchor) { - - nassertv_always(idx < 2); - ptr()->localAnchor[idx] = PhysxManager::point3_to_nxVec3(anchor); -} - -/** - * Set or clear a single JointFlag. - */ -void PhysxJointDesc:: -set_joint_flag(PhysxJointFlag flag, bool value) { - - if (value == true) { - ptr()->jointFlags |= flag; - } - else { - ptr()->jointFlags &= ~(flag); - } -} - -/** - * Set the local axis/normal using a world space axis. - */ -void PhysxJointDesc:: -set_global_axis(const LVector3f &axis) { - - ptr()->setGlobalAxis(PhysxManager::vec3_to_nxVec3(axis)); -} - -/** - * Set the anchor using a world space point. - */ -void PhysxJointDesc:: -set_global_anchor(const LPoint3f &anchor) { - - ptr()->setGlobalAnchor(PhysxManager::point3_to_nxVec3(anchor)); -} - -/** - * - */ -const char *PhysxJointDesc:: -get_name() const { - - return ptr()->name; -} - -/** - * - */ -float PhysxJointDesc:: -get_max_force() const { - - return ptr()->maxForce; -} - -/** - * - */ -float PhysxJointDesc:: -get_max_torque() const { - - return ptr()->maxTorque; -} - -/** - * - */ -float PhysxJointDesc:: -get_solver_extrapolation_factor() const { - - return ptr()->solverExtrapolationFactor; -} - -/** - * - */ -LVector3f PhysxJointDesc:: -get_local_normal(unsigned int idx) const { - - nassertr_always(idx < 2, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(ptr()->localNormal[idx]); -} - -/** - * - */ -LVector3f PhysxJointDesc:: -get_local_axis(unsigned int idx) const { - - nassertr_always(idx < 2, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(ptr()->localAxis[idx]); -} - -/** - * - */ -LPoint3f PhysxJointDesc:: -get_local_anchor(unsigned int idx) const { - - nassertr_always(idx < 2, LPoint3f::zero()); - return PhysxManager::nxVec3_to_point3(ptr()->localAnchor[idx]); -} - -/** - * - */ -bool PhysxJointDesc:: -get_joint_flag(const PhysxJointFlag flag) const { - - return (ptr()->jointFlags & flag) ? true : false; -} - -/** - * - */ -PhysxActor *PhysxJointDesc:: -get_actor(unsigned int idx) const { - - nassertr_always(idx < 2, nullptr); - - NxActor *actorPtr = ptr()->actor[idx]; - if (actorPtr == nullptr) { - return nullptr; - } - else { - return (PhysxActor *)(actorPtr->userData); - } -} diff --git a/panda/src/physx/physxJointDesc.h b/panda/src/physx/physxJointDesc.h deleted file mode 100644 index b123dd81e2..0000000000 --- a/panda/src/physx/physxJointDesc.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXJOINTDESC_H -#define PHYSXJOINTDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxActor; - -/** - * Abstract base class for joint descriptors. - */ -class EXPCL_PANDAPHYSX PhysxJointDesc : public PhysxEnums { - -PUBLISHED: - virtual void set_to_default() = 0; - virtual bool is_valid() const = 0; - - void set_name(const char *name); - void set_joint_flag(PhysxJointFlag flag, bool value); - void set_max_force(float force); - void set_max_torque(float torque); - void set_solver_extrapolation_factor(float factor); - void set_global_axis(const LVector3f &axis); - void set_global_anchor(const LPoint3f &anchor); - void set_local_normal(unsigned int idx, const LVector3f &normal); - void set_local_axis(unsigned int idx, const LVector3f &axis); - void set_local_anchor(unsigned int idx, const LPoint3f &anchor); - void set_actor(unsigned int idx, const PhysxActor &actor); - - const char *get_name() const; - bool get_joint_flag(PhysxJointFlag flag) const; - float get_max_force() const; - float get_max_torque() const; - float get_solver_extrapolation_factor() const; - LVector3f get_local_normal(unsigned int idx) const; - LVector3f get_local_axis(unsigned int idx) const; - LPoint3f get_local_anchor(unsigned int idx) const; - PhysxActor *get_actor(unsigned int idx) const; - -public: - virtual NxJointDesc *ptr() const = 0; - -private: - std::string _name; - -protected: - INLINE PhysxJointDesc(); - INLINE ~PhysxJointDesc(); -}; - -#include "physxJointDesc.I" - -#endif // PHYSXJOINTDESC_H diff --git a/panda/src/physx/physxJointDriveDesc.I b/panda/src/physx/physxJointDriveDesc.I deleted file mode 100644 index d8aeb3adf8..0000000000 --- a/panda/src/physx/physxJointDriveDesc.I +++ /dev/null @@ -1,39 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointDriveDesc.I - * @author enn0x - * @date 2009-10-01 - */ - -/** - * - */ -INLINE PhysxJointDriveDesc:: -PhysxJointDriveDesc() { - -} - -/** - * - */ -INLINE PhysxJointDriveDesc:: -PhysxJointDriveDesc(float spring, float damping, float forceLimit) { - - _desc.spring = spring; - _desc.damping = damping; - _desc.forceLimit = forceLimit; -} - -/** - * - */ -INLINE PhysxJointDriveDesc:: -~PhysxJointDriveDesc() { - -} diff --git a/panda/src/physx/physxJointDriveDesc.cxx b/panda/src/physx/physxJointDriveDesc.cxx deleted file mode 100644 index 83fd50a511..0000000000 --- a/panda/src/physx/physxJointDriveDesc.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointDriveDesc.cxx - * @author enn0x - * @date 2009-10-01 - */ - -#include "physxJointDriveDesc.h" - -/** - * - */ -void PhysxJointDriveDesc:: -set_spring(float spring) { - - _desc.spring = spring; -} - -/** - * - */ -void PhysxJointDriveDesc:: -set_damping(float damping) { - - _desc.damping = damping; -} - -/** - * - */ -void PhysxJointDriveDesc:: -set_force_limit(float forceLimit) { - - _desc.forceLimit = forceLimit; -} - -/** - * - */ -void PhysxJointDriveDesc:: -set_drive_type(PhysxD6JointDriveType driveType) { - - _desc.driveType = (NxD6JointDriveType)driveType; -} - -/** - * - */ -float PhysxJointDriveDesc:: -get_spring() const { - - return _desc.spring; -} - -/** - * - */ -float PhysxJointDriveDesc:: -get_damping() const { - - return _desc.damping; -} - -/** - * - */ -float PhysxJointDriveDesc:: -get_force_limit() const { - - return _desc.forceLimit; -} - -/** - * - */ -PhysxEnums::PhysxD6JointDriveType PhysxJointDriveDesc:: -get_drive_type() const { - - return (PhysxD6JointDriveType)_desc.driveType.bitField; -} diff --git a/panda/src/physx/physxJointDriveDesc.h b/panda/src/physx/physxJointDriveDesc.h deleted file mode 100644 index 156ddee243..0000000000 --- a/panda/src/physx/physxJointDriveDesc.h +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointDriveDesc.h - * @author enn0x - * @date 2009-10-01 - */ - -#ifndef PHYSXJOINTDRIVEDESC_H -#define PHYSXJOINTDRIVEDESC_H - -#include "pandabase.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -/** - * Used to describe drive properties for a PhysxD6Joint. - */ -class EXPCL_PANDAPHYSX PhysxJointDriveDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxJointDriveDesc(); - INLINE PhysxJointDriveDesc(float sping, float damping, float forceLimit); - INLINE ~PhysxJointDriveDesc(); - - void set_drive_type(PhysxD6JointDriveType type); - void set_spring(float spring); - void set_damping(float damping); - void set_force_limit(float limit); - - PhysxD6JointDriveType get_drive_type() const; - float get_spring() const; - float get_damping() const; - float get_force_limit() const; - -public: - NxJointDriveDesc _desc; -}; - -#include "physxJointDriveDesc.I" - -#endif // PHYSXJOINTDRIVEDESC_H diff --git a/panda/src/physx/physxJointLimitDesc.I b/panda/src/physx/physxJointLimitDesc.I deleted file mode 100644 index 83de64ea50..0000000000 --- a/panda/src/physx/physxJointLimitDesc.I +++ /dev/null @@ -1,39 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointLimitDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxJointLimitDesc:: -PhysxJointLimitDesc() { - -} - -/** - * - */ -INLINE PhysxJointLimitDesc:: -PhysxJointLimitDesc(float value, float restitution, float hardness) { - - _desc.value = value; - _desc.restitution = restitution; - _desc.hardness = hardness; -} - -/** - * - */ -INLINE PhysxJointLimitDesc:: -~PhysxJointLimitDesc() { - -} diff --git a/panda/src/physx/physxJointLimitDesc.cxx b/panda/src/physx/physxJointLimitDesc.cxx deleted file mode 100644 index c848bb7c33..0000000000 --- a/panda/src/physx/physxJointLimitDesc.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointLimitDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxJointLimitDesc.h" - -/** - * - */ -void PhysxJointLimitDesc:: -set_value(float value) { - - _desc.value = value; -} - -/** - * - */ -void PhysxJointLimitDesc:: -set_restitution(float restitution) { - - _desc.restitution = restitution; -} - -/** - * - */ -void PhysxJointLimitDesc:: -set_hardness(float hardness) { - - _desc.hardness = hardness; -} - -/** - * - */ -float PhysxJointLimitDesc:: -get_value() const { - - return _desc.value; -} - -/** - * - */ -float PhysxJointLimitDesc:: -get_restitution() const { - - return _desc.restitution; -} - -/** - * - */ -float PhysxJointLimitDesc:: -get_hardness() const { - - return _desc.hardness; -} diff --git a/panda/src/physx/physxJointLimitDesc.h b/panda/src/physx/physxJointLimitDesc.h deleted file mode 100644 index a19c81d183..0000000000 --- a/panda/src/physx/physxJointLimitDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointLimitDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXJOINTLIMITDESC_H -#define PHYSXJOINTLIMITDESC_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * Describes a joint limit. - */ -class EXPCL_PANDAPHYSX PhysxJointLimitDesc { - -PUBLISHED: - INLINE PhysxJointLimitDesc(); - INLINE PhysxJointLimitDesc(float value, float restitution, float hardness); - INLINE ~PhysxJointLimitDesc(); - - void set_value(float value); - void set_restitution(float restitution); - void set_hardness(float hardness); - - float get_value() const; - float get_restitution() const; - float get_hardness() const; - -public: - NxJointLimitDesc _desc; -}; - -#include "physxJointLimitDesc.I" - -#endif // PHYSXJOINTLIMITDESC_H diff --git a/panda/src/physx/physxJointLimitSoftDesc.I b/panda/src/physx/physxJointLimitSoftDesc.I deleted file mode 100644 index dc8bffd895..0000000000 --- a/panda/src/physx/physxJointLimitSoftDesc.I +++ /dev/null @@ -1,40 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointLimitSoftDesc.I - * @author enn0x - * @date 2009-10-01 - */ - -/** - * - */ -INLINE PhysxJointLimitSoftDesc:: -PhysxJointLimitSoftDesc() { - -} - -/** - * - */ -INLINE PhysxJointLimitSoftDesc:: -PhysxJointLimitSoftDesc(float value, float restitution, float spring, float damping) { - - _desc.value = value; - _desc.restitution = restitution; - _desc.spring = spring; - _desc.damping = damping; -} - -/** - * - */ -INLINE PhysxJointLimitSoftDesc:: -~PhysxJointLimitSoftDesc() { - -} diff --git a/panda/src/physx/physxJointLimitSoftDesc.cxx b/panda/src/physx/physxJointLimitSoftDesc.cxx deleted file mode 100644 index e0bcf271ce..0000000000 --- a/panda/src/physx/physxJointLimitSoftDesc.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointLimitSoftDesc.cxx - * @author enn0x - * @date 2009-10-01 - */ - -#include "physxJointLimitSoftDesc.h" - -/** - * - */ -void PhysxJointLimitSoftDesc:: -set_value(float value) { - - _desc.value = value; -} - -/** - * - */ -void PhysxJointLimitSoftDesc:: -set_restitution(float restitution) { - - _desc.restitution = restitution; -} - -/** - * - */ -void PhysxJointLimitSoftDesc:: -set_spring(float spring) { - - _desc.spring = spring; -} - -/** - * - */ -void PhysxJointLimitSoftDesc:: -set_damping(float damping) { - - _desc.damping = damping; -} - -/** - * - */ -float PhysxJointLimitSoftDesc:: -get_value() const { - - return _desc.value; -} - -/** - * - */ -float PhysxJointLimitSoftDesc:: -get_restitution() const { - - return _desc.restitution; -} - -/** - * - */ -float PhysxJointLimitSoftDesc:: -get_spring() const { - - return _desc.spring; -} - -/** - * - */ -float PhysxJointLimitSoftDesc:: -get_damping() const { - - return _desc.damping; -} diff --git a/panda/src/physx/physxJointLimitSoftDesc.h b/panda/src/physx/physxJointLimitSoftDesc.h deleted file mode 100644 index eed8e9517a..0000000000 --- a/panda/src/physx/physxJointLimitSoftDesc.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxJointLimitSoftDesc.h - * @author enn0x - * @date 2009-10-01 - */ - -#ifndef PHYSXJOINTLIMITSOFTDESC_H -#define PHYSXJOINTLIMITSOFTDESC_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * Describes a joint limit. - */ -class EXPCL_PANDAPHYSX PhysxJointLimitSoftDesc { - -PUBLISHED: - INLINE PhysxJointLimitSoftDesc(); - INLINE PhysxJointLimitSoftDesc(float value, float restitution, float spring, float damping); - INLINE ~PhysxJointLimitSoftDesc(); - - void set_value(float value); - void set_restitution(float restitution); - void set_spring(float spring); - void set_damping(float damping); - - float get_value() const; - float get_restitution() const; - float get_spring() const; - float get_damping() const; - -public: - NxJointLimitSoftDesc _desc; -}; - -#include "physxJointLimitSoftDesc.I" - -#endif // PHYSXJOINTLIMITSOFTDESC_H diff --git a/panda/src/physx/physxKitchen.I b/panda/src/physx/physxKitchen.I deleted file mode 100644 index 98c9507b6b..0000000000 --- a/panda/src/physx/physxKitchen.I +++ /dev/null @@ -1,33 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxKitchen.I - * @author enn0x - * @date 2009-10-12 - */ - -/** - * - */ -PhysxKitchen:: -PhysxKitchen() { - - _cooking = NxGetCookingLib( NX_PHYSICS_SDK_VERSION ); - - bool status = _cooking->NxInitCooking(); - nassertv_always( status ); -} - -/** - * - */ -PhysxKitchen:: -~PhysxKitchen() { - - _cooking->NxCloseCooking(); -} diff --git a/panda/src/physx/physxKitchen.cxx b/panda/src/physx/physxKitchen.cxx deleted file mode 100644 index 8dda747eaa..0000000000 --- a/panda/src/physx/physxKitchen.cxx +++ /dev/null @@ -1,252 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxKitchen.cxx - * @author enn0x - * @date 2009-10-12 - */ - -#include "physxKitchen.h" -#include "physxConvexMesh.h" -#include "physxConvexMeshDesc.h" -#include "physxTriangleMesh.h" -#include "physxTriangleMeshDesc.h" -#include "physxFileStream.h" -#include "physxMemoryReadBuffer.h" -#include "physxMemoryWriteBuffer.h" -#include "physxClothMesh.h" -#include "physxClothMeshDesc.h" -#include "physxSoftBodyMesh.h" -#include "physxSoftBodyMeshDesc.h" - -/** - * Sets two parameters which affect mesh cooking: - * - * Skin width for convex meshes: Specifies the amount to inflate the convex - * mesh by when the new convex hull generator is used. Inflating the mesh - * allows the user to hide interpenetration errors by increasing the size of - * the collision mesh with respect to the size of the rendered geometry. - * Default value: 0.025f - * - * Hint to choose speed or less memory for collision structures. Default - * value: false - */ -void PhysxKitchen:: -set_cooking_params(float skinWidth, bool hintCollisionSpeed) { - - NxCookingParams params; - - params.targetPlatform = PLATFORM_PC; - params.skinWidth = skinWidth; - params.hintCollisionSpeed = hintCollisionSpeed; - - _cooking->NxSetCookingParams(params); -} - -/** - * - */ -bool PhysxKitchen:: -cook_convex_mesh(const PhysxConvexMeshDesc &meshDesc, const Filename &filename) { - - nassertr_always(!filename.empty(), false); - nassertr_always(filename.touch(), false); - nassertr_always(meshDesc.is_valid(), false); - - PhysxFileStream fs = PhysxFileStream(filename, false); - return _cooking->NxCookConvexMesh(meshDesc.get_desc(), fs); -} - -/** - * - */ -bool PhysxKitchen:: -cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc, const Filename &filename) { - - nassertr_always(!filename.empty(), false); - nassertr_always(filename.touch(), false); - nassertr_always(meshDesc.is_valid(), false); - - PhysxFileStream fs = PhysxFileStream(filename, false); - return _cooking->NxCookTriangleMesh(meshDesc.get_desc(), fs); -} - -/** - * - */ -bool PhysxKitchen:: -cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc, const Filename &filename) { - - nassertr_always(!filename.empty(), false); - nassertr_always(filename.touch(), false); - nassertr_always(meshDesc.is_valid(), false); - - PhysxFileStream fs = PhysxFileStream(filename, false); - return _cooking->NxCookClothMesh(meshDesc.get_desc(), fs); -} - -/** - * - */ -bool PhysxKitchen:: -cook_soft_body_mesh(const PhysxSoftBodyMeshDesc &meshDesc, const Filename &filename) { - - nassertr_always(!filename.empty(), false); - nassertr_always(filename.touch(), false); - nassertr_always(meshDesc.is_valid(), false); - - PhysxFileStream fs = PhysxFileStream(filename, false); - return _cooking->NxCookSoftBodyMesh(meshDesc.get_desc(), fs); -} - -/** - * - */ -bool PhysxKitchen:: -cook_texcoords(const PhysxClothMeshDesc &meshDesc, const Filename &filename) { - - nassertr_always(!filename.empty(), false); - nassertr_always(filename.touch(), false); - nassertr_always(meshDesc.is_valid(), false); - - const plist texcoords = meshDesc.get_texcoords(); - - // Write texcoords to binary file - PhysxFileStream fs = PhysxFileStream(filename.c_str(), false); - - // Header - fs.storeByte('N'); - fs.storeByte('X'); - fs.storeByte('S'); - fs.storeByte(1); - fs.storeByte('T'); - fs.storeByte('E'); - fs.storeByte('X'); - fs.storeByte('C'); - fs.storeByte(1); - - // Size - fs.storeDword(texcoords.size()); - - // Texcoords - plist::const_iterator it; - for(it=texcoords.begin(); it!=texcoords.end(); it++) { - LPoint2f v = *it; - - fs.storeFloat(v.get_x()); - fs.storeFloat(v.get_y()); - } - - return true; -} - -/** - * - */ -PhysxConvexMesh *PhysxKitchen:: -cook_convex_mesh(const PhysxConvexMeshDesc &meshDesc) { - - nassertr_always(meshDesc.is_valid(), nullptr); - - PhysxMemoryWriteBuffer buffer; - bool status = _cooking->NxCookConvexMesh(meshDesc.get_desc(), buffer); - nassertr(status, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr(sdk, nullptr); - - PhysxConvexMesh *mesh = new PhysxConvexMesh(); - nassertr(mesh, nullptr); - - NxConvexMesh *meshPtr = sdk->createConvexMesh(PhysxMemoryReadBuffer(buffer.data)); - nassertr(meshPtr, nullptr); - - mesh->link(meshPtr); - - return mesh; -} - -/** - * - */ -PhysxTriangleMesh *PhysxKitchen:: -cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc) { - - nassertr_always(meshDesc.is_valid(), nullptr); - - PhysxMemoryWriteBuffer buffer; - bool status = _cooking->NxCookTriangleMesh(meshDesc.get_desc(), buffer); - nassertr(status, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr(sdk, nullptr); - - PhysxTriangleMesh *mesh = new PhysxTriangleMesh(); - nassertr(mesh, nullptr); - - NxTriangleMesh *meshPtr = sdk->createTriangleMesh(PhysxMemoryReadBuffer(buffer.data)); - nassertr(meshPtr, nullptr); - - mesh->link(meshPtr); - - return mesh; -} - -/** - * - */ -PhysxClothMesh *PhysxKitchen:: -cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc) { - - nassertr_always(meshDesc.is_valid(), nullptr); - - PhysxMemoryWriteBuffer wbuffer; - bool status = _cooking->NxCookClothMesh(meshDesc.get_desc(), wbuffer); - nassertr(status, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr(sdk, nullptr); - - PhysxClothMesh *mesh = new PhysxClothMesh(); - nassertr(mesh, nullptr); - - PhysxMemoryReadBuffer rbuffer(wbuffer.data); - NxClothMesh *meshPtr = sdk->createClothMesh(rbuffer); - nassertr(meshPtr, nullptr); - - mesh->link(meshPtr); - - return mesh; -} - -/** - * - */ -PhysxSoftBodyMesh *PhysxKitchen:: -cook_soft_body_mesh(const PhysxSoftBodyMeshDesc &meshDesc) { - - nassertr_always(meshDesc.is_valid(), nullptr); - - PhysxMemoryWriteBuffer wbuffer; - bool status = _cooking->NxCookSoftBodyMesh(meshDesc.get_desc(), wbuffer); - nassertr(status, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr(sdk, nullptr); - - PhysxSoftBodyMesh *mesh = new PhysxSoftBodyMesh(); - nassertr(mesh, nullptr); - - PhysxMemoryReadBuffer rbuffer(wbuffer.data); - NxSoftBodyMesh *meshPtr = sdk->createSoftBodyMesh(rbuffer); - nassertr(meshPtr, nullptr); - - mesh->link(meshPtr); - - return mesh; -} diff --git a/panda/src/physx/physxKitchen.h b/panda/src/physx/physxKitchen.h deleted file mode 100644 index 7d43fc7813..0000000000 --- a/panda/src/physx/physxKitchen.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxKitchen.h - * @author enn0x - * @date 2009-10-12 - */ - -#ifndef PHYSXKITCHEN_H -#define PHYSXKITCHEN_H - -#include "pandabase.h" -#include "filename.h" - -#include "physx_includes.h" - -class PhysxConvexMesh; -class PhysxConvexMeshDesc; -class PhysxTriangleMesh; -class PhysxTriangleMeshDesc; -class PhysxClothMesh; -class PhysxClothMeshDesc; -class PhysxSoftBodyMesh; -class PhysxSoftBodyMeshDesc; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxKitchen { - -PUBLISHED: - INLINE PhysxKitchen(); - INLINE ~PhysxKitchen(); - - void set_cooking_params(float skinWidth, bool hintCollisionSpeed); - - bool cook_convex_mesh(const PhysxConvexMeshDesc &meshDesc, const Filename &filename); - bool cook_triangle_mesh(const PhysxTriangleMeshDesc &meshDesc, const Filename &filename); - bool cook_cloth_mesh(const PhysxClothMeshDesc &meshDesc, const Filename &filename); - bool cook_soft_body_mesh(const PhysxSoftBodyMeshDesc &meshDesc, const Filename &filename); - bool cook_texcoords(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); - PhysxSoftBodyMesh *cook_soft_body_mesh(const PhysxSoftBodyMeshDesc &meshDesc); - -private: - NxCookingInterface *_cooking; -}; - -#include "physxKitchen.I" - -#endif // PHYSXKITCHEN_H diff --git a/panda/src/physx/physxLinearInterpolationValues.I b/panda/src/physx/physxLinearInterpolationValues.I deleted file mode 100644 index b2cceb7001..0000000000 --- a/panda/src/physx/physxLinearInterpolationValues.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxLinearInterpolationValues.I - * @author enn0x - * @date 2010-02-08 - */ - -/** - * - */ -INLINE PhysxLinearInterpolationValues:: -PhysxLinearInterpolationValues() : _min(0.0f), _max(0.0f), _map() { - -} - -/** - * - */ -INLINE PhysxLinearInterpolationValues:: -~PhysxLinearInterpolationValues() { - -} diff --git a/panda/src/physx/physxLinearInterpolationValues.cxx b/panda/src/physx/physxLinearInterpolationValues.cxx deleted file mode 100644 index 45cd603c64..0000000000 --- a/panda/src/physx/physxLinearInterpolationValues.cxx +++ /dev/null @@ -1,116 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxLinearInterpolationValues.cxx - * @author enn0x - * @date 2010-02-08 - */ - -#include "physxLinearInterpolationValues.h" - -/** - * - */ -void PhysxLinearInterpolationValues:: -clear() { - - _map.clear(); -} - -/** - * - */ -void PhysxLinearInterpolationValues:: -insert(float index, float value) { - - if (_map.empty()) { - _min = _max = index; - } - else { - _min = std::min(_min, index); - _max = std::max(_max, index); - } - _map[index] = value; -} - -/** - * - */ -bool PhysxLinearInterpolationValues:: -is_valid(float number) const { - - return (number >= _min) && (number <= _max); -} - -/** - * - */ -unsigned int PhysxLinearInterpolationValues:: -get_size() const { - - return _map.size(); -} - -/** - * - */ -float PhysxLinearInterpolationValues:: -get_value(float number) const { - - MapType::const_iterator lower = _map.begin(); - if (number < _min) { - return lower->second; - } - - MapType::const_iterator upper = _map.end(); - upper--; - if (number > _max) { - return upper->second; - } - - upper = _map.lower_bound(number); - if (upper == lower) { - return upper->second; - } - - lower = upper; - lower--; - - float w1 = number - lower->first; - float w2 = upper->first - number; - - return ((w2 * lower->second) + (w1 * upper->second)) / (w1 + w2); -} - -/** - * - */ -float PhysxLinearInterpolationValues:: -get_value_at_index(int index) const { - - MapType::const_iterator it = _map.begin(); - - for (int i=0; isecond; -} - -/** - * - */ -void PhysxLinearInterpolationValues:: -output(std::ostream &out) const { - - MapType::const_iterator it = _map.begin(); - - for (; it != _map.end(); ++it) { - std::cout << it->first << " -> " << it->second << "\n"; - } -} diff --git a/panda/src/physx/physxLinearInterpolationValues.h b/panda/src/physx/physxLinearInterpolationValues.h deleted file mode 100644 index 9bc5acb4d7..0000000000 --- a/panda/src/physx/physxLinearInterpolationValues.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxLinearInterpolationValues.h - * @author enn0x - * @date 2010-02-08 - */ - -#ifndef PHYSXLINEARINTERPOLATIONVALUES_H -#define PHYSXLINEARINTERPOLATIONVALUES_H - -#include "pandabase.h" -#include "pmap.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxLinearInterpolationValues { - -public: - INLINE PhysxLinearInterpolationValues(); - INLINE ~PhysxLinearInterpolationValues(); - - void output(std::ostream &out) const; - - void clear(); - void insert(float index, float value); - bool is_valid(float number) const; - float get_value(float number) const; - float get_value_at_index(int index) const; - unsigned int get_size() const; - -private: - float _min; - float _max; - - typedef pmap MapType; - MapType _map; -}; - -INLINE std::ostream &operator << (std::ostream &out, const PhysxLinearInterpolationValues &values) { - values.output(out); - return out; -} - -#include "physxLinearInterpolationValues.I" - -#endif // PHYSXLINEARINTERPOLATIONVALUES_H diff --git a/panda/src/physx/physxManager.I b/panda/src/physx/physxManager.I deleted file mode 100644 index c1bc8a59c9..0000000000 --- a/panda/src/physx/physxManager.I +++ /dev/null @@ -1,203 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxManager.I - * @author enn0x - * @date 2009-09-01 - */ - -/** - * Returns a pointer to the NxPhysicsSDK. - */ -INLINE NxPhysicsSDK *PhysxManager:: -get_sdk() const { - - return _sdk; -} - -/** - * Converts from LVector3f to NxVec3. - */ -INLINE NxVec3 PhysxManager:: -vec3_to_nxVec3(const LVector3f &v) { - - return NxVec3(v.get_x(), v.get_y(), v.get_z()); -} - -/** - * Converts from NxVec3 to LVector3f. - */ -INLINE LVector3f PhysxManager:: -nxVec3_to_vec3(const NxVec3 &v) { - - return LVector3f(v.x, v.y, v.z); -} - -/** - * Converts from LVector3f to NxExtendedVec3. - */ -INLINE NxExtendedVec3 PhysxManager:: -vec3_to_nxExtVec3(const LVector3f &v) { - - return NxExtendedVec3(v.get_x(), v.get_y(), v.get_z()); -} - -/** - * Converts from NxExtendedVec3 to LVector3f. - */ -INLINE LVector3f PhysxManager:: -nxExtVec3_to_vec3(const NxExtendedVec3 &v) { - - return LVector3f(v.x, v.y, v.z); -} - -/** - * Converts from LPoint3f to NxVec3. - */ -INLINE NxVec3 PhysxManager:: -point3_to_nxVec3(const LPoint3f &p) { - - return NxVec3(p.get_x(), p.get_y(), p.get_z()); -} - -/** - * Converts from NxVec3 to LPoint3f. - */ -INLINE LPoint3f PhysxManager:: -nxVec3_to_point3(const NxVec3 &p) { - - return LPoint3f(p.x, p.y, p.z); -} - -/** - * Converts from LPoint3f to NxExtendedVec3. - */ -INLINE NxExtendedVec3 PhysxManager:: -point3_to_nxExtVec3(const LPoint3f &p) { - - return NxExtendedVec3(p.get_x(), p.get_y(), p.get_z()); -} - -/** - * Converts from NxExtendedVec3 to LPoint3f. - */ -INLINE LPoint3f PhysxManager:: -nxExtVec3_to_point3(const NxExtendedVec3 &p) { - - return LPoint3f(p.x, p.y, p.z); -} - -/** - * Converts from LQuaternionf to NxQuat. - */ -INLINE NxQuat PhysxManager:: -quat_to_nxQuat(const LQuaternionf &q) { - - NxQuat nxq; - nxq.setXYZW(q.get_i(), q.get_j(), q.get_k(), q.get_r()); - return nxq; -} - -/** - * Converts from NxQuat to LQuaternionf. - */ -INLINE LQuaternionf PhysxManager:: -nxQuat_to_quat(const NxQuat &q) { - - return LQuaternionf(q.w, q.x, q.y, q.z); -} - -/** - * Converts from LMatrix4f to NxMat34. - */ -INLINE NxMat34 PhysxManager:: -mat4_to_nxMat34(const LMatrix4f &m) { - - NxMat33 mat = mat3_to_nxMat33(m.get_upper_3()); - NxVec3 v = vec3_to_nxVec3(m.get_row3(3)); - return NxMat34(mat, v); -} - -/** - * Converts from NxMat34 to LMatrix4f. - */ -INLINE LMatrix4f PhysxManager:: -nxMat34_to_mat4(const NxMat34 &m) { - - return LMatrix4f(nxMat33_to_mat3(m.M), nxVec3_to_vec3(m.t)); -} - -/** - * Converts from LMatrix3f to NxMat33. - */ -INLINE NxMat33 PhysxManager:: -mat3_to_nxMat33(const LMatrix3f &m) { - - NxMat33 mat; - mat.setColumnMajor(m.get_data()); - return mat; -} - -/** - * Converts from NxMat33 to LMatrix3f. - */ -INLINE LMatrix3f PhysxManager:: -nxMat33_to_mat3(const NxMat33 &m) { - - float cells[9]; - m.getColumnMajor(cells); - return LMatrix3f(cells[0], cells[1], cells[2], - cells[3], cells[4], cells[5], - cells[6], cells[7], cells[8]); -} - -/** - * - */ -INLINE void PhysxManager:: -update_vec3_from_nxVec3(LVector3f &v, const NxVec3 &nVec) { - - v.set_x(nVec.x); - v.set_y(nVec.y); - v.set_z(nVec.z); -} - -/** - * - */ -INLINE void PhysxManager:: -update_point3_from_nxVec3(LPoint3f &p, const NxVec3 &nVec) { - - p.set_x(nVec.x); - p.set_y(nVec.y); - p.set_z(nVec.z); -} - - -/** - * - */ -INLINE void PhysxManager:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxManager:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << "PhysxManager\n"; - - _scenes.ls(out, indent_level); - _heightfields.ls(out, indent_level); - _convex_meshes.ls(out, indent_level); - _triangle_meshes.ls(out, indent_level); -} diff --git a/panda/src/physx/physxManager.cxx b/panda/src/physx/physxManager.cxx deleted file mode 100644 index 1bba65c280..0000000000 --- a/panda/src/physx/physxManager.cxx +++ /dev/null @@ -1,463 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxManager.cxx - * @author enn0x - * @date 2009-09-01 - */ - -#include "physxManager.h" -#include "physxScene.h" -#include "physxSceneDesc.h" - -using std::endl; - -PhysxManager *PhysxManager::_global_ptr; -PhysxManager::PhysxOutputStream PhysxManager::_outputStream; - -/** - * - */ -PhysxManager:: -PhysxManager() { - - // Create PhysX SDK - NxSDKCreateError error; - NxPhysicsSDKDesc desc = NxPhysicsSDKDesc(); - - _sdk = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, nullptr, &_outputStream, desc, &error); - - if (error == NXCE_NO_ERROR) { - physx_cat.info() << "PhysX subsystem initialized. Number of PPUs=" - << _sdk->getNbPPUs() << endl; - } - else { - physx_cat.error() << "Error when setting up the PhysX subsystem: " - << get_sdk_error_string(error) << endl; - _sdk = nullptr; - } - - nassertv_always(error == NXCE_NO_ERROR); - nassertv_always(_sdk); - - // Set some default parameters - _sdk->setParameter(NX_VISUALIZATION_SCALE, 0.0f); - _sdk->setParameter(NX_VISUALIZE_COLLISION_SHAPES, true); - _sdk->setParameter(NX_VISUALIZE_ACTOR_AXES, true); - _sdk->setParameter(NX_VISUALIZE_BODY_LIN_VELOCITY, true); - _sdk->setParameter(NX_VISUALIZE_COLLISION_AABBS, false); - _sdk->setParameter(NX_VISUALIZE_COLLISION_VNORMALS, false); - _sdk->setParameter(NX_VISUALIZE_COLLISION_FNORMALS, false); - _sdk->setParameter(NX_VISUALIZE_FORCE_FIELDS, false); - - // Connect VDR - if(physx_want_vrd) { - physx_cat.info() << "Connecting to visual remote debugger at (" - << physx_vrd_host << ":" - << physx_vrd_port << ")" << endl; - - NxRemoteDebugger *debugger = _sdk->getFoundationSDK().getRemoteDebugger(); - - debugger->connect(physx_vrd_host.c_str(), - physx_vrd_port); - - if (!debugger->isConnected()) { - physx_cat.warning() << "Could not connect to visual remot debugger!" << endl; - } - } - -} - -/** - * - */ -PhysxManager:: -~PhysxManager() { - - // Disconnect VRD - if(physx_want_vrd) { - NxRemoteDebugger *debugger = _sdk->getFoundationSDK().getRemoteDebugger(); - if (!debugger->isConnected()) { - debugger->disconnect(); - } - } - - // Release PhysX SDK - NxReleasePhysicsSDK(_sdk); -} - -/** - * Returns a pointer to the global PhysxManager object. - */ -PhysxManager *PhysxManager:: -get_global_ptr() { - - if (_global_ptr == nullptr) { - _global_ptr = new PhysxManager; - } - - if (_global_ptr->_sdk == nullptr) { - return nullptr; - } - else { - return _global_ptr; - } -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_scenes() const { - - return _sdk->getNbScenes(); -} - -/** - * - */ -PhysxScene *PhysxManager:: -create_scene(PhysxSceneDesc &sceneDesc) { - - nassertr(sceneDesc.is_valid(),nullptr); - - // _desc.timeStepMethod = NX_TIMESTEP_FIXED; _desc.maxTimestep = 1.0f - // 240.0f; _desc.maxIter = 8; - - sceneDesc._desc.flags |= NX_SF_ENABLE_ACTIVETRANSFORMS; - sceneDesc._desc.flags |= NX_SF_SIMULATE_SEPARATE_THREAD; - - if (physx_internal_threads > 0) { - sceneDesc._desc.flags |= NX_SF_ENABLE_MULTITHREAD; - sceneDesc._desc.threadMask=0xfffffffe; - sceneDesc._desc.internalThreadCount = physx_internal_threads; - physx_cat.info() << "Multithreading enabled. " - << "Additional threads: " << physx_internal_threads << endl; - } - - PhysxScene *scene = new PhysxScene(); - nassertr(scene, nullptr); - - NxScene *scenePtr = _sdk->createScene(sceneDesc._desc); - nassertr(scenePtr, nullptr); - - scene->link(scenePtr); - - return scene; -} - -/** - * - */ -PhysxScene *PhysxManager:: -get_scene(unsigned int idx) const { - - nassertr_always(idx < _sdk->getNbScenes(), nullptr); - - NxScene *scenePtr = _sdk->getScene(idx); - PhysxScene *scene = (PhysxScene *)(scenePtr->userData); - - return scene; -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_height_fields() { - - return _sdk->getNbHeightFields(); -} - -/** - * - */ -PhysxHeightField *PhysxManager:: -create_height_field(PhysxHeightFieldDesc &desc) { - - nassertr(desc.is_valid(),nullptr); - - PhysxHeightField *hf = new PhysxHeightField(); - nassertr(hf, nullptr); - - NxHeightField *hfPtr = _sdk->createHeightField(desc._desc); - nassertr(hfPtr, nullptr); - - hf->link(hfPtr); - - return hf; -} - -/** - * - */ -PhysxHeightField *PhysxManager:: -get_height_field(unsigned int idx) { - - nassertr_always(idx < _sdk->getNbHeightFields(), nullptr); - - return (PhysxHeightField *)_heightfields[idx]; -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_convex_meshes() { - - return _sdk->getNbConvexMeshes(); -} - -/** - * - */ -PhysxConvexMesh *PhysxManager:: -get_convex_mesh(unsigned int idx) { - - nassertr_always(idx < _sdk->getNbConvexMeshes(), nullptr); - - return (PhysxConvexMesh *)_convex_meshes[idx]; -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_triangle_meshes() { - - return _sdk->getNbTriangleMeshes(); -} - -/** - * - */ -PhysxTriangleMesh *PhysxManager:: -get_triangle_mesh(unsigned int idx) { - - nassertr_always(idx < _sdk->getNbTriangleMeshes(), nullptr); - - return (PhysxTriangleMesh *)_triangle_meshes[idx]; -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_cloth_meshes() { - - return _sdk->getNbClothMeshes(); -} - -/** - * - */ -PhysxClothMesh *PhysxManager:: -get_cloth_mesh(unsigned int idx) { - - nassertr_always(idx < _sdk->getNbClothMeshes(), nullptr); - - return (PhysxClothMesh *)_cloth_meshes[idx]; -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_soft_body_meshes() { - - return _sdk->getNbSoftBodyMeshes(); -} - -/** - * - */ -PhysxSoftBodyMesh *PhysxManager:: -get_soft_body_mesh(unsigned int idx) { - - nassertr_always(idx < _sdk->getNbSoftBodyMeshes(), nullptr); - - return (PhysxSoftBodyMesh *)_softbody_meshes[idx]; -} - -/** - * - */ -unsigned int PhysxManager:: -get_num_ccd_skeletons() { - - return _sdk->getNbCCDSkeletons(); -} - -/** - * - */ -PhysxCcdSkeleton *PhysxManager:: -create_ccd_skeleton(PhysxCcdSkeletonDesc &desc) { - - nassertr(desc.is_valid(), nullptr); - nassertr(desc.get_desc().numVertices < 64, nullptr); - - PhysxCcdSkeleton *skel = new PhysxCcdSkeleton(); - nassertr(skel, nullptr); - - NxCCDSkeleton *skelPtr = _sdk->createCCDSkeleton(desc.get_desc()); - nassertr(skelPtr, nullptr); - - skel->link(skelPtr); - - return skel; -} - -/** - * - */ -PhysxCcdSkeleton *PhysxManager:: -get_ccd_skeleton(unsigned int idx) { - - nassertr_always(idx < _sdk->getNbCCDSkeletons(), nullptr); - - return (PhysxCcdSkeleton *)_ccd_skeletons[idx]; -} - -/** - * Returns TRUE if a physcis hardware is available on the host system. - */ -bool PhysxManager:: -is_hardware_available() { - - return _sdk->getHWVersion() != NX_HW_VERSION_NONE; -} - -/** - * Reports the number of PPUs installed in the host system. - */ -unsigned int PhysxManager:: -get_num_ppus() { - - return _sdk->getNbPPUs(); -} - -/** - * Reports the available revision of the PhysX Hardware. Returns 0 if there - * is no hardware present in the machine, 1 for the PhysX Athena revision 1.0 - * card. - */ -unsigned int PhysxManager:: -get_hw_version() { - - return _sdk->getHWVersion(); -} - -/** - * Reports the internal API version number of the SDK. - */ -const char *PhysxManager:: -get_internal_version() { - - NxU32 apiRev; - NxU32 descRev; - NxU32 branchId; - NxU32 v; - - v = _sdk->getInternalVersion(apiRev, descRev, branchId); - - std::stringstream version; - version << "version:" << (unsigned int)v - << " apiRef:" << (unsigned int)apiRev - << " descRev:" << (unsigned int)descRev - << " branchId: " << (unsigned int)branchId; - - return version.str().c_str(); -} - -/** - * - */ -void PhysxManager:: -set_parameter(PhysxParameter param, float value) { - - _sdk->setParameter((NxParameter)param, value); -} - -/** - * - */ -float PhysxManager:: -get_parameter(PhysxParameter param) { - - return _sdk->getParameter((NxParameter)param); -} - -/** - * Returns the NxSDKCreateError enum as string. - */ -const char *PhysxManager:: -get_sdk_error_string(const NxSDKCreateError &error) { - - switch (error) { - case NXCE_NO_ERROR: return "NXCE_NO_ERROR"; break; - case NXCE_PHYSX_NOT_FOUND: return "NXCE_PHYSX_NOT_FOUND"; break; - case NXCE_WRONG_VERSION: return "NXCE_WRONG_VERSION"; break; - case NXCE_DESCRIPTOR_INVALID: return "NXCE_DESCRIPTOR_INVALID"; break; - case NXCE_CONNECTION_ERROR: return "NXCE_CONNECTION_ERROR"; break; - case NXCE_RESET_ERROR: return "NXCE_RESET_ERROR"; break; - case NXCE_IN_USE_ERROR: return "NXCE_IN_USE_ERROR"; break; - case NXCE_BUNDLE_ERROR: return "NXCE_BUNDLE_ERROR"; break; - default: return "Unknown error"; break; - } -} - -/** - * Reports an error code from the PhysX SDK. - */ -void PhysxManager::PhysxOutputStream:: -reportError(NxErrorCode code, const char *message, const char *file, int line) { - - physx_cat.error() << get_error_code_string(code) << ": " - << message << endl; -} - -/** - * Returns the NxSDKCreateError enum as string. - */ -const char *PhysxManager::PhysxOutputStream:: -get_error_code_string(NxErrorCode code) { - - switch (code) { - case NXE_NO_ERROR: return "NO_ERROR"; break; - case NXE_INVALID_PARAMETER: return "INVALID_PARAMETER"; break; - case NXE_INVALID_OPERATION: return "INVALID_OPERATION"; break; - case NXE_OUT_OF_MEMORY: return "OUT_OF_MEMORY"; break; - case NXE_INTERNAL_ERROR: return "INTERNAL_ERROR"; break; - case NXE_ASSERTION: return "ASSERTION"; break; - case NXE_DB_INFO: return "DB_INFO"; break; - case NXE_DB_WARNING: return "DB_WARNING"; break; - case NXE_DB_PRINT: return "DB_PRINT"; break; - default: return ""; break; - } -} - -/** - * Reports an assertion violation from the PhysX SDK. - */ -NxAssertResponse PhysxManager::PhysxOutputStream:: -reportAssertViolation(const char *message, const char *file, int line) { - - physx_cat.error() << "AssertViolation: " << message << endl; - - return NX_AR_CONTINUE; -} - -/** - * Prints some debug text from the PhysX SDK. - */ -void PhysxManager::PhysxOutputStream:: -print(const char *message) { - - nout << message; -} diff --git a/panda/src/physx/physxManager.h b/panda/src/physx/physxManager.h deleted file mode 100644 index ed5f0b79d5..0000000000 --- a/panda/src/physx/physxManager.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxManager.h - * @author enn0x - * @date 2009-09-01 - */ - -#ifndef PHYSXMANAGER_H -#define PHYSXMANAGER_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physxObjectCollection.h" -#include "physx_includes.h" - -class PhysxScene; -class PhysxSceneDesc; -class PhysxHeightField; -class PhysxHeightFieldDesc; -class PhysxTriangleMesh; -class PhysxConvexMesh; -class PhysxClothMesh; -class PhysxSoftBodyMesh; -class PhysxOutputStream; -class PhysxCcdSkeleton; -class PhysxCcdSkeletonDesc; - -/** - * The central interface to the PhysX subsystem. Used e. g. for - * setting/retrieving global parameters or for creating scenes. - */ -class EXPCL_PANDAPHYSX PhysxManager : public PhysxEnums { - -protected: - PhysxManager(); - -public: - ~PhysxManager(); - -PUBLISHED: - static PhysxManager *get_global_ptr(); - - void set_parameter(PhysxParameter param, float value); - float get_parameter(PhysxParameter param); - - bool is_hardware_available(); - unsigned int get_num_ppus(); - unsigned int get_hw_version(); - const char *get_internal_version(); - - unsigned int get_num_scenes() const; - PhysxScene *create_scene(PhysxSceneDesc &desc); - PhysxScene *get_scene(unsigned int idx) const; - MAKE_SEQ(get_scenes, get_num_scenes, get_scene); - - unsigned int get_num_height_fields(); - PhysxHeightField *create_height_field(PhysxHeightFieldDesc &desc); - PhysxHeightField *get_height_field(unsigned int idx); - MAKE_SEQ(get_height_fields, get_num_height_fields, get_height_field); - - unsigned int get_num_convex_meshes(); - PhysxConvexMesh *get_convex_mesh(unsigned int idx); - MAKE_SEQ(get_convex_meshes, get_num_convex_meshes, get_convex_mesh); - - unsigned int get_num_triangle_meshes(); - PhysxTriangleMesh *get_triangle_mesh(unsigned int idx); - MAKE_SEQ(get_triangle_meshes, get_num_triangle_meshes, get_triangle_mesh); - - 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); - - unsigned int get_num_soft_body_meshes(); - PhysxSoftBodyMesh *get_soft_body_mesh(unsigned int idx); - MAKE_SEQ(get_soft_body_meshes, get_num_soft_body_meshes, get_soft_body_mesh); - - unsigned int get_num_ccd_skeletons(); - PhysxCcdSkeleton *create_ccd_skeleton(PhysxCcdSkeletonDesc &desc); - PhysxCcdSkeleton *get_ccd_skeleton(unsigned int idx); - MAKE_SEQ(get_ccd_skeletons, get_num_ccd_skeletons, get_ccd_skeleton); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE NxPhysicsSDK *get_sdk() const; - - PhysxObjectCollection _scenes; - PhysxObjectCollection _heightfields; - PhysxObjectCollection _convex_meshes; - PhysxObjectCollection _triangle_meshes; - PhysxObjectCollection _cloth_meshes; - PhysxObjectCollection _softbody_meshes; - PhysxObjectCollection _ccd_skeletons; - - INLINE static NxVec3 vec3_to_nxVec3(const LVector3f &v); - INLINE static LVector3f nxVec3_to_vec3(const NxVec3 &v); - INLINE static NxExtendedVec3 vec3_to_nxExtVec3(const LVector3f &v); - INLINE static LVector3f nxExtVec3_to_vec3(const NxExtendedVec3 &v); - INLINE static NxVec3 point3_to_nxVec3(const LPoint3f &p); - INLINE static LPoint3f nxVec3_to_point3(const NxVec3 &p); - INLINE static NxExtendedVec3 point3_to_nxExtVec3(const LPoint3f &p); - INLINE static LPoint3f nxExtVec3_to_point3(const NxExtendedVec3 &p); - INLINE static NxQuat quat_to_nxQuat(const LQuaternionf &q); - INLINE static LQuaternionf nxQuat_to_quat(const NxQuat &q); - INLINE static NxMat34 mat4_to_nxMat34(const LMatrix4f &m); - INLINE static LMatrix4f nxMat34_to_mat4(const NxMat34 &m); - INLINE static NxMat33 mat3_to_nxMat33(const LMatrix3f &m); - INLINE static LMatrix3f nxMat33_to_mat3(const NxMat33 &m); - - INLINE static void update_vec3_from_nxVec3(LVector3f &v, const NxVec3 &nVec); - INLINE static void update_point3_from_nxVec3(LPoint3f &p, const NxVec3 &nVec); - -private: - NxPhysicsSDK *_sdk; - - static PhysxManager *_global_ptr; - - class PhysxOutputStream : public NxUserOutputStream { - void reportError(NxErrorCode code, const char *message, const char *file, int line); - NxAssertResponse reportAssertViolation(const char *message, const char *file, int line); - void print(const char *message); - const char *get_error_code_string(NxErrorCode code); - }; - static PhysxOutputStream _outputStream; - - static const char *get_sdk_error_string(const NxSDKCreateError &error); -}; - -#include "physxManager.I" - -#endif // PHYSXMANAGER_H diff --git a/panda/src/physx/physxMask.I b/panda/src/physx/physxMask.I deleted file mode 100644 index 24b38ed612..0000000000 --- a/panda/src/physx/physxMask.I +++ /dev/null @@ -1,38 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMask.I - * @author enn0x - * @date 2009-10-21 - */ - -/** - * - */ -INLINE PhysxMask:: -PhysxMask() { - - _mask = 0xffffffff; -} - -/** - * - */ -INLINE PhysxMask:: -~PhysxMask() { - -} - -/** - * - */ -INLINE NxU32 PhysxMask:: -get_mask() const { - - return _mask; -} diff --git a/panda/src/physx/physxMask.cxx b/panda/src/physx/physxMask.cxx deleted file mode 100644 index b9f3437634..0000000000 --- a/panda/src/physx/physxMask.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMask.cxx - * @author enn0x - * @date 2009-10-21 - */ - -#include "physxMask.h" - -/** - * Returns a PhysxMask whose bits are all on. - */ -PhysxMask PhysxMask:: -all_on() { - - PhysxMask mask; - mask._mask = 0xffffffff; - return mask; -} - -/** - * Returns a PhysxMask whose bits are all off. - */ -PhysxMask PhysxMask:: -all_off() { - - PhysxMask mask; - mask._mask = 0x0000000; - return mask; -} - -/** - * Sets the nth bit on. Index must be in the range [0, 31]. - */ -void PhysxMask:: -set_bit(unsigned int idx) { - - nassertv_always(idx >= 0 && idx <= 31); - _mask = _mask | (1 << idx); -} - -/** - * Sets the nth bit off. Index must be in the range [0, 31]. - */ -void PhysxMask:: -clear_bit(unsigned int idx) { - - nassertv_always(idx >= 0 && idx <= 31); - _mask = _mask & ~(1 << idx); -} - -/** - * Returns true if the nth bit is set, false if it is cleared. Index must be - * in the range [0, 31]. - */ -bool PhysxMask:: -get_bit(unsigned int idx) const { - - nassertr_always(idx >= 0 && idx <= 31, false); - return (_mask & (1 << idx)) ? true : false; -} - -/** - * Writes the PhysxMask out as a list of ones and zeros. - */ -void PhysxMask:: -output(std::ostream &out) const { - - std::string name; - - for (int i=0; i<32; i++) { - name += (_mask & (1 << i)) ? '1' : '0'; - } - - out << "/" << name << "/"; -} diff --git a/panda/src/physx/physxMask.h b/panda/src/physx/physxMask.h deleted file mode 100644 index 9117d875bf..0000000000 --- a/panda/src/physx/physxMask.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMask.h - * @author enn0x - * @date 2009-10-21 - */ - -#ifndef PHYSXMASK_H -#define PHYSXMASK_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * 32-bit bitmask class. - */ -class EXPCL_PANDAPHYSX PhysxMask { - -PUBLISHED: - INLINE PhysxMask(); - INLINE ~PhysxMask(); - - void set_bit(unsigned int idx); - void clear_bit(unsigned int idx); - bool get_bit(unsigned int idx) const; - - void output(std::ostream &out) const; - - static PhysxMask all_on(); - static PhysxMask all_off(); - -public: - INLINE NxU32 get_mask() const; - -private: - NxU32 _mask; -}; - -INLINE std::ostream &operator << (std::ostream &out, const PhysxMask &mask) { - mask.output(out); - return out; -} - -#include "physxMask.I" - -#endif // PHYSXMASK_H diff --git a/panda/src/physx/physxMaterial.I b/panda/src/physx/physxMaterial.I deleted file mode 100644 index 7bc1f46db4..0000000000 --- a/panda/src/physx/physxMaterial.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMaterial.I - * @author enn0x - * @date 2009-09-21 - */ - -/** - * - */ -INLINE PhysxMaterial:: -PhysxMaterial() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxMaterial:: -~PhysxMaterial() { - -} - -/** - * - */ -INLINE void PhysxMaterial:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxMaterial:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxMaterial.cxx b/panda/src/physx/physxMaterial.cxx deleted file mode 100644 index 11dedcacd4..0000000000 --- a/panda/src/physx/physxMaterial.cxx +++ /dev/null @@ -1,315 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMaterial.cxx - * @author enn0x - * @date 2009-09-21 - */ - -#include "physxMaterial.h" -#include "physxMaterialDesc.h" -#include "physxManager.h" - -TypeHandle PhysxMaterial::_type_handle; - -/** - * - */ -void PhysxMaterial:: -link(NxMaterial *materialPtr) { - - // Link self - _ptr = materialPtr; - _ptr->userData = this; - _error_type = ET_ok; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_materials.add(this); -} - -/** - * - */ -void PhysxMaterial:: -unlink() { - - // Unlink self - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_materials.remove(this); -} - -/** - * - */ -void PhysxMaterial:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - _ptr->getScene().releaseMaterial(*_ptr); - _ptr = nullptr; -} - -/** - * Returns the scene that owns this material. - */ -PhysxScene *PhysxMaterial:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxScene *)(_ptr->getScene().userData); -} - -/** - * Returns the material index for this material. - * - * Materials are associated with mesh faces and shapes using material index - * identifiers. - * - * If you release a material while its material index is still in use by - * shapes or meshes, the material usage of these objects becomes undefined as - * the material index gets recycled. - */ -unsigned short PhysxMaterial:: -get_material_index() const { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getMaterialIndex(); -} - -/** - * Loads the entire state of the material from a descriptor with a single - * call. - */ -void PhysxMaterial:: -load_from_desc(const PhysxMaterialDesc &materialDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(materialDesc._desc); -} - -/** - * Saves the state of the material object to a descriptor. - */ -void PhysxMaterial:: -save_to_desc(PhysxMaterialDesc & materialDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(materialDesc._desc); -} - -/** - * Sets the coefficient of restitution. A coefficient of 0 makes the object - * bounce as little as possible, higher values up to 1.0 result in more - * bounce. - */ -void PhysxMaterial:: -set_restitution(float restitution) { - - nassertv(_error_type == ET_ok); - _ptr->setRestitution(restitution); -} - -/** - * Returns the coefficient of restitution. - */ -float PhysxMaterial:: -get_restitution() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRestitution(); -} - -/** - * Sets the coefficient of static friction. The coefficient of static - * friction should be in the range [0, +inf]. If the flag MF_anisotropic is - * set, then this value is used for the primary direction of anisotropy (U - * axis). - */ -void PhysxMaterial:: -set_static_friction(float coef) { - - nassertv(_error_type == ET_ok); - _ptr->setStaticFriction(coef); -} - -/** - * Returns the coefficient of static friction. - */ -float PhysxMaterial:: -get_static_friction() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getStaticFriction(); -} - -/** - * Sets the coefficient of dynamic friction. The coefficient of dynamic - * friction should be in [0, +inf]. If set to greater than staticFriction, the - * effective value of staticFriction will be increased to match. If the flag - * MF_anisotropic is set, then this value is used for the primary direction of - * anisotropy (U axis). - */ -void PhysxMaterial:: -set_dynamic_friction(float coef) { - - nassertv(_error_type == ET_ok); - _ptr->setDynamicFriction(coef); -} - -/** - * Returns the DynamicFriction value. - */ -float PhysxMaterial:: -get_dynamic_friction() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getDynamicFriction(); -} - -/** - * Sets the static friction coefficient along the secondary (V) axis. This is - * used when anisotropic friction is being applied. I.e. the flag - * MF_anisotropic is set. - */ -void PhysxMaterial:: -set_static_friction_v(float coef) { - - nassertv(_error_type == ET_ok); - _ptr->setStaticFrictionV(coef); -} - -/** - * Returns the static friction coefficient for the V direction. - */ -float PhysxMaterial:: -get_static_friction_v() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getStaticFrictionV(); -} - -/** - * Sets the dynamic friction coefficient along the secondary (V) axis. This - * is used when anisotropic friction is being applied. I.e. the flag - * MF_anisotropic is set. - */ -void PhysxMaterial:: -set_dynamic_friction_v(float coef) { - - nassertv(_error_type == ET_ok); - _ptr->setDynamicFrictionV(coef); -} - -/** - * Returns the dynamic friction coefficient for the V direction. - */ -float PhysxMaterial:: -get_dynamic_friction_v() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getDynamicFrictionV(); -} - -/** - * Sets the value of a single flag. - */ -void PhysxMaterial:: -set_flag(PhysxMaterialFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - NxU32 flags = _ptr->getFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setFlags(flags); -} - -/** - * Returns the value of a single flag. - */ -bool PhysxMaterial:: -get_flag(PhysxMaterialFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getFlags() & flag) ? true : false; -} - -/** - * Sets the shape space direction (unit vector) of anisotropy. This is only - * used if the flag MF_anisotropic is set. - */ -void PhysxMaterial:: -set_dir_of_anisotropy(const LVector3f dir) { - - nassertv(_error_type == ET_ok); - _ptr->setDirOfAnisotropy(PhysxManager::vec3_to_nxVec3(dir)); -} - -/** - * Returns the direction of anisotropy value. - */ -LVector3f PhysxMaterial:: -get_dir_of_anisotropy() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getDirOfAnisotropy()); -} - -/** - * Sets the friction combine mode. - CM_average : Average: (a + b)/2. - - * CM_min : Minimum: min(a,b). - CM_multiply : Multiply: a*b. - CM_max : - * Maximum: max(a,b). - */ -void PhysxMaterial:: -set_friction_combine_mode(PhysxCombineMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->setFrictionCombineMode((NxCombineMode)mode); -} - -/** - * Returns the friction combine mode. - */ -PhysxEnums::PhysxCombineMode PhysxMaterial:: -get_friction_combine_mode() const { - - nassertr(_error_type == ET_ok, CM_average); - return (PhysxCombineMode)_ptr->getFrictionCombineMode(); -} - -/** - * Sets the restitution combine mode. - CM_average : Average: (a + b)/2. - - * CM_min : Minimum: min(a,b). - CM_multiply : Multiply: a*b. - CM_max : - * Maximum: max(a,b). - */ -void PhysxMaterial:: -set_restitution_combine_mode(PhysxCombineMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->setRestitutionCombineMode((NxCombineMode)mode); -} - -/** - * Returns the restitution combine mode. - */ -PhysxEnums::PhysxCombineMode PhysxMaterial:: -get_restitution_combine_mode() const { - - nassertr(_error_type == ET_ok, CM_average); - return (PhysxCombineMode)_ptr->getRestitutionCombineMode(); -} diff --git a/panda/src/physx/physxMaterial.h b/panda/src/physx/physxMaterial.h deleted file mode 100644 index efbeaae9f6..0000000000 --- a/panda/src/physx/physxMaterial.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMaterial.h - * @author enn0x - * @date 2009-09-21 - */ - -#ifndef PHYSXMATERIAL_H -#define PHYSXMATERIAL_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxScene; -class PhysxMaterialDesc; - -/** - * A class for describing a shape's surface properties. - * - * You can create a material which has different friction coefficients - * depending on the direction that a body in contact is trying to move in. - * This is called anisotropic friction. - * - * Anisotropic friction is useful for modeling things like sledges, skis etc - * - * When you create an anisotropic material you specify the default friction - * parameters and also friction parameters for the V axis. The friction - * parameters for the V axis are applied to motion along the direction of - * anisotropy (dirOfAnisotropy). - * - * Default material: You can change the properties of the default material by - * querying for material index 0. - */ -class EXPCL_PANDAPHYSX PhysxMaterial : public PhysxObject, public PhysxEnums { - -PUBLISHED: - INLINE PhysxMaterial(); - INLINE ~PhysxMaterial(); - - PhysxScene *get_scene() const; - unsigned short get_material_index() const; - - void load_from_desc(const PhysxMaterialDesc &materialDesc); - void save_to_desc(PhysxMaterialDesc &materialDesc) const; - - void set_dynamic_friction(float coef); - void set_static_friction(float coef); - void set_restitution(float rest); - void set_dynamic_friction_v(float coef); - void set_static_friction_v(float coef); - void set_dir_of_anisotropy(const LVector3f dir); - void set_flag(PhysxMaterialFlag flag, bool value); - void set_friction_combine_mode(PhysxCombineMode mode); - void set_restitution_combine_mode(PhysxCombineMode mode); - - float get_dynamic_friction() const; - float get_static_friction() const; - float get_restitution() const; - float get_dynamic_friction_v() const; - float get_static_friction_v() const; - LVector3f get_dir_of_anisotropy() const; - bool get_flag(PhysxMaterialFlag flag) const; - PhysxCombineMode get_friction_combine_mode() const; - PhysxCombineMode get_restitution_combine_mode() const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -PUBLISHED: - void release(); - -public: - INLINE NxMaterial *ptr() const { return _ptr; }; - - void link(NxMaterial *ptr); - void unlink(); - -private: - NxMaterial *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxMaterial", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxMaterial.I" - -#endif // PHYSXMATERIAL_H diff --git a/panda/src/physx/physxMaterialDesc.I b/panda/src/physx/physxMaterialDesc.I deleted file mode 100644 index a63c56b69a..0000000000 --- a/panda/src/physx/physxMaterialDesc.I +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMaterialDesc.I - * @author enn0x - * @date 2009-09-21 - */ - -/** - * - */ -INLINE PhysxMaterialDesc:: -PhysxMaterialDesc() { - -} - -/** - * - */ -INLINE PhysxMaterialDesc:: -~PhysxMaterialDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxMaterialDesc:: -set_to_default() { - - _desc.setToDefault(); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxMaterialDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxMaterialDesc.cxx b/panda/src/physx/physxMaterialDesc.cxx deleted file mode 100644 index df226029bb..0000000000 --- a/panda/src/physx/physxMaterialDesc.cxx +++ /dev/null @@ -1,201 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMaterialDesc.cxx - * @author enn0x - * @date 2009-09-21 - */ - -#include "physxMaterialDesc.h" -#include "physxManager.h" - -/** - * Sets the coefficient of restitution -- 0 makes the object bounce as little - * as possible, higher values up to 1.0 result in more bounce. Note that - * values close to or above 1 may cause stability problems and/or increasing - * energy. Range: [0,1] Default: 0.0 - */ -void PhysxMaterialDesc:: -set_restitution(float restitution) { - - _desc.restitution = restitution; -} - -/** - * Sets the coefficient of static friction -- should be in [0, +inf]. If the - * flag MF_anisotropic is set, then this value is used for the primary - * direction of anisotropy (U axis). - */ -void PhysxMaterialDesc:: -set_static_friction(float coef) { - - _desc.staticFriction = coef; -} - -/** - * Sets the coefficient of dynamic friction -- should be in [0, +inf]. If set - * to greater than staticFriction, the effective value of staticFriction will - * be increased to match. If the flag MF_anisotropic is set, then this value - * is used for the primary direction of anisotropy (U axis). - */ -void PhysxMaterialDesc:: -set_dynamic_friction(float coef) { - - _desc.dynamicFriction = coef; -} - -/** - * Sets the anisotropic static friction coefficient for along the secondary - * (V) axis of anisotropy. This is only used if the flag MF_anisotropic is - * set. - */ -void PhysxMaterialDesc:: -set_static_friction_v(float coef) { - - _desc.staticFrictionV = coef; -} - -/** - * Sets the anisotropic dynamic friction coefficient for along the secondary - * (V) axis of anisotropy. This is only used if the flag MF_anisotropic is - * set. - */ -void PhysxMaterialDesc:: -set_dynamic_friction_v(float coef) { - - _desc.dynamicFrictionV = coef; -} - -/** - * Sets flags which control the behavior of a material. - */ -void PhysxMaterialDesc:: -set_flag(PhysxMaterialFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Sets the shape space direction (unit vector) of anisotropy. This is only - * used if the flag MF_anisotropic is set. - */ -void PhysxMaterialDesc:: -set_dir_of_anisotropy(const LVector3f dir) { - - _desc.dirOfAnisotropy = PhysxManager::vec3_to_nxVec3(dir); -} - -/** - * Sets the friction combine mode. - CM_average : Average: (a + b)/2. - - * CM_min : Minimum: min(a,b). - CM_multiply : Multiply: a*b. - CM_max : - * Maximum: max(a,b). - */ -void PhysxMaterialDesc:: -set_friction_combine_mode(PhysxCombineMode mode) { - - _desc.frictionCombineMode = (NxCombineMode)mode; -} - -/** - * Sets the restitution combine mode. - CM_average : Average: (a + b)/2. - - * CM_min : Minimum: min(a,b). - CM_multiply : Multiply: a*b. - CM_max : - * Maximum: max(a,b). - */ -void PhysxMaterialDesc:: -set_restitution_combine_mode(PhysxCombineMode mode) { - - _desc.restitutionCombineMode = (NxCombineMode)mode; -} - -/** - * Returns the coefficient of restitution. - */ -float PhysxMaterialDesc:: -get_restitution() const { - - return _desc.restitution; -} - -/** - * Retruns the coefficient of static friction. - */ -float PhysxMaterialDesc:: -get_static_friction() const { - - return _desc.staticFriction; -} - -/** - * Returns the coefficient of dynamic friction. - */ -float PhysxMaterialDesc:: -get_dynamic_friction() const { - - return _desc.dynamicFriction; -} - -/** - * Returns the anisotropic static friction coefficient for along the secondary - * (V) axis of anisotropy. - */ -float PhysxMaterialDesc:: -get_static_friction_v() const { - - return _desc.staticFrictionV; -} - -/** - * Returns the anisotropic dynamic friction coefficient for along the - * secondary (V) axis of anisotropy. - */ -float PhysxMaterialDesc:: -get_dynamic_friction_v() const { - - return _desc.dynamicFrictionV; -} - -/** - * Returns flags which control the behavior of a material. - */ -bool PhysxMaterialDesc:: -get_flag(PhysxMaterialFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * Returns the shape space direction (unit vector) of anisotropy. - */ -LVector3f PhysxMaterialDesc:: -get_dir_of_anisotropy() const { - - return PhysxManager::nxVec3_to_vec3(_desc.dirOfAnisotropy); -} - -/** - * Returns the friction combine mode. - */ -PhysxEnums::PhysxCombineMode PhysxMaterialDesc:: -get_friction_combine_mode() const { - - return (PhysxCombineMode)_desc.frictionCombineMode; -} - -/** - * Returns the restitution combine mode. - */ -PhysxEnums::PhysxCombineMode PhysxMaterialDesc:: -get_restitution_combine_mode() const { - - return (PhysxCombineMode)_desc.restitutionCombineMode; -} diff --git a/panda/src/physx/physxMaterialDesc.h b/panda/src/physx/physxMaterialDesc.h deleted file mode 100644 index 7210530761..0000000000 --- a/panda/src/physx/physxMaterialDesc.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMaterialDesc.h - * @author enn0x - * @date 2009-09-21 - */ - -#ifndef PHYSXMATERIALDESC_H -#define PHYSXMATERIALDESC_H - -#include "pandabase.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -/** - * Descriptor class for materials. See PhysxMaterial. - */ -class EXPCL_PANDAPHYSX PhysxMaterialDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxMaterialDesc(); - INLINE ~PhysxMaterialDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_dynamic_friction(float coef); - void set_static_friction(float coef); - void set_restitution(float rest); - void set_dynamic_friction_v(float coef); - void set_static_friction_v(float coef); - void set_dir_of_anisotropy(const LVector3f dir); - void set_flag(PhysxMaterialFlag flag, bool value); - void set_friction_combine_mode(PhysxCombineMode mode); - void set_restitution_combine_mode(PhysxCombineMode mode); - - float get_dynamic_friction() const; - float get_static_friction() const; - float get_restitution() const; - float get_dynamic_friction_v() const; - float get_static_friction_v() const; - LVector3f get_dir_of_anisotropy() const; - bool get_flag(PhysxMaterialFlag flag) const; - PhysxCombineMode get_friction_combine_mode() const; - PhysxCombineMode get_restitution_combine_mode() const; - -public: - NxMaterialDesc _desc; -}; - -#include "physxMaterialDesc.I" - -#endif // PHYSXMATERIALDESC_H diff --git a/panda/src/physx/physxMemoryReadBuffer.cxx b/panda/src/physx/physxMemoryReadBuffer.cxx deleted file mode 100644 index d70972f58f..0000000000 --- a/panda/src/physx/physxMemoryReadBuffer.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMemoryReadBuffer.cxx - * @author enn0x - * @date 2009-10-11 - */ - -#include "physxMemoryReadBuffer.h" - -/** - * - */ -PhysxMemoryReadBuffer::PhysxMemoryReadBuffer(const NxU8 *data) : buffer(data) -{ - -} - -/** - * - */ -PhysxMemoryReadBuffer::~PhysxMemoryReadBuffer() -{ - -} - -/** - * - */ -NxU8 PhysxMemoryReadBuffer::readByte() const -{ - NxU8 b; - memcpy(&b, buffer, sizeof(NxU8)); - buffer += sizeof(NxU8); - return b; -} - -/** - * - */ -NxU16 PhysxMemoryReadBuffer::readWord() const -{ - NxU16 w; - memcpy(&w, buffer, sizeof(NxU16)); - buffer += sizeof(NxU16); - return w; -} - -/** - * - */ -NxU32 PhysxMemoryReadBuffer::readDword() const -{ - NxU32 d; - memcpy(&d, buffer, sizeof(NxU32)); - buffer += sizeof(NxU32); - return d; -} - -/** - * - */ -float PhysxMemoryReadBuffer::readFloat() const -{ - float f; - memcpy(&f, buffer, sizeof(float)); - buffer += sizeof(float); - return f; -} - -/** - * - */ -double PhysxMemoryReadBuffer::readDouble() const -{ - double f; - memcpy(&f, buffer, sizeof(double)); - buffer += sizeof(double); - return f; -} - -/** - * - */ -void PhysxMemoryReadBuffer::readBuffer(void *dest, NxU32 size) const -{ - memcpy(dest, buffer, size); - buffer += size; -} diff --git a/panda/src/physx/physxMemoryReadBuffer.h b/panda/src/physx/physxMemoryReadBuffer.h deleted file mode 100644 index 5aa791be95..0000000000 --- a/panda/src/physx/physxMemoryReadBuffer.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMemoryReadBuffer.h - * @author enn0x - * @date 2009-10-11 - */ - -#ifndef PHYSXMEMORYREADBUFFER_H -#define PHYSXMEMORYREADBUFFER_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxMemoryReadBuffer : public NxStream { - -public: - PhysxMemoryReadBuffer(const NxU8 *data); - virtual ~PhysxMemoryReadBuffer(); - - virtual NxU8 readByte() const; - virtual NxU16 readWord() const; - virtual NxU32 readDword() const; - virtual float readFloat() const; - virtual double readDouble() const; - virtual void readBuffer(void *buffer, NxU32 size) const; - - virtual NxStream &storeByte(NxU8 b) { NX_ASSERT(0); return *this; } - virtual NxStream &storeWord(NxU16 w) { NX_ASSERT(0); return *this; } - virtual NxStream &storeDword(NxU32 d) { NX_ASSERT(0); return *this; } - virtual NxStream &storeFloat(NxReal f) { NX_ASSERT(0); return *this; } - virtual NxStream &storeDouble(NxF64 f) { NX_ASSERT(0); return *this; } - virtual NxStream &storeBuffer(const void *buffer, NxU32 size) { NX_ASSERT(0); return *this; } - - mutable const NxU8 *buffer; -}; - -#endif // PHYSXMEMORYREADBUFFER_H diff --git a/panda/src/physx/physxMemoryWriteBuffer.cxx b/panda/src/physx/physxMemoryWriteBuffer.cxx deleted file mode 100644 index 0bede7e426..0000000000 --- a/panda/src/physx/physxMemoryWriteBuffer.cxx +++ /dev/null @@ -1,98 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMemoryWriteBuffer.cxx - * @author enn0x - * @date 2009-10-11 - */ - -#include "physxMemoryWriteBuffer.h" - -/** - * - */ -PhysxMemoryWriteBuffer::PhysxMemoryWriteBuffer() : currentSize(0), maxSize(0), data(nullptr) -{ - -} - -/** - * - */ -PhysxMemoryWriteBuffer::~PhysxMemoryWriteBuffer() -{ - NxGetPhysicsSDKAllocator()->free(data); -} - -/** - * - */ -NxStream &PhysxMemoryWriteBuffer::storeByte(NxU8 b) -{ - storeBuffer(&b, sizeof(NxU8)); - return *this; -} - -/** - * - */ -NxStream &PhysxMemoryWriteBuffer::storeWord(NxU16 w) -{ - storeBuffer(&w, sizeof(NxU16)); - return *this; -} - -/** - * - */ -NxStream &PhysxMemoryWriteBuffer::storeDword(NxU32 d) -{ - storeBuffer(&d, sizeof(NxU32)); - return *this; -} - -/** - * - */ -NxStream &PhysxMemoryWriteBuffer::storeFloat(NxReal f) -{ - storeBuffer(&f, sizeof(NxReal)); - return *this; -} - -/** - * - */ -NxStream &PhysxMemoryWriteBuffer::storeDouble(NxF64 f) -{ - storeBuffer(&f, sizeof(NxF64)); - return *this; -} - -/** - * - */ -NxStream &PhysxMemoryWriteBuffer::storeBuffer(const void *buffer, NxU32 size) -{ - NxU32 expectedSize = currentSize + size; - if (expectedSize > maxSize) - { - maxSize = expectedSize + 4096; - - NxU8 *newData = (NxU8 *)NxGetPhysicsSDKAllocator()->malloc(maxSize, NX_MEMORY_PERSISTENT); - if(data) - { - memcpy(newData, data, currentSize); - NxGetPhysicsSDKAllocator()->free(data); - } - data = newData; - } - memcpy(data + currentSize, buffer, size); - currentSize += size; - return *this; -} diff --git a/panda/src/physx/physxMemoryWriteBuffer.h b/panda/src/physx/physxMemoryWriteBuffer.h deleted file mode 100644 index 3af1a70b34..0000000000 --- a/panda/src/physx/physxMemoryWriteBuffer.h +++ /dev/null @@ -1,49 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMemoryWriteBuffer.h - * @author enn0x - * @date 2009-10-11 - */ - -#ifndef PHYSXMEMORYWRITEBUFFER_H -#define PHYSXMEMORYWRITEBUFFER_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxMemoryWriteBuffer : public NxStream { - -public: - PhysxMemoryWriteBuffer(); - virtual ~PhysxMemoryWriteBuffer(); - - virtual NxU8 readByte() const { NX_ASSERT(0); return 0; } - virtual NxU16 readWord() const { NX_ASSERT(0); return 0; } - virtual NxU32 readDword() const { NX_ASSERT(0); return 0; } - virtual float readFloat() const { NX_ASSERT(0); return 0.0f; } - virtual double readDouble() const { NX_ASSERT(0); return 0.0; } - virtual void readBuffer(void *buffer, NxU32 size) const { NX_ASSERT(0); } - - virtual NxStream &storeByte(NxU8 b); - virtual NxStream &storeWord(NxU16 w); - virtual NxStream &storeDword(NxU32 d); - virtual NxStream &storeFloat(NxReal f); - virtual NxStream &storeDouble(NxF64 f); - virtual NxStream &storeBuffer(const void *buffer, NxU32 size); - - NxU32 currentSize; - NxU32 maxSize; - NxU8 *data; -}; - -#endif // PHYSXMEMORYWRITEBUFFER_H diff --git a/panda/src/physx/physxMeshHash.I b/panda/src/physx/physxMeshHash.I deleted file mode 100644 index ca956765a5..0000000000 --- a/panda/src/physx/physxMeshHash.I +++ /dev/null @@ -1,70 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMeshHash.I - * @author enn0x - * @date 2010-09-13 - */ - -/** - * - */ -INLINE PhysxMeshHash:: -PhysxMeshHash() { - - _time = 1; - MeshHashRoot *r = _hashIndex; - - for (int i=0; i < _hashIndexSize; i++) { - r->first = -1; - r->timeStamp = 0; - r++; - } - - _spacing = 0.25f; - _invSpacing = 1.0f / _spacing; - -} - -/** - * - */ -INLINE PhysxMeshHash:: -~PhysxMeshHash() { - -} - -/** - * - */ -INLINE int PhysxMeshHash:: -hash_function(int xi, int yi, int zi) const { - - unsigned int h = (xi * 92837111)^(yi * 689287499)^(zi * 283923481); - return h % _hashIndexSize; -} - -/** - * - */ -INLINE void PhysxMeshHash:: -cell_coord_of(const NxVec3 &v, int &xi, int &yi, int &zi) const { - - xi = (int)(v.x * _invSpacing); if (v.x < 0.0f) xi--; - yi = (int)(v.y * _invSpacing); if (v.y < 0.0f) yi--; - zi = (int)(v.z * _invSpacing); if (v.z < 0.0f) zi--; -} - -/** - * - */ -INLINE NxF32 PhysxMeshHash:: -get_grid_spacing() const { - - return 1.0f / _invSpacing; -} diff --git a/panda/src/physx/physxMeshHash.cxx b/panda/src/physx/physxMeshHash.cxx deleted file mode 100644 index bba45e710e..0000000000 --- a/panda/src/physx/physxMeshHash.cxx +++ /dev/null @@ -1,241 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMeshHash.cxx - * @author enn0x - * @date 2010-09-13 - */ - -#include "physxMeshHash.h" - -/** - * - */ -void PhysxMeshHash:: -quick_sort(pvector &itemIndices, int l, int r) { - - int i, j, mi; - int k, m; - - i = l; j = r; mi = (l + r)/2; - m = itemIndices[mi]; - - while (i <= j) { - while(itemIndices[i] < m) i++; - while(m < itemIndices[j]) j--; - - if (i <= j) { - k = itemIndices[i]; itemIndices[i] = itemIndices[j]; itemIndices[j] = k; - i++; j--; - } - } - - if (l < j) quick_sort(itemIndices, l, j); - if (i < r) quick_sort(itemIndices, i, r); -} - -/** - * - */ -void PhysxMeshHash:: -compress_indices(pvector &itemIndices) { - - if (itemIndices.size() == 0) return; - - // Sort results - quick_sort(itemIndices, 0, itemIndices.size() - 1); - - // Mark duplicates - int i = 0; - while (i < (int)itemIndices.size()) { - int j = i+1; - while (j < (int)itemIndices.size() && itemIndices[i] == itemIndices[j]) { - itemIndices[j] = -1; j++; - } - i = j; - } - - // Remove duplicates - i = 0; - while (i < (int)itemIndices.size()) { - if (itemIndices[i] < 0) { - itemIndices[i] = itemIndices[itemIndices.size()-1]; - itemIndices.pop_back(); - } - else i++; - } -} - -/** - * - */ -void PhysxMeshHash:: -set_grid_spacing(float spacing) { - - _spacing = spacing; - _invSpacing = 1.0f / spacing; - - reset(); -} - -/** - * - */ -void PhysxMeshHash:: -reset() { - - _time++; - _entries.clear(); -} - -/** - * - */ -void PhysxMeshHash:: -add(const NxBounds3 &bounds, int itemIndex) { - - int x1,y1,z1; - int x2,y2,z2; - int x,y,z; - - cell_coord_of(bounds.min, x1, y1, z1); - cell_coord_of(bounds.max, x2, y2, z2); - - MeshHashEntry entry; - entry.itemIndex = itemIndex; - - for (x = x1; x <= x2; x++) { - for (y = y1; y <= y2; y++) { - for (z = z1; z <= z2; z++) { - - int h = hash_function(x, y, z); - MeshHashRoot &r = _hashIndex[h]; - int n = _entries.size(); - - if (r.timeStamp != _time || r.first < 0) - entry.next = -1; - else - entry.next = r.first; - - r.first = n; - r.timeStamp = _time; - - _entries.push_back(entry); - } - } - } -} - -/** - * - */ -void PhysxMeshHash:: -add(const NxVec3 &pos, int itemIndex) { - - int x, y, z; - - cell_coord_of(pos, x, y, z); - - MeshHashEntry entry; - entry.itemIndex = itemIndex; - - int h = hash_function(x, y, z); - MeshHashRoot &r = _hashIndex[h]; - int n = _entries.size(); - - if (r.timeStamp != _time || r.first < 0) - entry.next = -1; - else - entry.next = r.first; - - r.first = n; - r.timeStamp = _time; - - _entries.push_back(entry); -} - -/** - * - */ -void PhysxMeshHash:: -query(const NxBounds3 &bounds, pvector &itemIndices, int maxIndices) { - - int x1, y1, z1; - int x2, y2, z2; - int x, y, z; - - cell_coord_of(bounds.min, x1, y1, z1); - cell_coord_of(bounds.max, x2, y2, z2); - - itemIndices.clear(); - - for (x=x1; x<=x2; x++) { - for (y=y1; y<=y2; y++) { - for (z=z1; z<=z2; z++) { - - int h = hash_function(x, y, z); - - MeshHashRoot &r = _hashIndex[h]; - if (r.timeStamp != _time) continue; - int i = r.first; - - while (i >= 0) { - MeshHashEntry &entry = _entries[i]; - itemIndices.push_back(entry.itemIndex); - if (maxIndices >= 0 && (int)itemIndices.size() >= maxIndices) return; - i = entry.next; - } - } - } - } -} - -/** - * - */ -void PhysxMeshHash:: -query_unique(const NxBounds3 &bounds, pvector &itemIndices, int maxIndices) { - - query(bounds, itemIndices, maxIndices); - compress_indices(itemIndices); -} - -/** - * - */ -void PhysxMeshHash:: -query(const NxVec3 &pos, pvector &itemIndices, int maxIndices) { - - int x, y, z; - - cell_coord_of(pos, x, y, z); - - itemIndices.clear(); - - int h = hash_function(x, y, z); - MeshHashRoot &r = _hashIndex[h]; - if (r.timeStamp != _time) return; - int i = r.first; - - while (i >= 0) { - MeshHashEntry &entry = _entries[i]; - itemIndices.push_back(entry.itemIndex); - if (maxIndices >= 0 && (int)itemIndices.size() >= maxIndices) return; - i = entry.next; - } -} - -/** - * - */ -void PhysxMeshHash:: -query_unique(const NxVec3 &pos, pvector &itemIndices, int maxIndices) { - - query(pos, itemIndices, maxIndices); - compress_indices(itemIndices); -} diff --git a/panda/src/physx/physxMeshHash.h b/panda/src/physx/physxMeshHash.h deleted file mode 100644 index 08301e4ab2..0000000000 --- a/panda/src/physx/physxMeshHash.h +++ /dev/null @@ -1,75 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMeshHash.h - * @author enn0x - * @date 2010-09-13 - */ - -#ifndef PHYSXMESHHASH_H -#define PHYSXMESHHASH_H - -#include "config_physx.h" - -#include "pvector.h" - -/** - * Utility class used in building links between a tetrahedron mesh (soft body) - * and a triangle mesh used for rendering the soft body. - */ -class PhysxMeshHash { - -public: - PhysxMeshHash(); - ~PhysxMeshHash(); - - void reset(); - - void set_grid_spacing(float spacing); - INLINE NxF32 get_grid_spacing() const; - - void add(const NxBounds3 &bounds, int itemIndex); - void add(const NxVec3 &pos, int itemIndex); - - void query(const NxBounds3 &bounds, pvector &itemIndices, int maxIndices=-1); - void query_unique(const NxBounds3 &bounds, pvector &itemIndices, int maxIndices=-1); - - void query(const NxVec3 &pos, pvector &itemIndices, int maxIndices=-1); - void query_unique(const NxVec3 &pos, pvector &itemIndices, int maxIndices=-1); - -private: - struct MeshHashRoot { - int first; - int timeStamp; - }; - - struct MeshHashEntry { - int itemIndex; - int next; - }; - - NxI32 _time; - NxF32 _spacing; - NxF32 _invSpacing; - - static const int _hashIndexSize = 17011; - MeshHashRoot _hashIndex[_hashIndexSize]; - - pvector _entries; - - INLINE int hash_function(int xi, int yi, int zi) const; - INLINE void cell_coord_of(const NxVec3 &v, int &xi, int &yi, int &zi) const; - - void compress_indices(pvector &itemIndices); - void quick_sort(pvector &itemIndices, int l, int r); - -}; - -#include "physxMeshHash.I" - -#endif // PHYSXMESHHASH_H diff --git a/panda/src/physx/physxMeshPool.I b/panda/src/physx/physxMeshPool.I deleted file mode 100644 index 113ba4a524..0000000000 --- a/panda/src/physx/physxMeshPool.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMeshPool.I - * @author enn0x - * @date 2009-10-14 - */ - -/** - * - */ -INLINE PhysxMeshPool:: -PhysxMeshPool() { - -} - -/** - * - */ -INLINE PhysxMeshPool:: -~PhysxMeshPool() { - -} diff --git a/panda/src/physx/physxMeshPool.cxx b/panda/src/physx/physxMeshPool.cxx deleted file mode 100644 index 155707cccb..0000000000 --- a/panda/src/physx/physxMeshPool.cxx +++ /dev/null @@ -1,345 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMeshPool.cxx - * @author enn0x - * @date 2009-10-14 - */ - -#include "physxMeshPool.h" -#include "physxConvexMesh.h" -#include "physxTriangleMesh.h" -#include "physxClothMesh.h" -#include "physxSoftBodyMesh.h" - -#include "physxFileStream.h" -#include "virtualFileSystem.h" - -PhysxMeshPool::ConvexMeshes PhysxMeshPool::_convex_meshes; -PhysxMeshPool::TriangleMeshes PhysxMeshPool::_triangle_meshes; -PhysxMeshPool::ClothMeshes PhysxMeshPool::_cloth_meshes; -PhysxMeshPool::SoftbodyMeshes PhysxMeshPool::_softbody_meshes; - -/** - * - */ -bool PhysxMeshPool:: -check_filename(const Filename &fn) { - - if (!(VirtualFileSystem::get_global_ptr()->exists(fn))) { - physx_cat.error() << "File does not exists: " << fn << std::endl; - return false; - } - - if (!(VirtualFileSystem::get_global_ptr()->is_regular_file(fn))) { - physx_cat.error() << "Not a regular file: " << fn << std::endl; - return false; - } - - return true; -} - -/** - * - */ -PhysxConvexMesh *PhysxMeshPool:: -load_convex_mesh(const Filename &fn) { - - if (!check_filename(fn)) return nullptr; - - PhysxConvexMesh *mesh; - - ConvexMeshes::iterator it = _convex_meshes.find(fn); - if (it == _convex_meshes.end()) { - // Not found; load mesh. - NxConvexMesh *meshPtr; - PhysxFileStream stream = PhysxFileStream(fn, true); - - mesh = new PhysxConvexMesh(); - nassertr_always(mesh, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr_always(sdk, nullptr); - - meshPtr = sdk->createConvexMesh(stream); - nassertr_always(meshPtr, nullptr); - - mesh->link(meshPtr); - - _convex_meshes.insert(ConvexMeshes::value_type(fn, mesh)); - } - else { - // Found; return previously loaded mesh. - mesh = (*it).second; - } - - return mesh; -} - -/** - * - */ -PhysxTriangleMesh *PhysxMeshPool:: -load_triangle_mesh(const Filename &fn) { - - if (!check_filename(fn)) return nullptr; - - PhysxTriangleMesh *mesh; - - TriangleMeshes::iterator it = _triangle_meshes.find(fn); - if (it == _triangle_meshes.end()) { - // Not found; load mesh. - NxTriangleMesh *meshPtr; - PhysxFileStream stream = PhysxFileStream(fn, true); - - mesh = new PhysxTriangleMesh(); - nassertr_always(mesh, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr_always(sdk, nullptr); - - meshPtr = sdk->createTriangleMesh(stream); - nassertr_always(meshPtr, nullptr); - - mesh->link(meshPtr); - - _triangle_meshes.insert(TriangleMeshes::value_type(fn, mesh)); - } - else { - // Found; return previously loaded mesh. - mesh = (*it).second; - } - - return mesh; -} - -/** - * - */ -PhysxClothMesh *PhysxMeshPool:: -load_cloth_mesh(const Filename &fn) { - - if (!check_filename(fn)) return nullptr; - - PhysxClothMesh *mesh; - - ClothMeshes::iterator it = _cloth_meshes.find(fn); - if (it == _cloth_meshes.end()) { - // Not found; load mesh. - NxClothMesh *meshPtr; - PhysxFileStream stream = PhysxFileStream(fn, true); - - mesh = new PhysxClothMesh(); - nassertr_always(mesh, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr_always(sdk, nullptr); - - meshPtr = sdk->createClothMesh(stream); - nassertr_always(meshPtr, nullptr); - - mesh->link(meshPtr); - - _cloth_meshes.insert(ClothMeshes::value_type(fn, mesh)); - } - else { - // Found; return previously loaded mesh. - mesh = (*it).second; - } - - return mesh; -} - -/** - * - */ -PhysxSoftBodyMesh *PhysxMeshPool:: -load_soft_body_mesh(const Filename &fn) { - - if (!check_filename(fn)) return nullptr; - - PhysxSoftBodyMesh *mesh; - - SoftbodyMeshes::iterator it = _softbody_meshes.find(fn); - if (it == _softbody_meshes.end()) { - // Not found; load mesh. - NxSoftBodyMesh *meshPtr; - PhysxFileStream stream = PhysxFileStream(fn, true); - - mesh = new PhysxSoftBodyMesh(); - nassertr_always(mesh, nullptr); - - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - nassertr_always(sdk, nullptr); - - meshPtr = sdk->createSoftBodyMesh(stream); - nassertr_always(meshPtr, nullptr); - - mesh->link(meshPtr); - - _softbody_meshes.insert(SoftbodyMeshes::value_type(fn, mesh)); - } - else { - // Found; return previously loaded mesh. - mesh = (*it).second; - } - - return mesh; -} - -/** - * - */ -bool PhysxMeshPool:: -release_convex_mesh(PhysxConvexMesh *mesh) { - - ConvexMeshes::iterator it; - for (it=_convex_meshes.begin(); it != _convex_meshes.end(); ++it) { - if (mesh == (*it).second) { - _convex_meshes.erase(it); - return true; - } - } - - return false; -} - -/** - * - */ -bool PhysxMeshPool:: -release_triangle_mesh(PhysxTriangleMesh *mesh) { - - TriangleMeshes::iterator it; - for (it=_triangle_meshes.begin(); it != _triangle_meshes.end(); ++it) { - if (mesh == (*it).second) { - _triangle_meshes.erase(it); - return true; - } - } - - return false; -} - -/** - * - */ -bool PhysxMeshPool:: -release_cloth_mesh(PhysxClothMesh *mesh) { - - ClothMeshes::iterator it; - for (it=_cloth_meshes.begin(); it != _cloth_meshes.end(); ++it) { - if (mesh == (*it).second) { - _cloth_meshes.erase(it); - return true; - } - } - - return false; -} - -/** - * - */ -bool PhysxMeshPool:: -release_soft_body_mesh(PhysxSoftBodyMesh *mesh) { - - SoftbodyMeshes::iterator it; - for (it=_softbody_meshes.begin(); it != _softbody_meshes.end(); ++it) { - if (mesh == (*it).second) { - _softbody_meshes.erase(it); - return true; - } - } - - return false; -} - -/** - * - */ -void PhysxMeshPool:: -list_contents() { - list_contents(nout); -} - -/** - * - */ -void PhysxMeshPool:: -list_contents(std::ostream &out) { - - out << "PhysX mesh pool contents:\n"; - - // Convex meshes - { - ConvexMeshes::const_iterator it; - for (it=_convex_meshes.begin(); it != _convex_meshes.end(); ++it) { - Filename fn = (*it).first; - PhysxConvexMesh *mesh = (*it).second; - - out << " " << fn.get_fullpath() - << " (convex mesh, " << mesh->ptr()->getReferenceCount() - << " references)" << std::endl; - } - } - - // Triangle meshes - { - TriangleMeshes::const_iterator it; - for (it=_triangle_meshes.begin(); it != _triangle_meshes.end(); ++it) { - Filename fn = (*it).first; - PhysxTriangleMesh *mesh = (*it).second; - - out << " " << fn.get_fullpath() - << " (triangle mesh, " << mesh->ptr()->getReferenceCount() - << " references)\n"; - } - } - - // Cloth meshes - { - ClothMeshes::const_iterator it; - for (it=_cloth_meshes.begin(); it != _cloth_meshes.end(); ++it) { - Filename fn = (*it).first; - PhysxClothMesh *mesh = (*it).second; - - out << " " << fn.get_fullpath() - << " (cloth mesh, " << mesh->ptr()->getReferenceCount() - << " references)\n"; - } - } - - // Soft body meshes - { - SoftbodyMeshes::const_iterator it; - for (it=_softbody_meshes.begin(); it != _softbody_meshes.end(); ++it) { - Filename fn = (*it).first; - PhysxSoftBodyMesh *mesh = (*it).second; - - out << " " << fn.get_fullpath() - << " (soft body mesh, " << mesh->ptr()->getReferenceCount() - << " references)\n"; - } - } - - // Summary - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - - out << " Total number of convex meshes: " << sdk->getNbConvexMeshes() - << " created, " << _convex_meshes.size() << " registred\n"; - - out << " Total number of triangle meshes: " << sdk->getNbTriangleMeshes() - << " created, " << _triangle_meshes.size() << " registred\n"; - - out << " Total number of cloth meshes: " << sdk->getNbClothMeshes() - << " created, " << _cloth_meshes.size() << " registred\n"; - - out << " Total number of soft body meshes: " << sdk->getNbSoftBodyMeshes() - << " created, " << _softbody_meshes.size() << " registred\n"; -} diff --git a/panda/src/physx/physxMeshPool.h b/panda/src/physx/physxMeshPool.h deleted file mode 100644 index b66d06df7c..0000000000 --- a/panda/src/physx/physxMeshPool.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMeshPool.h - * @author enn0x - * @date 2009-10-14 - */ - -#ifndef PHYSXMESHPOOL_H -#define PHYSXMESHPOOL_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "pnotify.h" -#include "pmap.h" -#include "filename.h" - -#include "physx_includes.h" - -class PhysxConvexMesh; -class PhysxTriangleMesh; -class PhysxClothMesh; -class PhysxSoftBodyMesh; - -/** - * This class unifies all references to the same filename, so that multiple - * attempts to load the same mesh will return the same pointer. The mesh - * filename is automatically resolved before an attempt to load the mesh is - * made. - */ -class EXPCL_PANDAPHYSX PhysxMeshPool { - -PUBLISHED: - INLINE PhysxMeshPool(); - INLINE ~PhysxMeshPool(); - - static PhysxConvexMesh *load_convex_mesh(const Filename &filename); - static PhysxTriangleMesh *load_triangle_mesh(const Filename &filename); - static PhysxClothMesh *load_cloth_mesh(const Filename &filename); - static PhysxSoftBodyMesh *load_soft_body_mesh(const Filename &filename); - - static bool release_convex_mesh(PhysxConvexMesh *mesh); - static bool release_triangle_mesh(PhysxTriangleMesh *mesh); - static bool release_cloth_mesh(PhysxClothMesh *mesh); - static bool release_soft_body_mesh(PhysxSoftBodyMesh *mesh); - - static void list_contents(); - static void list_contents(std::ostream &out); - -private: - static bool check_filename(const Filename &fn); - - typedef pmap ConvexMeshes; - static ConvexMeshes _convex_meshes; - - typedef pmap TriangleMeshes; - static TriangleMeshes _triangle_meshes; - - typedef pmap ClothMeshes; - static ClothMeshes _cloth_meshes; - - typedef pmap SoftbodyMeshes; - static SoftbodyMeshes _softbody_meshes; -}; - -#include "physxMeshPool.I" - -#endif // PHYSXMESHPOOL_H diff --git a/panda/src/physx/physxMotorDesc.I b/panda/src/physx/physxMotorDesc.I deleted file mode 100644 index 5511500ff5..0000000000 --- a/panda/src/physx/physxMotorDesc.I +++ /dev/null @@ -1,39 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMotorDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxMotorDesc:: -PhysxMotorDesc() { - -} - -/** - * - */ -INLINE PhysxMotorDesc:: -PhysxMotorDesc(float velTarget, float maxForce, bool freeSpin) { - - _desc.velTarget = velTarget; - _desc.maxForce = maxForce; - _desc.freeSpin = freeSpin; -} - -/** - * - */ -INLINE PhysxMotorDesc:: -~PhysxMotorDesc() { - -} diff --git a/panda/src/physx/physxMotorDesc.cxx b/panda/src/physx/physxMotorDesc.cxx deleted file mode 100644 index 1f230905d1..0000000000 --- a/panda/src/physx/physxMotorDesc.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMotorDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxMotorDesc.h" - -/** - * - */ -void PhysxMotorDesc:: -set_vel_target(float velTarget) { - - _desc.velTarget = velTarget; -} - -/** - * - */ -void PhysxMotorDesc:: -set_max_force(float maxForce) { - - _desc.maxForce = maxForce; -} - -/** - * - */ -void PhysxMotorDesc:: -set_free_spin(bool freeSpin) { - - _desc.freeSpin = (NX_BOOL)freeSpin; -} - -/** - * - */ -float PhysxMotorDesc:: -get_vel_target() const { - - return _desc.velTarget; -} - -/** - * - */ -float PhysxMotorDesc:: -get_max_force() const { - - return _desc.maxForce; -} - -/** - * - */ -bool PhysxMotorDesc:: -get_free_spin() const { - - return (_desc.freeSpin) ? true : false; -} diff --git a/panda/src/physx/physxMotorDesc.h b/panda/src/physx/physxMotorDesc.h deleted file mode 100644 index 9aab85fd16..0000000000 --- a/panda/src/physx/physxMotorDesc.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxMotorDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXMOTORDESC_H -#define PHYSXMOTORDESC_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * Describes a joint motor. Some joints can be motorized, this allows them to - * apply a force to cause attached actors to move. Joints which can be - * motorized: - PhysxPulleyJoint - PhysxRevoluteJoint - */ -class EXPCL_PANDAPHYSX PhysxMotorDesc { - -PUBLISHED: - INLINE PhysxMotorDesc(); - INLINE PhysxMotorDesc(float velTarget, float maxForce=0, bool freeSpin=0); - INLINE ~PhysxMotorDesc(); - - void set_vel_target(float velTarget); - void set_max_force(float maxForce); - void set_free_spin(bool freeSpin); - - float get_vel_target() const; - float get_max_force() const; - bool get_free_spin() const; - -public: - NxMotorDesc _desc; -}; - -#include "physxMotorDesc.I" - -#endif // PHYSXMOTORDESC_H diff --git a/panda/src/physx/physxObject.I b/panda/src/physx/physxObject.I deleted file mode 100644 index b2331f23d1..0000000000 --- a/panda/src/physx/physxObject.I +++ /dev/null @@ -1,116 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxObject.I - * @author enn0x - * @date 2009-09-11 - */ - -/** - * - */ -INLINE PhysxObject:: -PhysxObject() { - - _error_type = ET_empty; -} - -/** - * - */ -INLINE PhysxObject:: -~PhysxObject() { - -#ifdef HAVE_PYTHON - // Decrement the reference count of all held Python objects. - PythonTagData::const_iterator ti; - for (ti = _python_tag_data.begin(); ti != _python_tag_data.end(); ++ti) { - PyObject *value = (*ti).second; - Py_XDECREF(value); - } -#endif // HAVE_PYTHON -} - -#ifdef HAVE_PYTHON -/** - * - */ -INLINE bool PhysxObject:: -has_python_tags() const { - - return _python_tag_data.empty() ? false : true; -} - -/** - * - */ -INLINE void PhysxObject:: -set_python_tag(const std::string &key, PyObject *value) { - - Py_XINCREF(value); - - std::pair result; - result = _python_tag_data.insert(PythonTagData::value_type(key, value)); - - if (!result.second) { - // The insert was unsuccessful; that means the key was already present in - // the map. In this case, we should decrement the original value's - // reference count and replace it with the new object. - PythonTagData::iterator ti = result.first; - PyObject *old_value = (*ti).second; - Py_XDECREF(old_value); - (*ti).second = value; - } -} - -/** - * - */ -INLINE PyObject *PhysxObject:: -get_python_tag(const std::string &key) const { - - PythonTagData::const_iterator ti; - ti = _python_tag_data.find(key); - - if (ti != _python_tag_data.end()) { - PyObject *result = (*ti).second; - Py_XINCREF(result); - return result; - } - - Py_INCREF(Py_None); - return Py_None; -} - -/** - * - */ -INLINE bool PhysxObject:: -has_python_tag(const std::string &key) const { - - PythonTagData::const_iterator ti; - ti = _python_tag_data.find(key); - return (ti != _python_tag_data.end()); -} - -/** - * - */ -INLINE void PhysxObject:: -clear_python_tag(const std::string &key) { - - PythonTagData::iterator ti; - ti = _python_tag_data.find(key); - - if (ti != _python_tag_data.end()) { - PyObject *value = (*ti).second; - Py_XDECREF(value); - _python_tag_data.erase(ti); - } -} -#endif // HAVE_PYTHON diff --git a/panda/src/physx/physxObject.cxx b/panda/src/physx/physxObject.cxx deleted file mode 100644 index 72a90b038b..0000000000 --- a/panda/src/physx/physxObject.cxx +++ /dev/null @@ -1,16 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxObject.cxx - * @author enn0x - * @date 2009-09-11 - */ - -#include "physxObject.h" - -TypeHandle PhysxObject::_type_handle; diff --git a/panda/src/physx/physxObject.h b/panda/src/physx/physxObject.h deleted file mode 100644 index 0a40cb66fb..0000000000 --- a/panda/src/physx/physxObject.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxObject.h - * @author enn0x - * @date 2009-09-11 - */ - -#ifndef PHYSXOBJECT_H -#define PHYSXOBJECT_H - -#include "pandabase.h" -#include "typedReferenceCount.h" - -#ifdef HAVE_PYTHON -#undef _POSIX_C_SOURCE -#include -#endif // HAVE_PYTHON - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxObject : public TypedReferenceCount { - -#ifdef HAVE_PYTHON -PUBLISHED: - INLINE void set_python_tag(const std::string &key, PyObject *value); - INLINE PyObject *get_python_tag(const std::string &key) const; - INLINE bool has_python_tag(const std::string &key) const; - INLINE void clear_python_tag(const std::string &key); - INLINE bool has_python_tags() const; -#endif // HAVE_PYTHON - -PUBLISHED: - virtual void ls() const = 0; - virtual void ls(std::ostream &out, int indent_level=0) const = 0; - -protected: - INLINE PhysxObject(); - INLINE ~PhysxObject(); - - enum ErrorType { - ET_empty, - ET_ok, - ET_released, - ET_fail, - }; - - ErrorType _error_type; - -#ifdef HAVE_PYTHON -private: - typedef phash_map PythonTagData; - PythonTagData _python_tag_data; -#endif // HAVE_PYTHON - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - TypedReferenceCount::init_type(); - register_type(_type_handle, "PhysxObject", - TypedReferenceCount::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxObject.I" - -#endif // PHYSXOBJECT_H diff --git a/panda/src/physx/physxObjectCollection.I b/panda/src/physx/physxObjectCollection.I deleted file mode 100644 index 54137cec40..0000000000 --- a/panda/src/physx/physxObjectCollection.I +++ /dev/null @@ -1,97 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxObjectCollection.I - * @author enn0x - * @date 2009-11-08 - */ - -/** - * - */ -template -INLINE unsigned int PhysxObjectCollection:: -size() const { - - return _objects.size(); -} - -/** - * - */ -template -INLINE void PhysxObjectCollection:: -add(PT(T) object) { - - _objects.push_back(object); -} - -/** - * - */ -template -INLINE void PhysxObjectCollection:: -remove(PT(T) object) { - - typename pvector::iterator it; - - it = find(_objects.begin(), _objects.end(), object); - if (it != _objects.end()) { - _objects.erase(it); - } - else - { - physx_cat.warning() << "object not found in collection" << std::endl; - } -} - -/** - * Returns the n-th PhysxObject in the collection. The operator [] is maybe a - * more convenient way to access objects from the collection. - */ -template -INLINE T *PhysxObjectCollection:: -get(unsigned int index) const { - - nassertr(index < _objects.size(), nullptr); - return _objects[index]; -} - -/** - * Returns the n-th PhysxObject in the collection. This is the same as the - * get() method. - */ -template -INLINE T *PhysxObjectCollection:: -operator [] (unsigned int index) const { - - nassertr(index < _objects.size(), nullptr); - return _objects[index]; -} - -/** - * - */ -template -INLINE void PhysxObjectCollection:: -ls() const { - - ls(nout); -} - -/** - * - */ -template -INLINE void PhysxObjectCollection:: -ls(std::ostream &out, int indent_level) const { - - for (unsigned int i=0; i < size(); i++) { - get(i)->ls(out, indent_level + 2); - } -} diff --git a/panda/src/physx/physxObjectCollection.cxx b/panda/src/physx/physxObjectCollection.cxx deleted file mode 100644 index 061c5be82a..0000000000 --- a/panda/src/physx/physxObjectCollection.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxObjectCollection.cxx - * @author enn0x - * @date 2009-11-08 - */ - -#include "physxObjectCollection.h" diff --git a/panda/src/physx/physxObjectCollection.h b/panda/src/physx/physxObjectCollection.h deleted file mode 100644 index 77521de8aa..0000000000 --- a/panda/src/physx/physxObjectCollection.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxObjectCollection.h - * @author enn0x - * @date 2009-11-08 - */ - -#ifndef PHYSXOBJECTCOLLECTION_H -#define PHYSXOBJECTCOLLECTION_H - -#include "pandabase.h" - -#include "config_physx.h" - -/** - * - */ -template -class EXPCL_PANDAPHYSX PhysxObjectCollection { - -public: - INLINE unsigned int size() const; - INLINE void add(PT(T) object); - INLINE void remove(PT(T) object); - INLINE T *get(unsigned int index) const; - INLINE T *operator [] (unsigned int index) const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -private: - pvector _objects; -}; - -#include "physxObjectCollection.I" - -#endif // PHYSXOBJECTCOLLECTION_H diff --git a/panda/src/physx/physxOverlapReport.I b/panda/src/physx/physxOverlapReport.I deleted file mode 100644 index 16394aa48b..0000000000 --- a/panda/src/physx/physxOverlapReport.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxOverlapReport.I - * @author enn0x - * @date 2009-10-21 - */ - -/** - * - */ -INLINE PhysxOverlapReport:: -PhysxOverlapReport() { - -} - -/** - * - */ -INLINE PhysxOverlapReport:: -~PhysxOverlapReport() { - -} diff --git a/panda/src/physx/physxOverlapReport.cxx b/panda/src/physx/physxOverlapReport.cxx deleted file mode 100644 index 4589740dc4..0000000000 --- a/panda/src/physx/physxOverlapReport.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxOverlapReport.cxx - * @author enn0x - * @date 2009-10-21 - */ - -#include "physxOverlapReport.h" -#include "physxShape.h" - -/** - * - */ -bool PhysxOverlapReport:: -onEvent(NxU32 nbEntities, NxShape **entities) { - - for (unsigned int i=0; iuserData; - _overlaps.push_back(shape); - } - - return true; -} - -/** - * - */ -unsigned int PhysxOverlapReport:: -get_num_overlaps() const { - - return _overlaps.size(); -} - -/** - * - */ -PhysxShape *PhysxOverlapReport:: -get_first_overlap() { - - _iterator = _overlaps.begin(); - return get_next_overlap(); -} - -/** - * - */ -PhysxShape *PhysxOverlapReport:: -get_next_overlap() { - - if (_iterator != _overlaps.end()) { - return *_iterator++; - } - - // No more items. Return empty overlap. - return nullptr; -} - -/** - * - */ -PhysxShape *PhysxOverlapReport:: -get_overlap(unsigned int idx) { - - nassertr(idx < get_num_overlaps(), nullptr); - return _overlaps[idx]; -} diff --git a/panda/src/physx/physxOverlapReport.h b/panda/src/physx/physxOverlapReport.h deleted file mode 100644 index 13b39654b1..0000000000 --- a/panda/src/physx/physxOverlapReport.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxOverlapReport.h - * @author enn0x - * @date 2009-10-21 - */ - -#ifndef PHYSXOVERLAPREPORT_H -#define PHYSXOVERLAPREPORT_H - -#include "pandabase.h" -#include "pvector.h" -#include "pointerTo.h" - -#include "config_physx.h" -#include "physx_includes.h" - -class PhysxShape; - -class PhysxUserEntityReport : public NxUserEntityReport {}; - -/** - * Objects of this class are returned by the 'overlap shape' methods, for - * example overlapSphereShapes. They contain an iterable list of all sshapes - * that the raycast query produced. - */ -class EXPCL_PANDAPHYSX PhysxOverlapReport : public PhysxUserEntityReport { - -PUBLISHED: - unsigned int get_num_overlaps() const; - PhysxShape *get_first_overlap(); - PhysxShape *get_next_overlap(); - PhysxShape *get_overlap(unsigned int idx); - MAKE_SEQ(get_overlaps, get_num_overlaps, get_overlap); - -public: - INLINE PhysxOverlapReport(); - INLINE ~PhysxOverlapReport(); - - virtual bool onEvent(NxU32 nbEntities, NxShape **entities); - -private: - typedef pvector Overlaps; - Overlaps _overlaps; - - typedef Overlaps::const_iterator const_iterator; - const_iterator _iterator; -}; - -#include "physxOverlapReport.I" - -#endif // PHYSXOVERLAPREPORT_H diff --git a/panda/src/physx/physxPlane.I b/panda/src/physx/physxPlane.I deleted file mode 100644 index a974b2b513..0000000000 --- a/panda/src/physx/physxPlane.I +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlane.I - * @author enn0x - * @date 2009-10-31 - */ - -/** - * - */ -INLINE PhysxPlane:: -PhysxPlane() { - -} - -/** - * - */ -INLINE PhysxPlane:: -PhysxPlane(const PhysxPlane &plane) { - - _plane = plane._plane; -} - -/** - * - */ -INLINE PhysxPlane:: -~PhysxPlane() { - -} diff --git a/panda/src/physx/physxPlane.cxx b/panda/src/physx/physxPlane.cxx deleted file mode 100644 index 380c3bfdb8..0000000000 --- a/panda/src/physx/physxPlane.cxx +++ /dev/null @@ -1,155 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlane.cxx - * @author enn0x - * @date 2009-10-31 - */ - -#include "physxPlane.h" -#include "physxManager.h" - -/** - * - */ -float PhysxPlane:: -distance(const LPoint3f &p) const { - - nassertr(!p.is_nan(), 0.0f); - - return _plane.distance(PhysxManager::point3_to_nxVec3(p)); -} - -/** - * - */ -bool PhysxPlane:: -belongs(const LPoint3f &p) const { - - nassertr(!p.is_nan(), false); - - return _plane.belongs(PhysxManager::point3_to_nxVec3(p)); -} - -/** - * - */ -LPoint3f PhysxPlane:: -point_in_plane() const { - - return PhysxManager::nxVec3_to_point3(_plane.pointInPlane()); -} - -/** - * - */ -LPoint3f PhysxPlane:: -project(const LPoint3f &p) const { - - nassertr(!p.is_nan(), LPoint3f::zero()); - - return PhysxManager::nxVec3_to_point3(_plane.project(PhysxManager::point3_to_nxVec3(p))); -} - -/** - * - */ -void PhysxPlane:: -inverse_transform(const LMatrix4f &transform, PhysxPlane &transformed) const { - - nassertv(!transform.is_nan()); - - _plane.inverseTransform(PhysxManager::mat4_to_nxMat34(transform), transformed._plane); -} - -/** - * - */ -void PhysxPlane:: -normalize() { - - _plane.normalize(); -} - -/** - * - */ -void PhysxPlane:: -transform(const LMatrix4f &transform, PhysxPlane &transformed) const { - - nassertv(!transform.is_nan()); - - _plane.transform(PhysxManager::mat4_to_nxMat34(transform), transformed._plane); -} - -/** - * - */ -float PhysxPlane:: -get_d() const { - - return _plane.d; -} - -/** - * - */ -void PhysxPlane:: -set_d(float value) { - - _plane.d = value; -} - -/** - * - */ -LVector3f PhysxPlane:: -get_normal() const { - - return PhysxManager::nxVec3_to_vec3(_plane.normal); -} - -/** - * - */ -void PhysxPlane:: -set_normal(LVector3f normal) { - - nassertv(!normal.is_nan()); - - _plane.normal = PhysxManager::vec3_to_nxVec3(normal); -} - -/** - * - */ -PhysxPlane PhysxPlane:: -set(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f &p2) { - - PhysxPlane plane; - - nassertr(!p0.is_nan(), plane); - nassertr(!p1.is_nan(), plane); - nassertr(!p2.is_nan(), plane); - - plane._plane = _plane.set(PhysxManager::point3_to_nxVec3(p0), - PhysxManager::point3_to_nxVec3(p1), - PhysxManager::point3_to_nxVec3(p2)); - return plane; -} - -/** - * - */ -PhysxPlane PhysxPlane:: -zero() { - - PhysxPlane plane; - plane._plane = _plane.zero(); - return plane; -} diff --git a/panda/src/physx/physxPlane.h b/panda/src/physx/physxPlane.h deleted file mode 100644 index 9454ad920a..0000000000 --- a/panda/src/physx/physxPlane.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlane.h - * @author enn0x - * @date 2009-10-31 - */ - -#ifndef PHYSXPLANE_H -#define PHYSXPLANE_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxPlane { - -PUBLISHED: - INLINE PhysxPlane(); - INLINE PhysxPlane(const PhysxPlane &plane); - INLINE ~PhysxPlane(); - - float distance(const LPoint3f &p) const; - bool belongs(const LPoint3f &p) const; - void normalize(); - LPoint3f point_in_plane() const; - LPoint3f project(const LPoint3f &p) const; - void transform(const LMatrix4f &transform, PhysxPlane &transformed) const; - void inverse_transform(const LMatrix4f &transform, PhysxPlane &transformed) const; - - PhysxPlane set(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f &p2); - PhysxPlane zero(); - - float get_d() const; - LVector3f get_normal() const; - - void set_d(float d); - void set_normal(LVector3f normal); - -public: - NxPlane _plane; -}; - -#include "physxPlane.I" - -#endif // PHYSPLANE_H diff --git a/panda/src/physx/physxPlaneShape.I b/panda/src/physx/physxPlaneShape.I deleted file mode 100644 index 613d062fc4..0000000000 --- a/panda/src/physx/physxPlaneShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlaneShape.I - * @author enn0x - * @date 2009-09-16 - */ - -/** - * - */ -INLINE PhysxPlaneShape:: -PhysxPlaneShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxPlaneShape:: -~PhysxPlaneShape() { - -} diff --git a/panda/src/physx/physxPlaneShape.cxx b/panda/src/physx/physxPlaneShape.cxx deleted file mode 100644 index 05a22a60f7..0000000000 --- a/panda/src/physx/physxPlaneShape.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlaneShape.cxx - * @author enn0x - * @date 2009-09-16 - */ - -#include "physxPlaneShape.h" -#include "physxPlaneShapeDesc.h" -#include "physxManager.h" - -TypeHandle PhysxPlaneShape::_type_handle; - -/** - * - */ -void PhysxPlaneShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isPlane(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxPlaneShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxPlaneShape:: -save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Sets the plane equation. - normal: Normal for the plane, in the global - * frame. Range: direction vector - d: Distance coefficient of the plane - * equation. Range: (-inf,inf) - */ -void PhysxPlaneShape:: -set_plane(const LVector3f &normal, float d) { - - nassertv(_error_type == ET_ok); - _ptr->setPlane(PhysxManager::vec3_to_nxVec3(normal), d); -} diff --git a/panda/src/physx/physxPlaneShape.h b/panda/src/physx/physxPlaneShape.h deleted file mode 100644 index 15115bf6fe..0000000000 --- a/panda/src/physx/physxPlaneShape.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlaneShape.h - * @author enn0x - * @date 2009-09-16 - */ - -#ifndef PHYSXPLANESHAPE_H -#define PHYSXPLANESHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxPlaneShapeDesc; - -/** - * A plane collision detection primitive. By default it is configured to be - * the y == 0 plane. You can then set a normal and a d to specify an - * arbitrary plane. d is the distance of the plane from the origin along the - * normal, assuming the normal is normalized. Thus the plane equation is: - * normal.x * X + normal.y * Y + normal.z * Z = d - * - * Note: the plane does not represent an infinitely thin object, but rather a - * completely solid negative half space (all points p for which normal.dot(p) - * - d < 0 are inside the solid region.) - * - * Each shape is owned by an actor that it is attached to. - * - * An instance can be created by calling the createShape() method of the - * PhysxActor object that should own it, with a PhysxPlaneShapeDesc object as - * the parameter, or by adding the shape descriptor into the PhysxActorDesc - * class before creating the actor. - * - * The shape is deleted by calling release() on the shape itself. - */ -class EXPCL_PANDAPHYSX PhysxPlaneShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxPlaneShape(); - INLINE ~PhysxPlaneShape(); - - void save_to_desc(PhysxPlaneShapeDesc &shapeDesc) const; - - void set_plane(const LVector3f &normal, float d); - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxPlaneShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxPlaneShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxPlaneShape.I" - -#endif // PHYSXPLANESHAPE_H diff --git a/panda/src/physx/physxPlaneShapeDesc.I b/panda/src/physx/physxPlaneShapeDesc.I deleted file mode 100644 index 9ddac1ff6f..0000000000 --- a/panda/src/physx/physxPlaneShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlaneShapeDesc.I - * @author enn0x - * @date 2009-09-08 - */ - -/** - * - */ -INLINE PhysxPlaneShapeDesc:: -PhysxPlaneShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxPlaneShapeDesc:: -~PhysxPlaneShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxPlaneShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxPlaneShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxPlaneShapeDesc.cxx b/panda/src/physx/physxPlaneShapeDesc.cxx deleted file mode 100644 index 74e1b8d252..0000000000 --- a/panda/src/physx/physxPlaneShapeDesc.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlaneShapeDesc.cxx - * @author enn0x - * @date 2009-09-08 - */ - -#include "physxPlaneShapeDesc.h" -#include "physxManager.h" - -/** - * Sets the parameters of the plane equation. normal: Plane normal. d: The - * distance from the origin. - */ -void PhysxPlaneShapeDesc:: -set_plane(const LVector3f &normal, float d) { - - nassertv(!normal.is_nan()); - - _desc.normal = PhysxManager::vec3_to_nxVec3(normal); - _desc.d = d; -} diff --git a/panda/src/physx/physxPlaneShapeDesc.h b/panda/src/physx/physxPlaneShapeDesc.h deleted file mode 100644 index cb205e5763..0000000000 --- a/panda/src/physx/physxPlaneShapeDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPlaneShapeDesc.h - * @author enn0x - * @date 2009-09-08 - */ - -#ifndef PHYSXPLANESHAPEDESC_H -#define PHYSXPLANESHAPEDESC_H - -#include "pandabase.h" -#include "physxShapeDesc.h" - -#include "luse.h" - -#include "physx_includes.h" - -/** - * Descriptor class for PhysxPlaneShape. - */ -class EXPCL_PANDAPHYSX PhysxPlaneShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxPlaneShapeDesc(); - INLINE ~PhysxPlaneShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_plane(const LVector3f &normal, float d); - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxPlaneShapeDesc _desc; -}; - -#include "physxPlaneShapeDesc.I" - -#endif // PHYSXPLANESHAPEDESC_H diff --git a/panda/src/physx/physxPointInPlaneJoint.I b/panda/src/physx/physxPointInPlaneJoint.I deleted file mode 100644 index 2e7d85c017..0000000000 --- a/panda/src/physx/physxPointInPlaneJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointInPlaneJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxPointInPlaneJoint:: -PhysxPointInPlaneJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxPointInPlaneJoint:: -~PhysxPointInPlaneJoint() { - -} diff --git a/panda/src/physx/physxPointInPlaneJoint.cxx b/panda/src/physx/physxPointInPlaneJoint.cxx deleted file mode 100644 index fc05d6f8ca..0000000000 --- a/panda/src/physx/physxPointInPlaneJoint.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointInPlaneJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxPointInPlaneJoint.h" -#include "physxPointInPlaneJointDesc.h" - -TypeHandle PhysxPointInPlaneJoint::_type_handle; - -/** - * - */ -void PhysxPointInPlaneJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isPointInPlaneJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxPointInPlaneJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxPointInPlaneJoint:: -save_to_desc(PhysxPointInPlaneJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxPointInPlaneJoint:: -load_from_desc(const PhysxPointInPlaneJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} diff --git a/panda/src/physx/physxPointInPlaneJoint.h b/panda/src/physx/physxPointInPlaneJoint.h deleted file mode 100644 index e35eebb230..0000000000 --- a/panda/src/physx/physxPointInPlaneJoint.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointInPlaneJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXPOINTINPLANEJOINT_H -#define PHYSXPOINTINPLANEJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxPointInPlaneJointDesc; - -/** - * A point in plane joint constrains a point on one body to only move inside a - * plane attached to another body. The starting point of the point is defined - * as the anchor point. The plane through this point is specified by its - * normal which is the joint axis vector. - */ -class EXPCL_PANDAPHYSX PhysxPointInPlaneJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxPointInPlaneJoint(); - INLINE ~PhysxPointInPlaneJoint(); - - void save_to_desc(PhysxPointInPlaneJointDesc &jointDesc) const; - void load_from_desc(const PhysxPointInPlaneJointDesc &jointDesc); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxPointInPlaneJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxPointInPlaneJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxPointInPlaneJoint.I" - -#endif // PHYSXPOINTINPLANEJOINT_H diff --git a/panda/src/physx/physxPointInPlaneJointDesc.I b/panda/src/physx/physxPointInPlaneJointDesc.I deleted file mode 100644 index 1e841bb2fb..0000000000 --- a/panda/src/physx/physxPointInPlaneJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointInPlaneJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxPointInPlaneJointDesc:: -PhysxPointInPlaneJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxPointInPlaneJointDesc:: -~PhysxPointInPlaneJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxPointInPlaneJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxPointInPlaneJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxPointInPlaneJointDesc.cxx b/panda/src/physx/physxPointInPlaneJointDesc.cxx deleted file mode 100644 index 8a0384810a..0000000000 --- a/panda/src/physx/physxPointInPlaneJointDesc.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointInPlaneJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxPointInPlaneJointDesc.h" diff --git a/panda/src/physx/physxPointInPlaneJointDesc.h b/panda/src/physx/physxPointInPlaneJointDesc.h deleted file mode 100644 index 2b1ce4de8d..0000000000 --- a/panda/src/physx/physxPointInPlaneJointDesc.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointInPlaneJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXPOINTINPLANEJOINTDESC_H -#define PHYSXPOINTINPLANEJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for point-in-plane joint. See PhysxPointInPlaneJoint. - */ -class EXPCL_PANDAPHYSX PhysxPointInPlaneJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxPointInPlaneJointDesc(); - INLINE ~PhysxPointInPlaneJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxPointInPlaneJointDesc _desc; -}; - -#include "physxPointInPlaneJointDesc.I" - -#endif // PHYSXPOINTINPLANEJOINTDESC_H diff --git a/panda/src/physx/physxPointOnLineJoint.I b/panda/src/physx/physxPointOnLineJoint.I deleted file mode 100644 index 17092185e1..0000000000 --- a/panda/src/physx/physxPointOnLineJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointOnLineJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxPointOnLineJoint:: -PhysxPointOnLineJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxPointOnLineJoint:: -~PhysxPointOnLineJoint() { - -} diff --git a/panda/src/physx/physxPointOnLineJoint.cxx b/panda/src/physx/physxPointOnLineJoint.cxx deleted file mode 100644 index 5e5d4e8665..0000000000 --- a/panda/src/physx/physxPointOnLineJoint.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointOnLineJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxPointOnLineJoint.h" -#include "physxPointOnLineJointDesc.h" - -TypeHandle PhysxPointOnLineJoint::_type_handle; - -/** - * - */ -void PhysxPointOnLineJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isPointOnLineJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxPointOnLineJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxPointOnLineJoint:: -save_to_desc(PhysxPointOnLineJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxPointOnLineJoint:: -load_from_desc(const PhysxPointOnLineJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} diff --git a/panda/src/physx/physxPointOnLineJoint.h b/panda/src/physx/physxPointOnLineJoint.h deleted file mode 100644 index 7a24819522..0000000000 --- a/panda/src/physx/physxPointOnLineJoint.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointOnLineJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXPOINTONLINEJOINT_H -#define PHYSXPOINTONLINEJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxPointOnLineJointDesc; - -/** - * A point on line joint constrains a point on one body to only move along a - * line attached to another body. The starting point of the joint is defined - * as the anchor point. The line through this point is specified by its - * direction (axis) vector. - */ -class EXPCL_PANDAPHYSX PhysxPointOnLineJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxPointOnLineJoint(); - INLINE ~PhysxPointOnLineJoint(); - - void save_to_desc(PhysxPointOnLineJointDesc &jointDesc) const; - void load_from_desc(const PhysxPointOnLineJointDesc &jointDesc); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxPointOnLineJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxPointOnLineJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxPointOnLineJoint.I" - -#endif // PHYSXPOINTONLINEJOINT_H diff --git a/panda/src/physx/physxPointOnLineJointDesc.I b/panda/src/physx/physxPointOnLineJointDesc.I deleted file mode 100644 index c62346df54..0000000000 --- a/panda/src/physx/physxPointOnLineJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointOnLineJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxPointOnLineJointDesc:: -PhysxPointOnLineJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxPointOnLineJointDesc:: -~PhysxPointOnLineJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxPointOnLineJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxPointOnLineJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxPointOnLineJointDesc.cxx b/panda/src/physx/physxPointOnLineJointDesc.cxx deleted file mode 100644 index 3aef1d0ee0..0000000000 --- a/panda/src/physx/physxPointOnLineJointDesc.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointOnLineJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxPointOnLineJointDesc.h" diff --git a/panda/src/physx/physxPointOnLineJointDesc.h b/panda/src/physx/physxPointOnLineJointDesc.h deleted file mode 100644 index 4a283516f4..0000000000 --- a/panda/src/physx/physxPointOnLineJointDesc.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPointOnLineJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXPOINTONLINEJOINTDESC_H -#define PHYSXPOINTONLINEJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for point-on-line joint. See PhysxPointOnLineJoint. - */ -class EXPCL_PANDAPHYSX PhysxPointOnLineJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxPointOnLineJointDesc(); - INLINE ~PhysxPointOnLineJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxPointOnLineJointDesc _desc; -}; - -#include "physxPointOnLineJointDesc.I" - -#endif // PHYSXPOINTONLINEJOINTDESC_H diff --git a/panda/src/physx/physxPrismaticJoint.I b/panda/src/physx/physxPrismaticJoint.I deleted file mode 100644 index 6be48ffcb6..0000000000 --- a/panda/src/physx/physxPrismaticJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPrismaticJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxPrismaticJoint:: -PhysxPrismaticJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxPrismaticJoint:: -~PhysxPrismaticJoint() { - -} diff --git a/panda/src/physx/physxPrismaticJoint.cxx b/panda/src/physx/physxPrismaticJoint.cxx deleted file mode 100644 index 94b9fd0949..0000000000 --- a/panda/src/physx/physxPrismaticJoint.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPrismaticJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxPrismaticJoint.h" -#include "physxPrismaticJointDesc.h" - -TypeHandle PhysxPrismaticJoint::_type_handle; - -/** - * - */ -void PhysxPrismaticJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isPrismaticJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxPrismaticJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxPrismaticJoint:: -save_to_desc(PhysxPrismaticJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxPrismaticJoint:: -load_from_desc(const PhysxPrismaticJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} diff --git a/panda/src/physx/physxPrismaticJoint.h b/panda/src/physx/physxPrismaticJoint.h deleted file mode 100644 index 0aa1f2b54d..0000000000 --- a/panda/src/physx/physxPrismaticJoint.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPrismaticJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXPRISMATICJOINT_H -#define PHYSXPRISMATICJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxPrismaticJointDesc; - -/** - * A prismatic joint permits relative translational movement between two - * bodies along an axis, but no relative rotational movement. - */ -class EXPCL_PANDAPHYSX PhysxPrismaticJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxPrismaticJoint(); - INLINE ~PhysxPrismaticJoint(); - - void save_to_desc(PhysxPrismaticJointDesc &jointDesc) const; - void load_from_desc(const PhysxPrismaticJointDesc &jointDesc); - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxPrismaticJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxPrismaticJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxPrismaticJoint.I" - -#endif // PHYSXPRISMATICJOINT_H diff --git a/panda/src/physx/physxPrismaticJointDesc.I b/panda/src/physx/physxPrismaticJointDesc.I deleted file mode 100644 index b44bcc3493..0000000000 --- a/panda/src/physx/physxPrismaticJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPrismaticJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxPrismaticJointDesc:: -PhysxPrismaticJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxPrismaticJointDesc:: -~PhysxPrismaticJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxPrismaticJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxPrismaticJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxPrismaticJointDesc.cxx b/panda/src/physx/physxPrismaticJointDesc.cxx deleted file mode 100644 index 8643b0fd06..0000000000 --- a/panda/src/physx/physxPrismaticJointDesc.cxx +++ /dev/null @@ -1,14 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPrismaticJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxPrismaticJointDesc.h" diff --git a/panda/src/physx/physxPrismaticJointDesc.h b/panda/src/physx/physxPrismaticJointDesc.h deleted file mode 100644 index 0b6f2a58fa..0000000000 --- a/panda/src/physx/physxPrismaticJointDesc.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPrismaticJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXPRISMATICJOINTDESC_H -#define PHYSXPRISMATICJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for prismatic joint. See PhysxPrismaticJoint. - */ -class EXPCL_PANDAPHYSX PhysxPrismaticJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxPrismaticJointDesc(); - INLINE ~PhysxPrismaticJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxPrismaticJointDesc _desc; -}; - -#include "physxPrismaticJointDesc.I" - -#endif // PHYSXPRISMATICJOINTDESC_H diff --git a/panda/src/physx/physxPulleyJoint.I b/panda/src/physx/physxPulleyJoint.I deleted file mode 100644 index ca714f8d05..0000000000 --- a/panda/src/physx/physxPulleyJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPulleyJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxPulleyJoint:: -PhysxPulleyJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxPulleyJoint:: -~PhysxPulleyJoint() { - -} diff --git a/panda/src/physx/physxPulleyJoint.cxx b/panda/src/physx/physxPulleyJoint.cxx deleted file mode 100644 index 0986774ae8..0000000000 --- a/panda/src/physx/physxPulleyJoint.cxx +++ /dev/null @@ -1,140 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPulleyJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxPulleyJoint.h" -#include "physxPulleyJointDesc.h" -#include "physxMotorDesc.h" - -TypeHandle PhysxPulleyJoint::_type_handle; - -/** - * - */ -void PhysxPulleyJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isPulleyJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxPulleyJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxPulleyJoint:: -save_to_desc(PhysxPulleyJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxPulleyJoint:: -load_from_desc(const PhysxPulleyJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} - -/** - * Sets motor parameters for the joint. - * - * For a positive velTarget, the motor pulls the first body towards its - * pulley, for a negative velTarget, the motor pulls the second body towards - * its pulley. - * - * velTarget - the relative velocity the motor is trying to achieve. The - * motor will only be able to reach this velocity if the maxForce is - * sufficiently large. If the joint is moving faster than this velocity, the - * motor will actually try to brake. If you set this to infinity then the - * motor will keep speeding up, unless there is some sort of resistance on the - * attached bodies. - * - * maxForce - the maximum force the motor can exert. Zero disables the motor. - * Default is 0, should be >= 0. Setting this to a very large value if - * velTarget is also very large may not be a good idea. - * - * freeSpin - if this flag is set, and if the joint is moving faster than - * velTarget, then neither braking nor additional acceleration will result. - * default: false. - * - * This automatically enables the motor. - */ -void PhysxPulleyJoint:: -set_motor(const PhysxMotorDesc &motor) { - - nassertv(_error_type == ET_ok); - _ptr->setMotor(motor._desc); -} - -/** - * Sets or clear a single pulley joint flag. - */ -void PhysxPulleyJoint:: -set_flag(PhysxPulleyJointFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - NxU32 flags = _ptr->getFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setFlags(flags); -} - -/** - * Retrieves the value of a single PulleyJointFlag. - */ -bool PhysxPulleyJoint:: -get_flag(PhysxPulleyJointFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getFlags() & flag) ? true : false; -} - -/** - * - */ -PhysxMotorDesc PhysxPulleyJoint:: -get_motor() const { - - nassertr(_error_type == ET_ok, false); - - PhysxMotorDesc value; - _ptr->getMotor(value._desc); - return value; -} diff --git a/panda/src/physx/physxPulleyJoint.h b/panda/src/physx/physxPulleyJoint.h deleted file mode 100644 index 421ac6488e..0000000000 --- a/panda/src/physx/physxPulleyJoint.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPulleyJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXPULLEYJOINT_H -#define PHYSXPULLEYJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxMotorDesc; -class PhysxPulleyJointDesc; - -/** - * A pulley joint simulates a rope between two objects passing over two - * pulleys. - */ -class EXPCL_PANDAPHYSX PhysxPulleyJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxPulleyJoint(); - INLINE ~PhysxPulleyJoint(); - - void save_to_desc(PhysxPulleyJointDesc &jointDesc) const; - void load_from_desc(const PhysxPulleyJointDesc &jointDesc); - - void set_motor(const PhysxMotorDesc &motor); - void set_flag(PhysxPulleyJointFlag flag, bool value); - - bool get_flag(PhysxPulleyJointFlag flag) const; - PhysxMotorDesc get_motor() const; - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxPulleyJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxPulleyJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxPulleyJoint.I" - -#endif // PHYSXPULLEYJOINT_H diff --git a/panda/src/physx/physxPulleyJointDesc.I b/panda/src/physx/physxPulleyJointDesc.I deleted file mode 100644 index a31e1316b9..0000000000 --- a/panda/src/physx/physxPulleyJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPulleyJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxPulleyJointDesc:: -PhysxPulleyJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxPulleyJointDesc:: -~PhysxPulleyJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxPulleyJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxPulleyJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxPulleyJointDesc.cxx b/panda/src/physx/physxPulleyJointDesc.cxx deleted file mode 100644 index c436879940..0000000000 --- a/panda/src/physx/physxPulleyJointDesc.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPulleyJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxPulleyJointDesc.h" -#include "physxMotorDesc.h" -#include "physxManager.h" - -/** - * Sets the rest length of the rope connecting the two objects. - */ -void PhysxPulleyJointDesc:: -set_distance(float distance) { - - _desc.distance = distance; -} - -/** - * Sets how stiff the constraint is, between 0 and 1 (stiffest) - */ -void PhysxPulleyJointDesc:: -set_stiffness(float stiffness) { - - _desc.stiffness = stiffness; -} - -/** - * Sets the transmission ratio. - */ -void PhysxPulleyJointDesc:: -set_ratio(float ratio) { - - _desc.ratio = ratio; -} - -/** - * Sets or clears a single PulleyJointFlag flag. - */ -void PhysxPulleyJointDesc:: -set_flag(PhysxPulleyJointFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Sets the suspension points of two bodies in world space. - */ -void PhysxPulleyJointDesc:: -set_pulley(unsigned int idx, const LPoint3f pos) { - - nassertv_always(idx < 2); - _desc.pulley[idx] = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * Sets an optional joint motor. - */ -void PhysxPulleyJointDesc:: -set_motor(const PhysxMotorDesc &motor) { - - _desc.motor = motor._desc; -} - -/** - * - */ -float PhysxPulleyJointDesc:: -get_distance() const { - - return _desc.distance; -} - -/** - * - */ -float PhysxPulleyJointDesc:: -get_stiffness() const { - - return _desc.stiffness; -} - -/** - * - */ -float PhysxPulleyJointDesc:: -get_ratio() const { - - return _desc.ratio; -} - -/** - * - */ -bool PhysxPulleyJointDesc:: -get_flag(PhysxPulleyJointFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * - */ -LPoint3f PhysxPulleyJointDesc:: -get_pulley(unsigned int idx) const { - - nassertr_always(idx < 2, LPoint3f::zero()); - return PhysxManager::nxVec3_to_point3(_desc.pulley[idx]); -} - -/** - * - */ -PhysxMotorDesc PhysxPulleyJointDesc:: -get_motor() const { - - PhysxMotorDesc value; - value._desc = _desc.motor; - return value; -} diff --git a/panda/src/physx/physxPulleyJointDesc.h b/panda/src/physx/physxPulleyJointDesc.h deleted file mode 100644 index 154dd4fc2a..0000000000 --- a/panda/src/physx/physxPulleyJointDesc.h +++ /dev/null @@ -1,57 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxPulleyJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXPULLEYJOINTDESC_H -#define PHYSXPULLEYJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -class PhysxMotorDesc; - -/** - * Descriptor class for distance joint. See PhysxPulleyJoint. - */ -class EXPCL_PANDAPHYSX PhysxPulleyJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxPulleyJointDesc(); - INLINE ~PhysxPulleyJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_distance(float distance); - void set_stiffness(float stiffness); - void set_ratio(float ration); - void set_pulley(unsigned int idx, const LPoint3f pos); - void set_motor(const PhysxMotorDesc &motor); - void set_flag(PhysxPulleyJointFlag flag, bool value); - - float get_distance() const; - float get_stiffness() const; - float get_ratio() const; - bool get_flag(PhysxPulleyJointFlag flag) const; - LPoint3f get_pulley(unsigned int idx) const; - PhysxMotorDesc get_motor() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxPulleyJointDesc _desc; -}; - -#include "physxPulleyJointDesc.I" - -#endif // PHYSXPULLEYJOINTDESC_H diff --git a/panda/src/physx/physxRay.I b/panda/src/physx/physxRay.I deleted file mode 100644 index 9a7407a79c..0000000000 --- a/panda/src/physx/physxRay.I +++ /dev/null @@ -1,32 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRay.I - * @author enn0x - * @date 2009-10-21 - */ - -/** - * - */ -INLINE PhysxRay:: -PhysxRay() { - - _ray.orig = NxVec3(0.0f, 0.0f, 0.0f); - _ray.dir = NxVec3(1.0f, 0.0f, 0.0f); - - _length = NX_MAX_F32; -} - -/** - * - */ -INLINE PhysxRay:: -~PhysxRay() { - -} diff --git a/panda/src/physx/physxRay.cxx b/panda/src/physx/physxRay.cxx deleted file mode 100644 index d62007deb7..0000000000 --- a/panda/src/physx/physxRay.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRay.cxx - * @author enn0x - * @date 2009-10-21 - */ - -#include "physxRay.h" -#include "physxManager.h" - -/** - * Sets the ray origin. - */ -void PhysxRay:: -set_origin(const LPoint3f &origin) { - - nassertv_always(!origin.is_nan()); - _ray.orig = PhysxManager::point3_to_nxVec3(origin); -} - -/** - * Returns the ray origin - */ -LPoint3f PhysxRay:: -get_origin() const { - - return PhysxManager::nxVec3_to_point3(_ray.orig); -} - -/** - * Set the ray direction. It is not required to pass a normalized vector. - */ -void PhysxRay:: -set_direction(const LVector3f &direction) { - - nassertv_always(!direction.is_nan()); - - _ray.dir = PhysxManager::vec3_to_nxVec3(direction); - _ray.dir.normalize(); -} - -/** - * Returns the ray direction. - */ -LVector3f PhysxRay:: -get_direction() const { - - return PhysxManager::nxVec3_to_vec3(_ray.dir); -} - -/** - * Sets the ray length. If no length is set then the ray will be virtually - * infinite (the maximum floating point number will be used, e.g. - * 3.40282346639e+038). - */ -void PhysxRay:: -set_length(float length) { - - nassertv_always(length > 0.0f); - _length = length; -} - -/** - * Returns the ray length. - */ -float PhysxRay:: -get_length() const { - - return _length; -} diff --git a/panda/src/physx/physxRay.h b/panda/src/physx/physxRay.h deleted file mode 100644 index 9274576bd1..0000000000 --- a/panda/src/physx/physxRay.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRay.h - * @author enn0x - * @date 2009-10-21 - */ - -#ifndef PHYSXRAY_H -#define PHYSXRAY_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -/** - * Represents an ray as an origin and direction. The ray will be infinite if - * no length is given. - */ -class EXPCL_PANDAPHYSX PhysxRay { - -PUBLISHED: - INLINE PhysxRay(); - INLINE ~PhysxRay(); - - void set_length(float length); - void set_origin(const LPoint3f &origin); - void set_direction(const LVector3f &direction); - - float get_length() const; - LPoint3f get_origin() const; - LVector3f get_direction() const; - -public: - NxRay _ray; - NxReal _length; -}; - -#include "physxRay.I" - -#endif // PHYSRAY_H diff --git a/panda/src/physx/physxRaycastHit.I b/panda/src/physx/physxRaycastHit.I deleted file mode 100644 index 0decd62512..0000000000 --- a/panda/src/physx/physxRaycastHit.I +++ /dev/null @@ -1,29 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRaycastHit.I - * @author enn0x - * @date 2009-10-21 - */ - -/** - * - */ -INLINE PhysxRaycastHit:: -PhysxRaycastHit(const NxRaycastHit hit) { - - _hit = hit; -} - -/** - * - */ -INLINE PhysxRaycastHit:: -~PhysxRaycastHit() { - -} diff --git a/panda/src/physx/physxRaycastHit.cxx b/panda/src/physx/physxRaycastHit.cxx deleted file mode 100644 index 5d2bce1737..0000000000 --- a/panda/src/physx/physxRaycastHit.cxx +++ /dev/null @@ -1,62 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRaycastHit.cxx - * @author enn0x - * @date 2009-10-21 - */ - -#include "physxRaycastHit.h" -#include "physxManager.h" -#include "physxShape.h" - -/** - * - */ -bool PhysxRaycastHit:: -is_empty() const { - - return (_hit.shape == nullptr); -} - -/** - * - */ -PhysxShape *PhysxRaycastHit:: -get_shape() const { - - nassertr_always(_hit.shape, nullptr); - return (PhysxShape *)_hit.shape->userData; -} - -/** - * - */ -LPoint3f PhysxRaycastHit:: -get_impact_pos() const { - - return PhysxManager::nxVec3_to_point3(_hit.worldImpact); -} - -/** - * - */ -LVector3f PhysxRaycastHit:: -get_impact_normal() const { - - return PhysxManager::nxVec3_to_vec3(_hit.worldNormal); -} - -/** - * - */ -float PhysxRaycastHit:: -get_distance() const { - - return _hit.distance; -} diff --git a/panda/src/physx/physxRaycastHit.h b/panda/src/physx/physxRaycastHit.h deleted file mode 100644 index 918ee506dd..0000000000 --- a/panda/src/physx/physxRaycastHit.h +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRaycastHit.h - * @author enn0x - * @date 2009-10-21 - */ - -#ifndef PHYSXRAYCASTHIT_H -#define PHYSXRAYCASTHIT_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -class PhysxShape; - -/** - * This structure captures results for a single raycast query. See PhysxScene - * for raycasting methods. - */ -class EXPCL_PANDAPHYSX PhysxRaycastHit { - -PUBLISHED: - INLINE PhysxRaycastHit(const NxRaycastHit hit); - INLINE ~PhysxRaycastHit(); - - bool is_empty() const; - - PhysxShape *get_shape() const; - LPoint3f get_impact_pos() const; - LVector3f get_impact_normal() const; - float get_distance() const; - -private: - NxRaycastHit _hit; -}; - -#include "physxRaycastHit.I" - -#endif // PHYSXRAYCASTHIT_H diff --git a/panda/src/physx/physxRaycastReport.I b/panda/src/physx/physxRaycastReport.I deleted file mode 100644 index 2e8e5a7481..0000000000 --- a/panda/src/physx/physxRaycastReport.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRaycastReport.I - * @author enn0x - * @date 2009-10-21 - */ - -/** - * - */ -INLINE PhysxRaycastReport:: -PhysxRaycastReport() { - -} - -/** - * - */ -INLINE PhysxRaycastReport:: -~PhysxRaycastReport() { - -} diff --git a/panda/src/physx/physxRaycastReport.cxx b/panda/src/physx/physxRaycastReport.cxx deleted file mode 100644 index 368c5a5c54..0000000000 --- a/panda/src/physx/physxRaycastReport.cxx +++ /dev/null @@ -1,77 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRaycastReport.cxx - * @author enn0x - * @date 2009-10-21 - */ - -#include "physxRaycastReport.h" -#include "physxRaycastHit.h" - -/** - * - */ -bool PhysxRaycastReport:: -onHit(const NxRaycastHit& hit) { - - _hits.push_back(PhysxRaycastHit(hit)); - return true; -} - -/** - * - */ -unsigned int PhysxRaycastReport:: -get_num_hits() const { - - return _hits.size(); -} - -/** - * - */ -PhysxRaycastHit PhysxRaycastReport:: -get_first_hit() { - - _iterator = _hits.begin(); - return get_next_hit(); -} - -/** - * - */ -PhysxRaycastHit PhysxRaycastReport:: -get_next_hit() { - - if (_iterator != _hits.end()) { - return *_iterator++; - } - - // No more items. Return an empty hit. - NxRaycastHit hit; - hit.shape = nullptr; - return PhysxRaycastHit(hit); -} - -/** - * - */ -PhysxRaycastHit PhysxRaycastReport:: -get_hit(unsigned int idx) { - - if (!(idx < _hits.size())) - { - // Index out of bounds. Return an empty hit. - NxRaycastHit hit; - hit.shape = nullptr; - return PhysxRaycastHit(hit); - } - - return _hits[idx]; -} diff --git a/panda/src/physx/physxRaycastReport.h b/panda/src/physx/physxRaycastReport.h deleted file mode 100644 index 0d5d3f5ab0..0000000000 --- a/panda/src/physx/physxRaycastReport.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRaycastReport.h - * @author enn0x - * @date 2009-10-21 - */ - -#ifndef PHYSXRAYCASTREPORT_H -#define PHYSXRAYCASTREPORT_H - -#include "pandabase.h" -#include "pvector.h" - -#include "config_physx.h" - -class PhysxRaycastHit; - -/** - * Objects of this class are returned by the 'raycast all' methods. They - * contain an iterable list of all hits that the raycast query produced. - */ -class EXPCL_PANDAPHYSX PhysxRaycastReport : public NxUserRaycastReport { - -PUBLISHED: - unsigned int get_num_hits() const; - PhysxRaycastHit get_first_hit(); - PhysxRaycastHit get_next_hit(); - PhysxRaycastHit get_hit(unsigned int idx); - MAKE_SEQ(get_hits, get_num_hits, get_hit); - -public: - INLINE PhysxRaycastReport(); - INLINE ~PhysxRaycastReport(); - - virtual bool onHit(const NxRaycastHit& hit); - -private: - typedef pvector Hits; - Hits _hits; - - typedef Hits::const_iterator const_iterator; - const_iterator _iterator; -}; - -#include "physxRaycastReport.I" - -#endif // PHYSXRAYCASTREPORT_H diff --git a/panda/src/physx/physxRevoluteJoint.I b/panda/src/physx/physxRevoluteJoint.I deleted file mode 100644 index b9c803a518..0000000000 --- a/panda/src/physx/physxRevoluteJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRevoluteJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxRevoluteJoint:: -PhysxRevoluteJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxRevoluteJoint:: -~PhysxRevoluteJoint() { - -} diff --git a/panda/src/physx/physxRevoluteJoint.cxx b/panda/src/physx/physxRevoluteJoint.cxx deleted file mode 100644 index 43314ba157..0000000000 --- a/panda/src/physx/physxRevoluteJoint.cxx +++ /dev/null @@ -1,263 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRevoluteJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxRevoluteJoint.h" -#include "physxRevoluteJointDesc.h" -#include "physxJointLimitDesc.h" -#include "physxMotorDesc.h" -#include "physxSpringDesc.h" - -TypeHandle PhysxRevoluteJoint::_type_handle; - -/** - * - */ -void PhysxRevoluteJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isRevoluteJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxRevoluteJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxRevoluteJoint:: -save_to_desc(PhysxRevoluteJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxRevoluteJoint:: -load_from_desc(const PhysxRevoluteJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} - -/** - * Retrieves the current revolute joint angle. - * - * The relative orientation of the bodies is stored when the joint is created, - * or when set_axis() or set_anchor() is called. This initial orientation - * returns an angle of zero, and joint angles are measured relative to this - * pose. The angle is in the range [-180, 180], with positive angles CCW - * around the axis, measured from body2 to body1. - */ -float PhysxRevoluteJoint:: -get_angle() const { - - nassertr(_error_type == ET_ok, 0.0f); - return NxMath::radToDeg(_ptr->getAngle()); -} - -/** - * Retrieves the revolute joint angle's rate of change (angular velocity). It - * is the angular velocity of body1 minus body2 projected along the axis. - */ -float PhysxRevoluteJoint:: -get_velocity() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getVelocity(); -} - -/** - * Sets the joint projection mode. - */ -void PhysxRevoluteJoint:: -set_projection_mode(PhysxProjectionMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->setProjectionMode((NxJointProjectionMode)mode); -} - -/** - * Retrieves the joints projection mode. - */ -PhysxEnums::PhysxProjectionMode PhysxRevoluteJoint:: -get_projection_mode() const { - - nassertr(_error_type == ET_ok, PM_none); - return (PhysxProjectionMode)_ptr->getProjectionMode(); -} - -/** - * Sets or clears a single RevoluteJointFlag. - */ -void PhysxRevoluteJoint:: -set_flag(PhysxRevoluteJointFlag flag, bool value) { - - nassertv( _error_type == ET_ok ); - NxU32 flags = _ptr->getFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setFlags(flags); -} - -/** - * Returns the value of a single RevoluteJointFlag. - */ -bool PhysxRevoluteJoint:: -get_flag(PhysxRevoluteJointFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getFlags() & flag) ? true : false; -} - -/** - * Sets spring parameters. - * - * The spring is implicitly integrated so no instability should result for - * arbitrary spring and damping constants. Using these settings together with - * a motor is not possible -- the motor will have priority and the spring - * settings are ignored. If you would like to simulate your motor's internal - * friction, do this by altering the motor parameters directly. - * - * spring - The rotational spring acts along the hinge axis and tries to force - * the joint angle to zero. A setting of zero disables the spring. Default - * is 0, should be >= 0. - * - * damper - Damping coefficient; acts against the hinge's angular velocity. A - * setting of zero disables the damping. The default is 0, should be >= 0. - * - * targetValue - The angle at which the spring is relaxed. In [-Pi,Pi]. - * Default is 0. - * - * This automatically enables the spring - */ -void PhysxRevoluteJoint:: -set_spring(const PhysxSpringDesc &spring) { - - nassertv(_error_type == ET_ok); - _ptr->setSpring(spring._desc); -} - -/** - * Sets motor parameters for the joint. - * - * For a positive velTarget, the motor pulls the first body towards its - * pulley, for a negative velTarget, the motor pulls the second body towards - * its pulley. - * - * velTarget - the relative velocity the motor is trying to achieve. The - * motor will only be able to reach this velocity if the maxForce is - * sufficiently large. If the joint is moving faster than this velocity, the - * motor will actually try to brake. If you set this to infinity then the - * motor will keep speeding up, unless there is some sort of resistance on the - * attached bodies. - * - * maxForce - the maximum force the motor can exert. Zero disables the motor. - * Default is 0, should be >= 0. Setting this to a very large value if - * velTarget is also very large may not be a good idea. - * - * freeSpin - if this flag is set, and if the joint is moving faster than - * velTarget, then neither braking nor additional acceleration will result. - * default: false. - * - * This automatically enables the motor. - */ -void PhysxRevoluteJoint:: -set_motor(const PhysxMotorDesc &motor) { - - nassertv(_error_type == ET_ok); - _ptr->setMotor(motor._desc); -} - -/** - * Sets angular joint limits. - * - * If either of these limits are set, any planar limits in PhysxJoint are - * ignored. The limits are angles defined the same way as the values that - * get_angle() returns. - * - * The following has to hold: - * - * Pi < lowAngle < highAngle < Pi Both limits are disabled by default. Also - * sets coefficients of restitutions for the low and high angular limits. - * These settings are only used if valid limits are set using set_limits(). - * These restitution coefficients work the same way as for contacts. - * - * The coefficient of restitution determines whether a collision with the - * joint limit is completely elastic (like pool balls, restitution = 1, no - * energy is lost in the collision), completely inelastic (like putty, - * restitution = 0, no rebound after collision) or somewhere in between. The - * default is 0 for both. - * - * This automatically enables the limit. - */ -void PhysxRevoluteJoint:: -set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high) { - - nassertv(_error_type == ET_ok); - - NxJointLimitPairDesc limits; - limits.low = low._desc; - limits.high = high._desc; - _ptr->setLimits(limits); -} - -/** - * - */ -PhysxMotorDesc PhysxRevoluteJoint:: -get_motor() const { - - nassertr(_error_type == ET_ok, PhysxMotorDesc(0)); - - PhysxMotorDesc value; - _ptr->getMotor(value._desc); - return value; -} - -/** - * - */ -PhysxSpringDesc PhysxRevoluteJoint:: -get_spring() const { - - nassertr(_error_type == ET_ok, PhysxSpringDesc(0)); - - PhysxSpringDesc value; - _ptr->getSpring(value._desc); - return value; -} diff --git a/panda/src/physx/physxRevoluteJoint.h b/panda/src/physx/physxRevoluteJoint.h deleted file mode 100644 index 22c43ea652..0000000000 --- a/panda/src/physx/physxRevoluteJoint.h +++ /dev/null @@ -1,87 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRevoluteJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXREVOLUTEJOINT_H -#define PHYSXREVOLUTEJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxRevoluteJointDesc; -class PhysxSpringDesc; -class PhysxMotorDesc; -class PhysxJointLimitDesc; - -/** - * A joint which behaves in a similar way to a hinge or axel. A hinge joint - * removes all but a single rotational degree of freedom from two objects. - * The axis along which the two bodies may rotate is specified with a point - * and a direction vector. - */ -class EXPCL_PANDAPHYSX PhysxRevoluteJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxRevoluteJoint(); - INLINE ~PhysxRevoluteJoint(); - - void save_to_desc(PhysxRevoluteJointDesc &jointDesc) const; - void load_from_desc(const PhysxRevoluteJointDesc &jointDesc); - - void set_spring(const PhysxSpringDesc &spring); - void set_motor(const PhysxMotorDesc &motor); - void set_limits(const PhysxJointLimitDesc &low, const PhysxJointLimitDesc &high); - void set_flag(PhysxRevoluteJointFlag flag, bool value); - void set_projection_mode(PhysxProjectionMode mode); - - float get_angle() const; - float get_velocity() const; - bool get_flag(PhysxRevoluteJointFlag flag) const; - PhysxProjectionMode get_projection_mode() const; - PhysxMotorDesc get_motor() const; - PhysxSpringDesc get_spring() const; - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxRevoluteJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxRevoluteJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxRevoluteJoint.I" - -#endif // PHYSXREVOLUTEJOINT_H diff --git a/panda/src/physx/physxRevoluteJointDesc.I b/panda/src/physx/physxRevoluteJointDesc.I deleted file mode 100644 index 23ecfeefcf..0000000000 --- a/panda/src/physx/physxRevoluteJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRevoluteJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxRevoluteJointDesc:: -PhysxRevoluteJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxRevoluteJointDesc:: -~PhysxRevoluteJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxRevoluteJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxRevoluteJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxRevoluteJointDesc.cxx b/panda/src/physx/physxRevoluteJointDesc.cxx deleted file mode 100644 index be11cf4cf1..0000000000 --- a/panda/src/physx/physxRevoluteJointDesc.cxx +++ /dev/null @@ -1,174 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRevoluteJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxRevoluteJointDesc.h" -#include "physxSpringDesc.h" -#include "physxMotorDesc.h" -#include "physxJointLimitDesc.h" - -/** - * Sets the distance beyond which the joint is projected. - */ -void PhysxRevoluteJointDesc:: -set_projection_distance(float distance) { - - _desc.projectionDistance = distance; -} - -/** - * Sets the angle beyond which the joint is projected. - */ -void PhysxRevoluteJointDesc:: -set_projection_angle(float angle) { - - _desc.projectionAngle = angle; -} - -/** - * Sets an aptional spring. - */ -void PhysxRevoluteJointDesc:: -set_spring(const PhysxSpringDesc &spring) { - - _desc.spring = spring._desc; -} - -/** - * Sets or clears a single RevoluteJointFlag flag. - */ -void PhysxRevoluteJointDesc:: -set_flag(PhysxRevoluteJointFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Use this to enable joint projection. Default is PM_none. - */ -void PhysxRevoluteJointDesc:: -set_projection_mode(PhysxProjectionMode mode) { - - _desc.projectionMode = (NxJointProjectionMode)mode; -} - -/** - * Sets an optional joint motor. - */ -void PhysxRevoluteJointDesc:: -set_motor(const PhysxMotorDesc &motor) { - - _desc.motor = motor._desc; -} - -/** - * Sets optional limits for the angular motion of the joint. - */ -void PhysxRevoluteJointDesc:: -set_limit_low(const PhysxJointLimitDesc &low) { - - _desc.limit.low = low._desc; -} - -/** - * Sets optional limits for the angular motion of the joint. - */ -void PhysxRevoluteJointDesc:: -set_limit_high(const PhysxJointLimitDesc &high) { - - _desc.limit.high = high._desc; -} - -/** - * Return the distance beyond which the joint is projected. - */ -float PhysxRevoluteJointDesc:: -get_projection_distance() const { - - return _desc.projectionDistance; -} - -/** - * Return the angle beyond which the joint is projected. - */ -float PhysxRevoluteJointDesc:: -get_projection_angle() const { - - return _desc.projectionAngle; -} - -/** - * - */ -PhysxSpringDesc PhysxRevoluteJointDesc:: -get_spring() const { - - PhysxSpringDesc value; - value._desc = _desc.spring; - return value; -} - -/** - * - */ -bool PhysxRevoluteJointDesc:: -get_flag(PhysxRevoluteJointFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * - */ -PhysxEnums::PhysxProjectionMode PhysxRevoluteJointDesc:: -get_projection_mode() const { - - return (PhysxProjectionMode)_desc.projectionMode; -} - -/** - * Sets an optional joint motor. - */ -PhysxMotorDesc PhysxRevoluteJointDesc:: -get_motor() const { - - PhysxMotorDesc value; - value._desc = _desc.motor; - return value; -} - -/** - * - */ -PhysxJointLimitDesc PhysxRevoluteJointDesc:: -get_limit_low() const { - - PhysxJointLimitDesc value; - value._desc = _desc.limit.low; - return value; -} - -/** - * - */ -PhysxJointLimitDesc PhysxRevoluteJointDesc:: -get_limit_high() const { - - PhysxJointLimitDesc value; - value._desc = _desc.limit.high; - return value; -} diff --git a/panda/src/physx/physxRevoluteJointDesc.h b/panda/src/physx/physxRevoluteJointDesc.h deleted file mode 100644 index dd665c614d..0000000000 --- a/panda/src/physx/physxRevoluteJointDesc.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxRevoluteJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXREVOLUTEJOINTDESC_H -#define PHYSXREVOLUTEJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -class PhysxSpringDesc; -class PhysxMotorDesc; -class PhysxJointLimitDesc; - -/** - * Descriptor class for distance joint. See PhysxRevoluteJoint. - */ -class EXPCL_PANDAPHYSX PhysxRevoluteJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxRevoluteJointDesc(); - INLINE ~PhysxRevoluteJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_projection_distance(float distance); - void set_projection_angle(float angle); - void set_spring(const PhysxSpringDesc &spring); - void set_flag(PhysxRevoluteJointFlag flag, bool value); - void set_motor(const PhysxMotorDesc &motor); - void set_limit_low(const PhysxJointLimitDesc &low); - void set_limit_high(const PhysxJointLimitDesc &high); - void set_projection_mode(PhysxProjectionMode mode); - - float get_projection_distance() const; - float get_projection_angle() const; - bool get_flag(PhysxRevoluteJointFlag flag) const; - PhysxSpringDesc get_spring() const; - PhysxMotorDesc get_motor() const; - PhysxJointLimitDesc get_limit_low() const; - PhysxJointLimitDesc get_limit_high() const; - PhysxProjectionMode get_projection_mode() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxRevoluteJointDesc _desc; -}; - -#include "physxRevoluteJointDesc.I" - -#endif // PHYSXREVOLUTEJOINTDESC_H diff --git a/panda/src/physx/physxScene.I b/panda/src/physx/physxScene.I deleted file mode 100644 index 482ebf829f..0000000000 --- a/panda/src/physx/physxScene.I +++ /dev/null @@ -1,77 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxScene.I - * @author enn0x - * @date 2009-09-14 - */ - -/** - * - */ -INLINE PhysxScene:: -PhysxScene() : PhysxObject() { - - _debugNode = new PhysxDebugGeomNode(); -} - -/** - * - */ -INLINE PhysxScene:: -~PhysxScene() { - - _debugNode = nullptr; -} - -/** - * - */ -INLINE void PhysxScene:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxScene:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; - - _materials.ls(out, indent_level); - _actors.ls(out, indent_level); - _joints.ls(out, indent_level); - _forcefields.ls(out, indent_level); - _ffgroups.ls(out, indent_level); - _controllers.ls(out, indent_level); - _vehicles.ls(out, indent_level); - _cloths.ls(out, indent_level); - _softbodies.ls(out, indent_level); -} - -/** - * - */ -INLINE void PhysxScene:: -set_controller_shape_hit_callback(PT(CallbackObject) cbobj) { - - _controller_report.set_shape_hit_callback(cbobj); -} - -/** - * - */ -INLINE void PhysxScene:: -set_controller_controller_hit_callback(PT(CallbackObject) cbobj) { - - _controller_report.set_controller_hit_callback(cbobj); -} diff --git a/panda/src/physx/physxScene.cxx b/panda/src/physx/physxScene.cxx deleted file mode 100644 index b07a373729..0000000000 --- a/panda/src/physx/physxScene.cxx +++ /dev/null @@ -1,1553 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxScene.cxx - * @author enn0x - * @date 2009-09-14 - */ - -#include "physxScene.h" -#include "physxManager.h" -#include "physxActorDesc.h" -#include "physxForceFieldDesc.h" -#include "physxForceFieldShapeGroupDesc.h" -#include "physxControllerDesc.h" -#include "physxSceneStats2.h" -#include "physxConstraintDominance.h" -#include "physxVehicle.h" -#include "physxVehicleDesc.h" -#include "physxCloth.h" -#include "physxClothDesc.h" -#include "physxSoftBody.h" -#include "physxSoftBodyDesc.h" - -TypeHandle PhysxScene::_type_handle; - -PStatCollector PhysxScene::_pcollector_fetch_results("App:PhysX:Fetch Results"); -PStatCollector PhysxScene::_pcollector_update_transforms("App:PhysX:Update Transforms"); -PStatCollector PhysxScene::_pcollector_debug_renderer("App:PhysX:Debug Renderer"); -PStatCollector PhysxScene::_pcollector_simulate("App:PhysX:Simulate"); -PStatCollector PhysxScene::_pcollector_cloth("App:PhysX:Cloth"); -PStatCollector PhysxScene::_pcollector_softbody("App:PhysX:Softbody"); - -/** - * - */ -void PhysxScene:: -link(NxScene *scenePtr) { - - // Link self - _ptr = scenePtr; - _ptr->userData = this; - _error_type = ET_ok; - PhysxManager::get_global_ptr()->_scenes.add(this); - - _cm = NxCreateControllerManager(NxGetPhysicsSDKAllocator()); - nassertv_always(_cm); - - // Link materials - NxMaterial *materials[5]; - NxU32 iterator = 0; - - while (NxU32 i=_ptr->getMaterialArray(materials, 5, iterator)) { - while(i--) { - PhysxMaterial *material = new PhysxMaterial(); - material->link(materials[i]); - } - } -} - -/** - * - */ -void PhysxScene:: -unlink() { - - // Unlink vehicles - for (unsigned int i=0; i < _vehicles.size(); i++) { - _vehicles[i]->release(); - } - - // Unlink controllers - NxU32 nControllers = _cm->getNbControllers(); - - for (NxU32 i=0; i < nControllers; i++) { - NxController *controllerPtr = _cm->getController(i); - PhysxController *controller = (PhysxController *)controllerPtr->getUserData(); - controller->unlink(); - } - - // Unlink actors - NxActor **actors = _ptr->getActors(); - NxU32 nActors = _ptr->getNbActors(); - - for (NxU32 i=0; i < nActors; i++) { - PhysxActor *actor = (PhysxActor *)actors[i]->userData; - - // Actor could have already been unlinked by controller - if (actor) { - actor->unlink(); - } - } - - // Unlink joints - NxU32 nJoints = _ptr->getNbJoints(); - - _ptr->resetJointIterator(); - for (NxU32 i=0; i < nJoints; i++) { - NxJoint *jointPtr = _ptr->getNextJoint(); - PhysxJoint *joint = (PhysxJoint *)jointPtr->userData; - joint->unlink(); - } - - // Unlink force fields - NxForceField **fields = _ptr->getForceFields(); - NxU32 nFields = _ptr->getNbForceFields(); - - for (NxU32 i=0; i < nFields; i++) { - PhysxForceField *field = (PhysxForceField *)fields[i]->userData; - field->unlink(); - } - - // Unlink force field shape groups - NxU32 nGroups = _ptr->getNbForceFieldShapeGroups(); - - _ptr->resetForceFieldShapeGroupsIterator(); - for (NxU32 i=0; i < nGroups; i++) { - NxForceFieldShapeGroup *groupPtr = _ptr->getNextForceFieldShapeGroup(); - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)groupPtr->userData; - group->unlink(); - } - - // Unlink cloths - NxCloth **cloths = _ptr->getCloths(); - NxU32 nCloths = _ptr->getNbCloths(); - - for (NxU32 i=0; i < nCloths; i++) { - PhysxCloth *cloth = (PhysxCloth *)cloths[i]->userData; - cloth->unlink(); - } - - // Unlink softbodies - NxSoftBody **softbodies = _ptr->getSoftBodies(); - NxU32 nSoftbodies = _ptr->getNbSoftBodies(); - - for (NxU32 i=0; i < nSoftbodies; i++) { - PhysxSoftBody *softbody = (PhysxSoftBody *)softbodies[i]->userData; - softbody->unlink(); - } - - // Unlink materials - NxMaterial *materials[5]; - NxU32 iterator = 0; - - while (NxU32 i=_ptr->getMaterialArray(materials, 5, iterator)) { - while(i--) { - PhysxMaterial *material = (PhysxMaterial *)materials[i]->userData; - material->unlink(); - } - } - - // Unlink self - _cm->purgeControllers(); - NxReleaseControllerManager(_cm); - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxManager::get_global_ptr()->_scenes.remove(this); -} - -/** - * - */ -void PhysxScene:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxPhysicsSDK *sdk = NxGetPhysicsSDK(); - sdk->releaseScene(*_ptr); - _ptr = nullptr; -} - -/** - * Advances the simulation by an elapsedTime time. The elapsed time has to be - * in the range (0, inf). - * - * It is not allowed to modify the physics scene in between the simulate(dt) - * and the fetch_results calls! But it is allowed to read from the scene and - * do additional computations, e. g. AI, in between these calls. - */ -void PhysxScene:: -simulate(float dt) { - - nassertv(_error_type == ET_ok); - - _pcollector_simulate.start(); - - // Update all vehicles - for (unsigned int i=0; i < _vehicles.size(); i++) { - PhysxVehicle *vehicle = _vehicles[i]; - vehicle->update_vehicle(dt); - } - - // Update all controllers - for (NxU32 i=0; i < _cm->getNbControllers(); i++) { - NxController *controllerPtr = _cm->getController(i); - PhysxController *controller = (PhysxController *)controllerPtr->getUserData(); - controller->update_controller(dt); - } - - _cm->updateControllers(); - - // Simulate and flush streams - _ptr->simulate(dt); - _ptr->flushStream(); - - _pcollector_simulate.stop(); -} - -/** - * Waits until the simulation has finished, and then updates the scene graph - * with with simulation results. - * - * It is not allowed to modify the physics scene in between the simulate(dt) - * and the fetch_results calls! But it is allowed to read from the scene and - * do additional computations, e. g. AI, in between these calls. - */ -void PhysxScene:: -fetch_results() { - - nassertv(_error_type == ET_ok); - nassertv(_ptr != nullptr); - - _pcollector_fetch_results.start(); - _ptr->fetchResults(NX_RIGID_BODY_FINISHED, true); - _pcollector_fetch_results.stop(); - - // Update node transforms - _pcollector_update_transforms.start(); - - NxU32 nbTransforms = 0; - NxActiveTransform *activeTransforms = _ptr->getActiveTransforms(nbTransforms); - - if (nbTransforms && activeTransforms) { - for (NxU32 i=0; iupdate_transform(m); - } - } - } - _pcollector_update_transforms.stop(); - - // Update debug node - _pcollector_debug_renderer.start(); - _debugNode->update(_ptr); - _pcollector_debug_renderer.stop(); - - nassertv(_ptr->isWritable()); - - // Update cloth nodes - _pcollector_cloth.start(); - - NxCloth **cloths = _ptr->getCloths(); - for (NxU32 i=0; i < _ptr->getNbCloths(); i++) { - PT(PhysxCloth) cloth = (PhysxCloth *)cloths[i]->userData; - cloth->update(); - } - - _pcollector_cloth.stop(); - - // Update softbody nodes - _pcollector_softbody.start(); - - NxSoftBody **softbodies = _ptr->getSoftBodies(); - for (NxU32 i=0; i < _ptr->getNbSoftBodies(); i++) { - PT(PhysxSoftBody) softbody = (PhysxSoftBody *)softbodies[i]->userData; - softbody->update(); - } - - _pcollector_softbody.stop(); -} - -/** - * Sets simulation timing parameters used in simulate. - */ -void PhysxScene:: -set_timing_variable() { - - nassertv(_error_type == ET_ok); - _ptr->setTiming(0, 0, NX_TIMESTEP_VARIABLE); -} - -/** - * Sets simulation timing parameters used in simulate. The elapsed time - * (parameter "dt" in simulate()) is internally subdivided into up to maxIter - * substeps no larger than maxTimestep. If the elapsed time is not a multiple - * of maxTimestep then any remaining time is accumulated to be added onto the - * elapsed time for the next time step. If more sub steps than maxIter are - * needed to advance the simulation by elapsed time, then the remaining time - * is also accumulated for the next call to simulate(). - * - * This timing method is strongly preferred for stable, reproducible - * simulation. - */ -void PhysxScene:: -set_timing_fixed(float maxTimestep, unsigned int maxIter) { - - nassertv(_error_type == ET_ok); - _ptr->setTiming(maxTimestep, maxIter, NX_TIMESTEP_FIXED); -} - -/** - * Sets a constant gravity for the entire scene. - */ -void PhysxScene:: -set_gravity(const LVector3f &gravity) { - - nassertv(_error_type == ET_ok); - nassertv_always(!gravity.is_nan()); - - _ptr->setGravity(PhysxManager::vec3_to_nxVec3(gravity)); -} - -/** - * Retrieves the current gravity setting. - */ -LVector3f PhysxScene:: -get_gravity() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - - NxVec3 gravity; - _ptr->getGravity(gravity); - return PhysxManager::nxVec3_to_vec3(gravity); -} - -/** - * - */ -unsigned int PhysxScene:: -get_num_actors() const { - - nassertr(_error_type == ET_ok,-1); - - return _ptr->getNbActors(); -} - -/** - * - */ -PhysxActor *PhysxScene:: -create_actor(PhysxActorDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(), nullptr); - - PhysxActor *actor = new PhysxActor(); - nassertr(actor, nullptr); - - NxActor *actorPtr = _ptr->createActor(desc._desc); - nassertr(actorPtr, nullptr); - - actor->link(actorPtr); - - return actor; -} - -/** - * - */ -PhysxActor *PhysxScene:: -get_actor(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbActors(), nullptr); - - NxActor *actorPtr = _ptr->getActors()[idx]; - PhysxActor *actor = (PhysxActor *)(actorPtr->userData); - - return actor; -} - -/** - * Retrieves the debug geom node for this scene. The debug geom node is used - * to visualize information about the physical scene which can be useful for - * debugging an application. - * - * The debug geom node geometry is generated in global coordinates. In order - * to see correct information it is important not to dislocate the debug node. - * Reparent it to render and leave position at (0,0,0). - */ -PhysxDebugGeomNode *PhysxScene:: -get_debug_geom_node() { - - nassertr(_error_type == ET_ok, nullptr); - return _debugNode; -} - -/** - * - */ -void PhysxScene:: -enable_contact_reporting(bool enabled) { - - nassertv(_error_type == ET_ok); - - if (enabled) { - _ptr->setUserContactReport(&_contact_report); - _contact_report.enable(); - } - else { - _ptr->setUserContactReport(nullptr); - _contact_report.disable(); - } -} - -/** - * - */ -bool PhysxScene:: -is_contact_reporting_enabled() const { - - nassertr(_error_type == ET_ok, false); - - return _contact_report.is_enabled(); -} - -/** - * - */ -void PhysxScene:: -enable_trigger_reporting(bool enabled) { - - nassertv(_error_type == ET_ok); - - if (enabled) { - _ptr->setUserTriggerReport(&_trigger_report); - _trigger_report.enable(); - } - else { - _ptr->setUserTriggerReport(nullptr); - _trigger_report.disable(); - } -} - -/** - * - */ -bool PhysxScene:: -is_trigger_reporting_enabled() const { - - nassertr(_error_type == ET_ok, false); - - return _trigger_report.is_enabled(); -} - -/** - * - */ -void PhysxScene:: -enable_controller_reporting(bool enabled) { - - nassertv(_error_type == ET_ok); - - if (enabled) { - _controller_report.enable(); - } - else { - _controller_report.disable(); - } -} - -/** - * - */ -bool PhysxScene:: -is_controller_reporting_enabled() const { - - nassertr(_error_type == ET_ok, false); - - return _controller_report.is_enabled(); -} - -/** - * Return the number of materials in the scene. - * - * Note that the returned value is not related to material indices. Those may - * not be allocated continuously, and its values may be higher than - * get_num_materials(). This will also include the default material which - * exists without having to be created. - */ -unsigned int PhysxScene:: -get_num_materials() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getNbMaterials(); -} - -/** - * Creates a new PhysxMaterial. - * - * The material library consists of an array of material objects. Each - * material has a well defined index that can be used to refer to it. If an - * object references an undefined material, the default material with index 0 - * is used instead. - */ -PhysxMaterial *PhysxScene:: -create_material(PhysxMaterialDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(), nullptr); - - PhysxMaterial *material = new PhysxMaterial(); - nassertr(material, nullptr); - - NxMaterial *materialPtr = _ptr->createMaterial(desc._desc); - nassertr(materialPtr, nullptr); - - material->link(materialPtr); - - return material; -} - -/** - * Creates a new PhysxMaterial using the default settings of - * PhysxMaterialDesc. - */ -PhysxMaterial *PhysxScene:: -create_material() { - - nassertr(_error_type == ET_ok, nullptr); - - PhysxMaterial *material = new PhysxMaterial(); - nassertr(material, nullptr); - - NxMaterialDesc desc; - desc.setToDefault(); - NxMaterial *materialPtr = _ptr->createMaterial(desc); - nassertr(materialPtr, nullptr); - - material->link(materialPtr); - - return material; -} - -/** - * Returns current highest valid material index. - * - * Note that not all indices below this are valid if some of them belong to - * meshes that have beed freed. - */ -unsigned int PhysxScene:: -get_hightest_material_index() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getHighestMaterialIndex(); -} - -/** - * Retrieves the material with the given material index. - * - * There is always at least one material in the Scene, the default material - * (index 0). If the specified material index is out of range (larger than - * get_hightest_material_index) or belongs to a material that has been - * released, then the default material is returned, but no error is reported. - */ -PhysxMaterial *PhysxScene:: -get_material_from_index(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - - NxMaterial *materialPtr = _ptr->getMaterialFromIndex(idx); - - return (PhysxMaterial *)(materialPtr->userData); -} - -/** - * Retrieves the n-th material from the array of materials. See also - * get_material_from_index, which retrieves a material by it's material index. - */ -PhysxMaterial *PhysxScene:: -get_material(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbMaterials(), nullptr); - - NxU32 n = _ptr->getNbMaterials(); - NxMaterial **materials = new NxMaterial *[n]; - NxU32 materialCount; - NxU32 iterator = 0; - - materialCount = _ptr->getMaterialArray(materials, n, iterator); - nassertr((materialCount == n), nullptr); - - NxMaterial *materialPtr = materials[idx]; - delete[] materials; - - return (PhysxMaterial *)(materialPtr->userData); -} - -/** - * Return the number of controllers in the scene. - */ -unsigned int PhysxScene:: -get_num_controllers() const { - - nassertr(_error_type == ET_ok, -1); - return _cm->getNbControllers(); -} - - -/** - * Creates a new character controller. - */ -PhysxController *PhysxScene:: -create_controller(PhysxControllerDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(), nullptr); - - PhysxController *controller = PhysxController::factory(desc.ptr()->getType()); - nassertr(controller, nullptr); - - desc.ptr()->callback = &_controller_report; - desc.ptr()->userData = controller; - - NxController *controllerPtr = _cm->createController(_ptr,*desc.ptr()); - nassertr(controllerPtr, nullptr); - - controller->link(controllerPtr); - controller->get_actor()->set_name(""); - - return controller; -} - -/** - * Retrieves the n-th controller within the scene. - */ -PhysxController *PhysxScene:: -get_controller(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _cm->getNbControllers(), nullptr); - - NxController *controllerPtr = _cm->getController(idx); - PhysxController *controller = (PhysxController *)(controllerPtr->getUserData()); - - return controller; -} - -/** - * Returns the number of joints in the scene (excluding "dead" joints). Note - * that this includes compartments. - */ -unsigned int PhysxScene:: -get_num_joints() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getNbJoints(); -} - -/** - * Creates a joint in this scene. - */ -PhysxJoint *PhysxScene:: -create_joint(PhysxJointDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(), nullptr); - - PhysxJoint *joint = PhysxJoint::factory(desc.ptr()->getType()); - nassertr(joint, nullptr); - - NxJoint *jointPtr = _ptr->createJoint(*desc.ptr()); - nassertr(jointPtr, nullptr); - - joint->link(jointPtr); - - return joint; -} - -/** - * Retrieve the n-th joint from the array of all the joints in the scene. - */ -PhysxJoint *PhysxScene:: -get_joint(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbJoints(), nullptr); - - NxJoint *jointPtr; - NxU32 nJoints = _ptr->getNbJoints(); - - _ptr->resetJointIterator(); - for (NxU32 i=0; i <= idx; i++) { - jointPtr = _ptr->getNextJoint(); - } - - return (PhysxJoint *)(jointPtr->userData); -} - -/** - * Gets the number of force fields in the scene. - */ -unsigned int PhysxScene:: -get_num_force_fields() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getNbForceFields(); -} - -/** - * Creates a force field in this scene. - */ -PhysxForceField *PhysxScene:: -create_force_field(PhysxForceFieldDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - - // Create the kernel - desc.create_kernel(_ptr); - nassertr(desc.is_valid(), nullptr); - - // Create the force field - PhysxForceField *field = new PhysxForceField(); - nassertr(field, nullptr); - - NxForceField *fieldPtr = _ptr->createForceField(desc._desc); - nassertr(fieldPtr, nullptr); - - field->link(fieldPtr); - - return field; -} - -/** - * Returns the n-th force field from the array of all the force fields in the - * scene. - */ -PhysxForceField *PhysxScene:: -get_force_field(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbForceFields(), nullptr); - - NxForceField **fields = _ptr->getForceFields(); - NxForceField *fieldPtr = fields[idx]; - - return (PhysxForceField *)(fieldPtr->userData); -} - -/** - * Gets the number of force field shape groups in the scene. - */ -unsigned int PhysxScene:: -get_num_force_field_shape_groups() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getNbForceFieldShapeGroups(); -} - -/** - * Creates a new force field shape group in this scene. - */ -PhysxForceFieldShapeGroup *PhysxScene:: -create_force_field_shape_group(PhysxForceFieldShapeGroupDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - - PhysxForceFieldShapeGroup *group = new PhysxForceFieldShapeGroup(); - nassertr(group, nullptr); - - NxForceFieldShapeGroup *groupPtr = _ptr->createForceFieldShapeGroup(desc._desc); - nassertr(groupPtr, nullptr); - - group->link(groupPtr); - - return group; -} - -/** - * Returns the n-th force field shape group in this scene - */ -PhysxForceFieldShapeGroup *PhysxScene:: -get_force_field_shape_group(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbForceFieldShapeGroups(), nullptr); - - _ptr->resetForceFieldShapeGroupsIterator(); - NxForceFieldShapeGroup *groupPtr = nullptr; - idx++; - while (idx-- > 0) { - groupPtr = _ptr->getNextForceFieldShapeGroup(); - } - - return groupPtr ? (PhysxForceFieldShapeGroup *)groupPtr->userData : nullptr; -} - -/** - * Gets the number of cloths in the scene. - */ -unsigned int PhysxScene:: -get_num_cloths() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getNbCloths(); -} - -/** - * Creates a cloth in this scene. - */ -PhysxCloth *PhysxScene:: -create_cloth(PhysxClothDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - - PhysxCloth *cloth = new PhysxCloth(); - nassertr(cloth, nullptr); - - NxCloth *clothPtr = _ptr->createCloth(desc._desc); - nassertr(clothPtr, nullptr); - - cloth->link(clothPtr); - - return cloth; -} - -/** - * Returns the n-th cloth from the array of all the cloths in the scene. - */ -PhysxCloth *PhysxScene:: -get_cloth(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbCloths(), nullptr); - - NxCloth **cloths = _ptr->getCloths(); - NxCloth *clothPtr = cloths[idx]; - - return (PhysxCloth *)(clothPtr->userData); -} - -/** - * Gets the number of soft bodies in the scene. - */ -unsigned int PhysxScene:: -get_num_soft_bodies() const { - - nassertr(_error_type == ET_ok, -1); - return _ptr->getNbSoftBodies(); -} - -/** - * Creates a soft body in this scene. - */ -PhysxSoftBody *PhysxScene:: -create_soft_body(PhysxSoftBodyDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - - PhysxSoftBody *softbody = new PhysxSoftBody(); - nassertr(softbody, nullptr); - - NxSoftBody *softbodyPtr = _ptr->createSoftBody(desc._desc); - nassertr(softbodyPtr, nullptr); - - softbody->link(softbodyPtr); - - return softbody; -} - -/** - * Returns the n-th soft body from the array of all the soft bodies in the - * scene. - */ -PhysxSoftBody *PhysxScene:: -get_soft_body(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _ptr->getNbSoftBodies(), nullptr); - - NxSoftBody **softbodies = _ptr->getSoftBodies(); - NxSoftBody *softbodyPtr = softbodies[idx]; - - return (PhysxSoftBody *)(softbodyPtr->userData); -} - -/** - * Returns the number of vehicles in the scene. - */ -unsigned int PhysxScene:: -get_num_vehicles() const { - - nassertr(_error_type == ET_ok, -1); - return _vehicles.size(); -} - -/** - * Creates a vehicle in this scene. - */ -PhysxVehicle *PhysxScene:: -create_vehicle(PhysxVehicleDesc &desc) { - - nassertr(_error_type == ET_ok, nullptr); - nassertr(desc.is_valid(), nullptr); - - PhysxVehicle *vehicle = new PhysxVehicle(); - nassertr(vehicle, nullptr); - - vehicle->create(this, desc); - - return vehicle; -} - -/** - * Returns the n-th vehicle from the array of all the vehicles in the scene. - */ -PhysxVehicle *PhysxScene:: -get_vehicle(unsigned int idx) const { - - nassertr(_error_type == ET_ok, nullptr); - nassertr_always(idx < _vehicles.size(), nullptr); - - return _vehicles[idx]; -} - -/** - * - */ -PhysxSceneStats2 PhysxScene:: -get_stats2() const { - - nassertr(_error_type == ET_ok, nullptr); - return PhysxSceneStats2(_ptr->getStats2()); -} - -/** - * Returns true if any shape is intersected by the ray. - */ -bool PhysxScene:: -raycast_any_shape(const PhysxRay &ray, - PhysxShapesType shapesType, - PhysxMask mask, - PhysxGroupsMask *groups) const { - - nassertr(_error_type == ET_ok, false); - - NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : nullptr; - - return _ptr->raycastAnyShape(ray._ray, (NxShapesType)shapesType, - mask.get_mask(), ray._length, groupsPtr); -} - -/** - * Returns the first shape that is hit along the ray. If not shape is hit - * then an empty raycast hit is returned (is_empty() == true). - */ -PhysxRaycastHit PhysxScene:: -raycast_closest_shape(const PhysxRay &ray, - PhysxShapesType shapesType, - PhysxMask mask, - PhysxGroupsMask *groups, bool smoothNormal) const { - - NxRaycastHit hit; - - nassertr(_error_type == ET_ok, hit); - - NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : nullptr; - - NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE; - if (smoothNormal == true) { - hints |= NX_RAYCAST_NORMAL; - } - else { - hints |= NX_RAYCAST_FACE_NORMAL; - } - - _ptr->raycastClosestShape(ray._ray, (NxShapesType)shapesType, hit, - mask.get_mask(), ray._length, hints, groupsPtr); - - - return PhysxRaycastHit(hit); -} - -/** - * Returns a PhysxRaycastReport object which can be used to iterate over all - * shapes that have been hit by the ray. - */ -PhysxRaycastReport PhysxScene:: -raycast_all_shapes(const PhysxRay &ray, - PhysxShapesType shapesType, - PhysxMask mask, - PhysxGroupsMask *groups, bool smoothNormal) const { - - PhysxRaycastReport report; - - nassertr(_error_type == ET_ok, report); - - NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : nullptr; - - NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE; - if (smoothNormal == true) { - hints |= NX_RAYCAST_NORMAL; - } - else { - hints |= NX_RAYCAST_FACE_NORMAL; - } - - _ptr->raycastAllShapes(ray._ray, report, (NxShapesType)shapesType, - mask.get_mask(), ray._length, hints, groupsPtr); - - return report; -} - -/** - * Returns true if any axis aligned bounding box enclosing a shape is - * intersected by the ray. - */ -bool PhysxScene:: -raycast_any_bounds(const PhysxRay &ray, - PhysxShapesType shapesType, - PhysxMask mask, - PhysxGroupsMask *groups) const { - - nassertr(_error_type == ET_ok, false); - - NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : nullptr; - - return _ptr->raycastAnyBounds(ray._ray, (NxShapesType)shapesType, - mask.get_mask(), ray._length, groupsPtr); -} - -/** - * Returns the first axis aligned bounding box enclosing a shape that is hit - * along the ray. If not shape is hit then an empty raycast hit is returned - * (is_empty() == true). - */ -PhysxRaycastHit PhysxScene:: -raycast_closest_bounds(const PhysxRay &ray, PhysxShapesType shapesType, PhysxMask mask, PhysxGroupsMask *groups, bool smoothNormal) const { - - NxRaycastHit hit; - - nassertr(_error_type == ET_ok, hit); - - NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : nullptr; - - NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE; - if (smoothNormal == true) { - hints |= NX_RAYCAST_NORMAL; - } - else { - hints |= NX_RAYCAST_FACE_NORMAL; - } - - _ptr->raycastClosestBounds(ray._ray, (NxShapesType)shapesType, hit, - mask.get_mask(), ray._length, hints, groupsPtr); - - - return PhysxRaycastHit(hit); -} - -/** - * Returns a PhysxRaycastReport object which can be used to iterate over all - * shapes that have been enclosed by axis aligned bounding boxes hit by the - * ray. - */ -PhysxRaycastReport PhysxScene:: -raycast_all_bounds(const PhysxRay &ray, - PhysxShapesType shapesType, - PhysxMask mask, - PhysxGroupsMask *groups, bool smoothNormal) const { - - PhysxRaycastReport report; - - nassertr(_error_type == ET_ok, report); - - NxGroupsMask *groupsPtr = groups ? &(groups->_mask) : nullptr; - - NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE; - if (smoothNormal == true) { - hints |= NX_RAYCAST_NORMAL; - } - else { - hints |= NX_RAYCAST_FACE_NORMAL; - } - - _ptr->raycastAllBounds(ray._ray, report, (NxShapesType)shapesType, - mask.get_mask(), ray._length, hints, groupsPtr); - - return report; -} - -/** - * Returns the set of shapes overlapped by the world-space sphere. You can - * test against static and/or dynamic objects by adjusting 'shapeType'. - */ -PhysxOverlapReport PhysxScene:: -overlap_sphere_shapes(const LPoint3f ¢er, float radius, - PhysxShapesType shapesType, - PhysxMask mask, bool accurateCollision) const { - - PhysxOverlapReport report; - - nassertr(_error_type == ET_ok, report); - - NxSphere worldSphere(PhysxManager::point3_to_nxVec3(center), radius); - - _ptr->overlapSphereShapes(worldSphere, (NxShapesType)shapesType, 0, nullptr, &report, - mask.get_mask(), nullptr, accurateCollision); - - return report; -} - -/** - * Returns the set of shapes overlapped by the world-space capsule. You can - * test against static and/or dynamic objects by adjusting 'shapeType'. - */ -PhysxOverlapReport PhysxScene:: -overlap_capsule_shapes(const LPoint3f &p0, const LPoint3f &p1, float radius, - PhysxShapesType shapesType, - PhysxMask mask, bool accurateCollision) const { - - PhysxOverlapReport report; - - nassertr(_error_type == ET_ok, report); - - NxSegment segment(PhysxManager::point3_to_nxVec3(p0), - PhysxManager::point3_to_nxVec3(p1)); - NxCapsule worldCapsule(segment, radius); - - _ptr->overlapCapsuleShapes(worldCapsule, (NxShapesType)shapesType, 0, nullptr, &report, - mask.get_mask(), nullptr, accurateCollision); - - return report; -} - -/** - * Sets the pair flags for the given pair of actors. - * - * Calling this on an actor that has no shape(s) has no effect. The two actor - * references must not reference the same actor. - * - * It is important to note that the engine stores pair flags per shape, even - * for actor pair flags. This means that shapes should be created before - * actor pair flags are set, otherwise the pair flags will be ignored. - */ -void PhysxScene:: -set_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, - PhysxContactPairFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - - NxActor *ptrA = actorA.ptr(); - NxActor *ptrB = actorB.ptr(); - NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setActorPairFlags(*ptrA, *ptrB, flags); -} - -/** - * Retrieves a single flag for the given pair of actors. - * - * The two actor references must not reference the same actor. - */ -bool PhysxScene:: -get_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, - PhysxContactPairFlag flag) { - - nassertr(_error_type == ET_ok, false); - - NxActor *ptrA = actorA.ptr(); - NxActor *ptrB = actorB.ptr(); - NxU32 flags = _ptr->getActorPairFlags(*ptrA, *ptrB); - - return (flags && flag) ? true : false; -} - -/** - * Disables or enables contact generation for a pair of shapes. - * - * The two shape references must not reference the same shape. - */ -void PhysxScene:: -set_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB, bool value) { - - nassertv(_error_type == ET_ok); - - NxShape *ptrA = shapeA.ptr(); - NxShape *ptrB = shapeB.ptr(); - NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB); - - if (value == true) { - flags |= NX_IGNORE_PAIR; - } - else { - flags &= ~(NX_IGNORE_PAIR); - } - - _ptr->setShapePairFlags(*ptrA, *ptrB, flags); -} - -/** - * Returns /true/ if contact generation between a pair of shapes is enabled, - * and /false/ if contact generation is disables. - * - * The two shape references must not reference the same shape. - */ -bool PhysxScene:: -get_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB) { - - nassertr(_error_type == ET_ok, false); - - NxShape *ptrA = shapeA.ptr(); - NxShape *ptrB = shapeB.ptr(); - NxU32 flags = _ptr->getShapePairFlags(*ptrA, *ptrB); - - return (flags && NX_IGNORE_PAIR) ? true : false; -} - -/** - * With this method one can set contact reporting flags between actors - * belonging to a pair of groups. - * - * It is possible to assign each actor to a group using - * PhysxActor::set_group(). This is a different set of groups from the shape - * groups despite the similar name. Here up to 0xffff different groups are - * permitted, With this method one can set contact reporting flags between - * actors belonging to a pair of groups. - * - * The following flags are permitted: - CPF_start_touch - CPF_end_touch - - * CPF_touch - CPF_start_touch_treshold - CPF_end_touch_treshold - - * CPF_touch_treshold - * - * Note that finer grain control of pairwise flags is possible using the - * function PhysxScene::set_actor_pair_flags(). - */ -void PhysxScene:: -set_actor_group_pair_flag(unsigned int g1, unsigned int g2, - PhysxContactPairFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - - NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2); - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - _ptr->setActorGroupPairFlags(g1, g2, flags); -} - -/** - * Retrieves a single flag set with PhysxScene::set_actor_group_pair_flag() - */ -bool PhysxScene:: -get_actor_group_pair_flag(unsigned int g1, unsigned int g2, - PhysxContactPairFlag flag) { - - nassertr(_error_type == ET_ok, false); - NxU32 flags = _ptr->getActorGroupPairFlags(g1, g2); - return (flags && flag) ? true : false; -} - -/** - * Setups filtering operations. - */ -void PhysxScene:: -set_filter_ops(PhysxFilterOp op0, PhysxFilterOp op1, PhysxFilterOp op2) { - - nassertv(_error_type == ET_ok); - _ptr->setFilterOps((NxFilterOp)op0, (NxFilterOp)op1, (NxFilterOp)op2); -} - -/** - * Setups filtering's boolean value. - */ -void PhysxScene:: -set_filter_bool(bool flag) { - - nassertv(_error_type == ET_ok); - _ptr->setFilterBool(flag); -} - -/** - * Setups filtering's K0 value. - */ -void PhysxScene:: -set_filter_constant0(const PhysxGroupsMask &mask) { - - nassertv(_error_type == ET_ok); - _ptr->setFilterConstant0(mask.get_mask()); -} - -/** - * Setups filtering's K1 value. - */ -void PhysxScene:: -set_filter_constant1(const PhysxGroupsMask &mask) { - - nassertv(_error_type == ET_ok); - _ptr->setFilterConstant1(mask.get_mask()); -} - -/** - * Retrieves filtering's boolean value. - */ -bool PhysxScene:: -get_filter_bool() const { - - nassertr(_error_type == ET_ok, false); - return _ptr->getFilterBool(); -} - -/** - * Gets filtering constant K0. - */ -PhysxGroupsMask PhysxScene:: -get_filter_constant0() const { - - PhysxGroupsMask mask; - - nassertr(_error_type == ET_ok, mask); - - NxGroupsMask _mask = ptr()->getFilterConstant0(); - mask.set_mask(_mask); - - return mask; -} - -/** - * Gets filtering constant K1. - */ -PhysxGroupsMask PhysxScene:: -get_filter_constant1() const { - - PhysxGroupsMask mask; - - nassertr(_error_type == ET_ok, mask); - - NxGroupsMask _mask = ptr()->getFilterConstant1(); - mask.set_mask(_mask); - - return mask; -} - -/** - * Retrieves the op0 filtering operation. - */ -PhysxEnums::PhysxFilterOp PhysxScene:: -get_filter_op0() const { - - nassertr(_error_type == ET_ok, FO_and); - - NxFilterOp op0; - NxFilterOp op1; - NxFilterOp op2; - - _ptr->getFilterOps(op0, op1, op2); - - return (PhysxFilterOp)op0; -} - -/** - * Retrieves the op1 filtering operation. - */ -PhysxEnums::PhysxFilterOp PhysxScene:: -get_filter_op1() const { - - nassertr(_error_type == ET_ok, FO_and); - - NxFilterOp op0; - NxFilterOp op1; - NxFilterOp op2; - - _ptr->getFilterOps(op0, op1, op2); - - return (PhysxFilterOp)op1; -} - -/** - * Retrieves the op2 filtering operation. - */ -PhysxEnums::PhysxFilterOp PhysxScene:: -get_filter_op2() const { - - nassertr(_error_type == ET_ok, FO_and); - - NxFilterOp op0; - NxFilterOp op1; - NxFilterOp op2; - - _ptr->getFilterOps(op0, op1, op2); - - return (PhysxFilterOp)op2; -} - -/** - * Specifies if collision should be performed by a pair of shape groups. - * - * It is possible to assign each shape to a collision groups using - * PhysxShape::set_group(). With this method one can set whether collisions - * should be detected between shapes belonging to a given pair of groups. - * Initially all pairs are enabled. - * - * Fluids can be assigned to collision groups as well. - * - * Collision groups are integers between 0 and 31. - */ -void PhysxScene:: -set_group_collision_flag(unsigned int g1, unsigned int g2, bool enable) { - - nassertv(_error_type == ET_ok); - nassertv(g1 >= 0 && g1 < 32); - nassertv(g2 >= 0 && g2 < 32); - - _ptr->setGroupCollisionFlag((NxCollisionGroup)g1, (NxCollisionGroup)g2, enable); -} - -/** - * Determines if collision detection is performed between a pair of groups. - * Collision groups are integers between 0 and 31. - */ -bool PhysxScene:: -get_group_collision_flag(unsigned int g1, unsigned int g2) { - - nassertr(_error_type == ET_ok, false); - nassertr(g1 >= 0 && g1 < 32, false); - nassertr(g2 >= 0 && g2 < 32, false); - - return _ptr->getGroupCollisionFlag((NxCollisionGroup)g1, (NxCollisionGroup)g2); -} - -/** - * Return the specified scene flag flag. - */ -bool PhysxScene:: -get_flag(PhysxSceneFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getFlags() & flag) ? true : false; -} - -/** - * Returns TRUE if the the scene is simulated in hardware. FALSE if the scene - * is simulated in software. - */ -bool PhysxScene:: -is_hardware_scene() const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getSimType() & NX_SIMULATION_HW) ? true : false; -} - -/** - * Specifies the dominance behavior of constraints between two actors with two - * certain dominance groups. - * - * It is possible to assign each actor to a dominance groups using - * PhysxActor::set_dominance_group(). - * - * With dominance groups one can have all constraints (contacts and joints) - * created between actors act in one direction only. This is useful if you - * want to make sure that the movement of the rider of a vehicle or the pony - * tail of a character doesn't influence the object it is attached to, while - * keeping the motion of both inherently physical. - * - * Whenever a constraint (i.e. joint or contact) between two actors (a0, a1) - * needs to be solved, the groups (g0, g1) of both actors are retrieved. Then - * the constraint dominance setting for this group pair is retrieved. - * - * In the constraint, PhysxConstraintDominance::get_0() becomes the dominance - * setting for a0, and PhysxConstraintDominance::get_1() becomes the dominance - * setting for a1. A dominance setting of 1.0f, the default, will permit the - * actor to be pushed or pulled by the other actor. A dominance setting of - * 0.0f will however prevent the actor to be pushed or pulled by the other - * actor. Thus, a PhysxConstraintDominance of (1.0f, 0.0f) makes the - * interaction one-way. - * - * The dominance matrix is initialised by default such that: - if g1 == g2, - * then (1.0f, 1.0f) is returned - if g1 < g2, then (0.0f, 1.0f) is returned - - * if g1 > g2, then (1.0f, 0.0f) is returned - * - * In other words, actors in higher groups can be pushed around by actors in - * lower groups by default. - * - * These settings should cover most applications, and in fact not overriding - * these settings may likely result in higher performance. - * - * Dominance settings are currently specified as floats 0.0f or 1.0f because - * in the future PhysX may permit arbitrary fractional settings to express - * 'partly-one-way' interactions. - */ -void PhysxScene:: -set_dominance_group_pair(unsigned int g1, unsigned int g2, PhysxConstraintDominance dominance ) { - - nassertv(_error_type == ET_ok); - nassertv(g1 < 32); - nassertv(g2 < 32); - - NxConstraintDominance d = dominance.get_dominance(); - _ptr->setDominanceGroupPair((NxDominanceGroup)g1, (NxDominanceGroup)g2, d); -} - -/** - * Samples the dominance matrix. - */ -PhysxConstraintDominance PhysxScene:: -get_dominance_group_pair(unsigned int g1, unsigned int g2) { - - PhysxConstraintDominance result(1.0f, 1.0f); - - nassertr(_error_type == ET_ok, result); - nassertr(g1 < 32, result); - nassertr(g2 < 32, result); - - result.set_dominance(_ptr->getDominanceGroupPair((NxDominanceGroup)g1, (NxDominanceGroup)g2)); - return result; -} - -/** - * Gets the shared material for all wheel shapes. - * - * If this material is not already created then calling this method will - * create the material. - * - * Normally users don't need to call this method. It is used internally by - * PhysWheel::create_wheel. - */ -PhysxMaterial *PhysxScene:: -get_wheel_shape_material() { - - nassertr(_error_type == ET_ok, nullptr); - - if (_wheelShapeMaterial == nullptr) { - PhysxMaterialDesc materialDesc; - materialDesc.set_flag(PhysxMaterialDesc::MF_disable_friction, true); - _wheelShapeMaterial = create_material(materialDesc); - } - - return _wheelShapeMaterial; -} diff --git a/panda/src/physx/physxScene.h b/panda/src/physx/physxScene.h deleted file mode 100644 index f8bf2b302b..0000000000 --- a/panda/src/physx/physxScene.h +++ /dev/null @@ -1,284 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxScene.h - * @author enn0x - * @date 2009-09-14 - */ - -#ifndef PHYSXSCENE_H -#define PHYSXSCENE_H - -#include "pandabase.h" -#include "luse.h" -#include "callbackObject.h" - -#include "physxObject.h" -#include "physxObjectCollection.h" -#include "physxEnums.h" -#include "physxContactReport.h" -#include "physxControllerReport.h" -#include "physxTriggerReport.h" -#include "physxOverlapReport.h" -#include "physxMask.h" -#include "physxGroupsMask.h" -#include "physx_includes.h" - -class PhysxActor; -class PhysxActorDesc; -class PhysxController; -class PhysxControllerDesc; -class PhysxConstraintDominance; -class PhysxDebugGeomNode; -class PhysxForceField; -class PhysxForceFieldDesc; -class PhysxForceFieldShapeGroup; -class PhysxForceFieldShapeGroupDesc; -class PhysxJoint; -class PhysxJointDesc; -class PhysxMaterial; -class PhysxMaterialDesc; -class PhysxOverlapReport; -class PhysxRay; -class PhysxRaycastHit; -class PhysxRaycastReport; -class PhysxSceneStats2; -class PhysxVehicle; -class PhysxVehicleDesc; -class PhysxCloth; -class PhysxClothDesc; -class PhysxSoftBody; -class PhysxSoftBodyDesc; - -/** - * A scene is a collection of bodies, constraints, and effectors which can - * interact. - * - * The scene simulates the behavior of these objects over time. Several - * scenes may exist at the same time, but each body, constraint, or effector - * object is specific to a scene -- they may not be shared. - * - * For example, attempting to create a joint in one scene and then using it to - * attach bodies from a different scene results in undefined behavior. - */ -class EXPCL_PANDAPHYSX PhysxScene : public PhysxObject, public PhysxEnums { - -PUBLISHED: - INLINE PhysxScene(); - INLINE ~PhysxScene(); - - void simulate(float dt); - void fetch_results(); - void set_timing_variable(); - void set_timing_fixed(float maxTimestep=1.0f/60.0f, unsigned int maxIter=8); - - PhysxDebugGeomNode *get_debug_geom_node(); - - void enable_contact_reporting(bool enabled); - bool is_contact_reporting_enabled() const; - void enable_trigger_reporting(bool enabled); - bool is_trigger_reporting_enabled() const; - void enable_controller_reporting(bool enabled); - bool is_controller_reporting_enabled() const; - - INLINE void set_controller_shape_hit_callback(PT(CallbackObject) cbobj); - INLINE void set_controller_controller_hit_callback(PT(CallbackObject) cbobj); - - void set_gravity(const LVector3f &gravity); - - LVector3f get_gravity() const; - PhysxSceneStats2 get_stats2() const; - bool get_flag(PhysxSceneFlag flag) const; - bool is_hardware_scene() const; - - // Actors - unsigned int get_num_actors() const; - PhysxActor *create_actor(PhysxActorDesc &desc); - PhysxActor *get_actor(unsigned int idx) const; - MAKE_SEQ(get_actors, get_num_actors, get_actor); - - // Joints - unsigned int get_num_joints() const; - PhysxJoint *create_joint(PhysxJointDesc &desc); - PhysxJoint *get_joint(unsigned int idx) const; - MAKE_SEQ(get_joints, get_num_joints, get_joint); - - // Materials - unsigned int get_num_materials() const; - unsigned int get_hightest_material_index() const; - PhysxMaterial *create_material(PhysxMaterialDesc &desc); - PhysxMaterial *create_material(); - PhysxMaterial *get_material(unsigned int idx) const; - PhysxMaterial *get_material_from_index(unsigned int idx) const; - MAKE_SEQ(get_materials, get_num_materials, get_material); - - // Controllers - unsigned int get_num_controllers() const; - PhysxController *create_controller(PhysxControllerDesc &controllerDesc); - PhysxController *get_controller(unsigned int idx) const; - MAKE_SEQ(get_controllers, get_num_controllers, get_controller); - - // Force fields - unsigned int get_num_force_fields() const; - PhysxForceField *create_force_field(PhysxForceFieldDesc &desc); - PhysxForceField *get_force_field(unsigned int idx) const; - MAKE_SEQ(get_force_fields, get_num_force_fields, get_force_field); - - // Force field shape groups - unsigned int get_num_force_field_shape_groups() const; - PhysxForceFieldShapeGroup *create_force_field_shape_group(PhysxForceFieldShapeGroupDesc &desc); - PhysxForceFieldShapeGroup *get_force_field_shape_group(unsigned int idx) const; - MAKE_SEQ(get_force_field_shape_groups, get_num_force_field_shape_groups, get_force_field_shape_group); - - // Cloths - unsigned int get_num_cloths() const; - PhysxCloth *create_cloth(PhysxClothDesc &desc); - PhysxCloth *get_cloth(unsigned int idx) const; - MAKE_SEQ(get_cloths, get_num_cloths, get_cloth); - - // Soft bodies - unsigned int get_num_soft_bodies() const; - PhysxSoftBody *create_soft_body(PhysxSoftBodyDesc &desc); - PhysxSoftBody *get_soft_body(unsigned int idx) const; - MAKE_SEQ(get_soft_bodies, get_num_soft_bodies, get_soft_body); - - // Vehicles - unsigned int get_num_vehicles() const; - PhysxVehicle *create_vehicle(PhysxVehicleDesc &desc); - PhysxVehicle *get_vehicle(unsigned int idx) const; - MAKE_SEQ(get_vehicles, get_num_vehicles, get_vehicle); - - // Raycast queries - bool raycast_any_shape(const PhysxRay &ray, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), - PhysxGroupsMask *groups=nullptr) const; - - PhysxRaycastHit raycast_closest_shape(const PhysxRay &ray, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), - PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const; - - PhysxRaycastReport raycast_all_shapes(const PhysxRay &ray, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), - PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const; - - bool raycast_any_bounds(const PhysxRay &ray, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), - PhysxGroupsMask *groups=nullptr) const; - - PhysxRaycastHit raycast_closest_bounds(const PhysxRay &ray, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), - PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const; - - PhysxRaycastReport raycast_all_bounds(const PhysxRay &ray, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), - PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const; - - // Overlap queries - PhysxOverlapReport overlap_sphere_shapes(const LPoint3f ¢er, float radius, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), bool accurateCollision=true) const; - - PhysxOverlapReport overlap_capsule_shapes(const LPoint3f &p0, const LPoint3f &p1, float radius, - PhysxShapesType shapesType=ST_all, - PhysxMask mask=PhysxMask::all_on(), bool accurateCollision=true) const; - - // Filters - void set_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, PhysxContactPairFlag flag, bool value); - void set_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB, bool value); - void set_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag, bool value); - void set_group_collision_flag(unsigned int g1, unsigned int g2, bool enable); - void set_filter_ops(PhysxFilterOp op0, PhysxFilterOp op1, PhysxFilterOp op2); - void set_filter_bool(bool flag); - void set_filter_constant0(const PhysxGroupsMask &mask); - void set_filter_constant1(const PhysxGroupsMask &mask); - void set_dominance_group_pair(unsigned int g1, unsigned int g2, PhysxConstraintDominance dominance); - - bool get_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, PhysxContactPairFlag flag); - bool get_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB); - bool get_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag); - bool get_group_collision_flag(unsigned int g1, unsigned int g2); - bool get_filter_bool() const; - PhysxGroupsMask get_filter_constant0() const; - PhysxGroupsMask get_filter_constant1() const; - PhysxFilterOp get_filter_op0() const; - PhysxFilterOp get_filter_op1() const; - PhysxFilterOp get_filter_op2() const; - PhysxConstraintDominance get_dominance_group_pair(unsigned int g1, unsigned int g2); - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE NxScene *ptr() const { return _ptr; }; - INLINE NxControllerManager *cm() const { return _cm; }; - - void link(NxScene *ptr); - void unlink(); - - PhysxObjectCollection _materials; - PhysxObjectCollection _actors; - PhysxObjectCollection _joints; - PhysxObjectCollection _forcefields; - PhysxObjectCollection _ffgroups; - PhysxObjectCollection _controllers; - PhysxObjectCollection _vehicles; - PhysxObjectCollection _cloths; - PhysxObjectCollection _softbodies; - - PhysxMaterial *get_wheel_shape_material(); - -private: - NxScene *_ptr; - NxControllerManager *_cm; - PT(PhysxDebugGeomNode) _debugNode; - PT(PhysxMaterial) _wheelShapeMaterial; - - PhysxContactReport _contact_report; - PhysxControllerReport _controller_report; - PhysxTriggerReport _trigger_report; - - static PStatCollector _pcollector_fetch_results; - static PStatCollector _pcollector_update_transforms; - static PStatCollector _pcollector_debug_renderer; - static PStatCollector _pcollector_simulate; - static PStatCollector _pcollector_cloth; - static PStatCollector _pcollector_softbody; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxScene", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxScene.I" - -#endif // PHYSXSCENE_H diff --git a/panda/src/physx/physxSceneDesc.I b/panda/src/physx/physxSceneDesc.I deleted file mode 100644 index c5134fa6f0..0000000000 --- a/panda/src/physx/physxSceneDesc.I +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSceneDesc.I - * @author enn0x - * @date 2009-09-05 - */ - -/** - * - */ -INLINE PhysxSceneDesc:: -PhysxSceneDesc() { - -} - -/** - * - */ -INLINE PhysxSceneDesc:: -~PhysxSceneDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxSceneDesc:: -set_to_default() { - - _desc.setToDefault(); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxSceneDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxSceneDesc.cxx b/panda/src/physx/physxSceneDesc.cxx deleted file mode 100644 index a7ebd6c63b..0000000000 --- a/panda/src/physx/physxSceneDesc.cxx +++ /dev/null @@ -1,218 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSceneDesc.cxx - * @author enn0x - * @date 2009-09-05 - */ - -#include "physxSceneDesc.h" -#include "physxManager.h" -#include "physxBounds3.h" - -/** - * Sets the gravity vector. - */ -void PhysxSceneDesc:: -set_gravity(const LVector3f &gravity) { - - nassertv_always(!gravity.is_nan()); - _desc.gravity = PhysxManager::vec3_to_nxVec3(gravity); -} - -/** - * Get the gravity vector. - */ -LVector3f PhysxSceneDesc:: -get_gravity() const { - - return PhysxManager::nxVec3_to_vec3(_desc.gravity); -} - -/** - * Raise or lower individual scene flags. - */ -void PhysxSceneDesc:: -set_flag(const PhysxSceneFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Returns the specified scene flag. - */ -bool PhysxSceneDesc:: -get_flag(const PhysxSceneFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * Set the max scene bounds. - * - * If scene bounds are provided (maxBounds in the descriptor), the SDK takes - * advantage of this information to accelerate scene-level collision queries - * (e.g. raycasting). When using maxBounds, you have to make sure created - * objects stay within the scene bounds. In particular, the position of - * dynamic shapes should stay within the provided bounds. Otherwise the - * shapes outside the bounds will not be taken into account by all scene - * queries (raycasting, sweep tests, overlap tests, etc). They will - * nonetheless still work correctly for the main physics simulation. - */ -void PhysxSceneDesc:: -set_max_bounds(PhysxBounds3 &bounds) { - - _desc.maxBounds = &(bounds._bounds); -} - -/** - * - */ -PhysxBounds3 PhysxSceneDesc:: -get_max_bounds() const { - assert(false /* Not implemented */); - - // PhysxBounds3 value; value._bounds = *(_desc.maxBounds); return value; - return PhysxBounds3(); -} - -/** - * Defines the structure used to store static objects. - */ -void PhysxSceneDesc:: -set_static_structure(PhysxPruningStructure value) { - - _desc.staticStructure = (NxPruningStructure)value; -} - -/** - * Defines the subdivision level for acceleration structures used for scene - * queries. This is only used when maxBounds are defined! - */ -void PhysxSceneDesc:: -set_dynamic_structure(PhysxPruningStructure value) { - - _desc.dynamicStructure = (NxPruningStructure)value; -} - -/** - * Returns the structure used to store static objects. - */ -PhysxEnums::PhysxPruningStructure PhysxSceneDesc:: -get_static_structure() const { - - return (PhysxPruningStructure)_desc.staticStructure; -} - -/** - * Returns the subdivision level for acceleration structures used for scene - * queries. - */ -PhysxEnums::PhysxPruningStructure PhysxSceneDesc:: -get_dynamic_structure() const { - - return (PhysxPruningStructure)_desc.dynamicStructure; -} - -/** - * Defines the subdivision level for acceleration structures used for scene - * queries. This is only used when maxBounds are defined! - */ -void PhysxSceneDesc:: -set_subdivision_level(unsigned int value) { - - _desc.subdivisionLevel = (NxU32)value; -} - -/** - * Defines the number of broadphase cells along the grid x-axis. Must be - * power of two. Max is 8 at the moment. The broadphase type must be set to - * BPT_sap_multi for this parameter to have an effect. - */ -void PhysxSceneDesc:: -set_num_grid_cells_x(unsigned int value) { - - _desc.nbGridCellsX = (NxU32)value; -} - -/** - * Defines the number of broadphase cells along the grid y-axis. Must be - * power of two. Max is 8 at the moment. The broadphase type must be set to - * BPT_sap_multi for this parameter to have an effect. - */ -void PhysxSceneDesc:: -set_num_grid_cells_y(unsigned int value) { - - _desc.nbGridCellsY = (NxU32)value; -} - -/** - * Returns the subdivision level for acceleration structures used for scene - * queries. - */ -unsigned int PhysxSceneDesc:: -get_subdivision_level() const { - - return _desc.subdivisionLevel; -} - -/** - * Returns the number of broadphase cells along the grid x-axis. - */ -unsigned int PhysxSceneDesc:: -get_num_grid_cells_x() const { - - return _desc.nbGridCellsX; -} - -/** - * Returns the number of broadphase cells along the grid y-axis. - */ -unsigned int PhysxSceneDesc:: -get_num_grid_cells_y() const { - - return _desc.nbGridCellsY; -} - -/** - * Defines which type of broadphase to use. - * - * (1) BPT_sap_single: A sweep-and-prune (SAP) algorithm to find pairs of - * potentially colliding shapes. - * - * (2) BPT_sap_multi: A multi sweep-and-prune algorithm to find pairs of - * potentially colliding shapes. Uses a configurable 2D grid to divide the - * scene space into cells. The potentially overlapping shape pairs are - * detected in each cell and the information is merged together. This - * approach is usually faster than BPT_sap_single in scenarios with many - * shapes and a high creation/deletion rate of shapes. However, the amount of - * memory required is considerably higher depending on the number of grid - * cells used. The following extra parameters need to be defined: - - * PhysxSceneDesc.set_max_bounds - PhysxSceneDesc.set_num_grid_cells_x - - * PhysxSceneDesc.set_num_grid_cells_y (the scene up direction is set via - * config options) - */ -void PhysxSceneDesc:: -set_bp_type(PhysxBroadPhaseType value) { - - _desc.bpType = (NxBroadPhaseType)value; -} - -/** - * Returns the type of broadphase to use. - */ -PhysxEnums::PhysxBroadPhaseType PhysxSceneDesc:: -get_bp_type() const { - - return (PhysxBroadPhaseType)_desc.bpType; -} diff --git a/panda/src/physx/physxSceneDesc.h b/panda/src/physx/physxSceneDesc.h deleted file mode 100644 index 3370af5290..0000000000 --- a/panda/src/physx/physxSceneDesc.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSceneDesc.h - * @author enn0x - * @date 2009-09-05 - */ - -#ifndef PHYSXSCENEDESC_H -#define PHYSXSCENEDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxBounds3; - -/** - * Descriptor for PhysxScene. - */ -class EXPCL_PANDAPHYSX PhysxSceneDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxSceneDesc(); - INLINE ~PhysxSceneDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_flag(PhysxSceneFlag flag, bool value); - void set_gravity(const LVector3f &gravity); - void set_max_bounds(PhysxBounds3 &bounds); - void set_static_structure(PhysxPruningStructure value); - void set_dynamic_structure(PhysxPruningStructure value); - void set_bp_type(PhysxBroadPhaseType value); - void set_subdivision_level(unsigned int value); - void set_num_grid_cells_x(unsigned int value); - void set_num_grid_cells_y(unsigned int value); - - bool get_flag(PhysxSceneFlag flag) const; - LVector3f get_gravity() const; - PhysxBounds3 get_max_bounds() const; - PhysxPruningStructure get_static_structure() const; - PhysxPruningStructure get_dynamic_structure() const; - PhysxBroadPhaseType get_bp_type() const; - unsigned int get_subdivision_level() const; - unsigned int get_num_grid_cells_x() const; - unsigned int get_num_grid_cells_y() const; - -public: - NxSceneDesc _desc; -}; - -#include "physxSceneDesc.I" - -#endif // PHYSXSCENEDESC_H diff --git a/panda/src/physx/physxSceneStats2.I b/panda/src/physx/physxSceneStats2.I deleted file mode 100644 index e5d64f6d03..0000000000 --- a/panda/src/physx/physxSceneStats2.I +++ /dev/null @@ -1,61 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSceneStats2.I - * @author enn0x - * @date 2009-10-20 - */ - -/** - * - */ -INLINE unsigned int PhysxSceneStats2:: -get_num_stats() const { - - return _ptr->numStats; -} - -/** - * - */ -INLINE int PhysxSceneStats2:: -get_cur_value(unsigned int index) const { - - nassertr(index < _ptr->numStats, -1); - return _ptr->stats[index].curValue; -} - -/** - * - */ -INLINE int PhysxSceneStats2:: -get_max_value(unsigned int index) const { - - nassertr(index < _ptr->numStats, -1); - return _ptr->stats[index].maxValue; -} - -/** - * - */ -INLINE const char * PhysxSceneStats2:: -get_name(unsigned int index) const { - - nassertr(index < _ptr->numStats, ""); - return _ptr->stats[index].name; -} - -/** - * - */ -INLINE unsigned int PhysxSceneStats2:: -get_parent(unsigned int index) const { - - nassertr(index < _ptr->numStats, 0); - return _ptr->stats[index].parent; -} diff --git a/panda/src/physx/physxSceneStats2.cxx b/panda/src/physx/physxSceneStats2.cxx deleted file mode 100644 index 278c97209b..0000000000 --- a/panda/src/physx/physxSceneStats2.cxx +++ /dev/null @@ -1,31 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSceneStats2.cxx - * @author enn0x - * @date 2009-10-20 - */ - -#include "physxSceneStats2.h" - -/** - * - */ -PhysxSceneStats2:: -PhysxSceneStats2(const NxSceneStats2 *ptr) { - - _ptr = ptr; -} - -/** - * - */ -PhysxSceneStats2:: -~PhysxSceneStats2() { - -} diff --git a/panda/src/physx/physxSceneStats2.h b/panda/src/physx/physxSceneStats2.h deleted file mode 100644 index 1830b136e2..0000000000 --- a/panda/src/physx/physxSceneStats2.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSceneStats2.h - * @author enn0x - * @date 2009-10-20 - */ - -#ifndef PHYSXSCENESTATS2_H -#define PHYSXSCENESTATS2_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxSceneStats2 { - -PUBLISHED: - PhysxSceneStats2(const NxSceneStats2 *ptr); - ~PhysxSceneStats2(); - - INLINE unsigned int get_num_stats() const; - INLINE int get_cur_value(unsigned int index) const; - INLINE int get_max_value(unsigned int index) const; - INLINE const char *get_name(unsigned int index) const; - INLINE unsigned int get_parent(unsigned int index) const; - -private: - const NxSceneStats2 *_ptr; -}; - -#include "physxSceneStats2.I" - -#endif // PHYSXSCENESTATS2_H diff --git a/panda/src/physx/physxSegment.I b/panda/src/physx/physxSegment.I deleted file mode 100644 index ea2da6e716..0000000000 --- a/panda/src/physx/physxSegment.I +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSegment.I - * @author enn0x - * @date 2009-10-31 - */ - -/** - * - */ -INLINE PhysxSegment:: -PhysxSegment() { - -} - -/** - * - */ -INLINE PhysxSegment:: -PhysxSegment(const PhysxSegment &segment) { - - _segment = segment._segment; -} - -/** - * - */ -INLINE PhysxSegment:: -~PhysxSegment() { - -} diff --git a/panda/src/physx/physxSegment.cxx b/panda/src/physx/physxSegment.cxx deleted file mode 100644 index f432711d9c..0000000000 --- a/panda/src/physx/physxSegment.cxx +++ /dev/null @@ -1,133 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSegment.cxx - * @author enn0x - * @date 2009-10-31 - */ - -#include "physxSegment.h" -#include "physxManager.h" - -/** - * - */ -PhysxSegment:: -PhysxSegment(const LPoint3f &p0, const LPoint3f &p1) { - - _segment.p0 = PhysxManager::point3_to_nxVec3(p0); - _segment.p1 = PhysxManager::point3_to_nxVec3(p1); -} - -/** - * Returns the start point of the segment. - */ -LPoint3f PhysxSegment:: -get_p0() const { - - return PhysxManager::nxVec3_to_vec3(_segment.p0); -} - -/** - * Sets the start point of the segment. - */ -void PhysxSegment:: -set_p0(LPoint3f p) { - - nassertv_always(!p.is_nan()); - - _segment.p0 = PhysxManager::vec3_to_nxVec3(p); -} - -/** - * Returns the end point of the segment. - */ -LPoint3f PhysxSegment:: -get_p1() const { - - return PhysxManager::nxVec3_to_vec3(_segment.p1); -} - -/** - * Sets the end point of the segment. - */ -void PhysxSegment:: -set_p1(LPoint3f p) { - - nassertv_always(!p.is_nan()); - - _segment.p1 = PhysxManager::vec3_to_nxVec3(p); -} - -/** - * Returns the start point of the segment. - */ -LPoint3f PhysxSegment:: -get_origin() const { - - return PhysxManager::nxVec3_to_point3(_segment.getOrigin()); -} - -/** - * Returns the direction vector from the segment's start point to it's end - * point. - */ -void PhysxSegment:: -compute_direction(LPoint3f &dir) const { - - nassertv(!dir.is_nan()); - - NxVec3 nDir = PhysxManager::point3_to_nxVec3(dir); - _segment.computeDirection(nDir); - PhysxManager::update_point3_from_nxVec3(dir, nDir); -} - -/** - * Returns the distance from the segment's start point to it's end point. - */ -float PhysxSegment:: -compute_length() const { - - return _segment.computeLength(); -} - -/** - * Computes a point on the segment. - */ -void PhysxSegment:: -compute_point(LPoint3f &p, float t) const { - - nassertv(!p.is_nan()); - - NxVec3 nP = PhysxManager::point3_to_nxVec3(p); - _segment.computePoint(nP, t); - PhysxManager::update_point3_from_nxVec3(p, nP); -} - -/** - * Returns the square distance from the segment's start point to it's end - * point. - */ -float PhysxSegment:: -compute_square_length() const { - - return _segment.computeSquareLength(); -} - -/** - * Setup this segment from origin (start point) and direction vector. - */ -void PhysxSegment:: -set_origin_direction(const LPoint3f &origin, const LVector3f &direction) { - - nassertv_always(!origin.is_nan()); - nassertv_always(!direction.is_nan()); - - _segment.setOriginDirection(PhysxManager::point3_to_nxVec3(origin), - PhysxManager::vec3_to_nxVec3(direction)); -} diff --git a/panda/src/physx/physxSegment.h b/panda/src/physx/physxSegment.h deleted file mode 100644 index 14633b7030..0000000000 --- a/panda/src/physx/physxSegment.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSegment.h - * @author enn0x - * @date 2009-10-31 - */ - -#ifndef PHYSXSEGMENT_H -#define PHYSXSEGMENT_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -/** - * Represents a line segment. - */ -class EXPCL_PANDAPHYSX PhysxSegment { - -PUBLISHED: - INLINE PhysxSegment(); - INLINE PhysxSegment(const PhysxSegment & segment); - PhysxSegment(const LPoint3f &p0, const LPoint3f &p1); - INLINE ~PhysxSegment(); - - void compute_direction(LPoint3f &dir) const; - float compute_length() const; - void compute_point(LPoint3f &p, float t) const; - float compute_square_length() const; - LPoint3f get_origin() const; - void set_origin_direction(const LPoint3f &origin, const LVector3f &direction); - - LPoint3f get_p0() const; - LPoint3f get_p1() const; - - void set_p0(LPoint3f p); - void set_p1(LPoint3f p); - -public: - NxSegment _segment; -}; - -#include "physxSegment.I" - -#endif // PHYSSEGMENT_H diff --git a/panda/src/physx/physxShape.I b/panda/src/physx/physxShape.I deleted file mode 100644 index 110613ba2a..0000000000 --- a/panda/src/physx/physxShape.I +++ /dev/null @@ -1,40 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxShape.I - * @author enn0x - * @date 2009-09-16 - */ - -/** - * - */ -INLINE PhysxShape:: -PhysxShape() : PhysxObject() { - -} - -/** - * - */ -INLINE void PhysxShape:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxShape:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxShape.cxx b/panda/src/physx/physxShape.cxx deleted file mode 100644 index 0518f81d12..0000000000 --- a/panda/src/physx/physxShape.cxx +++ /dev/null @@ -1,412 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxShape.cxx - * @author enn0x - * @date 2009-09-16 - */ - -#include "physxShape.h" -#include "physxManager.h" -#include "physxActor.h" -#include "physxBoxShape.h" -#include "physxCapsuleShape.h" -#include "physxPlaneShape.h" -#include "physxSphereShape.h" -#include "physxConvexShape.h" -#include "physxHeightFieldShape.h" -#include "physxTriangleMeshShape.h" -#include "physxWheelShape.h" -#include "physxGroupsMask.h" -#include "physxBounds3.h" -#include "physxSphere.h" -#include "physxBox.h" -#include "physxCapsule.h" -#include "physxRay.h" -#include "physxRaycastHit.h" -#include "physxCcdSkeleton.h" - -TypeHandle PhysxShape::_type_handle; - -/** - * - */ -void PhysxShape:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - ptr()->getActor().releaseShape(*ptr()); -} - -/** - * - */ -PhysxShape *PhysxShape:: -factory(NxShapeType shapeType) { - - switch (shapeType) { - - case NX_SHAPE_PLANE: - return new PhysxPlaneShape(); - - case NX_SHAPE_SPHERE: - return new PhysxSphereShape(); - - case NX_SHAPE_BOX: - return new PhysxBoxShape(); - - case NX_SHAPE_CAPSULE: - return new PhysxCapsuleShape(); - - case NX_SHAPE_CONVEX: - return new PhysxConvexShape(); - - case NX_SHAPE_MESH: - return new PhysxTriangleMeshShape(); - - case NX_SHAPE_HEIGHTFIELD: - return new PhysxHeightFieldShape(); - - case NX_SHAPE_WHEEL: - return new PhysxWheelShape(); - } - - physx_cat.error() << "Unknown shape type.\n"; - return nullptr; -} - -/** - * Retrieves the actor which this shape is associated with. - */ -PhysxActor *PhysxShape:: -get_actor() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxActor *)(ptr()->getActor().userData); -} - -/** - * Sets a name string for this object. The name can be retrieved again with - * get_name(). This is for debugging and is not used by the physics engine. - */ -void PhysxShape:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - ptr()->setName(_name.c_str()); -} - -/** - * Returns the name string. - */ -const char *PhysxShape:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return ptr()->getName(); -} - -/** - * Sets the specified shape flag. - * - * The shape may be turned into a trigger by setting one or more of the - * TriggerFlags to true. A trigger shape will not collide with other shapes. - * Instead, if a shape enters the trigger's volume, a trigger event will be - * sent. Trigger events can be listened to by DirectObjects. - * - * The following trigger events can be sent: - physx-trigger-enter - physx- - * trigger-stay - physx-trigger-leave - */ -void PhysxShape:: -set_flag(PhysxShapeFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - - ptr()->setFlag((NxShapeFlag)flag, value); -} - -/** - * Returns the specified shape flag. - */ -bool PhysxShape:: -get_flag(PhysxShapeFlag flag) const { - - nassertr(_error_type == ET_ok, false); - - return (ptr()->getFlag((NxShapeFlag)flag)) ? true : false; -} - -/** - * Sets the skin width. The skin width must be non-negative. - */ -void PhysxShape:: -set_skin_width(float skinWidth) { - - nassertv(_error_type == ET_ok); - nassertv(skinWidth >= 0.0f); - - ptr()->setSkinWidth(skinWidth); -} - -/** - * Returns the skin width. - */ -float PhysxShape:: -get_skin_width() const { - - nassertr(_error_type == ET_ok, 0.0f); - - return ptr()->getSkinWidth(); -} - -/** - * Sets which collision group this shape is part of. - * - * Default group is 0. Maximum possible group is 31. Collision groups are sets - * of shapes which may or may not be set to collision detect with each other; - * this can be set using PhysxScene::set_group_collision_flag(). - */ -void PhysxShape:: -set_group(unsigned short group) { - - nassertv(_error_type == ET_ok); - nassertv(group < 32); - - ptr()->setGroup(group); -} - -/** - * Retrieves the collision group set for this shape. The collision group is - * an integer between 0 and 31. - */ -unsigned short PhysxShape:: -get_group() const { - - nassertr(_error_type == ET_ok, 0); - - return ptr()->getGroup(); -} - -/** - * Set the position of the shape in actor space, i.e. relative to the actor - * it is owned by. - * - * Calling this method does NOT wake the associated actor up automatically. - * - * Calling this method does not automatically update the inertia properties of - * the owning actor (if applicable); use PhysxActor::update_mass_from_shapes() - * to do this. - */ -void PhysxShape:: -set_local_pos(const LPoint3f &pos) { - - nassertv(_error_type == ET_ok); - - ptr()->setLocalPosition(PhysxManager::point3_to_nxVec3(pos)); -} - -/** - * Retrieve the position of the shape in actor space, i.e. relative to the - * actor it is owned by. - */ -LPoint3f PhysxShape:: -get_local_pos() const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - - return PhysxManager::nxVec3_to_point3(ptr()->getLocalPosition()); -} - -/** - * Set the transform of the shape in actor space, i.e. relative to the actor - * it is owned by. - * - * Calling this method does NOT wake the associated actor up automatically. - * - * Calling this method does not automatically update the inertia properties of - * the owning actor (if applicable); use PhysxActor::update_mass_from_shapes() - * to do this. - */ -void PhysxShape:: -set_local_mat(const LMatrix4f &mat) { - - nassertv(_error_type == ET_ok); - - ptr()->setLocalPose(PhysxManager::mat4_to_nxMat34(mat)); -} - -/** - * Retrieve the transform of the shape in actor space, i.e. relative to the - * actor it is owned by. - */ -LMatrix4f PhysxShape:: -get_local_mat() const { - - nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat()); - - return PhysxManager::nxMat34_to_mat4(ptr()->getLocalPose()); -} - -/** - * Returns the material index currently assigned to the shape. - */ -unsigned short PhysxShape:: -get_material_index() const { - - nassertr(_error_type == ET_ok, 0); - NxMaterialIndex index = ptr()->getMaterial(); - return (unsigned int)index; -} - -/** - * Assigns a material to the shape. - */ -void PhysxShape:: -set_material(const PhysxMaterial &material) { - - nassertv(_error_type == ET_ok); - ptr()->setMaterial(material.ptr()->getMaterialIndex()); -} - -/** - * Assigns a material index to the shape. - * - * The material index can be retrieved by calling - * PhysxMaterial::get_material_index(). If the material index is invalid, it - * will still be recorded, but the default material (at index 0) will - * effectively be used for simulation. - */ -void PhysxShape:: -set_material_index(unsigned short index) { - - nassertv(_error_type == ET_ok); - ptr()->setMaterial((NxMaterialIndex)index); -} - -/** - * Sets 128-bit mask used for collision filtering. Does NOT wake the - * associated actor up automatically. - */ -void PhysxShape:: -set_groups_mask(const PhysxGroupsMask &mask) { - - nassertv(_error_type == ET_ok); - ptr()->setGroupsMask(mask.get_mask()); -} - -/** - * Gets 128-bit mask used for collision filtering. - */ -PhysxGroupsMask PhysxShape:: -get_groups_mask() const { - - PhysxGroupsMask mask; - nassertr(_error_type == ET_ok, mask); - mask.set_mask(ptr()->getGroupsMask()); - return mask; -} - -/** - * Returns a world space AABB enclosing this shape. - */ -PhysxBounds3 PhysxShape:: -get_world_bounds() const { - - PhysxBounds3 bounds; - nassertr(_error_type == ET_ok, bounds); - ptr()->getWorldBounds(bounds._bounds); - return bounds; -} - -/** - * Checks whether the shape overlaps a world-space AABB or not. - */ -bool PhysxShape:: -check_overlap_aabb(const PhysxBounds3 &world_bounds) const { - - nassertr(_error_type == ET_ok, false); - return ptr()->checkOverlapAABB(world_bounds._bounds); -} - -/** - * Checks whether the shape overlaps a world-space capsule or not. - */ -bool PhysxShape:: -check_overlap_capsule(const PhysxCapsule &world_capsule) const { - - nassertr(_error_type == ET_ok, false); - return ptr()->checkOverlapCapsule(world_capsule._capsule); -} - -/** - * Checks whether the shape overlaps a world-space OBB or not. - */ -bool PhysxShape:: -check_overlap_obb(const PhysxBox &world_box) const { - - nassertr(_error_type == ET_ok, false); - return ptr()->checkOverlapOBB(world_box._box); -} - -/** - * Checks whether the shape overlaps a world-space sphere or not. - */ -bool PhysxShape:: -check_overlap_sphere(const PhysxSphere &world_sphere) const { - - nassertr(_error_type == ET_ok, false); - return ptr()->checkOverlapSphere(world_sphere._sphere); -} - -/** - * - */ -PhysxRaycastHit PhysxShape:: -raycast(const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const { - - NxRaycastHit hit; - nassertr(_error_type == ET_ok, hit); - - NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE; - if (smoothNormal == true) { - hints |= NX_RAYCAST_NORMAL; - } - else { - hints |= NX_RAYCAST_FACE_NORMAL; - } - - ptr()->raycast(worldRay._ray, worldRay._length, hints, hit, firstHit); - return PhysxRaycastHit(hit); -} - -/** - * - */ -void PhysxShape:: -set_ccd_skeleton(PhysxCcdSkeleton *skel) { - - nassertv(_error_type == ET_ok); - - ptr()->setCCDSkeleton(skel->ptr()); - _skel = skel; -} - -/** - * - */ -PhysxCcdSkeleton *PhysxShape:: -get_ccd_skeleton() const { - - nassertr(_error_type == ET_ok, nullptr); - - return _skel; -} diff --git a/panda/src/physx/physxShape.h b/panda/src/physx/physxShape.h deleted file mode 100644 index fbfe01d988..0000000000 --- a/panda/src/physx/physxShape.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxShape.h - * @author enn0x - * @date 2009-09-16 - */ - -#ifndef PHYSXSHAPE_H -#define PHYSXSHAPE_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxActor; -class PhysxMaterial; -class PhysxGroupsMask; -class PhysxBounds3; -class PhysxSphere; -class PhysxBox; -class PhysxCapsule; -class PhysxRay; -class PhysxRaycastHit; -class PhysxCcdSkeleton; - -/** - * Abstract base class for shapes. - */ -class EXPCL_PANDAPHYSX PhysxShape : public PhysxObject, public PhysxEnums { - -PUBLISHED: - void release(); - - PhysxActor *get_actor() const; - - void set_name(const char *name); - void set_flag(const PhysxShapeFlag flag, bool value); - void set_skin_width(float skinWidth); - void set_group(unsigned short group); - void set_local_pos(const LPoint3f &pos); - void set_local_mat(const LMatrix4f &mat); - void set_material(const PhysxMaterial &material); - void set_material_index(unsigned short idx); - void set_groups_mask(const PhysxGroupsMask &mask); - void set_ccd_skeleton(PhysxCcdSkeleton *skel); - - const char *get_name() const; - bool get_flag(const PhysxShapeFlag flag) const; - float get_skin_width() const; - unsigned short get_group() const; - LPoint3f get_local_pos() const; - LMatrix4f get_local_mat() const; - unsigned short get_material_index() const; - PhysxGroupsMask get_groups_mask() const; - PhysxBounds3 get_world_bounds() const; - PhysxCcdSkeleton *get_ccd_skeleton() const; - - bool check_overlap_aabb(const PhysxBounds3 &world_bounds) const; - bool check_overlap_capsule(const PhysxCapsule &world_capsule) const; - bool check_overlap_obb(const PhysxBox &world_box) const; - bool check_overlap_sphere(const PhysxSphere &world_sphere) const; - PhysxRaycastHit raycast(const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - static PhysxShape *factory(NxShapeType shapeType); - - virtual NxShape *ptr() const = 0; - - virtual void link(NxShape *shapePtr) = 0; - virtual void unlink() = 0; - -protected: - INLINE PhysxShape(); - -private: - std::string _name; - PT(PhysxCcdSkeleton) _skel; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxShape", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxShape.I" - -#endif // PHYSXSHAPE_H diff --git a/panda/src/physx/physxShapeDesc.I b/panda/src/physx/physxShapeDesc.I deleted file mode 100644 index e16895bb26..0000000000 --- a/panda/src/physx/physxShapeDesc.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxShapeDesc.I - * @author enn0x - * @date 2009-09-08 - */ - -/** - * - */ -INLINE PhysxShapeDesc:: -PhysxShapeDesc() { - -} - -/** - * - */ -INLINE PhysxShapeDesc:: -~PhysxShapeDesc() { - -} diff --git a/panda/src/physx/physxShapeDesc.cxx b/panda/src/physx/physxShapeDesc.cxx deleted file mode 100644 index 2929f00692..0000000000 --- a/panda/src/physx/physxShapeDesc.cxx +++ /dev/null @@ -1,249 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxShapeDesc.cxx - * @author enn0x - * @date 2009-09-08 - */ - -#include "physxShapeDesc.h" -#include "physxManager.h" -#include "physxMaterial.h" - -/** - * Sets a possible debug name. - */ -void PhysxShapeDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - ptr()->name = _name.c_str(); -} - -/** - * This shape will become a trigger shape if this parameter is set to TRUE. It - * won't take part in collisions, but trigger events if some other shape - * passes through it. - */ -void PhysxShapeDesc:: -set_trigger(bool value) { - - if (value == true) { - ptr()->shapeFlags |= NX_TRIGGER_ENABLE; - } - else { - ptr()->shapeFlags &= ~(NX_TRIGGER_ENABLE); - } -} - -/** - * - */ -void PhysxShapeDesc:: -set_local_pos(const LPoint3f &pos) { - - nassertv(!pos.is_nan()); - ptr()->localPose.t = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * - */ -void PhysxShapeDesc:: -set_local_mat(const LMatrix4f &mat) { - - nassertv(!mat.is_nan()); - ptr()->localPose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * - */ -void PhysxShapeDesc:: -set_local_hpr(float h, float p, float r) { - - LQuaternionf q; - LMatrix3f rot; - NxMat34 m; - - q.set_hpr(LVector3f(h, p, r)); - q.extract_to_matrix(rot); - - ptr()->localPose.M = PhysxManager::mat3_to_nxMat33(rot); -} - -/** - * Specifies by how much shapes can interpenetrate. - * - * Two shapes will interpenetrate by the sum of their skin widths. This means - * that their graphical representations should be adjusted so that they just - * touch when the shapes are interpenetrating. - * - * The default skin width is the 'physx-skin-width' parameter. - * - * A skin width sum of zero for two bodies is not permitted because it will - * lead to an unstable simulation. - * - * If your simulation jitters because resting bodies occasionally lose - * contact, increasing the size of your collision volumes and the skin width - * may improve things. - */ -void PhysxShapeDesc:: -set_skin_width(float skinWidth) { - - nassertv(skinWidth >= 0.0f); - ptr()->skinWidth = skinWidth; -} - -/** - * - */ -void PhysxShapeDesc:: -set_shape_flag(const PhysxShapeFlag flag, bool value) { - - if (value == true) { - ptr()->shapeFlags |= flag; - } - else { - ptr()->shapeFlags &= ~(flag); - } -} - -/** - * Sets the mass of this individual shape when computing mass inertial - * properties for a rigidbody. When mass<=0.0 then density and volume - * determine the mass. Note that this will only be used if the body has a - * zero inertia tensor, or if you call PhysxActor::update_mass_from_shapes - * explicitly. - */ -void PhysxShapeDesc:: -set_mass(float mass) { - - ptr()->mass = mass; -} - -/** - * Sets the density of this individual shape when computing mass inertial - * properties for a rigidbody (unless a valid mass >0.0 is provided). Note - * that this will only be used if the body has a zero inertia tensor, or if - * you call PhysxActor::update_mass_from_shapes explicitly. - */ -void PhysxShapeDesc:: -set_density(float density) { - - nassertv(density > 0.0f); - ptr()->density = density; -} - -/** - * - */ -void PhysxShapeDesc:: -set_group(unsigned short group) { - - ptr()->group = group; -} - -/** - * - */ -const char *PhysxShapeDesc:: -get_name() const { - - return ptr()->name; -} - -/** - * - */ -LPoint3f PhysxShapeDesc:: -get_local_pos() const { - - return PhysxManager::nxVec3_to_point3(ptr()->localPose.t); -} - -/** - * - */ -LMatrix4f PhysxShapeDesc:: -get_local_mat() const { - - return PhysxManager::nxMat34_to_mat4(ptr()->localPose); -} - -/** - * - */ -float PhysxShapeDesc:: -get_skin_width() const { - - return ptr()->skinWidth; -} - -/** - * - */ -bool PhysxShapeDesc:: -get_shape_flag(const PhysxShapeFlag flag) const { - - return (ptr()->shapeFlags & flag) ? true : false; -} - -/** - * - */ -float PhysxShapeDesc:: -get_mass() const { - - return ptr()->mass; -} - -/** - * - */ -float PhysxShapeDesc:: -get_density() const { - - return ptr()->density; -} - -/** - * - */ -unsigned short PhysxShapeDesc:: -get_group() const { - - return ptr()->group; -} - -/** - * - */ -void PhysxShapeDesc:: -set_material(const PhysxMaterial &material) { - - ptr()->materialIndex = material.ptr()->getMaterialIndex(); -} - -/** - * - */ -void PhysxShapeDesc:: -set_material_index(unsigned short index) { - - ptr()->materialIndex = index; -} - -/** - * - */ -unsigned short PhysxShapeDesc:: -get_material_index() const { - - return ptr()->materialIndex; -} diff --git a/panda/src/physx/physxShapeDesc.h b/panda/src/physx/physxShapeDesc.h deleted file mode 100644 index 0ef063fe22..0000000000 --- a/panda/src/physx/physxShapeDesc.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxShapeDesc.h - * @author enn0x - * @date 2009-09-08 - */ - -#ifndef PHYSXSHAPEDESC_H -#define PHYSXSHAPEDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxMaterial; - -/** - * Abstract base class for shape descriptors. Descriptors for all the - * different shape types are derived from this class. - */ -class EXPCL_PANDAPHYSX PhysxShapeDesc : public PhysxEnums, public ReferenceCount { - -PUBLISHED: - virtual void set_to_default() = 0; - virtual bool is_valid() const = 0; - - void set_name(const char *name); - void set_trigger(bool value); - void set_local_pos(const LPoint3f &pos); - void set_local_mat(const LMatrix4f &mat); - void set_local_hpr(float h, float p, float r); - void set_skin_width(float skinWidth); - void set_shape_flag(const PhysxShapeFlag flag, bool value); - void set_mass(float mass); - void set_density(float density); - void set_group(unsigned short group); - void set_material(const PhysxMaterial &material); - void set_material_index(unsigned short index); - - const char *get_name() const; - LPoint3f get_local_pos() const; - LMatrix4f get_local_mat() const; - float get_skin_width() const; - bool get_shape_flag(const PhysxShapeFlag flag) const; - float get_mass() const; - float get_density() const; - unsigned short get_group() const; - unsigned short get_material_index() const; - -public: - virtual NxShapeDesc *ptr() const = 0; - -private: - std::string _name; - -protected: - INLINE PhysxShapeDesc(); - INLINE ~PhysxShapeDesc(); -}; - -#include "physxShapeDesc.I" - -#endif // PHYSXSHAPEDESC_H diff --git a/panda/src/physx/physxSoftBody.I b/panda/src/physx/physxSoftBody.I deleted file mode 100644 index cba8af0499..0000000000 --- a/panda/src/physx/physxSoftBody.I +++ /dev/null @@ -1,54 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBody.I - * @author enn0x - * @date 2010-09-13 - */ - -/** - * - */ -INLINE PhysxSoftBody:: -PhysxSoftBody() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxSoftBody:: -~PhysxSoftBody() { - -} - -/** - * - */ -INLINE void PhysxSoftBody:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxSoftBody:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " " << _name - << " (at 0x" << this << ")"; - - if (_node) { - out << " N:0x" << _node; - } - - out << "\n"; -} diff --git a/panda/src/physx/physxSoftBody.cxx b/panda/src/physx/physxSoftBody.cxx deleted file mode 100644 index 1e5ed73685..0000000000 --- a/panda/src/physx/physxSoftBody.cxx +++ /dev/null @@ -1,785 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBody.cxx - * @author enn0x - * @date 2010-09-13 - */ - -#include "physxSoftBody.h" -#include "physxSoftBodyDesc.h" -#include "physxSoftBodyNode.h" -#include "physxScene.h" -#include "physxGroupsMask.h" - -#include "boundingBox.h" - -TypeHandle PhysxSoftBody::_type_handle; - -/** - * - */ -void PhysxSoftBody:: -link(NxSoftBody *softbodyPtr) { - - // Link self - _ptr = softbodyPtr; - _error_type = ET_ok; - _ptr->userData = this; - - set_name(softbodyPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_softbodies.add(this); -} - -/** - * - */ -void PhysxSoftBody:: -unlink() { - - // Unlink self - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_softbodies.remove(this); - - _node = nullptr; -} - -/** - * - */ -void PhysxSoftBody:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - _ptr->getScene().releaseSoftBody(*_ptr); - _ptr = nullptr; -} - -/** - * - */ -void PhysxSoftBody:: -update() { - - if (_node) { - - // Update node mesh data - _node->update(); - - // Update node bounding volume - NxBounds3 bounds; - _ptr->getWorldBounds(bounds); - - BoundingBox bb(PhysxManager::nxVec3_to_point3(bounds.min), - PhysxManager::nxVec3_to_point3(bounds.max)); - _node->set_bounds(&bb); - } -} - -/** - * Returns the scene which this soft body belongs to. - */ -PhysxScene *PhysxSoftBody:: -get_scene() const { - - nassertr(_error_type == ET_ok, nullptr); - return (PhysxScene *)_ptr->getScene().userData; -} - -/** - * - */ -PhysxSoftBodyNode *PhysxSoftBody:: -get_soft_body_node() const { - - nassertr(_error_type == ET_ok, nullptr); - return _node; -} - -/** - * - */ -PhysxSoftBodyNode *PhysxSoftBody:: -create_soft_body_node(const char *name) { - - nassertr(_error_type == ET_ok, nullptr); - - _node = new PhysxSoftBodyNode(name); - _node->allocate(this); - - return _node; -} - -/** - * Sets a name string for the object that can be retrieved with get_name(). - * This is for debugging and is not used by the engine. - */ -void PhysxSoftBody:: -set_name(const char *name) { - - nassertv(_error_type == ET_ok); - - _name = name ? name : ""; - _ptr->setName(_name.c_str()); -} - -/** - * Retrieves the name string. - */ -const char *PhysxSoftBody:: -get_name() const { - - nassertr(_error_type == ET_ok, ""); - return _ptr->getName(); -} - -/** - * Sets which collision group this soft body is part of. Collision group must - * be between 0 and 31. - */ -void PhysxSoftBody:: -set_group(unsigned int group) { - - nassertv(_error_type == ET_ok); - nassertv(group >= 0 && group < 32); - _ptr->setGroup(group); -} - -/** - * Retrieves the collision group this soft body is part of. - */ -unsigned int PhysxSoftBody:: -get_group() const { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getGroup(); -} - -/** - * Sets 128-bit mask used for collision filtering. - */ -void PhysxSoftBody:: -set_groups_mask(const PhysxGroupsMask &mask) { - - nassertv(_error_type == ET_ok); - - NxGroupsMask _mask = mask.get_mask(); - _ptr->setGroupsMask(_mask); -} - -/** - * Gets the 128-bit groups mask used for collision filtering. - */ -PhysxGroupsMask PhysxSoftBody:: -get_groups_mask() const { - - PhysxGroupsMask mask; - - nassertr(_error_type == ET_ok, mask); - - NxGroupsMask _mask = _ptr->getGroupsMask(); - mask.set_mask(_mask); - - return mask; -} - -/** - * Gets the number of cloth particles. - */ -unsigned int PhysxSoftBody:: -get_num_particles() { - - nassertr(_error_type == ET_ok, 0); - return _ptr->getNumberOfParticles(); -} - -/** - * Sets the soft body particle radius (must be positive). - */ -void PhysxSoftBody:: -set_particle_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setParticleRadius(radius); -} - -/** - * Gets the soft body particle radius. - */ -float PhysxSoftBody:: -get_particle_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getParticleRadius(); -} - -/** - * Sets the value of a single flag. - */ -void PhysxSoftBody:: -set_flag(PhysxSoftBodyFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - - NxU32 flags = _ptr->getFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setFlags(flags); -} - -/** - * Retrieves the value of a single flag. - */ -bool PhysxSoftBody:: -get_flag(PhysxSoftBodyFlag flag) const { - - nassertr(_error_type == ET_ok, false); - - return (_ptr->getFlags() & flag) ? true : false; -} - -/** - * Gets the soft body density. - */ -float PhysxSoftBody:: -get_density() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getDensity(); -} - -/** - * Gets the relative grid spacing for the broad phase. The cloth is - * represented by a set of world aligned cubical cells in broad phase. The - * size of these cells is determined by multiplying the length of the diagonal - * of the AABB of the initial soft body size with this constant. - */ -float PhysxSoftBody:: -get_relative_grid_spacing() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRelativeGridSpacing(); -} - -/** - * Sets the soft body volume stiffness in the range from 0 to 1. - */ -void PhysxSoftBody:: -set_volume_stiffness(float stiffness) { - - nassertv(_error_type == ET_ok); - ptr()->setVolumeStiffness(stiffness); -} - -/** - * Retrieves the soft body volume stiffness. - */ -float PhysxSoftBody:: -get_volume_stiffness() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getVolumeStiffness(); -} - -/** - * Sets the soft body stretching stiffness in the range from 0 to 1. - */ -void PhysxSoftBody:: -set_stretching_stiffness(float stiffness) { - - nassertv(_error_type == ET_ok); - ptr()->setStretchingStiffness(stiffness); -} - -/** - * Retrieves the soft body stretching stiffness. - */ -float PhysxSoftBody:: -get_stretching_stiffness() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getStretchingStiffness(); -} - -/** - * Sets the damping coefficient in the range from 0 to 1. - */ -void PhysxSoftBody:: -set_damping_coefficient(float coef) { - - nassertv(_error_type == ET_ok); - ptr()->setDampingCoefficient(coef); -} - -/** - * Retrieves the damping coefficient. - */ -float PhysxSoftBody:: -get_damping_coefficient() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getDampingCoefficient(); -} - -/** - * Sets the soft body friction coefficient in the range from 0 to 1. - */ -void PhysxSoftBody:: -set_friction(float friction) { - - nassertv(_error_type == ET_ok); - ptr()->setFriction(friction); -} - -/** - * Retrieves the soft body friction coefficient. - */ -float PhysxSoftBody:: -get_friction() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getFriction(); -} - -/** - * Sets the soft body tear factor (must be larger than one). - */ -void PhysxSoftBody:: -set_tear_factor(float factor) { - - nassertv(_error_type == ET_ok); - nassertv(factor > 1.0f); - ptr()->setTearFactor(factor); -} - -/** - * Retrieves the soft body tear factor. - */ -float PhysxSoftBody:: -get_tear_factor() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getTearFactor(); -} - -/** - * Sets the soft body attachment tear factor (must be larger than one). - */ -void PhysxSoftBody:: -set_attachment_tear_factor(float factor) { - - nassertv(_error_type == ET_ok); - nassertv(factor > 1.0f); - ptr()->setAttachmentTearFactor(factor); -} - -/** - * Retrieves the attachment soft body tear factor. - */ -float PhysxSoftBody:: -get_attachment_tear_factor() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getAttachmentTearFactor(); -} - -/** - * Sets the soft body solver iterations. - */ -void PhysxSoftBody:: -set_solver_iterations(unsigned int iterations) { - - nassertv(_error_type == ET_ok); - ptr()->setSolverIterations(iterations); -} - -/** - * Retrieves the soft body solver iterations. - */ -unsigned int PhysxSoftBody:: -get_solver_iterations() const { - - nassertr(_error_type == ET_ok, 0); - return ptr()->getSolverIterations(); -} - -/** - * Returns true if this soft body is sleeping. - * - * When a soft body does not move for a period of time, it is no longer - * simulated in order to save time. This state is called sleeping. However, - * because the object automatically wakes up when it is either touched by an - * awake object, or one of its properties is changed by the user, the entire - * sleep mechanism should be transparent to the user. - */ -bool PhysxSoftBody:: -is_sleeping() const { - - nassertr(_error_type == ET_ok, false); - return _ptr->isSleeping(); -} - -/** - * Wakes up the soft body if it is sleeping. - * - * The wakeCounterValue determines how long until the body is put to sleep, a - * value of zero means that the body is sleeping. wake_up(0) is equivalent to - * PhysxSoftBody::put_to_sleep(). - */ -void PhysxSoftBody:: -wake_up(float wakeCounterValue) { - - nassertv(_error_type == ET_ok); - _ptr->wakeUp(wakeCounterValue); -} - -/** - * Forces the soft body to sleep. - * - * The soft body will stay asleep until the next call to simulate, and will - * not wake up until then even when otherwise it would (for example a force is - * applied to it). It can however wake up during the next do_physics call. - */ -void PhysxSoftBody:: -put_to_sleep() { - - nassertv(_error_type == ET_ok); - _ptr->putToSleep(); -} - -/** - * Sets the linear velocity below which an soft body may go to sleep. - * SoftBodys whose linear velocity is above this threshold will not be put to - * sleep. - * - * Setting the sleep angular/linear velocity only makes sense when the - * BF_energy_sleep_test is not set. - */ -void PhysxSoftBody:: -set_sleep_linear_velocity(float threshold) { - - nassertv(_error_type == ET_ok); - _ptr->setSleepLinearVelocity(threshold); -} - -/** - * Returns the linear velocity below which an soft body may go to sleep. Soft - * bodies whose linear velocity is above this threshold will not be put to - * sleep. - */ -float PhysxSoftBody:: -get_sleep_linear_velocity() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSleepLinearVelocity(); -} - -#if NX_SDK_VERSION_NUMBER > 281 -/** - * Sets the soft body self collision thickness (must be positive). - */ -void PhysxSoftBody:: -set_self_collision_thickness(float thickness) { - - nassertv(_error_type == ET_ok); - _ptr->setSelfCollisionThickness(thickness); -} - -/** - * Gets the soft body self collision thickness. - */ -float PhysxSoftBody:: -get_self_collision_thickness() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSelfCollisionThickness(); -} - -/** - * Sets the soft body hard stretch elongation limit. - */ -void PhysxSoftBody:: -set_hard_stretch_limitation_factor(float factor) { - - nassertv(_error_type == ET_ok); - ptr()->setHardStretchLimitationFactor(factor); -} - -/** - * Retrieves the soft body hard stretch elongation limit. - */ -float PhysxSoftBody:: -get_hard_stretch_limitation_factor() const { - - nassertr(_error_type == ET_ok, 0.0f); - return ptr()->getHardStretchLimitationFactor(); -} -#endif // NX_SDK_VERSION_NUMBER > 281 - - -/** - * Attaches a cloth vertex to a position in world space. - */ -/* -void PhysxSoftBody:: -attach_vertex_to_global_pos(unsigned int vertexId, LPoint3f const &pos) { - - nassertv(_error_type == ET_ok); - nassertv(!pos.is_nan()); - - _ptr->attachVertexToGlobalPosition(vertexId, PhysxManager::point3_to_nxVec3(pos)); -} -*/ - -/** - * Attaches the cloth to a shape. All cloth points currently inside the shape - * are attached. - * - * This method only works with primitive and convex shapes. Since the inside - * of a general triangle mesh is not clearly defined. - */ -/* -void PhysxSoftBody:: -attach_to_shape(PhysxShape *shape) { - - nassertv(_error_type == ET_ok); - nassertv(shape); - - NxU32 attachmentFlags = 0; // --TODO-- - _ptr->attachToShape(shape->ptr(), attachmentFlags); -} -*/ - -/** - * Attaches the cloth to all shapes, currently colliding. - * - * This method only works with primitive and convex shapes. Since the inside - * of a general triangle mesh is not clearly defined. - */ -/* -void PhysxSoftBody:: -attach_to_colliding_shapes() { - - nassertv(_error_type == ET_ok); - - NxU32 attachmentFlags = 0; // --TODO-- - _ptr->attachToCollidingShapes(attachmentFlags); -} -*/ - -/** - * Detaches the cloth from a shape it has been attached to before. - * - * If the cloth has not been attached to the shape before, the call has no - * effect. - */ -/* -void PhysxSoftBody:: -detach_from_shape(PhysxShape *shape) { - - nassertv(_error_type == ET_ok); - nassertv(shape); - - _ptr->detachFromShape(shape->ptr()); -} -*/ - -/** - * Frees a previously attached cloth point. - */ -/* -void PhysxSoftBody:: -free_vertex(unsigned int vertexId) { - - nassertv(_error_type == ET_ok); - _ptr->freeVertex(vertexId); -} -*/ - -/** - * Attaches a cloth vertex to a local position within a shape. - */ -/* -void PhysxSoftBody:: -attach_vertex_to_shape(unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos) { - - nassertv(_error_type == ET_ok); - nassertv(!localPos.is_nan()); - nassertv(shape); - - NxU32 attachmentFlags = 0; // --TODO-- - _ptr->attachVertexToShape(vertexId, shape->ptr(), - PhysxManager::point3_to_nxVec3(localPos), - attachmentFlags); -} -*/ - -/** - * Return the attachment status of the given vertex. - */ -/* -PhysxEnums::PhysxVertexAttachmentStatus PhysxSoftBody:: -get_vertex_attachment_status(unsigned int vertexId) const { - - nassertr(_error_type == ET_ok, VAS_none); - // --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), VAS_none); - - return (PhysxVertexAttachmentStatus) _ptr->getVertexAttachmentStatus(vertexId); -} -*/ - -/** - * Returns the pointer to an attached shape pointer of the given vertex. If - * the vertex is not attached or attached to a global position, NULL is - * returned. - */ -/* -PhysxShape *PhysxSoftBody:: -get_vertex_attachment_shape(unsigned int vertexId) const { - - nassertr(_error_type == ET_ok, NULL); - // --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), NULL); - - NxShape *shapePtr = _ptr->getVertexAttachmentShape(vertexId); - PhysxShape *shape = shapePtr ? (PhysxShape *)(shapePtr->userData) : NULL; - - return shape; -} -*/ - -/** - * Returns the attachment position of the given vertex. If the vertex is - * attached to shape, the position local to the shape's pose is returned. If - * the vertex is not attached, the return value is undefined. - */ -/* -LPoint3f PhysxSoftBody:: -get_vertex_attachment_pos(unsigned int vertexId) const { - - nassertr(_error_type == ET_ok, LPoint3f::zero()); - // --TODO-- nassertr(vertexId < _ptr->getNumberOfParticles(), - // LPoint3f::zero()); - - return PhysxManager::nxVec3_to_point3(_ptr->getVertexAttachmentPosition(vertexId)); -} -*/ - -/** - * Sets an external acceleration which affects all non attached particles of - * the cloth. - */ -/* -void PhysxSoftBody:: -set_external_acceleration(LVector3f const &acceleration) { - - nassertv(_error_type == ET_ok); - nassertv_always(!acceleration.is_nan()); - - _ptr->setExternalAcceleration(PhysxManager::vec3_to_nxVec3(acceleration)); -} -*/ - -/** - * Sets an acceleration acting normal to the cloth surface at each vertex. - */ -/* -void PhysxSoftBody:: -set_wind_acceleration(LVector3f const &acceleration) { - - nassertv(_error_type == ET_ok); - nassertv_always(!acceleration.is_nan()); - - _ptr->setWindAcceleration(PhysxManager::vec3_to_nxVec3(acceleration)); -} -*/ - -/** - * Retrieves the external acceleration which affects all non attached - * particles of the cloth. - */ -/* -LVector3f PhysxSoftBody:: -get_external_acceleration() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getExternalAcceleration()); -} -*/ - -/** - * Retrieves the acceleration acting normal to the cloth surface at each - * vertex - */ -/* -LVector3f PhysxSoftBody:: -get_wind_acceleration() const { - - nassertr(_error_type == ET_ok, LVector3f::zero()); - return PhysxManager::nxVec3_to_vec3(_ptr->getWindAcceleration()); -} -*/ - -/** - * Applies a force (or impulse) defined in the global coordinate frame, to a - * particular vertex of the cloth. - */ -/* -void PhysxSoftBody:: -add_force_at_vertex(LVector3f const &force, int vertexId, PhysxForceMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->addForceAtVertex(PhysxManager::vec3_to_nxVec3(force), - vertexId, - (NxForceMode) mode); -} -*/ - -/** - * Applies a radial force (or impulse) at a particular position. All vertices - * within radius will be affected with a quadratic drop-off. - */ -/* -void PhysxSoftBody:: -add_force_at_pos(LPoint3f const &pos, float magnitude, float radius, PhysxForceMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->addForceAtPos(PhysxManager::point3_to_nxVec3(pos), - magnitude, - radius, - (NxForceMode) mode); -} -*/ - -/** - * Applies a directed force (or impulse) at a particular position. All - * vertices within radius will be affected with a quadratic drop-off. - */ -/* -void PhysxSoftBody:: -add_directed_force_at_pos(LPoint3f const &pos, LVector3f const &force, float radius, PhysxForceMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->addDirectedForceAtPos(PhysxManager::point3_to_nxVec3(pos), - PhysxManager::vec3_to_nxVec3(force), - radius, - (NxForceMode) mode); -} -*/ diff --git a/panda/src/physx/physxSoftBody.h b/panda/src/physx/physxSoftBody.h deleted file mode 100644 index 45416148c3..0000000000 --- a/panda/src/physx/physxSoftBody.h +++ /dev/null @@ -1,213 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBody.h - * @author enn0x - * @date 2010-09-13 - */ - -#ifndef PHYSXSOFTBODY_H -#define PHYSXSOFTBODY_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxObject.h" -#include "physxObjectCollection.h" -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxScene; -class PhysxGroupsMask; -class PhysxSoftBodyNode; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxSoftBody : public PhysxObject, public PhysxEnums { - -PUBLISHED: - INLINE PhysxSoftBody(); - INLINE ~PhysxSoftBody(); - - PhysxScene *get_scene() const; - PhysxSoftBodyNode *get_soft_body_node() const; - PhysxSoftBodyNode *create_soft_body_node(const char *name); - - void set_name(const char *name); - void set_flag(PhysxSoftBodyFlag flag, bool value); - void set_groups_mask(const PhysxGroupsMask &mask); - void set_group(unsigned int group); - void set_solver_iterations(unsigned int iterations); - void set_particle_radius(float radius); -#if NX_SDK_VERSION_NUMBER > 281 - void set_self_collision_thickness(float thickness); - void set_hard_stretch_limitation_factor(float factor); -#endif - void set_volume_stiffness(float stiffness); - void set_stretching_stiffness(float stiffness); - void set_damping_coefficient(float coef); - void set_friction(float friction); - void set_tear_factor(float factor); - void set_attachment_tear_factor(float factor); - - const char *get_name() const; - bool get_flag(PhysxSoftBodyFlag flag) const; - PhysxGroupsMask get_groups_mask() const; - unsigned int get_group() const; - unsigned int get_num_particles(); - unsigned int get_solver_iterations() const; - float get_particle_radius() const; - float get_density() const; - float get_relative_grid_spacing() const; -#if NX_SDK_VERSION_NUMBER > 281 - float get_self_collision_thickness() const; - float get_hard_stretch_limitation_factor() const; -#endif - float get_volume_stiffness() const; - float get_stretching_stiffness() const; - float get_damping_coefficient() const; - float get_friction() const; - float get_tear_factor() const; - float get_attachment_tear_factor() const; - -/* - // Attachment - void attach_vertex_to_global_pos(unsigned int vertexId, LPoint3f const &pos); - void free_vertex(unsigned int vertexId); - void attach_to_shape(PhysxShape *shape); - void attach_to_colliding_shapes(); - void detach_from_shape(PhysxShape *shape); - void attach_vertex_to_shape(unsigned int vertexId, PhysxShape *shape, LPoint3f const &localPos); - PhysxVertexAttachmentStatus get_vertex_attachment_status(unsigned int vertexId) const; - PhysxShape *get_vertex_attachment_shape(unsigned int vertexId) const; - LPoint3f get_vertex_attachment_pos(unsigned int vertexId) const; -*/ - - // Sleeping - bool is_sleeping() const; - void wake_up(float wakeCounterValue=NX_SLEEP_INTERVAL); - void put_to_sleep(); - void set_sleep_linear_velocity(float threshold); - float get_sleep_linear_velocity() const; - -/* - // Forces - void set_external_acceleration(LVector3f const &acceleration); - LVector3f get_external_acceleration() const; - - void set_wind_acceleration(LVector3f const &acceleration); - LVector3f get_wind_acceleration() const; - - void add_force_at_vertex(LVector3f const &force, int vertexId, - PhysxForceMode mode=FM_force); - void add_force_at_pos(LPoint3f const &pos, float magnitude, float radius, - PhysxForceMode mode=FM_force); - void add_directed_force_at_pos(LPoint3f const &pos, LVector3f const &force, float radius, - PhysxForceMode mode=FM_force); -*/ - - -/* -virtual void getWorldBounds (NxBounds3 &bounds) const =0 -virtual void attachToShape (const NxShape *shape, NxU32 attachmentFlags)=0 -virtual void attachToCollidingShapes (NxU32 attachmentFlags)=0 -virtual void detachFromShape (const NxShape *shape)=0 -virtual void attachVertexToShape (NxU32 vertexId, const NxShape *shape, const NxVec3 &localPos, NxU32 attachmentFlags)=0 -virtual void attachVertexToGlobalPosition (const NxU32 vertexId, const NxVec3 &pos)=0 -virtual void freeVertex (const NxU32 vertexId)=0 -virtual bool tearVertex (const NxU32 vertexId, const NxVec3 &normal)=0 -virtual bool raycast (const NxRay &worldRay, NxVec3 &hit, NxU32 &vertexId)=0 -virtual void setMeshData (NxMeshData &meshData)=0 -virtual NxMeshData getMeshData ()=0 -virtual void setSplitPairData (NxSoftBodySplitPairData &splitPairData)=0 -virtual NxSoftBodySplitPairData getSplitPairData ()=0 -virtual void setValidBounds (const NxBounds3 &validBounds)=0 -virtual void getValidBounds (NxBounds3 &validBounds) const =0 -virtual void setPosition (const NxVec3 &position, NxU32 vertexId)=0 -virtual void setPositions (void *buffer, NxU32 byteStride=sizeof(NxVec3))=0 -virtual NxVec3 getPosition (NxU32 vertexId) const =0 -virtual void getPositions (void *buffer, NxU32 byteStride=sizeof(NxVec3))=0 -virtual void setVelocity (const NxVec3 &velocity, NxU32 vertexId)=0 -virtual void setVelocities (void *buffer, NxU32 byteStride=sizeof(NxVec3))=0 -virtual NxVec3 getVelocity (NxU32 vertexId) const =0 -virtual void getVelocities (void *buffer, NxU32 byteStride=sizeof(NxVec3))=0 -virtual void setConstrainPositions (void *buffer, NxU32 byteStride=sizeof(NxVec3))=0 -virtual void setConstrainNormals (void *buffer, NxU32 byteStride=sizeof(NxVec3))=0 -virtual void setConstrainCoefficients (const NxSoftBodyConstrainCoefficients *coefficients, NxU32 byteStride=sizeof(NxSoftBodyConstrainCoefficients))=0 -virtual NxU32 queryShapePointers ()=0 -virtual NxU32 getStateByteSize ()=0 -virtual void getShapePointers (NxShape **shapePointers, NxU32 *flags)=0 -virtual void setShapePointers (NxShape **shapePointers, unsigned int numShapes)=0 -virtual void saveStateToStream (NxStream &stream, bool permute=false)=0 -virtual void loadStateFromStream (NxStream &stream)=0 -virtual void setCollisionResponseCoefficient (NxReal coefficient)=0 -virtual NxReal getCollisionResponseCoefficient () const =0 -virtual void setAttachmentResponseCoefficient (NxReal coefficient)=0 -virtual NxReal getAttachmentResponseCoefficient () const =0 -virtual void setFromFluidResponseCoefficient (NxReal coefficient)=0 -virtual NxReal getFromFluidResponseCoefficient () const =0 -virtual void setToFluidResponseCoefficient (NxReal coefficient)=0 -virtual NxReal getToFluidResponseCoefficient () const =0 -virtual void setExternalAcceleration (NxVec3 acceleration)=0 -virtual NxVec3 getExternalAcceleration () const =0 -virtual void setMinAdhereVelocity (NxReal velocity)=0 -virtual NxReal getMinAdhereVelocity () const =0 -virtual void addForceAtVertex (const NxVec3 &force, NxU32 vertexId, NxForceMode mode=NX_FORCE)=0 -virtual void addForceAtPos (const NxVec3 &position, NxReal magnitude, NxReal radius, NxForceMode mode=NX_FORCE)=0 -virtual void addDirectedForceAtPos (const NxVec3 &position, const NxVec3 &force, NxReal radius, NxForceMode mode=NX_FORCE)=0 -virtual bool overlapAABBTetrahedra (const NxBounds3 &bounds, NxU32 &nb, const NxU32 *&indices) const =0 -virtual NxCompartment * getCompartment () const =0 -virtual NxForceFieldMaterial getForceFieldMaterial () const =0 -virtual void setForceFieldMaterial (NxForceFieldMaterial)=0 -*/ - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - void update(); - -PUBLISHED: - void release(); - -public: - INLINE NxSoftBody *ptr() const { return _ptr; }; - - void link(NxSoftBody *ptr); - void unlink(); - -private: - NxSoftBody *_ptr; - PT(PhysxSoftBodyNode) _node; - std::string _name; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxSoftBody", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxSoftBody.I" - -#endif // PHYSXSOFTBODY_H diff --git a/panda/src/physx/physxSoftBodyDesc.I b/panda/src/physx/physxSoftBodyDesc.I deleted file mode 100644 index e5a02ac6a3..0000000000 --- a/panda/src/physx/physxSoftBodyDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyDesc.I - * @author enn0x - * @date 2010-09-12 - */ - -/** - * - */ -INLINE PhysxSoftBodyDesc:: -PhysxSoftBodyDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxSoftBodyDesc:: -~PhysxSoftBodyDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxSoftBodyDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxSoftBodyDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxSoftBodyDesc.cxx b/panda/src/physx/physxSoftBodyDesc.cxx deleted file mode 100644 index 2f3aada839..0000000000 --- a/panda/src/physx/physxSoftBodyDesc.cxx +++ /dev/null @@ -1,334 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyDesc.cxx - * @author enn0x - * @date 2010-09-12 - */ - -#include "physxSoftBodyDesc.h" -#include "physxSoftBodyMesh.h" -#include "physxManager.h" - -/** - * - */ -void PhysxSoftBodyDesc:: -set_name(const char *name) { - - _name = name ? name : ""; - _desc.name = _name.c_str(); -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_global_pos(const LPoint3f &pos) { - - _desc.globalPose.t = PhysxManager::point3_to_nxVec3(pos); -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_global_mat(const LMatrix4f &mat) { - - _desc.globalPose = PhysxManager::mat4_to_nxMat34(mat); -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_global_hpr(float h, float p, float r) { - - LQuaternionf q; - LMatrix3f rot; - NxMat34 m; - - q.set_hpr(LVector3f(h, p, r)); - q.extract_to_matrix(rot); - - _desc.globalPose.M = PhysxManager::mat3_to_nxMat33(rot); -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_particle_radius(float radius) { - - _desc.particleRadius = radius; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_relative_grid_spacing(float spacing) { - - _desc.relativeGridSpacing = spacing; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_collision_response_coefficient(float coef) { - - _desc.collisionResponseCoefficient = coef; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_attachment_response_coefficient(float coef) { - - _desc.attachmentResponseCoefficient = coef; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_density(float density) { - - _desc.density = density; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_volume_stiffness(float stiffness) { - - _desc.volumeStiffness = stiffness; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_stretching_stiffness(float stiffness) { - - _desc.stretchingStiffness = stiffness; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_damping_coefficient(float damping) { - - _desc.dampingCoefficient = damping; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_friction(float friction) { - - _desc.friction = friction; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_tear_factor(float tearFactor) { - - _desc.tearFactor = tearFactor; -} - -/** - * Raise or lower individual SoftBodyFlag flags. - */ -void PhysxSoftBodyDesc:: -set_flag(PhysxSoftBodyFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Number of solver iterations. Small numbers make the simulation faster - * while the soft body gets less stiff. - */ -void PhysxSoftBodyDesc:: -set_solver_iterations(unsigned int iterations) { - - _desc.solverIterations = iterations; -} - -/** - * - */ -void PhysxSoftBodyDesc:: -set_soft_body_mesh(PhysxSoftBodyMesh *mesh) { - - _desc.softBodyMesh = mesh->ptr(); -} - -/** - * - */ -const char *PhysxSoftBodyDesc:: -get_name() const { - - return _desc.name; -} - -/** - * - */ -LPoint3f PhysxSoftBodyDesc:: -get_global_pos() const { - - return PhysxManager::nxVec3_to_point3(_desc.globalPose.t); -} - -/** - * - */ -LMatrix4f PhysxSoftBodyDesc:: -get_global_mat() const { - - return PhysxManager::nxMat34_to_mat4(_desc.globalPose); -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_particle_radius() const { - - return _desc.particleRadius; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_relative_grid_spacing() const { - - return _desc.relativeGridSpacing; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_collision_response_coefficient() const { - - return _desc.collisionResponseCoefficient; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_attachment_response_coefficient() const { - - return _desc.attachmentResponseCoefficient; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_density() const { - - return _desc.density; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_volume_stiffness() const { - - return _desc.volumeStiffness; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_stretching_stiffness() const { - - return _desc.stretchingStiffness; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_damping_coefficient() const { - - return _desc.dampingCoefficient; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_friction() const { - - return _desc.friction; -} - -/** - * - */ -float PhysxSoftBodyDesc:: -get_tear_factor() const { - - return _desc.tearFactor; -} - -/** - * - */ -bool PhysxSoftBodyDesc:: -get_flag(PhysxSoftBodyFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * - */ -unsigned int PhysxSoftBodyDesc:: -get_solver_iterations() const { - - return _desc.solverIterations; -} - -/** - * Used by PhysScene to query the sizes of arrays to allocate for the user - * buffers in PhysxSoftBodyNode. - */ -/* -void PhysxSoftBodyDesc:: -get_mesh_numbers(NxU32 &numVertices, NxU32 &numTriangles) { - - NxSoftBodyMeshDesc meshDesc; - _desc.clothMesh->saveToDesc(meshDesc); - - numVertices = meshDesc.numVertices; - numTriangles = meshDesc.numTriangles; -} -*/ diff --git a/panda/src/physx/physxSoftBodyDesc.h b/panda/src/physx/physxSoftBodyDesc.h deleted file mode 100644 index 10db3cabae..0000000000 --- a/panda/src/physx/physxSoftBodyDesc.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyDesc.h - * @author enn0x - * @date 2010-09-12 - */ - -#ifndef PHYSXSOFTBODYDESC_H -#define PHYSXSOFTBODYDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxEnums.h" -#include "physx_includes.h" - -class PhysxSoftBodyMesh; - -/** - * Descriptor for PhysxSoftBody. - */ -class EXPCL_PANDAPHYSX PhysxSoftBodyDesc : public PhysxEnums { - -PUBLISHED: - INLINE PhysxSoftBodyDesc(); - INLINE ~PhysxSoftBodyDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_soft_body_mesh(PhysxSoftBodyMesh *mesh); - - void set_name(const char *name); - void set_global_pos(const LPoint3f &pos); - void set_global_mat(const LMatrix4f &mat); - void set_global_hpr(float h, float p, float r); - void set_density(float density); - void set_volume_stiffness(float stiffness); - void set_stretching_stiffness(float stiffness); - void set_damping_coefficient(float damping); - void set_friction(float friction); - void set_tear_factor(float tearFactor); - void set_particle_radius(float radius); - void set_relative_grid_spacing(float spacing); - void set_collision_response_coefficient(float coef); - void set_attachment_response_coefficient(float coef); - void set_solver_iterations(unsigned int interations); - void set_flag(PhysxSoftBodyFlag flag, bool value); - - const char *get_name() const; - LPoint3f get_global_pos() const; - LMatrix4f get_global_mat() const; - float get_density() const; - float get_volume_stiffness() const; - float get_stretching_stiffness() const; - float get_damping_coefficient() const; - float get_friction() const; - float get_tear_factor() const; - float get_particle_radius() const; - float get_relative_grid_spacing() const; - float get_collision_response_coefficient() const; - float get_attachment_response_coefficient() const; - unsigned int get_solver_iterations() const; - bool get_flag(PhysxSoftBodyFlag flag) const; - -public: - NxSoftBodyDesc _desc; - -private: - std::string _name; -}; - -#include "physxSoftBodyDesc.I" - -#endif // PHYSXSOFTBODYDESC_H diff --git a/panda/src/physx/physxSoftBodyMesh.I b/panda/src/physx/physxSoftBodyMesh.I deleted file mode 100644 index 314089dda6..0000000000 --- a/panda/src/physx/physxSoftBodyMesh.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyMesh.I - * @author enn0x - * @date 2010-09-12 - */ - -/** - * - */ -INLINE PhysxSoftBodyMesh:: -PhysxSoftBodyMesh() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxSoftBodyMesh:: -~PhysxSoftBodyMesh() { - -} - -/** - * - */ -INLINE void PhysxSoftBodyMesh:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxSoftBodyMesh:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxSoftBodyMesh.cxx b/panda/src/physx/physxSoftBodyMesh.cxx deleted file mode 100644 index 2f69f3d173..0000000000 --- a/panda/src/physx/physxSoftBodyMesh.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyMesh.cxx - * @author enn0x - * @date 2010-09-12 - */ - -#include "physxSoftBodyMesh.h" -#include "physxMeshPool.h" - -TypeHandle PhysxSoftBodyMesh::_type_handle; - -/** - * - */ -void PhysxSoftBodyMesh:: -link(NxSoftBodyMesh *meshPtr) { - - // Link self - PhysxManager::get_global_ptr()->_softbody_meshes.add(this); - _ptr = meshPtr; - _error_type = ET_ok; -} - -/** - * - */ -void PhysxSoftBodyMesh:: -unlink() { - - // Unlink self - _error_type = ET_released; - PhysxManager::get_global_ptr()->_softbody_meshes.remove(this); -} - -/** - * - */ -void PhysxSoftBodyMesh:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxGetPhysicsSDK()->releaseSoftBodyMesh(*_ptr); - _ptr = nullptr; - - PhysxMeshPool::release_soft_body_mesh(this); -} - -/** - * Returns the reference count for shared meshes. - */ -unsigned int PhysxSoftBodyMesh:: -get_reference_count() const { - - nassertr(_error_type == ET_ok, 0); - - return _ptr->getReferenceCount(); -} diff --git a/panda/src/physx/physxSoftBodyMesh.h b/panda/src/physx/physxSoftBodyMesh.h deleted file mode 100644 index 1284582285..0000000000 --- a/panda/src/physx/physxSoftBodyMesh.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyMesh.h - * @author enn0x - * @date 2010-09-12 - */ - -#ifndef PHYSXSOFTBODYMESH_H -#define PHYSXSOFTBODYMESH_H - -#include "pandabase.h" - -#include "physxObject.h" -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxSoftBodyMesh : public PhysxObject { - -PUBLISHED: - unsigned int get_reference_count() const; - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE PhysxSoftBodyMesh(); - INLINE ~PhysxSoftBodyMesh(); - - INLINE NxSoftBodyMesh *ptr() const { return _ptr; }; - - void link(NxSoftBodyMesh *meshPtr); - void unlink(); - -private: - NxSoftBodyMesh *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxSoftBodyMesh", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxSoftBodyMesh.I" - -#endif // PHYSXSOFTBODYMESH_H diff --git a/panda/src/physx/physxSoftBodyMeshDesc.I b/panda/src/physx/physxSoftBodyMeshDesc.I deleted file mode 100644 index 0125b456ec..0000000000 --- a/panda/src/physx/physxSoftBodyMeshDesc.I +++ /dev/null @@ -1,61 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyMeshDesc.I - * @author enn0x - * @date 2010-09-12 - */ - -/** - * - */ -INLINE PhysxSoftBodyMeshDesc:: -PhysxSoftBodyMeshDesc() { - - _desc.flags = 0; - _desc.vertexStrideBytes = sizeof(NxVec3); - _desc.tetrahedronStrideBytes = 4*sizeof(NxU32); - _desc.vertices = nullptr; - _desc.tetrahedra = nullptr; - - _vertices = nullptr; - _tetrahedra = nullptr; -} - -/** - * - */ -INLINE PhysxSoftBodyMeshDesc:: -~PhysxSoftBodyMeshDesc() { - - if (_vertices) { - delete [] _vertices; - } - - if (_tetrahedra) { - delete [] _tetrahedra; - } -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxSoftBodyMeshDesc:: -is_valid() const { - - return _desc.isValid(); -} - -/** - * - */ -INLINE const NxSoftBodyMeshDesc &PhysxSoftBodyMeshDesc:: -get_desc() const { - - return _desc; -} diff --git a/panda/src/physx/physxSoftBodyMeshDesc.cxx b/panda/src/physx/physxSoftBodyMeshDesc.cxx deleted file mode 100644 index b6a4a6aa6d..0000000000 --- a/panda/src/physx/physxSoftBodyMeshDesc.cxx +++ /dev/null @@ -1,82 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyMeshDesc.cxx - * @author enn0x - * @date 2010-09-12 - */ - -#include "physxSoftBodyMeshDesc.h" -#include "physxManager.h" - -/** - * Sets the number of vertices to be stored within this soft body mesh. The - * function allocates memory for the vertices, but it does not set any - * vertices. - * - * This method must be called before any calls to set_vertex are done! - */ -void PhysxSoftBodyMeshDesc:: -set_num_vertices(unsigned int numVertices) { - - // Vertices - if (_desc.vertices) { - delete [] _vertices; - } - - _vertices = new NxVec3[numVertices]; - - _desc.numVertices = numVertices; - _desc.vertices = _vertices; -} - -/** - * Sets a single vertex. You have to call the function set_num_vertices - * before you can call this function. - */ -void PhysxSoftBodyMeshDesc:: -set_vertex(unsigned int idx, const LPoint3f &vert) { - - nassertv(_desc.numVertices > idx); - - _vertices[idx] = PhysxManager::point3_to_nxVec3(vert); -} - -/** - * Sets the number of tetrahedra to be stored in this soft body mesh. - * - * This method must be called before any calls to set_tetrahedron are done! - */ -void PhysxSoftBodyMeshDesc:: -set_num_tetrahedra(unsigned int numTetrahedra) { - - if (_desc.tetrahedra) { - delete [] _tetrahedra; - } - - _tetrahedra = new NxU32[4 * numTetrahedra]; - - _desc.numTetrahedra = numTetrahedra; - _desc.tetrahedra = _tetrahedra; -} - -/** - * Sets a single tetrahedron, by providing the three indices i1, i2, i3, i4. - */ -void PhysxSoftBodyMeshDesc:: -set_tetrahedron(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3, unsigned int i4) { - - nassertv(_desc.numTetrahedra > idx); - - idx = 4 * idx; - _tetrahedra[idx] = i1; - _tetrahedra[idx + 1] = i2; - _tetrahedra[idx + 2] = i3; - _tetrahedra[idx + 3] = i4; -} diff --git a/panda/src/physx/physxSoftBodyMeshDesc.h b/panda/src/physx/physxSoftBodyMeshDesc.h deleted file mode 100644 index 4032360716..0000000000 --- a/panda/src/physx/physxSoftBodyMeshDesc.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyMeshDesc.h - * @author enn0x - * @date 2010-09-12 - */ - -#ifndef PHYSXSOFTBODYMESHDESC_H -#define PHYSXSOFTBODYMESHDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxSoftBodyMeshDesc { - -PUBLISHED: - INLINE PhysxSoftBodyMeshDesc(); - INLINE ~PhysxSoftBodyMeshDesc(); - - INLINE bool is_valid() const; - - void set_num_vertices(unsigned int n); - void set_vertex(unsigned int idx, - const LPoint3f &vert); - - void set_num_tetrahedra(unsigned int n); - void set_tetrahedron(unsigned int idx, - unsigned int i1, - unsigned int i2, - unsigned int i3, - unsigned int i4); - -public: - INLINE const NxSoftBodyMeshDesc &get_desc() const; - -private: - NxSoftBodyMeshDesc _desc; - NxVec3 *_vertices; - NxU32 *_tetrahedra; -}; - -#include "physxSoftBodyMeshDesc.I" - -#endif // PHYSXSOFTBODYMESHDESC_H diff --git a/panda/src/physx/physxSoftBodyNode.I b/panda/src/physx/physxSoftBodyNode.I deleted file mode 100644 index 210db12f7b..0000000000 --- a/panda/src/physx/physxSoftBodyNode.I +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyNode.I - * @author enn0x - * @date 2010-09-13 - */ - -/** - * - */ -INLINE PhysxSoftBodyNode:: -PhysxSoftBodyNode(const char *name) : GeomNode(name) { - - _vdata = new GeomVertexData("", GeomVertexFormat::get_v3n3t2(), Geom::UH_stream); - - _prim = new GeomTriangles(Geom::UH_stream); - _prim->set_shade_model(Geom::SM_uniform); - - _geom = new Geom(_vdata); - _geom->add_primitive(_prim); - - this->add_geom(_geom); -} - -/** - * - */ -INLINE PhysxSoftBodyNode:: -~PhysxSoftBodyNode() { - -} diff --git a/panda/src/physx/physxSoftBodyNode.cxx b/panda/src/physx/physxSoftBodyNode.cxx deleted file mode 100644 index 99802f2109..0000000000 --- a/panda/src/physx/physxSoftBodyNode.cxx +++ /dev/null @@ -1,393 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyNode.cxx - * @author enn0x - * @date 2010-09-13 - */ - -#include "physxSoftBodyNode.h" -#include "physxSoftBody.h" -#include "physxFileStream.h" -#include "physxManager.h" -#include "physxMeshHash.h" - -#include "geomVertexFormat.h" -#include "geomVertexWriter.h" -#include "geomVertexRewriter.h" - -TypeHandle PhysxSoftBodyNode::_type_handle; - -/** - * - */ -void PhysxSoftBodyNode:: -allocate(PhysxSoftBody *softbody) { - - _softbody = softbody; - - // Retrieve number of vertices and triangles the hard way - NxSoftBodyMeshDesc meshDesc; - _softbody->ptr()->getSoftBodyMesh()->saveToDesc(meshDesc); - - NxU32 numVertices = meshDesc.numVertices; - NxU32 numTetrahedra = meshDesc.numTetrahedra; - - float factor = 1.0f; // TODO max(1.0f, factor); - - // Reserve more memory for vertices than the initial mesh takes because - // tearing creates new vertices - NxU32 maxVertices = factor * numVertices; - _mesh.verticesPosBegin = (NxVec3 *)malloc(sizeof(NxVec3) * maxVertices); - _mesh.verticesPosByteStride = sizeof(NxVec3); - _mesh.maxVertices = maxVertices; - _mesh.numVerticesPtr = (NxU32 *)malloc(sizeof(NxU32)); - - // The number of tetrahedra is constant, even if the softbody is torn - NxU32 maxIndices = 4 * numTetrahedra; - _mesh.indicesBegin = (NxU32 *)malloc(sizeof(NxU32) * maxIndices); - _mesh.indicesByteStride = sizeof(NxU32); - _mesh.maxIndices = maxIndices; - _mesh.numIndicesPtr = (NxU32 *)malloc(sizeof(NxU32)); - - *(_mesh.numVerticesPtr) = 0; - *(_mesh.numIndicesPtr) = 0; - - _softbody->ptr()->setMeshData(_mesh); -} - -/** - * Reads the vertices and indices from an existing Geom and makes a decomposed - * copy of the data. Then computes links between the owning soft body - * tetrahedron mesh in order to render an updated geometry every simulation - * frame. - */ -void PhysxSoftBodyNode:: -set_from_geom(const Geom *geom) { - - _prim->clear_vertices(); - - GeomVertexWriter vwriter = GeomVertexWriter(_vdata, InternalName::get_vertex()); - GeomVertexWriter nwriter = GeomVertexWriter(_vdata, InternalName::get_normal()); - GeomVertexWriter twriter = GeomVertexWriter(_vdata, InternalName::get_texcoord()); - - CPT(GeomVertexData) vdata = geom->get_vertex_data(); - GeomVertexReader vreader = GeomVertexReader(vdata, InternalName::get_vertex()); - GeomVertexReader nreader = GeomVertexReader(vdata, InternalName::get_normal()); - GeomVertexReader treader = GeomVertexReader(vdata, InternalName::get_texcoord()); - - while (!vreader.is_at_end()) { - LVecBase3f v = vreader.get_data3f(); - vwriter.add_data3f(v.get_x(), v.get_y(), v.get_z()); - } - - while (!nreader.is_at_end()) { - LVecBase3f n = nreader.get_data3f(); - nwriter.add_data3f(n.get_x(), n.get_y(), n.get_z()); - } - - while (!treader.is_at_end()) { - LVecBase2f t = treader.get_data2f(); - twriter.add_data2f(t.get_x(), t.get_y()); - } - - for (int i=0; iget_num_primitives(); i++) { - - CPT(GeomPrimitive) prim = geom->get_primitive(i); - prim = prim->decompose(); - - for (int j=0; jget_num_primitives(); j++) { - - int s = prim->get_primitive_start(j); - int e = prim->get_primitive_end(j); - - for (int l=s; ladd_vertex(prim->get_vertex(l)); - } - } - } - - _prim->close_primitive(); - - update_bounds(); - build_tetra_links(); -} - -/** - * - */ -void PhysxSoftBodyNode:: -build_tetra_links() { - - NxSoftBodyMeshDesc meshDesc; - _softbody->ptr()->getSoftBodyMesh()->saveToDesc(meshDesc); - const NxVec3 *vertices = (const NxVec3 *) meshDesc.vertices; - const NxU32 *indices = (const NxU32 *) meshDesc.tetrahedra; - const NxU32 numTets = meshDesc.numTetrahedra; - - _tetraLinks.clear(); - - PhysxMeshHash* hash = new PhysxMeshHash(); - hash->set_grid_spacing(_bounds.min.distance(_bounds.max) * 0.1f); - - for (NxU32 i=0; iadd(tetraBounds, i); - } - - GeomVertexReader vreader = GeomVertexReader(_vdata, InternalName::get_vertex()); - - while (!vreader.is_at_end()) { - - // Prepare datastructure for drained tetras - _drainedTriVertices.push_back(false); - - TetraLink tmpLink; - - LVecBase3f v = vreader.get_data3f(); - NxVec3 triVert = PhysxManager::vec3_to_nxVec3(v); - pvector itemIndices; - hash->query_unique(triVert, itemIndices); - - NxReal minDist = 0.0f; - NxVec3 b; - int num, isize; - num = isize = itemIndices.size(); - if (num == 0) { - num = numTets; - } - - for (int i=0; i 0) { - j = itemIndices[i]; - } - - const NxU32 *ix = &indices[j*4]; - const NxVec3 &p0 = vertices[*ix++]; - const NxVec3 &p1 = vertices[*ix++]; - const NxVec3 &p2 = vertices[*ix++]; - const NxVec3 &p3 = vertices[*ix++]; - - NxVec3 b = compute_bary_coords(triVert, p0, p1, p2, p3); - - // Is the vertex inside the tetrahedron? If yes we take it - if (b.x >= 0.0f && b.y >= 0.0f && b.z >= 0.0f && (b.x + b.y + b.z) <= 1.0f) { - tmpLink.barycentricCoords = b; - tmpLink.tetraNr = j; - break; - } - - // Otherwise, if we are not in any tetrahedron we take the closest one - NxReal dist = 0.0f; - if (b.x + b.y + b.z > 1.0f) dist = b.x + b.y + b.z - 1.0f; - if (b.x < 0.0f) dist = (-b.x < dist) ? dist : -b.x; - if (b.y < 0.0f) dist = (-b.y < dist) ? dist : -b.y; - if (b.z < 0.0f) dist = (-b.z < dist) ? dist : -b.z; - - if (i == 0 || dist < minDist) { - minDist = dist; - tmpLink.barycentricCoords = b; - tmpLink.tetraNr = j; - } - } - - _tetraLinks.push_back(tmpLink); - } - - delete hash; -} - -/** - * - */ -void PhysxSoftBodyNode:: -remove_tris_related_to_vertex(const int vertexIndex) { - - GeomVertexRewriter vrewriter = GeomVertexRewriter(_vdata, InternalName::get_vertex()); - LVecBase3f v; - - for (int j=0; j<_prim->get_num_primitives(); j++) { - - int s = _prim->get_primitive_start(j); - int idx0 = _prim->get_vertex(s); - int idx1 = _prim->get_vertex(s+1); - int idx2 = _prim->get_vertex(s+2); - - if (vertexIndex == idx0 || vertexIndex == idx1 || vertexIndex == idx2) { - - // Make this triangle degenerated - vrewriter.set_row_unsafe(idx0); v = vrewriter.get_data3f(); - vrewriter.set_row_unsafe(idx1); vrewriter.set_data3f(v.get_x(), v.get_y(), v.get_z()); - vrewriter.set_row_unsafe(idx2); vrewriter.set_data3f(v.get_x(), v.get_y(), v.get_z()); - } - } -} - -/** - * - */ -void PhysxSoftBodyNode:: -update_bounds() { - - _bounds.setEmpty(); - - GeomVertexReader vreader = GeomVertexReader(_vdata, InternalName::get_vertex()); - - while (!vreader.is_at_end()) { - LVecBase3f v = vreader.get_data3f(); - _bounds.include(PhysxManager::vec3_to_nxVec3(v)); - } -} - -/** - * _bounds.include(mVertices[i]); - */ -void PhysxSoftBodyNode:: -update_normals() { - - _normals.resize(_vdata->get_num_rows()); - - int i; - for (i=0; i<(int)_normals.size(); i++) { - _normals[i] = LVector3f::zero(); - } - - LVecBase3f n, v0, v1, v2; - GeomVertexReader vreader = GeomVertexReader(_vdata, InternalName::get_vertex()); - - for (int j=0; j<_prim->get_num_primitives(); j++) { - - int s = _prim->get_primitive_start(j); - int idx0 = _prim->get_vertex(s); - int idx1 = _prim->get_vertex(s+1); - int idx2 = _prim->get_vertex(s+2); - - vreader.set_row_unsafe(idx0); v0 = vreader.get_data3f(); - vreader.set_row_unsafe(idx1); v1 = vreader.get_data3f(); - vreader.set_row_unsafe(idx2); v2 = vreader.get_data3f(); - - n = (v1 - v0).cross(v2 - v0); - - _normals[idx0] += n; - _normals[idx1] += n; - _normals[idx2] += n; - } - - for (i=0; i<(int)_normals.size(); i++) { - _normals[i].normalize(); - } - - GeomVertexWriter nwriter = GeomVertexWriter(_vdata, InternalName::get_normal()); - for (i=0; i<(int)_normals.size(); i++) { - n = _normals[i]; - nwriter.add_data3f(n.get_x(), n.get_y(), n.get_z()); - } -} - -/** - * - */ -NxVec3 PhysxSoftBodyNode:: -compute_bary_coords(NxVec3 vertex, NxVec3 p0, NxVec3 p1, NxVec3 p2, NxVec3 p3) const { - - NxVec3 baryCoords; - - NxVec3 q = vertex - p3; - NxVec3 q0 = p0 - p3; - NxVec3 q1 = p1 - p3; - NxVec3 q2 = p2 - p3; - - NxMat33 m; - m.setColumn(0, q0); - m.setColumn(1, q1); - m.setColumn(2, q2); - - NxReal det = m.determinant(); - - m.setColumn(0, q); - baryCoords.x = m.determinant(); - - m.setColumn(0, q0); - m.setColumn(1, q); - baryCoords.y = m.determinant(); - - m.setColumn(1, q1); - m.setColumn(2,q); - baryCoords.z = m.determinant(); - - if (det != 0.0f) { - baryCoords /= det; - } - - return baryCoords; -} - -/** - * - */ -void PhysxSoftBodyNode:: -update() { - - update_tetra_links(); -} - -/** - * - */ -bool PhysxSoftBodyNode:: -update_tetra_links() { - - if (_tetraLinks.size() != _vdata->get_num_rows()) - { - return false; - } - - NxU32 numVertices = *_mesh.numVerticesPtr; - NxU32 numTetrahedra = *_mesh.numIndicesPtr / 4; - const NxVec3 *vertices = (NxVec3*)_mesh.verticesPosBegin; - NxU32* indices = (NxU32*)_mesh.indicesBegin; - - GeomVertexRewriter vwriter = GeomVertexRewriter(_vdata, InternalName::get_vertex()); - - int i = 0; - while (!vwriter.is_at_end()) { - - TetraLink &link = _tetraLinks[i]; - - if (!_drainedTriVertices[i]) { - const NxU32 *ix = &indices[4*link.tetraNr]; - - if (*ix == *(ix + 1)) { - remove_tris_related_to_vertex(i); - _drainedTriVertices[i] = true; - continue; - } - - const NxVec3 &p0 = vertices[*ix++]; - const NxVec3 &p1 = vertices[*ix++]; - const NxVec3 &p2 = vertices[*ix++]; - const NxVec3 &p3 = vertices[*ix++]; - - NxVec3 &b = link.barycentricCoords; - NxVec3 tmp = p0 * b.x + p1 * b.y + p2 * b.z + p3 * (1.0f - b.x - b.y - b.z); - vwriter.set_data3f(tmp.x, tmp.y, tmp.z); - } - i++; - } - - update_normals(); - - return true; -} diff --git a/panda/src/physx/physxSoftBodyNode.h b/panda/src/physx/physxSoftBodyNode.h deleted file mode 100644 index 8f6cba7ba1..0000000000 --- a/panda/src/physx/physxSoftBodyNode.h +++ /dev/null @@ -1,94 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSoftBodyNode.h - * @author enn0x - * @date 2010-09-13 - */ - -#ifndef PHYSXSOFTBODYNODE_H -#define PHYSXSOFTBODYNODE_H - -#include "pandabase.h" -#include "pointerTo.h" -#include "geomNode.h" -#include "transformState.h" -#include "geom.h" -#include "geomVertexData.h" -#include "geomTriangles.h" -#include "filename.h" - -#include "physx_includes.h" - -class PhysxSoftBody; - -/** - * Renderable geometry which represents a soft body mesh. - */ -class EXPCL_PANDAPHYSX PhysxSoftBodyNode : public GeomNode { -PUBLISHED: - INLINE explicit PhysxSoftBodyNode(const char *name); - INLINE ~PhysxSoftBodyNode(); - - void set_from_geom(const Geom *geom); - -public: - void allocate(PhysxSoftBody *cloth); - void update(); - -private: - - struct TetraLink { - int tetraNr; - NxVec3 barycentricCoords; - }; - - void update_bounds(); - void build_tetra_links(); - bool update_tetra_links(); - void update_normals(); - void remove_tris_related_to_vertex(const int vertexIndex); - NxVec3 compute_bary_coords(NxVec3 vertex, NxVec3 p0, NxVec3 p1, NxVec3 p2, NxVec3 p3) const; - - pvector _tetraLinks; - pvector _drainedTriVertices; - pvector _normals; - - NxBounds3 _bounds; - NxMeshData _mesh; - - PT(GeomVertexData) _vdata; - PT(Geom) _geom; - PT(GeomTriangles) _prim; - - PT(PhysxSoftBody) _softbody; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - GeomNode::init_type(); - register_type(_type_handle, "PhysxSoftBodyNode", - GeomNode::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxSoftBodyNode.I" - -#endif // PHYSXSOFTBODYNODE_H diff --git a/panda/src/physx/physxSphere.I b/panda/src/physx/physxSphere.I deleted file mode 100644 index 6a9da28307..0000000000 --- a/panda/src/physx/physxSphere.I +++ /dev/null @@ -1,37 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphere.I - * @author enn0x - * @date 2009-10-31 - */ - -/** - * - */ -INLINE PhysxSphere:: -PhysxSphere() { - -} - -/** - * - */ -INLINE PhysxSphere:: -PhysxSphere(const PhysxSphere &sphere) { - - _sphere = sphere._sphere; -} - -/** - * - */ -INLINE PhysxSphere:: -~PhysxSphere() { - -} diff --git a/panda/src/physx/physxSphere.cxx b/panda/src/physx/physxSphere.cxx deleted file mode 100644 index b1060aa7a2..0000000000 --- a/panda/src/physx/physxSphere.cxx +++ /dev/null @@ -1,106 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphere.cxx - * @author enn0x - * @date 2009-10-31 - */ - -#include "physxSphere.h" -#include "physxManager.h" - -/** - * Returns TRUE if this sphere is valid. - */ -bool PhysxSphere:: -is_valid() const { - - return _sphere.IsValid(); -} - -/** - * Tests if a point is contained within the sphere. - */ -bool PhysxSphere:: -contains(const LPoint3f &p) const { - - nassertr(!p.is_nan(), false); - - return _sphere.Contains(PhysxManager::vec3_to_nxVec3(p)); -} - -/** - * Tests if a sphere is contained within the sphere. - */ -bool PhysxSphere:: -contains(const PhysxSphere &sphere) const { - - return _sphere.Contains(sphere._sphere); -} - -/** - * Tests if an axis aligned box is contained within the sphere. The axis - * aligned box is defined by the minimum corner and the maximum corner. - */ -bool PhysxSphere:: -contains(const LPoint3f &min, const LPoint3f &max) const { - - nassertr(!min.is_nan(), false); - nassertr(!max.is_nan(), false); - - return _sphere.Contains(PhysxManager::vec3_to_nxVec3(min), - PhysxManager::vec3_to_nxVec3(max)); -} - -/** - * Tests if the sphere intersects another sphere. Returns TRUE if the spheres - * overlap. - */ -bool PhysxSphere:: -intersect(const PhysxSphere &sphere) const { - - return _sphere.Intersect(sphere._sphere); -} - -/** - * Returns the center of the sphere. - */ -LPoint3f PhysxSphere:: -get_center() const { - - return PhysxManager::nxVec3_to_vec3(_sphere.center); -} - -/** - * Sets the center of the sphere. - */ -void PhysxSphere:: -set_center(LPoint3f center) { - - nassertv(!center.is_nan()); - - _sphere.center = PhysxManager::vec3_to_nxVec3(center); -} - -/** - * Returns the sphere's radius. - */ -float PhysxSphere:: -get_radius() const { - - return _sphere.radius; -} - -/** - * Sets the sphere's radius. - */ -void PhysxSphere:: -set_radius(float radius) { - - _sphere.radius = radius; -} diff --git a/panda/src/physx/physxSphere.h b/panda/src/physx/physxSphere.h deleted file mode 100644 index 09a9b4c492..0000000000 --- a/panda/src/physx/physxSphere.h +++ /dev/null @@ -1,50 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphere.h - * @author enn0x - * @date 2009-10-31 - */ - -#ifndef PHYSXSPHERE_H -#define PHYSXSPHERE_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -/** - * Represents a sphere defined by its center point and radius. - */ -class EXPCL_PANDAPHYSX PhysxSphere { - -PUBLISHED: - INLINE PhysxSphere(); - INLINE PhysxSphere(const PhysxSphere &sphere); - INLINE ~PhysxSphere(); - - bool contains(const LPoint3f &p) const; - bool contains(const PhysxSphere &sphere) const; - bool contains(const LPoint3f &min, const LPoint3f &max) const; - bool intersect(const PhysxSphere &sphere) const; - bool is_valid() const; - - LPoint3f get_center() const; - float get_radius() const; - - void set_center(LPoint3f value); - void set_radius(float value); - -public: - NxSphere _sphere; -}; - -#include "physxSphere.I" - -#endif // PHYSSPHERE_H diff --git a/panda/src/physx/physxSphereForceFieldShape.I b/panda/src/physx/physxSphereForceFieldShape.I deleted file mode 100644 index 78232f1fb8..0000000000 --- a/panda/src/physx/physxSphereForceFieldShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereForceFieldShape.I - * @author enn0x - * @date 2009-11-15 - */ - -/** - * - */ -INLINE PhysxSphereForceFieldShape:: -PhysxSphereForceFieldShape() : PhysxForceFieldShape() { - -} - -/** - * - */ -INLINE PhysxSphereForceFieldShape:: -~PhysxSphereForceFieldShape() { - -} diff --git a/panda/src/physx/physxSphereForceFieldShape.cxx b/panda/src/physx/physxSphereForceFieldShape.cxx deleted file mode 100644 index bb04de907a..0000000000 --- a/panda/src/physx/physxSphereForceFieldShape.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereForceFieldShape.cxx - * @author enn0x - * @date 2009-11-15 - */ - -#include "physxSphereForceFieldShape.h" -#include "physxSphereForceFieldShapeDesc.h" - -TypeHandle PhysxSphereForceFieldShape::_type_handle; - -/** - * - */ -void PhysxSphereForceFieldShape:: -link(NxForceFieldShape *shapePtr) { - - _ptr = shapePtr->isSphere(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.add(this); -} - -/** - * - */ -void PhysxSphereForceFieldShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxForceFieldShapeGroup *group = (PhysxForceFieldShapeGroup *)_ptr->getShapeGroup().userData; - group->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxSphereForceFieldShape:: -save_to_desc(PhysxSphereForceFieldShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Sets the sphere radius. - */ -void PhysxSphereForceFieldShape:: -set_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setRadius(radius); -} - -/** - * Returns the radius of the sphere. - */ -float PhysxSphereForceFieldShape:: -get_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRadius(); -} diff --git a/panda/src/physx/physxSphereForceFieldShape.h b/panda/src/physx/physxSphereForceFieldShape.h deleted file mode 100644 index 1f49e5eeb1..0000000000 --- a/panda/src/physx/physxSphereForceFieldShape.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereForceFieldShape.h - * @author enn0x - * @date 2009-11-15 - */ - -#ifndef PHYSXSPHEREFORCEFIELDSHAPE_H -#define PHYSXSPHEREFORCEFIELDSHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxForceFieldShape.h" -#include "physx_includes.h" - -class PhysxSphereForceFieldShapeDesc; - -/** - * A spherical force field shape. - */ -class EXPCL_PANDAPHYSX PhysxSphereForceFieldShape : public PhysxForceFieldShape { - -PUBLISHED: - INLINE PhysxSphereForceFieldShape(); - INLINE ~PhysxSphereForceFieldShape(); - - void save_to_desc(PhysxSphereForceFieldShapeDesc &shapeDesc) const; - - void set_radius(float radius); - - float get_radius() const; - -public: - INLINE NxForceFieldShape *ptr() const { return (NxForceFieldShape *)_ptr; }; - - void link(NxForceFieldShape *shapePtr); - void unlink(); - -private: - NxSphereForceFieldShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxForceFieldShape::init_type(); - register_type(_type_handle, "PhysxSphereForceFieldShape", - PhysxForceFieldShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxSphereForceFieldShape.I" - -#endif // PHYSXSPHEREFORCEFIELDSHAPE_H diff --git a/panda/src/physx/physxSphereForceFieldShapeDesc.I b/panda/src/physx/physxSphereForceFieldShapeDesc.I deleted file mode 100644 index efdd6e0525..0000000000 --- a/panda/src/physx/physxSphereForceFieldShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereForceFieldShapeDesc.I - * @author enn0x - * @date 2009-11-06 - */ - -/** - * - */ -INLINE PhysxSphereForceFieldShapeDesc:: -PhysxSphereForceFieldShapeDesc() : PhysxForceFieldShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxSphereForceFieldShapeDesc:: -~PhysxSphereForceFieldShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxSphereForceFieldShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxSphereForceFieldShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxSphereForceFieldShapeDesc.cxx b/panda/src/physx/physxSphereForceFieldShapeDesc.cxx deleted file mode 100644 index d6fd3dbe78..0000000000 --- a/panda/src/physx/physxSphereForceFieldShapeDesc.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereForceFieldShapeDesc.cxx - * @author enn0x - * @date 2009-11-06 - */ - -#include "physxSphereForceFieldShapeDesc.h" - -/** - * Radius of shape. Must be positive. - */ -void PhysxSphereForceFieldShapeDesc:: -set_radius(float radius) { - - _desc.radius = radius; -} - -/** - * Radius of shape. - */ -float PhysxSphereForceFieldShapeDesc:: -get_radius() const { - - return _desc.radius; -} diff --git a/panda/src/physx/physxSphereForceFieldShapeDesc.h b/panda/src/physx/physxSphereForceFieldShapeDesc.h deleted file mode 100644 index df9361bf89..0000000000 --- a/panda/src/physx/physxSphereForceFieldShapeDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereForceFieldShapeDesc.h - * @author enn0x - * @date 2009-11-06 - */ - -#ifndef PHYSXSPHEREFORCEFIELDSHAPEDESC_H -#define PHYSXSPHEREFORCEFIELDSHAPEDESC_H - -#include "pandabase.h" - -#include "physxForceFieldShapeDesc.h" -#include "physx_includes.h" - -/** - * A descriptor for a sphere force field shape. - */ -class EXPCL_PANDAPHYSX PhysxSphereForceFieldShapeDesc : public PhysxForceFieldShapeDesc { - -PUBLISHED: - INLINE PhysxSphereForceFieldShapeDesc(); - INLINE ~PhysxSphereForceFieldShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_radius(float radius); - - float get_radius() const; - -public: - NxForceFieldShapeDesc *ptr() const { return (NxForceFieldShapeDesc *)&_desc; }; - NxSphereForceFieldShapeDesc _desc; -}; - -#include "physxSphereForceFieldShapeDesc.I" - -#endif // PHYSXSPHEREFORCEFIELDSHAPEDESC_H diff --git a/panda/src/physx/physxSphereShape.I b/panda/src/physx/physxSphereShape.I deleted file mode 100644 index 880f09493c..0000000000 --- a/panda/src/physx/physxSphereShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereShape.I - * @author enn0x - * @date 2009-09-16 - */ - -/** - * - */ -INLINE PhysxSphereShape:: -PhysxSphereShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxSphereShape:: -~PhysxSphereShape() { - -} diff --git a/panda/src/physx/physxSphereShape.cxx b/panda/src/physx/physxSphereShape.cxx deleted file mode 100644 index a67a3b2062..0000000000 --- a/panda/src/physx/physxSphereShape.cxx +++ /dev/null @@ -1,76 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereShape.cxx - * @author enn0x - * @date 2009-09-16 - */ - -#include "physxSphereShape.h" -#include "physxSphereShapeDesc.h" - -TypeHandle PhysxSphereShape::_type_handle; - -/** - * - */ -void PhysxSphereShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isSphere(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxSphereShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxSphereShape:: -save_to_desc(PhysxSphereShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Sets the sphere radius. - */ -void PhysxSphereShape:: -set_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setRadius(radius); -} - -/** - * Returns the radius of the sphere. - */ -float PhysxSphereShape:: -get_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRadius(); -} diff --git a/panda/src/physx/physxSphereShape.h b/panda/src/physx/physxSphereShape.h deleted file mode 100644 index cb01666ee8..0000000000 --- a/panda/src/physx/physxSphereShape.h +++ /dev/null @@ -1,80 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereShape.h - * @author enn0x - * @date 2009-09-16 - */ - -#ifndef PHYSXSPHERESHAPE_H -#define PHYSXSPHERESHAPE_H - -#include "pandabase.h" -#include "luse.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxSphereShapeDesc; - -/** - * A sphere shaped collision detection primitive. Each shape is owned by an - * actor that it is attached to. - * - * An instance can be created by calling the createShape() method of the - * PhysxActor object that should own it, with a PhysxSphereShapeDesc object as - * the parameter, or by adding the shape descriptor into the PhysxActorDesc - * class before creating the actor. - * - * The shape is deleted by calling release() on the shape itself. - */ -class EXPCL_PANDAPHYSX PhysxSphereShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxSphereShape(); - INLINE ~PhysxSphereShape(); - - void save_to_desc(PhysxSphereShapeDesc &shapeDesc) const; - - void set_radius(float radius); - - float get_radius() const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxSphereShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxSphereShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxSphereShape.I" - -#endif // PHYSXSPHERESHAPE_H diff --git a/panda/src/physx/physxSphereShapeDesc.I b/panda/src/physx/physxSphereShapeDesc.I deleted file mode 100644 index 0cc60d3065..0000000000 --- a/panda/src/physx/physxSphereShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereShapeDesc.I - * @author enn0x - * @date 2009-09-11 - */ - -/** - * - */ -INLINE PhysxSphereShapeDesc:: -PhysxSphereShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxSphereShapeDesc:: -~PhysxSphereShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxSphereShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxSphereShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxSphereShapeDesc.cxx b/panda/src/physx/physxSphereShapeDesc.cxx deleted file mode 100644 index 16ab172d37..0000000000 --- a/panda/src/physx/physxSphereShapeDesc.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereShapeDesc.cxx - * @author enn0x - * @date 2009-09-11 - */ - -#include "physxSphereShapeDesc.h" - -/** - * Radius of shape. Must be positive. - */ -void PhysxSphereShapeDesc:: -set_radius(float radius) { - - _desc.radius = radius; -} - -/** - * Radius of shape. - */ -float PhysxSphereShapeDesc:: -get_radius() const { - - return _desc.radius; -} diff --git a/panda/src/physx/physxSphereShapeDesc.h b/panda/src/physx/physxSphereShapeDesc.h deleted file mode 100644 index fb7ea37705..0000000000 --- a/panda/src/physx/physxSphereShapeDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphereShapeDesc.h - * @author enn0x - * @date 2009-09-11 - */ - -#ifndef PHYSXSPHERESHAPEDESC_H -#define PHYSXSPHERESHAPEDESC_H - -#include "pandabase.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -/** - * Descriptor class for PhysxSphereShape. - */ -class EXPCL_PANDAPHYSX PhysxSphereShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxSphereShapeDesc(); - INLINE ~PhysxSphereShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_radius(float radius); - - float get_radius() const; - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxSphereShapeDesc _desc; -}; - -#include "physxSphereShapeDesc.I" - -#endif // PHYSXSPHERESHAPEDESC_H diff --git a/panda/src/physx/physxSphericalJoint.I b/panda/src/physx/physxSphericalJoint.I deleted file mode 100644 index e0b5cda439..0000000000 --- a/panda/src/physx/physxSphericalJoint.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphericalJoint.I - * @author enn0x - * @date 2009-10-02 - */ - -/** - * - */ -INLINE PhysxSphericalJoint:: -PhysxSphericalJoint() : PhysxJoint() { - -} - -/** - * - */ -INLINE PhysxSphericalJoint:: -~PhysxSphericalJoint() { - -} diff --git a/panda/src/physx/physxSphericalJoint.cxx b/panda/src/physx/physxSphericalJoint.cxx deleted file mode 100644 index 3dabd9bfe4..0000000000 --- a/panda/src/physx/physxSphericalJoint.cxx +++ /dev/null @@ -1,115 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphericalJoint.cxx - * @author enn0x - * @date 2009-10-02 - */ - -#include "physxSphericalJoint.h" -#include "physxSphericalJointDesc.h" - -TypeHandle PhysxSphericalJoint::_type_handle; - -/** - * - */ -void PhysxSphericalJoint:: -link(NxJoint *jointPtr) { - - _ptr = jointPtr->isSphericalJoint(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(jointPtr->getName()); - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.add(this); -} - -/** - * - */ -void PhysxSphericalJoint:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxScene *scene = (PhysxScene *)_ptr->getScene().userData; - scene->_joints.remove(this); -} - -/** - * Saves the state of the joint object to a descriptor. - */ -void PhysxSphericalJoint:: -save_to_desc(PhysxSphericalJointDesc &jointDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(jointDesc._desc); -} - -/** - * Loads the entire state of the joint from a descriptor with a single call. - */ -void PhysxSphericalJoint:: -load_from_desc(const PhysxSphericalJointDesc &jointDesc) { - - nassertv(_error_type == ET_ok); - _ptr->loadFromDesc(jointDesc._desc); -} - -/** - * Sets the joint projection mode. - */ -void PhysxSphericalJoint:: -set_projection_mode(PhysxProjectionMode mode) { - - nassertv(_error_type == ET_ok); - _ptr->setProjectionMode((NxJointProjectionMode)mode); -} - -/** - * Returns the current projection mode settings. - */ -PhysxEnums::PhysxProjectionMode PhysxSphericalJoint:: -get_projection_mode() const { - - nassertr(_error_type == ET_ok, PM_none); - return (PhysxProjectionMode)_ptr->getProjectionMode(); -} - -/** - * Sets or clears a single SphericalJointFlag. - */ -void PhysxSphericalJoint:: -set_flag(PhysxSphericalJointFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - NxU32 flags = _ptr->getFlags(); - - if (value == true) { - flags |= flag; - } - else { - flags &= ~(flag); - } - - _ptr->setFlags(flags); -} - -/** - * Returns the value of a single SphericalJointFlag. - */ -bool PhysxSphericalJoint:: -get_flag(PhysxSphericalJointFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getFlags() & flag) ? true : false; -} diff --git a/panda/src/physx/physxSphericalJoint.h b/panda/src/physx/physxSphericalJoint.h deleted file mode 100644 index e8e44e37a1..0000000000 --- a/panda/src/physx/physxSphericalJoint.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphericalJoint.h - * @author enn0x - * @date 2009-10-02 - */ - -#ifndef PHYSXSPHERICALJOINT_H -#define PHYSXSPHERICALJOINT_H - -#include "pandabase.h" - -#include "physxJoint.h" -#include "physx_includes.h" - -class PhysxSphericalJointDesc; - -/** - * A sphere joint constrains two points on two bodies to coincide. This - * point, specified in world space (this guarantees that the points coincide - * to start with) is the only parameter that has to be specified. - */ -class EXPCL_PANDAPHYSX PhysxSphericalJoint : public PhysxJoint { - -PUBLISHED: - INLINE PhysxSphericalJoint(); - INLINE ~PhysxSphericalJoint(); - - void save_to_desc(PhysxSphericalJointDesc &jointDesc) const; - void load_from_desc(const PhysxSphericalJointDesc &jointDesc); - - void set_flag(PhysxSphericalJointFlag flag, bool value); - void set_projection_mode(PhysxProjectionMode mode); - - bool get_flag(PhysxSphericalJointFlag flag) const; - PhysxProjectionMode get_projection_mode() const; - -public: - INLINE NxJoint *ptr() const { return (NxJoint *)_ptr; }; - - void link(NxJoint *jointPtr); - void unlink(); - -private: - NxSphericalJoint *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxJoint::init_type(); - register_type(_type_handle, "PhysxSphericalJoint", - PhysxJoint::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxSphericalJoint.I" - -#endif // PHYSXSPHERICALJOINT_H diff --git a/panda/src/physx/physxSphericalJointDesc.I b/panda/src/physx/physxSphericalJointDesc.I deleted file mode 100644 index 6c7302b777..0000000000 --- a/panda/src/physx/physxSphericalJointDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphericalJointDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxSphericalJointDesc:: -PhysxSphericalJointDesc() : PhysxJointDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxSphericalJointDesc:: -~PhysxSphericalJointDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxSphericalJointDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxSphericalJointDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxSphericalJointDesc.cxx b/panda/src/physx/physxSphericalJointDesc.cxx deleted file mode 100644 index a87b755a2b..0000000000 --- a/panda/src/physx/physxSphericalJointDesc.cxx +++ /dev/null @@ -1,215 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphericalJointDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxSphericalJointDesc.h" -#include "physxManager.h" -#include "physxSpringDesc.h" -#include "physxJointLimitDesc.h" - -/** - * Set the distance above which to project joint. - */ -void PhysxSphericalJointDesc:: -set_projection_distance(float distance) { - - _desc.projectionDistance = distance; -} - -/** - * Sets or clears a single SphericalJointFlag flag. - */ -void PhysxSphericalJointDesc:: -set_flag(PhysxSphericalJointFlag flag, bool value) { - - if (value == true) { - _desc.flags |= flag; - } - else { - _desc.flags &= ~(flag); - } -} - -/** - * Sets a spring that works against twisting. - */ -void PhysxSphericalJointDesc:: -set_twist_spring(const PhysxSpringDesc &spring) { - - _desc.twistSpring = spring._desc; -} - -/** - * Sets a spring that works against swinging. - */ -void PhysxSphericalJointDesc:: -set_swing_spring(const PhysxSpringDesc &spring) { - - _desc.swingSpring = spring._desc; -} - -/** - * Sets a spring that lets the joint get pulled apart. - */ -void PhysxSphericalJointDesc:: -set_joint_spring(const PhysxSpringDesc &spring) { - - _desc.jointSpring = spring._desc; -} - -/** - * Set the swing limit axis defined in the joint space of actor 0. - */ -void PhysxSphericalJointDesc:: -set_swing_axis(const LVector3f &axis) { - - nassertv( !axis.is_nan() ); - _desc.swingAxis = PhysxManager::vec3_to_nxVec3(axis); -} - -/** - * Use this to enable joint projection. Default is PM_none. - */ -void PhysxSphericalJointDesc:: -set_projection_mode(PhysxProjectionMode mode) { - - _desc.projectionMode = (NxJointProjectionMode)mode; -} - -/** - * Limits rotation around twist axis. - */ -void PhysxSphericalJointDesc:: -set_twist_limit_low(const PhysxJointLimitDesc &low) { - - _desc.twistLimit.low = low._desc; -} - -/** - * Limits rotation around twist axis. - */ -void PhysxSphericalJointDesc:: -set_twist_limit_high(const PhysxJointLimitDesc &high) { - - _desc.twistLimit.high = high._desc; -} - -/** - * Limits swing of twist axis. - */ -void PhysxSphericalJointDesc:: -set_swing_limit(const PhysxJointLimitDesc &limit) { - - _desc.swingLimit = limit._desc; -} - -/** - * - */ -float PhysxSphericalJointDesc:: -get_projection_distance() const { - - return _desc.projectionDistance; -} - -/** - * - */ -bool PhysxSphericalJointDesc:: -get_flag(PhysxSphericalJointFlag flag) const { - - return (_desc.flags & flag) ? true : false; -} - -/** - * - */ -PhysxSpringDesc PhysxSphericalJointDesc:: -get_twist_spring() const { - - PhysxSpringDesc value; - value._desc = _desc.twistSpring; - return value; -} - -/** - * - */ -PhysxSpringDesc PhysxSphericalJointDesc:: -get_swing_spring() const { - - PhysxSpringDesc value; - value._desc = _desc.swingSpring; - return value; -} - -/** - * - */ -PhysxSpringDesc PhysxSphericalJointDesc:: -get_joint_spring() const { - - PhysxSpringDesc value; - value._desc = _desc.jointSpring; - return value; -} - -/** - * - */ -LVector3f PhysxSphericalJointDesc:: -get_swing_axis() const { - - return PhysxManager::nxVec3_to_vec3(_desc.swingAxis); -} - -/** - * - */ -PhysxEnums::PhysxProjectionMode PhysxSphericalJointDesc:: -get_projection_mode() const { - - return (PhysxProjectionMode)_desc.projectionMode; -} - -/** - * - */ -PhysxJointLimitDesc PhysxSphericalJointDesc:: -get_twist_limit_low() const { - - PhysxJointLimitDesc value; - value._desc = _desc.twistLimit.low; - return value; -} - -/** - * - */ -PhysxJointLimitDesc PhysxSphericalJointDesc:: -get_twist_limit_high() const { - - PhysxJointLimitDesc value; - value._desc = _desc.twistLimit.high; - return value; -} - -/** - * Limits swing of twist axis. - */ -PhysxJointLimitDesc PhysxSphericalJointDesc:: -get_swing_limit() const { - - PhysxJointLimitDesc value; - value._desc = _desc.swingLimit; - return value; -} diff --git a/panda/src/physx/physxSphericalJointDesc.h b/panda/src/physx/physxSphericalJointDesc.h deleted file mode 100644 index 31bb011ed0..0000000000 --- a/panda/src/physx/physxSphericalJointDesc.h +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSphericalJointDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXSPHERICALJOINTDESC_H -#define PHYSXSPHERICALJOINTDESC_H - -#include "pandabase.h" - -#include "physxJointDesc.h" -#include "physx_includes.h" - -class PhysxSpringDesc; -class PhysxJointLimitDesc; - -/** - * Descriptor class for distance joint. See PhysxSphericalJoint. - */ -class EXPCL_PANDAPHYSX PhysxSphericalJointDesc : public PhysxJointDesc { - -PUBLISHED: - INLINE PhysxSphericalJointDesc(); - INLINE ~PhysxSphericalJointDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_projection_distance(float distance); - void set_flag(PhysxSphericalJointFlag flag, bool value); - void set_swing_axis(const LVector3f &axis); - void set_twist_spring(const PhysxSpringDesc &spring); - void set_swing_spring(const PhysxSpringDesc &spring); - void set_joint_spring(const PhysxSpringDesc &spring); - void set_twist_limit_low(const PhysxJointLimitDesc &low); - void set_twist_limit_high(const PhysxJointLimitDesc &high); - void set_swing_limit(const PhysxJointLimitDesc &limit); - void set_projection_mode(PhysxProjectionMode mode); - - float get_projection_distance() const; - bool get_flag(PhysxSphericalJointFlag flag) const; - LVector3f get_swing_axis() const; - PhysxSpringDesc get_twist_spring() const; - PhysxSpringDesc get_swing_spring() const; - PhysxSpringDesc get_joint_spring() const; - PhysxJointLimitDesc get_twist_limit_low() const; - PhysxJointLimitDesc get_twist_limit_high() const; - PhysxJointLimitDesc get_swing_limit() const; - PhysxProjectionMode get_projection_mode() const; - -public: - NxJointDesc *ptr() const { return (NxJointDesc *)&_desc; }; - NxSphericalJointDesc _desc; -}; - -#include "physxSphericalJointDesc.I" - -#endif // PHYSXSPHERICALJOINTDESC_H diff --git a/panda/src/physx/physxSpringDesc.I b/panda/src/physx/physxSpringDesc.I deleted file mode 100644 index a3bd8e16cf..0000000000 --- a/panda/src/physx/physxSpringDesc.I +++ /dev/null @@ -1,39 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSpringDesc.I - * @author enn0x - * @date 2009-09-28 - */ - -/** - * - */ -INLINE PhysxSpringDesc:: -PhysxSpringDesc() { - -} - -/** - * - */ -INLINE PhysxSpringDesc:: -PhysxSpringDesc(float spring, float damper, float target) { - - _desc.spring = spring; - _desc.damper = damper; - _desc.targetValue = target; -} - -/** - * - */ -INLINE PhysxSpringDesc:: -~PhysxSpringDesc() { - -} diff --git a/panda/src/physx/physxSpringDesc.cxx b/panda/src/physx/physxSpringDesc.cxx deleted file mode 100644 index 1a4a00afa4..0000000000 --- a/panda/src/physx/physxSpringDesc.cxx +++ /dev/null @@ -1,68 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSpringDesc.cxx - * @author enn0x - * @date 2009-09-28 - */ - -#include "physxSpringDesc.h" - -/** - * - */ -void PhysxSpringDesc:: -set_spring(float spring) { - - _desc.spring = spring; -} - -/** - * - */ -void PhysxSpringDesc:: -set_damper(float damper) { - - _desc.damper = damper; -} - -/** - * - */ -void PhysxSpringDesc:: -set_target_value(float targetValue) { - - _desc.targetValue = targetValue; -} - -/** - * - */ -float PhysxSpringDesc:: -get_spring() const { - - return _desc.spring; -} - -/** - * - */ -float PhysxSpringDesc:: -get_damper() const { - - return _desc.damper; -} - -/** - * - */ -float PhysxSpringDesc:: -get_target_value() const { - - return _desc.targetValue; -} diff --git a/panda/src/physx/physxSpringDesc.h b/panda/src/physx/physxSpringDesc.h deleted file mode 100644 index 3bb5086c8c..0000000000 --- a/panda/src/physx/physxSpringDesc.h +++ /dev/null @@ -1,46 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxSpringDesc.h - * @author enn0x - * @date 2009-09-28 - */ - -#ifndef PHYSXSPRINGDESC_H -#define PHYSXSPRINGDESC_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * Describes a joint spring. The spring is implicitly integrated, so even - * high spring and damper coefficients should be robust. - */ -class EXPCL_PANDAPHYSX PhysxSpringDesc { - -PUBLISHED: - INLINE PhysxSpringDesc(); - INLINE PhysxSpringDesc(float spring, float damper=0, float targetValue=0); - INLINE ~PhysxSpringDesc(); - - void set_spring(float spring); - void set_damper(float damper); - void set_target_value(float target); - - float get_spring() const; - float get_damper() const; - float get_target_value() const; - -public: - NxSpringDesc _desc; -}; - -#include "physxSpringDesc.I" - -#endif // PHYSXSPRINGDESC_H diff --git a/panda/src/physx/physxTriangleMesh.I b/panda/src/physx/physxTriangleMesh.I deleted file mode 100644 index d4e6a6e994..0000000000 --- a/panda/src/physx/physxTriangleMesh.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMesh.I - * @author enn0x - * @date 2009-10-14 - */ - -/** - * - */ -INLINE PhysxTriangleMesh:: -PhysxTriangleMesh() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxTriangleMesh:: -~PhysxTriangleMesh() { - -} - -/** - * - */ -INLINE void PhysxTriangleMesh:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxTriangleMesh:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxTriangleMesh.cxx b/panda/src/physx/physxTriangleMesh.cxx deleted file mode 100644 index 2b3d81280c..0000000000 --- a/panda/src/physx/physxTriangleMesh.cxx +++ /dev/null @@ -1,66 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMesh.cxx - * @author enn0x - * @date 2009-10-14 - */ - -#include "physxTriangleMesh.h" -#include "physxMeshPool.h" - -TypeHandle PhysxTriangleMesh::_type_handle; - -/** - * - */ -void PhysxTriangleMesh:: -link(NxTriangleMesh *meshPtr) { - - // Link self - PhysxManager::get_global_ptr()->_triangle_meshes.add(this); - _ptr = meshPtr; - _error_type = ET_ok; -} - -/** - * - */ -void PhysxTriangleMesh:: -unlink() { - - // Unlink self - _error_type = ET_released; - PhysxManager::get_global_ptr()->_triangle_meshes.remove(this); -} - -/** - * - */ -void PhysxTriangleMesh:: -release() { - - nassertv(_error_type == ET_ok); - - unlink(); - NxGetPhysicsSDK()->releaseTriangleMesh(*_ptr); - _ptr = nullptr; - - PhysxMeshPool::release_triangle_mesh(this); -} - -/** - * Returns the reference count for shared meshes. - */ -unsigned int PhysxTriangleMesh:: -get_reference_count() const { - - nassertr(_error_type == ET_ok, 0); - - return _ptr->getReferenceCount(); -} diff --git a/panda/src/physx/physxTriangleMesh.h b/panda/src/physx/physxTriangleMesh.h deleted file mode 100644 index 691e012a3f..0000000000 --- a/panda/src/physx/physxTriangleMesh.h +++ /dev/null @@ -1,71 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMesh.h - * @author enn0x - * @date 2009-10-14 - */ - -#ifndef PHYSXTRIANGLEMESH_H -#define PHYSXTRIANGLEMESH_H - -#include "pandabase.h" - -#include "physxObject.h" -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxTriangleMesh : public PhysxObject { - -PUBLISHED: - unsigned int get_reference_count() const; - -PUBLISHED: - void release(); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -public: - INLINE PhysxTriangleMesh(); - INLINE ~PhysxTriangleMesh(); - - INLINE NxTriangleMesh *ptr() const { return _ptr; }; - - void link(NxTriangleMesh *meshPtr); - void unlink(); - -private: - NxTriangleMesh *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxTriangleMesh", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxTriangleMesh.I" - -#endif // PHYSXTRIANGLEMESH_H diff --git a/panda/src/physx/physxTriangleMeshDesc.I b/panda/src/physx/physxTriangleMeshDesc.I deleted file mode 100644 index e337b35d18..0000000000 --- a/panda/src/physx/physxTriangleMeshDesc.I +++ /dev/null @@ -1,59 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshDesc.I - * @author enn0x - * @date 2009-10-11 - */ - -/** - * - */ -INLINE PhysxTriangleMeshDesc:: -PhysxTriangleMeshDesc() { - - _desc.flags = 0; - _desc.pointStrideBytes = sizeof(NxVec3); - _desc.triangleStrideBytes = 3*sizeof(NxU32); - _desc.materialIndexStride = sizeof(NxMaterialIndex); - _desc.points = nullptr; - _desc.triangles = nullptr; - _desc.materialIndices = nullptr; - - _vertices = nullptr; - _triangles = nullptr; - _materials = nullptr; -} - -/** - * - */ -INLINE PhysxTriangleMeshDesc:: -~PhysxTriangleMeshDesc() { - - if (_vertices) { - delete [] _vertices; - } - - if (_triangles) { - delete [] _triangles; - } - - if (_materials) { - delete [] _materials; - } -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxTriangleMeshDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxTriangleMeshDesc.cxx b/panda/src/physx/physxTriangleMeshDesc.cxx deleted file mode 100644 index 896d3cb98b..0000000000 --- a/panda/src/physx/physxTriangleMeshDesc.cxx +++ /dev/null @@ -1,191 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshDesc.cxx - * @author enn0x - * @date 2009-10-11 - */ - -#include "physxTriangleMeshDesc.h" -#include "physxManager.h" - -#include "nodePathCollection.h" -#include "geomNode.h" -#include "geomVertexReader.h" - -/** - * Sets the number of vertices to be stored within this triangle mesh. The - * function allocates memory for the vertices, but it does not set any - * vertices. - * - * This method must be called before any calls to set_vertex are done! - */ -void PhysxTriangleMeshDesc:: -set_num_vertices(unsigned int numVertices) { - - if (_desc.points) { - delete [] _vertices; - } - - _vertices = new NxVec3[numVertices]; - - _desc.numVertices = numVertices; - _desc.points = _vertices; -} - -/** - * Sets a single vertex. You have to call the function set_num_vertices - * before you can call this function. - */ -void PhysxTriangleMeshDesc:: -set_vertex(unsigned int idx, const LPoint3f &vert) { - - nassertv(_desc.numVertices > idx); - _vertices[idx] = PhysxManager::point3_to_nxVec3(vert); -} - -/** - * Sets the number of triangles to be stored in this triangle mesh. - * - * This method must be called before any calls to set_triangle are done! - */ -void PhysxTriangleMeshDesc:: -set_num_triangles(unsigned int numTriangles, bool use_material_indices) { - - if (_desc.triangles) { - delete [] _triangles; - } - - if (_desc.materialIndices) { - delete [] _materials; - } - - _triangles = new NxU32[3 * numTriangles]; - - _desc.numTriangles = numTriangles; - _desc.triangles = _triangles; - - if (use_material_indices == true) { - _materials = new NxMaterialIndex[numTriangles]; - _desc.materialIndices = _materials; - } -} - -/** - * Sets a single triangle, by providing the three indices i1, i2, i3. - */ -void PhysxTriangleMeshDesc:: -set_triangle(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3, - unsigned int material_index) { - - nassertv(_desc.numTriangles > idx); - - if (_desc.materialIndices) { - _materials[idx] = (NxMaterialIndex) material_index; - } - - idx = 3 * idx; - _triangles[idx] = i1; - _triangles[idx + 1] = i2; - _triangles[idx + 2] = i3; -} - -/** - * - */ -const NxTriangleMeshDesc &PhysxTriangleMeshDesc:: -get_desc() const { - - return _desc; -} - -/** - * A convenience method to set the mesh data from a NodePath in a single call. - * The method iterates over the NodePath geoms and collects data for the - * triangle mesh. - * - * Do not use the following function when using this one: - set_num_vertices - - * set_vertex - set_num_triangles - set_triangle - */ -void PhysxTriangleMeshDesc:: -set_from_node_path(const NodePath &np) { - - pvector dataVertices; - pvector dataIndices; - - // Collect data from NodePath - NodePathCollection npc = np.find_all_matches( "**/+GeomNode" ); - for (int i=0; iget_num_geoms(); j++) { - CPT(Geom) geom = gnode->get_geom(j); - - // Vertices - CPT(GeomVertexData) vdata = geom->get_vertex_data(); - GeomVertexReader reader = GeomVertexReader(vdata, InternalName::get_vertex()); - - while (!reader.is_at_end()) { - dataVertices.push_back(reader.get_data3f()); - } - - // Indices - for (int k=0; kget_num_primitives(); k++) { - - CPT(GeomPrimitive) prim = geom->get_primitive(k); - prim = prim->decompose(); - - for (int l=0; lget_num_primitives(); l++) { - - int s = prim->get_primitive_start(l); - int e = prim->get_primitive_end(l); - - for (int l=s; lget_vertex(l)); - } - } - } - } - } - - // Set descriptor members - int i; - - NxU32 numVertices = dataVertices.size(); - NxU32 numTriangles = dataIndices.size() / 3; - - _vertices = new NxVec3[numVertices]; - _triangles = new NxU32[3 * numTriangles]; - - i = 0; - pvector::const_iterator vit; - for (vit=dataVertices.begin(); vit!=dataVertices.end(); vit++) { - LPoint3f v = *vit; - - _vertices[i].x = v.get_x(); - _vertices[i].y = v.get_y(); - _vertices[i].z = v.get_z(); - i++; - } - - i = 0; - pvector::const_iterator iit; - for(iit=dataIndices.begin(); iit!=dataIndices.end(); iit++) { - NxU32 idx = *iit; - - _triangles[i] = idx; - i++; - } - - _desc.numVertices = numVertices; - _desc.points = _vertices; - _desc.numTriangles = numTriangles; - _desc.triangles = _triangles; -} diff --git a/panda/src/physx/physxTriangleMeshDesc.h b/panda/src/physx/physxTriangleMeshDesc.h deleted file mode 100644 index 60b9503964..0000000000 --- a/panda/src/physx/physxTriangleMeshDesc.h +++ /dev/null @@ -1,56 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshDesc.h - * @author enn0x - * @date 2009-10-11 - */ - -#ifndef PHYSXTRIANGLEMESHDESC_H -#define PHYSXTRIANGLEMESHDESC_H - -#include "pandabase.h" -#include "nodePath.h" -#include "luse.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxTriangleMeshDesc { - -PUBLISHED: - INLINE PhysxTriangleMeshDesc(); - INLINE ~PhysxTriangleMeshDesc(); - - INLINE bool is_valid() const; - - void set_num_vertices(unsigned int n); - void set_vertex(unsigned int idx, const LPoint3f &vert); - - void set_num_triangles(unsigned int n, bool use_material_indices=false); - void set_triangle(unsigned int idx, - unsigned int i1, unsigned int i2, unsigned int i3, - unsigned int material_index=1); - - void set_from_node_path(const NodePath &np); - -public: - const NxTriangleMeshDesc &get_desc() const; - -private: - NxVec3 *_vertices; - NxU32 *_triangles; - NxMaterialIndex *_materials; - NxTriangleMeshDesc _desc; -}; - -#include "physxTriangleMeshDesc.I" - -#endif // PHYSXTRIANGLEMESHDESC_H diff --git a/panda/src/physx/physxTriangleMeshShape.I b/panda/src/physx/physxTriangleMeshShape.I deleted file mode 100644 index 35890f2bfb..0000000000 --- a/panda/src/physx/physxTriangleMeshShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshShape.I - * @author enn0x - * @date 2009-10-14 - */ - -/** - * - */ -INLINE PhysxTriangleMeshShape:: -PhysxTriangleMeshShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxTriangleMeshShape:: -~PhysxTriangleMeshShape() { - -} diff --git a/panda/src/physx/physxTriangleMeshShape.cxx b/panda/src/physx/physxTriangleMeshShape.cxx deleted file mode 100644 index eaa57db4fc..0000000000 --- a/panda/src/physx/physxTriangleMeshShape.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshShape.cxx - * @author enn0x - * @date 2009-10-14 - */ - -#include "physxTriangleMeshShape.h" -#include "physxTriangleMeshShapeDesc.h" - -TypeHandle PhysxTriangleMeshShape::_type_handle; - -/** - * - */ -void PhysxTriangleMeshShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isTriangleMesh(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxTriangleMeshShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxTriangleMeshShape:: -save_to_desc(PhysxTriangleMeshShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} diff --git a/panda/src/physx/physxTriangleMeshShape.h b/panda/src/physx/physxTriangleMeshShape.h deleted file mode 100644 index 57d49311ad..0000000000 --- a/panda/src/physx/physxTriangleMeshShape.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshShape.h - * @author enn0x - * @date 2009-10-14 - */ - -#ifndef PHYSXTRIANGLEMESHSHAPE_H -#define PHYSXTRIANGLEMESHSHAPE_H - -#include "pandabase.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxTriangleMeshShapeDesc; - -/** - * A shapes which is used to represent an instance of an convex mesh. - */ -class EXPCL_PANDAPHYSX PhysxTriangleMeshShape : public PhysxShape { - -PUBLISHED: - INLINE PhysxTriangleMeshShape(); - INLINE ~PhysxTriangleMeshShape(); - - void save_to_desc(PhysxTriangleMeshShapeDesc &shapeDesc) const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxTriangleMeshShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxTriangleMeshShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxTriangleMeshShape.I" - -#endif // PHYSXTRIANGLEMESHSHAPE_H diff --git a/panda/src/physx/physxTriangleMeshShapeDesc.I b/panda/src/physx/physxTriangleMeshShapeDesc.I deleted file mode 100644 index 21c33397bf..0000000000 --- a/panda/src/physx/physxTriangleMeshShapeDesc.I +++ /dev/null @@ -1,48 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshShapeDesc.I - * @author enn0x - * @date 2009-10-14 - */ - -/** - * - */ -INLINE PhysxTriangleMeshShapeDesc:: -PhysxTriangleMeshShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxTriangleMeshShapeDesc:: -~PhysxTriangleMeshShapeDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxTriangleMeshShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxTriangleMeshShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxTriangleMeshShapeDesc.cxx b/panda/src/physx/physxTriangleMeshShapeDesc.cxx deleted file mode 100644 index 8a1be92e42..0000000000 --- a/panda/src/physx/physxTriangleMeshShapeDesc.cxx +++ /dev/null @@ -1,24 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshShapeDesc.cxx - * @author enn0x - * @date 2009-10-14 - */ - -#include "physxTriangleMeshShapeDesc.h" -#include "physxTriangleMesh.h" - -/** - * - */ -void PhysxTriangleMeshShapeDesc:: -set_mesh(PhysxTriangleMesh *mesh) { - - _desc.meshData = mesh->ptr(); -} diff --git a/panda/src/physx/physxTriangleMeshShapeDesc.h b/panda/src/physx/physxTriangleMeshShapeDesc.h deleted file mode 100644 index 864f00a0e9..0000000000 --- a/panda/src/physx/physxTriangleMeshShapeDesc.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriangleMeshShapeDesc.h - * @author enn0x - * @date 2009-10-14 - */ - -#ifndef PHYSXTRIANGLEMESHSHAPEDESC_H -#define PHYSXTRIANGLEMESHSHAPEDESC_H - -#include "pandabase.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -class PhysxTriangleMesh; - -/** - * Descriptor class for PhysxTriangleMeshShape. - */ -class EXPCL_PANDAPHYSX PhysxTriangleMeshShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxTriangleMeshShapeDesc(); - INLINE ~PhysxTriangleMeshShapeDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - - void set_mesh(PhysxTriangleMesh *mesh); - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxTriangleMeshShapeDesc _desc; -}; - -#include "physxTriangleMeshShapeDesc.I" - -#endif // PHYSXTRIANGLEMESHSHAPEDESC_H diff --git a/panda/src/physx/physxTriggerReport.I b/panda/src/physx/physxTriggerReport.I deleted file mode 100644 index 33f288ab55..0000000000 --- a/panda/src/physx/physxTriggerReport.I +++ /dev/null @@ -1,29 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriggerReport.I - * @author enn0x - * @date 2009-09-19 - */ - -/** - * - */ -INLINE PhysxTriggerReport:: -PhysxTriggerReport() : NxUserTriggerReport() { - - _enabled = false; -} - -/** - * - */ -INLINE PhysxTriggerReport:: -~PhysxTriggerReport() { - -} diff --git a/panda/src/physx/physxTriggerReport.cxx b/panda/src/physx/physxTriggerReport.cxx deleted file mode 100644 index 6d0ad2cf3e..0000000000 --- a/panda/src/physx/physxTriggerReport.cxx +++ /dev/null @@ -1,83 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriggerReport.cxx - * @author enn0x - * @date 2009-09-19 - */ - -#include "physxTriggerReport.h" - -#include "event.h" -#include "eventQueue.h" -#include "eventParameter.h" - -PStatCollector PhysxTriggerReport::_pcollector("App:PhysX:Trigger Reporting"); - -/** - * - */ -void PhysxTriggerReport:: -enable() { - - _enabled = true; -} - -/** - * - */ -void PhysxTriggerReport:: -disable() { - - _enabled = false; -} - -/** - * - */ -bool PhysxTriggerReport:: -is_enabled() const { - - return _enabled; -} - -/** - * - */ -void PhysxTriggerReport:: -onTrigger(NxShape &triggerShape, NxShape &otherShape, NxTriggerFlag status) { - - if (!_enabled) { - return; - } - - _pcollector.start(); - - Event *event; - if (status & NX_TRIGGER_ON_ENTER) { - event = new Event("physx-trigger-enter"); - } - else if (status & NX_TRIGGER_ON_LEAVE) { - event = new Event("physx-trigger-leave"); - } - else if (status & NX_TRIGGER_ON_STAY) { - event = new Event("physx-trigger-stay"); - } - else { - return; - } - - PT(PhysxShape) pTriggerShape = (PhysxShape *)triggerShape.userData; - PT(PhysxShape) pOtherShape = (PhysxShape *)otherShape.userData; - event->add_parameter(EventParameter(pTriggerShape)); - event->add_parameter(EventParameter(pOtherShape)); - - EventQueue::get_global_event_queue()->queue_event(event); - - _pcollector.stop(); -} diff --git a/panda/src/physx/physxTriggerReport.h b/panda/src/physx/physxTriggerReport.h deleted file mode 100644 index 3a8d37cc3d..0000000000 --- a/panda/src/physx/physxTriggerReport.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxTriggerReport.h - * @author enn0x - * @date 2009-09-19 - */ - -#ifndef PHYSXTRIGGERREPORT_H -#define PHYSXTRIGGERREPORT_H - -#include "pandabase.h" -#include "pStatCollector.h" - -#include "physx_includes.h" - -/** - * Implementation of the NxUserTriggerReport interface. - */ -class EXPCL_PANDAPHYSX PhysxTriggerReport : public NxUserTriggerReport { - -public: - INLINE PhysxTriggerReport(); - INLINE ~PhysxTriggerReport(); - - void enable(); - void disable(); - bool is_enabled() const; - - void onTrigger(NxShape &triggerShape, NxShape &otherShape, NxTriggerFlag status); - -private: - bool _enabled; - static PStatCollector _pcollector; -}; - -#include "physxTriggerReport.I" - -#endif // PHYSXTRIGGERREPORT_H diff --git a/panda/src/physx/physxUtilLib.I b/panda/src/physx/physxUtilLib.I deleted file mode 100644 index dcdcb328ae..0000000000 --- a/panda/src/physx/physxUtilLib.I +++ /dev/null @@ -1,30 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxUtilLib.I - * @author enn0x - * @date 2009-11-01 - */ - -/** - * - */ -INLINE PhysxUtilLib:: -PhysxUtilLib() { - - _ptr = NxGetUtilLib(); -} - -/** - * - */ -INLINE PhysxUtilLib:: -~PhysxUtilLib() { - - _ptr = nullptr; -} diff --git a/panda/src/physx/physxUtilLib.cxx b/panda/src/physx/physxUtilLib.cxx deleted file mode 100644 index fa26d10883..0000000000 --- a/panda/src/physx/physxUtilLib.cxx +++ /dev/null @@ -1,858 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxUtilLib.cxx - * @author enn0x - * @date 2009-11-01 - */ - -#include "physxUtilLib.h" -#include "physxManager.h" -#include "physxBounds3.h" -#include "physxBox.h" -#include "physxCapsule.h" -#include "physxPlane.h" -#include "physxRay.h" -#include "physxSegment.h" -#include "physxSphere.h" - -/** - * Set FPU precision. - */ -void PhysxUtilLib:: -set_fpu_exceptions(bool b) { - - _ptr->NxSetFPUExceptions(b); -} - -/** - * Set FPU precision. - */ -void PhysxUtilLib:: -set_fpu_precision24() { - - _ptr->NxSetFPUPrecision24(); -} - -/** - * Set FPU precision. - */ -void PhysxUtilLib:: -set_fpu_precision53() { - - _ptr->NxSetFPUPrecision53(); -} - -/** - * Set FPU precision. - */ -void PhysxUtilLib:: -set_fpu_precision64() { - - _ptr->NxSetFPUPrecision64(); -} - -/** - * Set FPU precision. - */ -void PhysxUtilLib:: -set_fpu_rounding_chop() { - - _ptr->NxSetFPURoundingChop(); -} - -/** - * Set FPU rounding mode. - */ -void PhysxUtilLib:: -set_fpu_rounding_down() { - - _ptr->NxSetFPURoundingDown(); -} - -/** - * Set FPU rounding mode. - */ -void PhysxUtilLib:: -set_fpu_rounding_near() { - - _ptr->NxSetFPURoundingNear(); -} - -/** - * Set FPU rounding mode. - */ -void PhysxUtilLib:: -set_fpu_rounding_up() { - - _ptr->NxSetFPURoundingUp(); -} - -/** - * Convert a floating point number to an integer. - */ -int PhysxUtilLib:: -int_ceil(const float &f) { - - return _ptr->NxIntCeil(f); -} - -/** - * Convert a floating point number to an integer. - */ -int PhysxUtilLib:: -int_chop(const float &f) { - - return _ptr->NxIntChop(f); -} - -/** - * Convert a floating point number to an integer. - */ -int PhysxUtilLib:: -int_floor(const float &f) { - - return _ptr->NxIntFloor(f); -} - -/** - * Test if an oriented box contains a point. - * - * \param [in] box \param [in] p - */ -bool PhysxUtilLib:: -box_contains_point(const PhysxBox &box, const LPoint3f &p) { - - return _ptr->NxBoxContainsPoint(box._box, PhysxManager::point3_to_nxVec3(p)); -} - -/** - * Create an oriented box from an axis aligned box and a transformation. - * - * \param [in] aabb \param [in] mat - */ -PhysxBox PhysxUtilLib:: -create_box(const PhysxBounds3 &aabb, const LMatrix4f &mat) { - - PhysxBox box; - _ptr->NxCreateBox(box._box, aabb._bounds, PhysxManager::mat4_to_nxMat34(mat)); - return box; -} - -/** - * Compute and edge normals for an oriented box. This is an averaged normal, - * from the two faces sharing the edge. The edge index should be from 0 to 11 - * (i.e. a box has 12 edges). - * - * \param [in] box \param [in] edge_index - */ -LVector3f PhysxUtilLib:: -compute_box_world_edge_normal(const PhysxBox &box, unsigned int edge_index) { - - NxVec3 nNormal; - - nassertr(edge_index < 12, LVector3f::zero()); - - _ptr->NxComputeBoxWorldEdgeNormal(box._box, edge_index, nNormal); - return PhysxManager::nxVec3_to_vec3(nNormal); -} - -/** - * Compute a capsule which encloses a box. - * - * \param [in] box - */ -PhysxCapsule PhysxUtilLib:: -compute_capsule_around_box(const PhysxBox &box) { - - PhysxCapsule capsule; - _ptr->NxComputeCapsuleAroundBox(box._box, capsule._capsule); - return capsule; -} - -/** - * Test if box A is inside another box B. Returns TRUE if box A is inside box - * B. - * - * \param [in] a \param [in] b - */ -bool PhysxUtilLib:: -is_box_a_inside_box_b(const PhysxBox &a, const PhysxBox &b) { - - return _ptr->NxIsBoxAInsideBoxB(a._box, b._box); -} - -/** - * Compute a box which encloses a capsule. - * - * \param [in] capsule - */ -PhysxBox PhysxUtilLib:: -compute_box_around_capsule(const PhysxCapsule &capsule) { - - PhysxBox box; - _ptr->NxComputeBoxAroundCapsule(capsule._capsule, box._box); - return box; -} - -/** - * Compute the distance squared from a point to a ray. - * - * \param [in] ray \param [in] point - */ -float PhysxUtilLib:: -compute_distance_squared(const PhysxRay &ray, const LPoint3f &point) { - - NxF32 t; // not used - return _ptr->NxComputeDistanceSquared(ray._ray, PhysxManager::point3_to_nxVec3(point), &t); -} - -/** - * Compute the distance squared from a point to a line segment. - * - * \param [in] seg \param [in] point - */ -float PhysxUtilLib:: -compute_square_distance(const PhysxSegment &seg, const LPoint3f &point) { - - NxF32 t; // not used - return _ptr->NxComputeSquareDistance(seg._segment, PhysxManager::point3_to_nxVec3(point), &t); -} - -/** - * Compute an overall bounding sphere for a pair of spheres. - * - * \param [in] sphere0 \param [in] sphere1 - */ -PhysxSphere PhysxUtilLib:: -merge_spheres(const PhysxSphere &sphere0, const PhysxSphere &sphere1) { - - PhysxSphere merged; - _ptr->NxMergeSpheres(merged._sphere, sphere0._sphere, sphere1._sphere); - return merged; -} - -/** - * Get the tangent vectors associated with a normal. - * - * \param [in] n \param [out] t1 \param [out] t2 - */ -void PhysxUtilLib:: -normal_to_tangents(const LVector3f &n, LVector3f &t1, LVector3f &t2) { - - NxVec3 nt1; - NxVec3 nt2; - - _ptr->NxNormalToTangents(PhysxManager::vec3_to_nxVec3(n), nt1, nt2); - - t1.set_x(nt1.x); - t1.set_y(nt1.y); - t1.set_z(nt1.z); - - t2.set_x(nt2.x); - t2.set_y(nt2.y); - t2.set_z(nt2.z); -} - -/** - * Computes a rotation matrix M so that: M * x = b (x and b are unit vectors). - * - * \param [in] x \param [in] b - */ -LMatrix3f PhysxUtilLib:: -find_rotation_matrix(const LVector3f &x, const LVector3f &b) { - - NxMat33 nmat; - _ptr->NxFindRotationMatrix(PhysxManager::vec3_to_nxVec3(x), - PhysxManager::vec3_to_nxVec3(b), - nmat); - return PhysxManager::nxMat33_to_mat3(nmat); -} - -/** - * Computes mass of a homogeneous sphere according to sphere density. - * - * \param [in] radius \param [in] density - */ -float PhysxUtilLib:: -compute_sphere_mass(float radius, float density) { - - return _ptr->NxComputeSphereMass(radius, density); -} - -/** - * Computes density of a homogeneous sphere according to sphere mass - * - * \param [in] radius \param [in] mass - */ -float PhysxUtilLib:: -compute_sphere_density(float radius, float mass) { - - return _ptr->NxComputeSphereDensity(radius, mass); -} - -/** - * Computes mass of a homogeneous box according to box density. - * - * \param [in] radius \param [in] density - */ -float PhysxUtilLib:: -compute_box_mass(const LVector3f &extents, float density) { - - return _ptr->NxComputeBoxMass(PhysxManager::vec3_to_nxVec3(extents), density); -} - -/** - * Computes density of a homogeneous box according to box mass. - * - * \param [in] radius \param [in] mass - */ -float PhysxUtilLib:: -compute_box_density(const LVector3f &extents, float mass) { - - return _ptr->NxComputeBoxDensity(PhysxManager::vec3_to_nxVec3(extents), mass); -} - -/** - * Computes mass of a homogeneous ellipsoid according to ellipsoid density. - * - * \param [in] radius \param [in] density - */ -float PhysxUtilLib:: -compute_ellipsoid_mass(const LVector3f &extents, float density ) { - - return _ptr->NxComputeEllipsoidMass(PhysxManager::vec3_to_nxVec3(extents), density); -} - -/** - * Computes density of a homogeneous ellipsoid according to ellipsoid mass. - * - * \param [in] radius \param [in] mass - */ -float PhysxUtilLib:: -compute_ellipsoid_density(const LVector3f &extents, float mass) { - - return _ptr->NxComputeEllipsoidDensity(PhysxManager::vec3_to_nxVec3(extents), mass); -} - -/** - * Computes mass of a homogeneous cylinder according to cylinder density. - * - * \param [in] radius \param [in] density - */ -float PhysxUtilLib:: -compute_cylinder_mass(float radius, float length, float density) { - - return _ptr->NxComputeCylinderMass(radius, length, density); -} - -/** - * Computes density of a homogeneous cylinder according to cylinder mass. - * - * \param [in] radius \param [in] mass - */ -float PhysxUtilLib:: -compute_cylinder_density(float radius, float length, float mass) { - - return _ptr->NxComputeCylinderDensity(radius, length, mass); -} - -/** - * Computes mass of a homogeneous cone according to cone density. - * - * \param [in] radius \param [in] density - */ -float PhysxUtilLib:: -compute_cone_mass(float radius, float length, float density) { - - return _ptr->NxComputeConeMass(radius, length, density); -} - -/** - * Computes density of a homogeneous cone according to cone mass. - * - * \param [in] radius \param [in] mass - */ -float PhysxUtilLib:: -compute_cone_density(float radius, float length, float mass) { - - return _ptr->NxComputeConeDensity(radius, length, mass); -} - -/** - * Computes diagonalized inertia tensor for a box. - * - * \param [in] mass \param [in] xlength \param [in] ylength \param [in] - * zlength - */ -LVector3f PhysxUtilLib:: -compute_box_inertia_tensor(float mass, float xlength, float ylength, float zlength) { - - NxVec3 tensor; - _ptr->NxComputeBoxInertiaTensor(tensor, mass, xlength, ylength, zlength); - return PhysxManager::nxVec3_to_vec3(tensor); -} - -/** - * Computes diagonalized inertia tensor for a sphere. - * - * \param [in] mass \param [in] radius \param [in] hollow - */ -LVector3f PhysxUtilLib:: -compute_sphere_inertia_tensor(float mass, float radius, bool hollow) { - - NxVec3 tensor; - _ptr->NxComputeSphereInertiaTensor(tensor, mass, radius, hollow); - return PhysxManager::nxVec3_to_vec3(tensor); -} - -/** - * Boolean intersection test between two OBBs. Uses the separating axis - * theorem. Disabling 'full_test' only performs 6 axis tests out of 15. - * - * \param [in] extents0 \param [in] center0 \param [in] rotation0 \param [in] - * extents1 \param [in] center1 \param [in] rotation1 \param [in] full_test - */ -bool PhysxUtilLib:: -box_box_intersect(const LVector3f &extents0, const LPoint3f ¢er0, const LMatrix3f &rotation0, const LVector3f &extents1, const LPoint3f ¢er1, const LMatrix3f &rotation1, bool full_test) { - - nassertr_always(!extents0.is_nan(), false); - nassertr_always(!center0.is_nan(), false); - nassertr_always(!rotation0.is_nan(), false); - nassertr_always(!extents1.is_nan(), false); - nassertr_always(!center1.is_nan(), false); - nassertr_always(!rotation1.is_nan(), false); - - return _ptr->NxBoxBoxIntersect( - PhysxManager::vec3_to_nxVec3(extents0), - PhysxManager::point3_to_nxVec3(center0), - PhysxManager::mat3_to_nxMat33(rotation0), - PhysxManager::vec3_to_nxVec3(extents1), - PhysxManager::point3_to_nxVec3(center1), - PhysxManager::mat3_to_nxMat33(rotation1), full_test); -} - -/** - * Boolean intersection test between a triangle and a box. - * - * \param [in] vertex0 \param [in] vertex1 \param [in] vertex2 \param [in] - * center \param [in] extents - */ -bool PhysxUtilLib:: -tri_box_intersect(const LPoint3f &vertex0, const LPoint3f &vertex1, const LPoint3f &vertex2, const LPoint3f ¢er, const LVector3f &extents) { - - nassertr_always(!vertex0.is_nan(), false); - nassertr_always(!vertex1.is_nan(), false); - nassertr_always(!vertex2.is_nan(), false); - nassertr_always(!center.is_nan(), false); - nassertr_always(!extents.is_nan(), false); - - return _ptr->NxTriBoxIntersect( - PhysxManager::point3_to_nxVec3(vertex0), - PhysxManager::point3_to_nxVec3(vertex1), - PhysxManager::point3_to_nxVec3(vertex2), - PhysxManager::point3_to_nxVec3(center), - PhysxManager::point3_to_nxVec3(extents)); -} - -/** - * Ray-plane intersection test. - * - * \param [in] ray \param [in] plane \param [out] point_on_plane - */ -bool PhysxUtilLib:: -ray_plane_intersect(const PhysxRay &ray, const PhysxPlane &plane, LPoint3f &point_on_plane) { - - NxReal dist; // not used - NxVec3 nPointOnPlane; - - bool result = _ptr->NxRayPlaneIntersect(ray._ray, plane._plane, dist, nPointOnPlane); - - PhysxManager::update_point3_from_nxVec3(point_on_plane, nPointOnPlane); - return result; -} - -/** - * Ray-sphere intersection test. Returns true if the ray intersects the - * sphere, and the impact point if needed. - * - * \param [in] origin \param [in] dir \param [in] length \param [in] center - * \param [in] radius \param [out] hit_pos - */ -bool PhysxUtilLib:: -ray_sphere_intersect(const LPoint3f &origin, const LVector3f &dir, float length, const LPoint3f ¢er, float radius, LPoint3f &hit_pos) { - - nassertr_always(!origin.is_nan(), false); - nassertr_always(!dir.is_nan(), false); - nassertr_always(!center.is_nan(), false); - - NxReal nHitTime; // not used - NxVec3 nPointOnPlane; - - bool result = _ptr->NxRaySphereIntersect( - PhysxManager::point3_to_nxVec3(origin), - PhysxManager::vec3_to_nxVec3(dir), - length, - PhysxManager::point3_to_nxVec3(center), - radius, - nHitTime, - nPointOnPlane); - - PhysxManager::update_point3_from_nxVec3(hit_pos, nPointOnPlane); - return result; -} - -/** - * Segment-AABB intersection test. Also computes intersection point. - * - * \param [in] p1 \param [in] p2 \param [in] bbox_min \param [in] bbox_max - * \param [out] intercept - */ -bool PhysxUtilLib:: -segment_box_intersect(const LPoint3f &p1, const LPoint3f &p2, const LPoint3f &bbox_min, const LPoint3f &bbox_max, LPoint3f &intercept) { - - nassertr_always(!p1.is_nan(), false); - nassertr_always(!p2.is_nan(), false); - nassertr_always(!bbox_min.is_nan(), false); - nassertr_always(!bbox_max.is_nan(), false); - - NxVec3 nIntercept; - - bool result =_ptr->NxSegmentBoxIntersect( - PhysxManager::point3_to_nxVec3(p1), - PhysxManager::point3_to_nxVec3(p2), - PhysxManager::point3_to_nxVec3(bbox_min), - PhysxManager::point3_to_nxVec3(bbox_max), - nIntercept); - - PhysxManager::update_point3_from_nxVec3(intercept, nIntercept); - return result; -} - -/** - * Ray-AABB intersection test. Also computes intersection point. - * - * \param [in] min \param [in] max \param [in] origin \param [in] dir \param - * [out] coord - */ -bool PhysxUtilLib:: -ray_aabb_intersect(const LPoint3f &min, const LPoint3f &max, const LPoint3f &origin, const LVector3f &dir, LPoint3f &coord) { - - nassertr_always(!min.is_nan(), false); - nassertr_always(!max.is_nan(), false); - nassertr_always(!origin.is_nan(), false); - nassertr_always(!dir.is_nan(), false); - - NxVec3 nCoord; - - bool result = _ptr->NxRayAABBIntersect( - PhysxManager::point3_to_nxVec3(min), - PhysxManager::point3_to_nxVec3(max), - PhysxManager::point3_to_nxVec3(origin), - PhysxManager::vec3_to_nxVec3(dir), - nCoord); - - PhysxManager::update_point3_from_nxVec3(coord, nCoord); - return result; -} - -/** - * Boolean segment-OBB intersection test. Based on separating axis theorem. - * - * \param [in] p0 \param [in] p1 \param [in] center \param [in] extents \param - * [in] rot - */ -bool PhysxUtilLib:: -segment_obb_intersect(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot) { - - nassertr_always(!p0.is_nan(), false); - nassertr_always(!p1.is_nan(), false); - nassertr_always(!center.is_nan(), false); - nassertr_always(!extents.is_nan(), false); - nassertr_always(!rot.is_nan(), false); - - return _ptr->NxSegmentOBBIntersect( - PhysxManager::point3_to_nxVec3(p0), - PhysxManager::point3_to_nxVec3(p1), - PhysxManager::point3_to_nxVec3(center), - PhysxManager::vec3_to_nxVec3(extents), - PhysxManager::mat3_to_nxMat33(rot)); -} - -/** - * Boolean segment-AABB intersection test. Based on separating axis theorem. - * - * \param [in] p0 \param [in] p1 \param [in] min \param [in] max - */ -bool PhysxUtilLib:: -segment_aabb_intersect(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f &min, const LPoint3f &max) { - - nassertr_always(!p0.is_nan(), false); - nassertr_always(!p1.is_nan(), false); - nassertr_always(!min.is_nan(), false); - nassertr_always(!max.is_nan(), false); - - return _ptr->NxSegmentAABBIntersect( - PhysxManager::point3_to_nxVec3(p0), - PhysxManager::point3_to_nxVec3(p1), - PhysxManager::point3_to_nxVec3(min), - PhysxManager::point3_to_nxVec3(max)); -} - -/** - * Boolean ray-OBB intersection test. Based on separating axis theorem. - * - * \param [in] ray \param [in] center \param [in] extents \param [in] rot - */ -bool PhysxUtilLib:: -ray_obb_intersect(const PhysxRay &ray, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot) { - - nassertr_always(!center.is_nan(), false); - nassertr_always(!extents.is_nan(), false); - nassertr_always(!rot.is_nan(), false); - - return _ptr->NxRayOBBIntersect( - ray._ray, - PhysxManager::point3_to_nxVec3(center), - PhysxManager::point3_to_nxVec3(extents), - PhysxManager::mat3_to_nxMat33(rot)); -} - -/** - * Ray-capsule intersection test. Returns number of intersection points (0,1 - * or 2) along the ray. - * - * \param [in] origin \param [in] dir \param [in] capsule - */ -unsigned int PhysxUtilLib:: -ray_capsule_intersect(const LPoint3f &origin, const LVector3f &dir, const PhysxCapsule &capsule) { - - nassertr_always(!origin.is_nan(), -1); - nassertr_always(!dir.is_nan(), -1); - - NxReal t[2] = { 0.0f, 0.0f }; // not used - - return _ptr->NxRayCapsuleIntersect( - PhysxManager::point3_to_nxVec3(origin), - PhysxManager::vec3_to_nxVec3(dir), - capsule._capsule, t); -} - -/** - * Sphere-sphere sweep test. Returns true if spheres intersect during their - * linear motion along provided velocity vectors. - * - * \param [in] sphere0 \param [in] velocity0 \param [in] sphere1 \param [in] - * velocity1 - */ -bool PhysxUtilLib:: -swept_spheres_intersect(const PhysxSphere &sphere0, const LVector3f &velocity0, const PhysxSphere &sphere1, const LVector3f &velocity1) { - - nassertr_always(!velocity0.is_nan(), false); - nassertr_always(!velocity1.is_nan(), false); - - return _ptr->NxSweptSpheresIntersect( - sphere0._sphere, - PhysxManager::vec3_to_nxVec3(velocity0), - sphere1._sphere, - PhysxManager::vec3_to_nxVec3(velocity1)); -} - -/** - * Ray-triangle intersection test. Returns impact distance (t) as well as - * barycentric coordinates (u,v) of impact point. The test performs back face - * culling or not according to 'cull'. - * - * \param [in] orig \param [in] dir \param [in] vert0 \param [in] vert1 \param - * [in] vert2 \param [out] hit, with coordinates (t,u,v) \param [in] cull - */ -bool PhysxUtilLib:: -ray_tri_intersect(const LPoint3f &orig, const LVector3f &dir, const LPoint3f &vert0, const LPoint3f &vert1, const LPoint3f &vert2, LVector3f &hit, bool cull) { - - nassertr_always(!orig.is_nan(), false); - nassertr_always(!dir.is_nan(), false); - nassertr_always(!vert0.is_nan(), false); - nassertr_always(!vert1.is_nan(), false); - nassertr_always(!vert2.is_nan(), false); - - NxReal t, u, v; - - bool result = _ptr->NxRayTriIntersect( - PhysxManager::point3_to_nxVec3(orig), - PhysxManager::vec3_to_nxVec3(dir), - PhysxManager::point3_to_nxVec3(vert0), - PhysxManager::point3_to_nxVec3(vert1), - PhysxManager::point3_to_nxVec3(vert2), - t, u, v, cull); - - hit.set_x(t); - hit.set_y(u); - hit.set_z(v); - - return result; -} - -/** - * Box-vs-capsule sweep test. Sweeps a box against a capsule, returns true if - * box hit the capsule. Also returns contact information. - * - * \param [in] box Box \param [in] lss Capsule \param [in] dir Unit-length - * sweep direction \param [in] length Length of sweep \param [out] normal - * Normal at impact point - */ -bool PhysxUtilLib:: -sweep_box_capsule(const PhysxBox &box, const PhysxCapsule &lss, const LVector3f &dir, float length, LVector3f &normal) { - - nassertr_always(!dir.is_nan(), false); - - NxReal min_dist; // not used - NxVec3 nNormal; - - bool result = _ptr->NxSweepBoxCapsule( - box._box, lss._capsule, - PhysxManager::vec3_to_nxVec3(dir), - length, min_dist, nNormal); - - PhysxManager::update_vec3_from_nxVec3(normal, nNormal); - return result; -} - -/** - * Box-vs-sphere sweep test. Sweeps a box against a sphere, returns true if - * box hit the sphere. Also returns contact information. - * - * \param [in] box Box \param [in] sphere Sphere \param [in] dir Unit-length - * sweep direction \param [in] length Length of sweep \param [out] normal - * Normal at impact point - */ -bool PhysxUtilLib:: -sweep_box_sphere(const PhysxBox &box, const PhysxSphere &sphere, const LVector3f &dir, float length, LVector3f &normal) { - - nassertr_always(!dir.is_nan(), false); - - NxReal min_dist; // not used - NxVec3 nNormal; - - bool result = _ptr->NxSweepBoxSphere( - box._box, sphere._sphere, - PhysxManager::vec3_to_nxVec3(dir), - length, min_dist, nNormal); - - PhysxManager::update_vec3_from_nxVec3(normal, nNormal); - return result; -} - -/** - * Capsule-vs-capsule sweep test. Sweeps a capsule against a capsule, returns - * true if capsule hit the other capsule. Also returns contact information. - * - * \param [in] lss0 \param [in] lss1 \param [in] dir Unit-length sweep - * direction \param [in] length Length of sweep \param [out] ip Impact point - * \param [out] normal Normal at impact point - */ -bool PhysxUtilLib:: -sweep_capsule_capsule(const PhysxCapsule &lss0, const PhysxCapsule &lss1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal) { - - nassertr_always(!dir.is_nan(), false); - - NxReal min_dist; // not used - NxVec3 nIp; - NxVec3 nNormal; - - bool result = _ptr->NxSweepCapsuleCapsule( - lss0._capsule, lss1._capsule, - PhysxManager::vec3_to_nxVec3(dir), - length, min_dist, nIp, nNormal); - - PhysxManager::update_point3_from_nxVec3(ip, nIp); - PhysxManager::update_vec3_from_nxVec3(normal, nNormal); - return result; -} - -/** - * Sphere-vs-capsule sweep test. Sweeps a sphere against a capsule, returns - * true if sphere hit the capsule. Also returns contact information. - * - * \param [in] sphere \param [in] lss \param [in] dir Unit-length sweep - * direction \param [in] length Length of sweep \param [out] ip Impact point - * \param [out] normal Normal at impact point - */ -bool PhysxUtilLib:: -sweep_sphere_capsule(const PhysxSphere &sphere, const PhysxCapsule &lss, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal) { - - nassertr_always(!dir.is_nan(), false); - - NxReal min_dist; // not used - NxVec3 nIp; - NxVec3 nNormal; - - bool result = _ptr->NxSweepSphereCapsule( - sphere._sphere, lss._capsule, - PhysxManager::vec3_to_nxVec3(dir), - length, min_dist, nIp, nNormal); - - PhysxManager::update_point3_from_nxVec3(ip, nIp); - PhysxManager::update_vec3_from_nxVec3(normal, nNormal); - return result; -} - -/** - * Box-vs-box sweep test. Sweeps a box against a box, returns true if box hit - * the other box. Also returns contact information. - * - * \param [in] box0 \param [in] box1 \param [in] dir Unit-length sweep - * direction \param [in] length Length of sweep \param [out] ip Impact point - * \param [out] normal Normal at impact point - */ -bool PhysxUtilLib:: -sweep_box_box(const PhysxBox &box0, const PhysxBox &box1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal) { - - nassertr_always(!dir.is_nan(), false); - - NxReal min_dist; // not used - NxVec3 nIp; - NxVec3 nNormal; - - bool result = _ptr->NxSweepBoxBox( - box0._box, box1._box, - PhysxManager::vec3_to_nxVec3(dir), - length, nIp, nNormal, min_dist); - - PhysxManager::update_point3_from_nxVec3(ip, nIp); - PhysxManager::update_vec3_from_nxVec3(normal, nNormal); - return result; -} - -/** - * Point-vs-OBB distance computation. Returns distance between a point and an - * OBB. - * - * \param [in] point The point \param [in] center OBB center \param [in] - * extents OBB extents \param [in] rot OBB rotation \param [out] params - * Closest point on the box, in box space - */ -float PhysxUtilLib:: -point_obb_sqr_dist(const LPoint3f &point, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot, LPoint3f ¶ms) { - - nassertr_always(!point.is_nan(), 0.0f); - nassertr_always(!center.is_nan(), 0.0f); - nassertr_always(!extents.is_nan(), 0.0f); - nassertr_always(!rot.is_nan(), 0.0f); - - NxVec3 nParams; - - float result = _ptr->NxPointOBBSqrDist( - PhysxManager::point3_to_nxVec3(point), - PhysxManager::point3_to_nxVec3(center), - PhysxManager::vec3_to_nxVec3(extents), - PhysxManager::mat3_to_nxMat33(rot), - &nParams); - - PhysxManager::update_point3_from_nxVec3(params, nParams); - return result; -} diff --git a/panda/src/physx/physxUtilLib.h b/panda/src/physx/physxUtilLib.h deleted file mode 100644 index acd4901363..0000000000 --- a/panda/src/physx/physxUtilLib.h +++ /dev/null @@ -1,123 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxUtilLib.h - * @author enn0x - * @date 2009-11-01 - */ - -#ifndef PHYSXUTILLIB_H -#define PHYSXUTILLIB_H - -#include "pandabase.h" -#include "luse.h" - -#include "config_physx.h" - -class PhysxBounds3; -class PhysxBox; -class PhysxCapsule; -class PhysxPlane; -class PhysxRay; -class PhysxSegment; -class PhysxSphere; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxUtilLib { - -PUBLISHED: - INLINE PhysxUtilLib(); - INLINE ~PhysxUtilLib(); - - bool box_contains_point(const PhysxBox &box, const LPoint3f &p); - PhysxBox create_box(const PhysxBounds3 &aabb, const LMatrix4f &mat); - LVector3f compute_box_world_edge_normal(const PhysxBox &box, unsigned int edge_index); - PhysxCapsule compute_capsule_around_box(const PhysxBox &box); - bool is_box_a_inside_box_b(const PhysxBox &a, const PhysxBox &b); - PhysxBox compute_box_around_capsule(const PhysxCapsule &capsule); - void set_fpu_exceptions(bool b); - void set_fpu_precision24(); - void set_fpu_precision53(); - void set_fpu_precision64(); - void set_fpu_rounding_chop(); - void set_fpu_rounding_down(); - void set_fpu_rounding_near(); - void set_fpu_rounding_up(); - int int_ceil(const float &f); - int int_chop(const float &f); - int int_floor(const float &f); - float compute_distance_squared(const PhysxRay &ray, const LPoint3f &point); - float compute_square_distance(const PhysxSegment &seg, const LPoint3f &point); - PhysxSphere merge_spheres(const PhysxSphere &sphere0, const PhysxSphere &sphere1); - void normal_to_tangents(const LVector3f &n, LVector3f &t1, LVector3f &t2); - LMatrix3f find_rotation_matrix(const LVector3f &x, const LVector3f &b); - float compute_sphere_mass(float radius, float density); - float compute_sphere_density(float radius, float mass); - float compute_box_mass(const LVector3f &extents, float density); - float compute_box_density(const LVector3f &extents, float mass); - float compute_ellipsoid_mass(const LVector3f &extents, float density); - float compute_ellipsoid_density(const LVector3f &extents, float mass); - float compute_cylinder_mass(float radius, float length, float density); - float compute_cylinder_density(float radius, float length, float mass); - float compute_cone_mass(float radius, float length, float density); - float compute_cone_density(float radius, float length, float mass); - LVector3f compute_box_inertia_tensor(float mass, float xlength, float ylength, float zlength); - LVector3f compute_sphere_inertia_tensor(float mass, float radius, bool hollow); - bool box_box_intersect(const LVector3f &extents0, const LPoint3f ¢er0, const LMatrix3f &rotation0, const LVector3f &extents1, const LPoint3f ¢er1, const LMatrix3f &rotation1, bool full_test); - bool tri_box_intersect(const LPoint3f &vertex0, const LPoint3f &vertex1, const LPoint3f &vertex2, const LPoint3f ¢er, const LVector3f &extents); - bool ray_plane_intersect(const PhysxRay &ray, const PhysxPlane &plane, LPoint3f &point_on_plane); - bool ray_sphere_intersect(const LPoint3f &origin, const LVector3f &dir, float length, const LPoint3f ¢er, float radius, LPoint3f &hit_pos); - bool segment_box_intersect(const LPoint3f &p1, const LPoint3f &p2, const LPoint3f &bbox_min, const LPoint3f &bbox_max, LPoint3f &intercept); - bool ray_aabb_intersect(const LPoint3f &min, const LPoint3f &max, const LPoint3f &origin, const LVector3f &dir, LPoint3f &coord); - bool segment_obb_intersect(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot); - bool segment_aabb_intersect(const LPoint3f &p0, const LPoint3f &p1, const LPoint3f &min, const LPoint3f &max); - bool ray_obb_intersect(const PhysxRay &ray, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot); - unsigned int ray_capsule_intersect(const LPoint3f &origin, const LVector3f &dir, const PhysxCapsule &capsule); - bool swept_spheres_intersect(const PhysxSphere &sphere0, const LVector3f &velocity0, const PhysxSphere &sphere1, const LVector3f &velocity1); - bool ray_tri_intersect(const LPoint3f &orig, const LVector3f &dir, const LPoint3f &vert0, const LPoint3f &vert1, const LPoint3f &vert2, LVector3f &hit, bool cull); - bool sweep_box_capsule(const PhysxBox &box, const PhysxCapsule &lss, const LVector3f &dir, float length, LVector3f &normal); - bool sweep_box_sphere(const PhysxBox &box, const PhysxSphere &sphere, const LVector3f &dir, float length, LVector3f &normal); - bool sweep_capsule_capsule(const PhysxCapsule &lss0, const PhysxCapsule &lss1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal); - bool sweep_sphere_capsule(const PhysxSphere &sphere, const PhysxCapsule &lss, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal); - bool sweep_box_box(const PhysxBox &box0, const PhysxBox &box1, const LVector3f &dir, float length, LPoint3f &ip, LVector3f &normal); - float point_obb_sqr_dist(const LPoint3f &point, const LPoint3f ¢er, const LVector3f &extents, const LMatrix3f &rot, LPoint3f ¶ms); - -public: - NxUtilLib *_ptr; -}; - -#include "physxUtilLib.I" - -#endif // PHYSUTILLIB_H - -/* -NOT WRAPPED: -bool NxComputeBoxPlanes(const NxBox &box, NxPlane *planes) -bool NxComputeBoxPoints(const NxBox &box, NxVec3 *pts) -bool NxComputeBoxVertexNormals(const NxBox &box, NxVec3 *pts) -const NxU32 *NxGetBoxEdges() -const NxI32 *NxGetBoxEdgesAxes() -const NxU32 *NxGetBoxTriangles() -const NxVec3 *NxGetBoxLocalEdgeNormals() -const NxU32 *NxGetBoxQuads() -const NxU32 *NxBoxVertexToQuad(NxU32 vertexIndex) -NxBSphereMethod NxComputeSphere(NxSphere &sphere, unsigned nb_verts, const NxVec3 *verts) -bool NxFastComputeSphere(NxSphere &sphere, unsigned nb_verts, const NxVec3 *verts) -bool NxDiagonalizeInertiaTensor(const NxMat33 &denseInertia, NxVec3 &diagonalInertia, NxMat33 &rotation) -void NxComputeBounds(NxVec3 &min, NxVec3 &max, NxU32 nbVerts, const NxVec3 *verts) -NxU32 NxCrc32(const void *buffer, NxU32 nbBytes) -NxSepAxis NxSeparatingAxis(const NxVec3 &extents0, const NxVec3 ¢er0, const NxMat33 &rotation0, const NxVec3 &extents1, const NxVec3 ¢er1, const NxMat33 &rotation1, bool fullTest=true) -void NxSegmentPlaneIntersect(const NxVec3 &v1, const NxVec3 &v2, const NxPlane &plane, NxReal &dist, NxVec3 &pointOnPlane) -NxU32 NxRayAABBIntersect2(const NxVec3 &min, const NxVec3 &max, const NxVec3 &origin, const NxVec3 &dir, NxVec3 &coord, NxReal &t) -bool NxBuildSmoothNormals(NxU32 nbTris, NxU32 nbVerts, const NxVec3 *verts, const NxU32 *dFaces, const NxU16 *wFaces, NxVec3 *normals, bool flip=false) -bool NxSweepBoxTriangles(NxU32 nb_tris, const NxTriangle *triangles, const NxTriangle *edge_triangles, const NxU32 *edge_flags, const NxBounds3 &box, const NxVec3 &dir, float length, NxVec3 &hit, NxVec3 &normal, float &d, NxU32 &index, NxU32 *cachedIndex=NULL) -bool NxSweepCapsuleTriangles(NxU32 up_direction, NxU32 nb_tris, const NxTriangle *triangles, const NxU32 *edge_flags, const NxVec3 ¢er, const float radius, const float height, const NxVec3 &dir, float length, NxVec3 &hit, NxVec3 &normal, float &d, NxU32 &index, NxU32 *cachedIndex=NULL) -float NxSegmentOBBSqrDist(const NxSegment &segment, const NxVec3 &c0, const NxVec3 &e0, const NxMat33 &r0, float *t, NxVec3 *p) -*/ diff --git a/panda/src/physx/physxVehicle.I b/panda/src/physx/physxVehicle.I deleted file mode 100644 index ed095f7211..0000000000 --- a/panda/src/physx/physxVehicle.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxVehicle.I - * @author enn0x - * @date 2010-03-23 - */ - -/** - * - */ -INLINE PhysxVehicle:: -PhysxVehicle() : PhysxObject() { - -} - -/** - * - */ -INLINE PhysxVehicle:: -~PhysxVehicle() { - -} - -/** - * - */ -INLINE void PhysxVehicle:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxVehicle:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxVehicle.cxx b/panda/src/physx/physxVehicle.cxx deleted file mode 100644 index c4aa1a57fc..0000000000 --- a/panda/src/physx/physxVehicle.cxx +++ /dev/null @@ -1,94 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxVehicle.cxx - * @author enn0x - * @date 2010-03-23 - */ - -#include "physxVehicle.h" -#include "physxActor.h" -#include "physxWheel.h" -#include "physxScene.h" - -TypeHandle PhysxVehicle::_type_handle; - -/** - * - */ -void PhysxVehicle:: -create(PhysxScene *scene, PhysxVehicleDesc &desc) { - - nassertv(_error_type == ET_empty); - - _scene = scene; - - // TODO !!! - - _error_type = ET_ok; - _scene->_vehicles.add(this); -} - -/** - * Destroys this vehicle. - */ -void PhysxVehicle:: -release() { - - nassertv(_error_type == ET_ok); - - _error_type = ET_released; - _scene->_vehicles.remove(this); -} - -/** - * - */ -void PhysxVehicle:: -update_vehicle(float dt) { - - nassertv(_error_type == ET_ok); - - // TODO !!! -} - -/** - * Returns the actor for this vehicle. - */ -/* -PhysxActor *PhysxVehicle:: -get_actor() const { - - nassertr(_error_type == ET_ok, NULL); - return _actor; -} -*/ - -/** - * Returns the number of wheels on this vehicle. - */ -/* -unsigned int PhysxVehicle:: -get_num_wheels() const { - - nassertr(_error_type == ET_ok, 0); - return _wheels.size(); -} -*/ - -/** - * Returns the n-th wheel of this vehicle. - */ -/* -PhysxWheel *PhysxVehicle:: -get_wheel(unsigned int idx) const { - - nassertr(_error_type == ET_ok, NULL); - return _wheels[idx]; -} -*/ diff --git a/panda/src/physx/physxVehicle.h b/panda/src/physx/physxVehicle.h deleted file mode 100644 index 15c3cb6bfa..0000000000 --- a/panda/src/physx/physxVehicle.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxVehicle.h - * @author enn0x - * @date 2010-03-23 - */ - -#ifndef PHYSXVEHICLE_H -#define PHYSXVEHICLE_H - -#include "pandabase.h" -#include "pointerToArray.h" - -#include "physxObject.h" -#include "physx_includes.h" - -class PhysxActor; -class PhysxWheel; -class PhysxVehicleDesc; -class PhysxScene; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxVehicle : public PhysxObject { - -PUBLISHED: - INLINE PhysxVehicle(); - INLINE ~PhysxVehicle(); - - //PhysxActor *get_actor() const; - - //unsigned int get_num_wheels() const; - //PhysxWheel *get_wheel(unsigned int idx) const; - //MAKE_SEQ(get_wheels, get_num_wheels, get_wheel); - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -private: - -PUBLISHED: - void release(); - -public: - void create(PhysxScene *scene, PhysxVehicleDesc &desc); - void update_vehicle(float dt); - -private: - PTA(PT(PhysxWheel)) _wheels; - PT(PhysxActor) _actor; - PT(PhysxScene) _scene; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxVehicle", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxVehicle.I" - -#endif // PHYSXVEHICLE_H diff --git a/panda/src/physx/physxVehicleDesc.I b/panda/src/physx/physxVehicleDesc.I deleted file mode 100644 index 81bba8329f..0000000000 --- a/panda/src/physx/physxVehicleDesc.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxVehicleDesc.I - * @author enn0x - * @date 2010-03-23 - */ - -/** - * - */ -INLINE PhysxVehicleDesc:: -PhysxVehicleDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxVehicleDesc:: -~PhysxVehicleDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxVehicleDesc:: -set_to_default() { - - // TODO -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxVehicleDesc:: -is_valid() const { - - return true; -} diff --git a/panda/src/physx/physxVehicleDesc.cxx b/panda/src/physx/physxVehicleDesc.cxx deleted file mode 100644 index 0a114773cd..0000000000 --- a/panda/src/physx/physxVehicleDesc.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxVehicleDesc.cxx - * @author enn0x - * @date 2010-03-23 - */ - -#include "physxVehicleDesc.h" - -/** - * - */ -/* -void PhysxVehicleDesc:: -add_wheel(PhysxWheelDesc *wheelDesc) { - - _wheels.push_back(wheelDesc); -} -*/ diff --git a/panda/src/physx/physxVehicleDesc.h b/panda/src/physx/physxVehicleDesc.h deleted file mode 100644 index cbb38f28b2..0000000000 --- a/panda/src/physx/physxVehicleDesc.h +++ /dev/null @@ -1,38 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxVehicleDesc.h - * @author enn0x - * @date 2010-03-23 - */ - -#ifndef PHYSXVEHICLEDESC_H -#define PHYSXVEHICLEDESC_H - -#include "pandabase.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxVehicleDesc : public ReferenceCount { - -PUBLISHED: - INLINE PhysxVehicleDesc(); - INLINE ~PhysxVehicleDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: -}; - -#include "physxVehicleDesc.I" - -#endif // PHYSXVEHICLEDESC_H diff --git a/panda/src/physx/physxWheel.I b/panda/src/physx/physxWheel.I deleted file mode 100644 index 1aef97f663..0000000000 --- a/panda/src/physx/physxWheel.I +++ /dev/null @@ -1,47 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheel.I - * @author enn0x - * @date 2010-03-23 - */ - -/** - * - */ -INLINE PhysxWheel:: -PhysxWheel() { - -} - -/** - * - */ -INLINE PhysxWheel:: -~PhysxWheel() { - -} - -/** - * - */ -INLINE void PhysxWheel:: -ls() const { - - ls(nout); -} - -/** - * - */ -INLINE void PhysxWheel:: -ls(std::ostream &out, int indent_level) const { - - indent(out, indent_level) << get_type().get_name() - << " (at 0x" << this << ")\n"; -} diff --git a/panda/src/physx/physxWheel.cxx b/panda/src/physx/physxWheel.cxx deleted file mode 100644 index d8c3663532..0000000000 --- a/panda/src/physx/physxWheel.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheel.cxx - * @author enn0x - * @date 2010-03-23 - */ - -#include "physxWheel.h" -#include "physxWheelDesc.h" -#include "physxWheelShape.h" - -TypeHandle PhysxWheel::_type_handle; - -/** - * - */ -/* -PhysxWheelShape *PhysxWheel:: -get_wheel_shape() const { - - return _wheelShape; -} -*/ - -/** - * Attaches a node path to this wheel. The node path's transform will be - * updated automatically. - * - * Note: any non-uniform scale or shear set on the NodePath's transform will - * be overwritten at the time of the first update. - */ -/* -void PhysxWheel:: -attach_node_path(const NodePath &np) { - - nassertv(_error_type == ET_ok); - nassertv_always(!np.is_empty()); - _np = NodePath(np); -} -*/ - -/** - * Detaches a previously assigned NodePath from this wheel. The NodePath's - * transform will no longer be updated. - */ -/* -void PhysxWheel:: -detach_node_path() { - - nassertv(_error_type == ET_ok); - _np = NodePath(); -} -*/ - -/** - * Retrieves a previously attached NodePath. An empty NodePath will be - * returned if no NodePath has been attached to this wheel. - */ -/* -NodePath PhysxWheel:: -get_node_path() const { - - nassertr(_error_type == ET_ok, NodePath::fail()); - return _np; -} -*/ diff --git a/panda/src/physx/physxWheel.h b/panda/src/physx/physxWheel.h deleted file mode 100644 index 457962995c..0000000000 --- a/panda/src/physx/physxWheel.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheel.h - * @author enn0x - * @date 2010-03-23 - */ - -#ifndef PHYSXWHEEL_H -#define PHYSXWHEEL_H - -#include "pandabase.h" -#include "nodePath.h" - -#include "physxObject.h" -#include "physx_includes.h" - -class PhysxWheelDesc; -class PhysxWheelShape; - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxWheel : public PhysxObject { - -PUBLISHED: - INLINE PhysxWheel(); - INLINE ~PhysxWheel(); - - //PhysxActor *get_touched_actor() const; - //PhysxWheelShape *get_wheel_shape() const; - - //void attach_node_path(const NodePath &np); - //void detach_node_path(); - //NodePath get_node_path() const; - - INLINE void ls() const; - INLINE void ls(std::ostream &out, int indent_level=0) const; - -private: - PT(PhysxWheelShape) _wheelShape; - NodePath _np; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxObject::init_type(); - register_type(_type_handle, "PhysxWheel", - PhysxObject::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxWheel.I" - -#endif // PHYSXWHEEL_H diff --git a/panda/src/physx/physxWheelDesc.I b/panda/src/physx/physxWheelDesc.I deleted file mode 100644 index e806d24dc3..0000000000 --- a/panda/src/physx/physxWheelDesc.I +++ /dev/null @@ -1,49 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelDesc.I - * @author enn0x - * @date 2010-03-23 - */ - -/** - * - */ -INLINE PhysxWheelDesc:: -PhysxWheelDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxWheelDesc:: -~PhysxWheelDesc() { - -} - -/** - * (re)sets the structure to the default. - */ -INLINE void PhysxWheelDesc:: -set_to_default() { - - // TODO -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxWheelDesc:: -is_valid() const { - - // TODO - - return true; -} diff --git a/panda/src/physx/physxWheelDesc.cxx b/panda/src/physx/physxWheelDesc.cxx deleted file mode 100644 index 20c71c173a..0000000000 --- a/panda/src/physx/physxWheelDesc.cxx +++ /dev/null @@ -1,25 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelDesc.cxx - * @author enn0x - * @date 2010-03-23 - */ - -#include "physxWheelDesc.h" - -/** - * - */ -/* -void PhysxWheelDesc:: -set_wheel_radius(float wheelRadius) { - - _wheelRadius = wheelRadius; -} -*/ diff --git a/panda/src/physx/physxWheelDesc.h b/panda/src/physx/physxWheelDesc.h deleted file mode 100644 index 56239edf9c..0000000000 --- a/panda/src/physx/physxWheelDesc.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelDesc.h - * @author enn0x - * @date 2010-03-23 - */ - -#ifndef PHYSXWHEELDESC_H -#define PHYSXWHEELDESC_H - -#include "pandabase.h" -#include "luse.h" - -#include "physx_includes.h" - -/** - * - */ -class EXPCL_PANDAPHYSX PhysxWheelDesc : public ReferenceCount { - -PUBLISHED: - INLINE PhysxWheelDesc(); - INLINE ~PhysxWheelDesc(); - - INLINE void set_to_default(); - INLINE bool is_valid() const; - -public: -}; - -#include "physxWheelDesc.I" - -#endif // PHYSXWHEELDESC_H diff --git a/panda/src/physx/physxWheelShape.I b/panda/src/physx/physxWheelShape.I deleted file mode 100644 index dfe32fd410..0000000000 --- a/panda/src/physx/physxWheelShape.I +++ /dev/null @@ -1,28 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelShape.I - * @author enn0x - * @date 2009-11-09 - */ - -/** - * - */ -INLINE PhysxWheelShape:: -PhysxWheelShape() : PhysxShape() { - -} - -/** - * - */ -INLINE PhysxWheelShape:: -~PhysxWheelShape() { - -} diff --git a/panda/src/physx/physxWheelShape.cxx b/panda/src/physx/physxWheelShape.cxx deleted file mode 100644 index 69a3e5d02a..0000000000 --- a/panda/src/physx/physxWheelShape.cxx +++ /dev/null @@ -1,267 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelShape.cxx - * @author enn0x - * @date 2009-11-09 - */ - -#include "physxWheelShape.h" -#include "physxWheelShapeDesc.h" -#include "physxSpringDesc.h" - -TypeHandle PhysxWheelShape::_type_handle; - -/** - * - */ -void PhysxWheelShape:: -link(NxShape *shapePtr) { - - _ptr = shapePtr->isWheel(); - _ptr->userData = this; - _error_type = ET_ok; - - set_name(shapePtr->getName()); - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.add(this); -} - -/** - * - */ -void PhysxWheelShape:: -unlink() { - - _ptr->userData = nullptr; - _error_type = ET_released; - - PhysxActor *actor = (PhysxActor *)_ptr->getActor().userData; - actor->_shapes.remove(this); -} - -/** - * Saves the state of the shape object to a descriptor. - */ -void PhysxWheelShape:: -save_to_desc(PhysxWheelShapeDesc &shapeDesc) const { - - nassertv(_error_type == ET_ok); - _ptr->saveToDesc(shapeDesc._desc); -} - -/** - * Sets the sphere radius. - */ -void PhysxWheelShape:: -set_radius(float radius) { - - nassertv(_error_type == ET_ok); - _ptr->setRadius(radius); -} - -/** - * Returns the radius of the sphere. - */ -float PhysxWheelShape:: -get_radius() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getRadius(); -} - -/** - * Set the maximum extension distance of suspension along shape's -Y axis. - * The minimum extension is always 0. - */ -void PhysxWheelShape:: -set_suspension_travel(float travel) { - - nassertv(_error_type == ET_ok); - _ptr->setSuspensionTravel(travel); -} - -/** - * Returns the suspension travel - */ -float PhysxWheelShape:: -get_suspension_travel() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getSuspensionTravel(); -} - -/** - * Set the inverse mass of the wheel. Determines the wheel velocity that - * wheel torques can achieve. - */ -void PhysxWheelShape:: -set_inverse_wheel_mass(float invMass) { - - nassertv(_error_type == ET_ok); - _ptr->setInverseWheelMass(invMass); -} - -/** - * Returns the inverse mass of the wheel. Determines the wheel velocity that - * wheel torques can achieve. - */ -float PhysxWheelShape:: -get_inverse_wheel_mass() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getInverseWheelMass(); -} - -/** - * Set the sum engine torque on the wheel axle. Positive or negative - * depending on direction - */ -void PhysxWheelShape:: -set_motor_torque(float torque) { - - nassertv(_error_type == ET_ok); - _ptr->setMotorTorque(torque); -} - -/** - * Retrieves the sum engine torque on the wheel axle. Positive or negative - * depending on direction - */ -float PhysxWheelShape:: -get_motor_torque() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getMotorTorque(); -} - -/** - * Must be nonnegative. Very large values should lock wheel but should be - * stable. - */ -void PhysxWheelShape:: -set_brake_torque(float torque) { - - nassertv(_error_type == ET_ok); - _ptr->setBrakeTorque(torque); -} - -/** - * Must be nonnegative. Very large values should lock wheel but should be - * stable. - */ -float PhysxWheelShape:: -get_brake_torque() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getBrakeTorque(); -} - -/** - * Set the steering angle, around shape Y axis. The steering angle is - * measured in degrees. - */ -void PhysxWheelShape:: -set_steer_angle(float angle) { - - nassertv(_error_type == ET_ok); - _ptr->setSteerAngle(NxMath::degToRad(-1.0f * angle)); -} - -/** - * Retrieves the steering angle, around shape Y axis. The steering angle is - * measured in degrees. - */ -float PhysxWheelShape:: -get_steer_angle() const { - - nassertr(_error_type == ET_ok, 0.0f); - return -1.0f * NxMath::radToDeg(_ptr->getSteerAngle()); -} - -/** - * Set the steering angle, around shape Y axis. The steering angle is - * measured in radians. - */ -void PhysxWheelShape:: -set_steer_angle_rad(float angle) { - - nassertv(_error_type == ET_ok); - _ptr->setSteerAngle(-1.0f * angle); -} - -/** - * Retrieves the steering angle, around shape Y axis. The steering angle is - * measured in radians. - */ -float PhysxWheelShape:: -get_steer_angle_rad() const { - - nassertr(_error_type == ET_ok, 0.0f); - return -1.0f * _ptr->getSteerAngle(); -} - -/** - * Set the current axle rotation speed. Note: WSF_axle_speed_override flag - * must be raised for this to have effect! - */ -void PhysxWheelShape:: -set_axle_speed(float speed) { - - nassertv(_error_type == ET_ok); - _ptr->setAxleSpeed(speed); -} - -/** - * Retrieves the current axle rotation speed. - */ -float PhysxWheelShape:: -get_axle_speed() const { - - nassertr(_error_type == ET_ok, 0.0f); - return _ptr->getAxleSpeed(); -} - -/** - * Turns the specified wheel shape flag on or off. - */ -void PhysxWheelShape:: -set_wheel_flag(PhysxWheelShapeFlag flag, bool value) { - - nassertv(_error_type == ET_ok); - NxU32 flags = _ptr->getWheelFlags(); - - if (value == true) { - flags |= flag; - } else { - flags &= ~(flag); - } - - _ptr->setWheelFlags(flags); -} - -/** - * Returns the value of the specified wheel shape flag. - */ -bool PhysxWheelShape:: -get_wheel_flag(PhysxWheelShapeFlag flag) const { - - nassertr(_error_type == ET_ok, false); - return (_ptr->getWheelFlags() & flag) ? true : false; -} - -/** - * Set the data intended for car wheel suspension effects. - */ -void PhysxWheelShape:: -set_suspension(const PhysxSpringDesc &spring) { - - nassertv(_error_type == ET_ok); - return _ptr->setSuspension(spring._desc); -} diff --git a/panda/src/physx/physxWheelShape.h b/panda/src/physx/physxWheelShape.h deleted file mode 100644 index 7b4a1ee7bd..0000000000 --- a/panda/src/physx/physxWheelShape.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelShape.h - * @author enn0x - * @date 2009-11-09 - */ - -#ifndef PHYSXWHEELSHAPE_H -#define PHYSXWHEELSHAPE_H - -#include "pandabase.h" - -#include "physxShape.h" -#include "physx_includes.h" - -class PhysxWheelShapeDesc; -class PhysxSpringDesc; - -/** - * A special shape used for simulating a car wheel. The -Y axis should be - * directed toward the ground. - * - * A ray is cast from the shape's origin along the -Y axis. When the ray - * strikes something, and the distance is: - * - * - less than wheelRadius from the shape origin: a hard contact is created - - * between wheelRadius and (suspensionTravel + wheelRadius): a soft suspension - * contact is created - greater than (suspensionTravel + wheelRadius): no - * contact is created. - * - * Thus at the point of greatest possible suspension compression the wheel - * axle will pass through at the shape's origin. At the point greatest - * suspension extension the wheel axle will be a distance of suspensionTravel - * from the shape's origin. - * - * The suspension's targetValue is 0 for real cars, which means that the - * suspension tries to extend all the way. Otherwise one can specify values - * [0,1] for suspensions which have a spring to pull the wheel up when it is - * extended too far. 0.5 will then fall halfway along suspensionTravel. - * - * The +Z axis is the 'forward' direction of travel for the wheel. -Z is - * backwards. The wheel rolls forward when rotating around the positive - * direction around the X axis. - * - * A positive wheel steering angle corresponds to a positive rotation around - * the shape's Y axis. (Castor angles are not modeled.) - * - * The coordinate frame of the shape is rigidly fixed on the car. - */ -class EXPCL_PANDAPHYSX PhysxWheelShape : public PhysxShape { -PUBLISHED: - INLINE PhysxWheelShape(); - INLINE ~PhysxWheelShape(); - - void save_to_desc(PhysxWheelShapeDesc &shapeDesc) const; - - void set_radius(float radius); - void set_suspension_travel(float travel); - void set_inverse_wheel_mass(float invMass); - void set_motor_torque(float torque); - void set_brake_torque(float torque); - void set_steer_angle(float angle); - void set_steer_angle_rad(float angle); - void set_axle_speed(float speed); - void set_wheel_flag(PhysxWheelShapeFlag flag, bool value); - void set_suspension(const PhysxSpringDesc &spring); - - float get_radius() const; - float get_suspension_travel() const; - float get_inverse_wheel_mass() const; - float get_motor_torque() const; - float get_brake_torque() const; - float get_steer_angle() const; - float get_steer_angle_rad() const; - float get_axle_speed() const; - bool get_wheel_flag(PhysxWheelShapeFlag flag) const; - -public: - INLINE NxShape *ptr() const { return (NxShape *)_ptr; }; - - void link(NxShape *shapePtr); - void unlink(); - -private: - NxWheelShape *_ptr; - -public: - static TypeHandle get_class_type() { - return _type_handle; - } - static void init_type() { - PhysxShape::init_type(); - register_type(_type_handle, "PhysxWheelShape", - PhysxShape::get_class_type()); - } - virtual TypeHandle get_type() const { - return get_class_type(); - } - virtual TypeHandle force_init_type() { - init_type(); - return get_class_type(); - } - -private: - static TypeHandle _type_handle; -}; - -#include "physxWheelShape.I" - -#endif // PHYSXWHEELSHAPE_H diff --git a/panda/src/physx/physxWheelShapeDesc.I b/panda/src/physx/physxWheelShapeDesc.I deleted file mode 100644 index 4a40eb24cf..0000000000 --- a/panda/src/physx/physxWheelShapeDesc.I +++ /dev/null @@ -1,38 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelShapeDesc.I - * @author enn0x - * @date 2009-11-09 - */ - -/** - * - */ -INLINE PhysxWheelShapeDesc:: -PhysxWheelShapeDesc() : PhysxShapeDesc() { - - set_to_default(); -} - -/** - * - */ -INLINE PhysxWheelShapeDesc:: -~PhysxWheelShapeDesc() { - -} - -/** - * Returns true if the descriptor is valid. - */ -INLINE bool PhysxWheelShapeDesc:: -is_valid() const { - - return _desc.isValid(); -} diff --git a/panda/src/physx/physxWheelShapeDesc.cxx b/panda/src/physx/physxWheelShapeDesc.cxx deleted file mode 100644 index 2a3791ba77..0000000000 --- a/panda/src/physx/physxWheelShapeDesc.cxx +++ /dev/null @@ -1,178 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelShapeDesc.cxx - * @author enn0x - * @date 2009-11-09 - */ - -#include "physxWheelShapeDesc.h" - -/** - * (re)sets the structure to the default. - */ -void PhysxWheelShapeDesc:: -set_to_default() { - - _desc.setToDefault(); - set_name(""); - - _desc.localPose = PhysxManager::mat4_to_nxMat34(LMatrix4f::y_to_z_up_mat()); -} - -/** - * Radius of shape. Must be positive. - */ -void PhysxWheelShapeDesc:: -set_radius(float radius) { - - _desc.radius = radius; -} - -/** - * Radius of shape. - */ -float PhysxWheelShapeDesc:: -get_radius() const { - - return _desc.radius; -} - -/** - * Set the maximum extension distance of suspension along shape's -Y axis. - */ -void PhysxWheelShapeDesc:: -set_suspension_travel(float suspensionTravel) { - - _desc.suspensionTravel = suspensionTravel; -} - -/** - * - */ -float PhysxWheelShapeDesc:: -get_suspension_travel() const { - - return _desc.suspensionTravel; -} - -/** - * Set the inverse mass of the wheel. - */ -void PhysxWheelShapeDesc:: -set_inverse_wheel_mass(float inverseWheelMass) { - - _desc.inverseWheelMass = inverseWheelMass; -} - -/** - * - */ -float PhysxWheelShapeDesc:: -get_inverse_wheel_mass() const { - - return _desc.inverseWheelMass; -} - -/** - * Set the sum engine torque on the wheel axle. - */ -void PhysxWheelShapeDesc:: -set_motor_torque(float motorTorque) { - - _desc.motorTorque = motorTorque; -} - -/** - * - */ -float PhysxWheelShapeDesc:: -get_motor_torque() const { - - return _desc.motorTorque; -} - -/** - * Set the amount of torque applied for braking. - */ -void PhysxWheelShapeDesc:: -set_brake_torque(float brakeTorque) { - - _desc.brakeTorque = brakeTorque; -} - -/** - * - */ -float PhysxWheelShapeDesc:: -get_brake_torque() const { - - return _desc.brakeTorque; -} - -/** - * Set the steering angle, around shape Y axis. The steering angle is - * measured in degrees. - */ -void PhysxWheelShapeDesc:: -set_steer_angle(float steerAngle) { - - _desc.steerAngle = NxMath::degToRad(steerAngle); -} - -/** - * - */ -float PhysxWheelShapeDesc:: -get_steer_angle() const { - - return _desc.steerAngle; -} - -/** - * Turn the specified wheel shape flag on or off. - */ -void PhysxWheelShapeDesc:: -set_wheel_flag(PhysxWheelShapeFlag flag, bool value) { - - if (value == true) { - _desc.wheelFlags |= flag; - } - else { - _desc.wheelFlags &= ~(flag); - } -} - -/** - * Returns the specified wheel shape flag. - */ -bool PhysxWheelShapeDesc:: -get_wheel_flag(const PhysxWheelShapeFlag flag) const { - - return (_desc.wheelFlags & flag) ? true : false; -} - -/** - * Set the data intended for car wheel suspension effects. - */ -void PhysxWheelShapeDesc:: -set_suspension(const PhysxSpringDesc &spring) { - - _desc.suspension = spring._desc; -} - -/** - * - */ -PhysxSpringDesc PhysxWheelShapeDesc:: -get_suspension() const { - - PhysxSpringDesc value; - value._desc = _desc.suspension; - return value; -} diff --git a/panda/src/physx/physxWheelShapeDesc.h b/panda/src/physx/physxWheelShapeDesc.h deleted file mode 100644 index 85dcf96d62..0000000000 --- a/panda/src/physx/physxWheelShapeDesc.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physxWheelShapeDesc.h - * @author enn0x - * @date 2009-11-09 - */ - -#ifndef PHYSXWHEELSHAPEDESC_H -#define PHYSXWHEELSHAPEDESC_H - -#include "pandabase.h" - -#include "physxShapeDesc.h" -#include "physx_includes.h" - -class PhysxSpringDesc; - -/** - * Descriptor class for PhysxWheelShape. - */ -class EXPCL_PANDAPHYSX PhysxWheelShapeDesc : public PhysxShapeDesc { - -PUBLISHED: - INLINE PhysxWheelShapeDesc(); - INLINE ~PhysxWheelShapeDesc(); - - void set_to_default(); - INLINE bool is_valid() const; - - void set_radius(float radius); - void set_suspension_travel(float suspensionTravel); - void set_inverse_wheel_mass(float inverseWheelMass); - void set_motor_torque(float motorTorque); - void set_brake_torque(float brakeTorque); - void set_steer_angle(float steerAngle); - void set_wheel_flag(PhysxWheelShapeFlag flag, bool value); - void set_suspension(const PhysxSpringDesc &spring); - - float get_radius() const; - float get_suspension_travel() const; - float get_inverse_wheel_mass() const; - float get_motor_torque() const; - float get_brake_torque() const; - float get_steer_angle() const; - bool get_wheel_flag(PhysxWheelShapeFlag flag) const; - PhysxSpringDesc get_suspension() const; - -public: - NxShapeDesc *ptr() const { return (NxShapeDesc *)&_desc; }; - NxWheelShapeDesc _desc; -}; - -#include "physxWheelShapeDesc.I" - -#endif // PHYSXWHEELSHAPEDESC_H diff --git a/panda/src/physx/physx_includes.h b/panda/src/physx/physx_includes.h deleted file mode 100644 index fb46a62fae..0000000000 --- a/panda/src/physx/physx_includes.h +++ /dev/null @@ -1,63 +0,0 @@ -/** - * PANDA 3D SOFTWARE - * Copyright (c) Carnegie Mellon University. All rights reserved. - * - * All use of this software is subject to the terms of the revised BSD - * license. You should have received a copy of this license along - * with this source code in a file named "LICENSE." - * - * @file physx_includes.h - * @author joswilso - * @date 2007-01-30 - */ - -#ifndef PHYSX_INCLUDES_H -#define PHYSX_INCLUDES_H - -// This one is safe to include -#include - -// Platform-specific defines -#if defined(_WIN64) -#define NX64 1 -#elif defined(_WIN32) -#define NX32 1 -#else -#if NATIVE_WORDSIZE == 64 -#define NX64 1 -#endif - -#if NATIVE_WORDSIZE == 32 -#define NX32 1 -#endif -#endif - -#ifdef IS_LINUX -#define LINUX 1 -#define CORELIB 1 -#define NX_DISABLE_HARDWARE 1 -#if NX_SDK_VERSION_NUMBER <= 281 -// Defining this in 2.8.3.3 yields a crash. -#define NX_DISABLE_FLUIDS 1 -#endif -#endif - - -// Undefine min and max before any PhysX headers get included -#undef min -#undef max - - -// PhysX headers -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#endif // PHYSX_INCLUDES_H