mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
update bullet so it actually works
Moved the addSourceDirectory for physics/Bullet into the Engine/Source/CMakeLists.txt file that way it can actually appear where we expect it to in the solution explorer.
This commit is contained in:
parent
c7be48130a
commit
13fa178cf6
5986 changed files with 1811270 additions and 453803 deletions
16
Engine/lib/bullet/examples/SharedMemory/physx/PhysXC_API.cpp
Normal file
16
Engine/lib/bullet/examples/SharedMemory/physx/PhysXC_API.cpp
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
#ifdef BT_ENABLE_PHYSX
|
||||
#include "PhysXC_API.h"
|
||||
#include "../PhysicsDirect.h"
|
||||
#include "PhysXServerCommandProcessor.h"
|
||||
|
||||
|
||||
B3_SHARED_API b3PhysicsClientHandle b3ConnectPhysX(int argc, char* argv[])
|
||||
{
|
||||
PhysXServerCommandProcessor* sdk = new PhysXServerCommandProcessor(argc,argv);
|
||||
|
||||
PhysicsDirect* direct = new PhysicsDirect(sdk, true);
|
||||
bool connected;
|
||||
connected = direct->connect();
|
||||
return (b3PhysicsClientHandle)direct;
|
||||
}
|
||||
#endif //BT_ENABLE_PHYSX
|
||||
20
Engine/lib/bullet/examples/SharedMemory/physx/PhysXC_API.h
Normal file
20
Engine/lib/bullet/examples/SharedMemory/physx/PhysXC_API.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef PHYSX_C_API_H
|
||||
#define PHYSX_C_API_H
|
||||
|
||||
#ifdef BT_ENABLE_PHYSX
|
||||
|
||||
#include "../PhysicsClientC_API.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
B3_SHARED_API b3PhysicsClientHandle b3ConnectPhysX(int argc, char* argv[]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //BT_ENABLE_PHYSX
|
||||
#endif //PHYSX_C_API_H
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,57 @@
|
|||
#ifndef PHYSX_SERVER_COMMAND_PROCESSOR_H
|
||||
#define PHYSX_SERVER_COMMAND_PROCESSOR_H
|
||||
|
||||
#include "../PhysicsCommandProcessorInterface.h"
|
||||
|
||||
class PhysXServerCommandProcessor : public PhysicsCommandProcessorInterface
|
||||
{
|
||||
struct PhysXServerCommandProcessorInternalData* m_data;
|
||||
|
||||
bool processSyncBodyInfoCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processRequestInternalDataCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processSyncUserDataCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processLoadURDFCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processRequestBodyInfoCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processForwardDynamicsCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processSendPhysicsParametersCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processRequestActualStateCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processResetSimulationCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processInitPoseCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processSendDesiredStateCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processChangeDynamicsInfoCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processRequestPhysicsSimulationParametersCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processRequestContactpointInformationCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processCreateCollisionShapeCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processSetAdditionalSearchPathCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processUserDebugDrawCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
bool processRequestCameraImageCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
bool processCustomCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
void resetSimulation();
|
||||
bool processStateLoggingCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
public:
|
||||
PhysXServerCommandProcessor(int argc, char* argv[]);
|
||||
|
||||
virtual ~PhysXServerCommandProcessor();
|
||||
|
||||
virtual bool connect();
|
||||
|
||||
virtual void disconnect();
|
||||
|
||||
virtual bool isConnected() const;
|
||||
|
||||
virtual bool processCommand(const struct SharedMemoryCommand& clientCmd, struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
virtual bool receiveStatus(struct SharedMemoryStatus& serverStatusOut, char* bufferServerToClient, int bufferSizeInBytes);
|
||||
|
||||
virtual void renderScene(int renderFlags) {}
|
||||
virtual void physicsDebugDraw(int debugDrawFlags) {}
|
||||
virtual void setGuiHelper(struct GUIHelperInterface* guiHelper) {}
|
||||
virtual void setTimeOut(double timeOutInSeconds) {}
|
||||
|
||||
virtual void reportNotifications() {}
|
||||
};
|
||||
|
||||
#endif //PHYSX_SERVER_COMMAND_PROCESSOR_H
|
||||
1434
Engine/lib/bullet/examples/SharedMemory/physx/PhysXUrdfImporter.cpp
Normal file
1434
Engine/lib/bullet/examples/SharedMemory/physx/PhysXUrdfImporter.cpp
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,116 @@
|
|||
#ifndef PHYSX_URDF_IMPORTER_H
|
||||
#define PHYSX_URDF_IMPORTER_H
|
||||
|
||||
#include "../../Importers/ImportURDFDemo/URDFImporterInterface.h"
|
||||
#include "../../Importers/ImportURDFDemo/UrdfRenderingInterface.h"
|
||||
|
||||
struct PhysXURDFTexture
|
||||
{
|
||||
int m_width;
|
||||
int m_height;
|
||||
unsigned char* textureData1;
|
||||
bool m_isCached;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///PhysXURDFImporter can deal with URDF and SDF files
|
||||
class PhysXURDFImporter : public URDFImporterInterface
|
||||
{
|
||||
struct PhysXURDFInternalData* m_data;
|
||||
|
||||
public:
|
||||
PhysXURDFImporter(struct CommonFileIOInterface* fileIO=0,double globalScaling=1, int flags=0);
|
||||
|
||||
virtual ~PhysXURDFImporter();
|
||||
|
||||
virtual bool loadURDF(const char* fileName, bool forceFixedBase = false);
|
||||
|
||||
//warning: some quick test to load SDF: we 'activate' a model, so we can re-use URDF code path
|
||||
virtual bool loadSDF(const char* fileName, bool forceFixedBase = false);
|
||||
virtual int getNumModels() const;
|
||||
virtual void activateModel(int modelIndex);
|
||||
virtual void setBodyUniqueId(int bodyId);
|
||||
virtual int getBodyUniqueId() const;
|
||||
const char* getPathPrefix();
|
||||
|
||||
void printTree(); //for debugging
|
||||
|
||||
virtual int getRootLinkIndex() const;
|
||||
|
||||
virtual void getLinkChildIndices(int linkIndex, btAlignedObjectArray<int>& childLinkIndices) const;
|
||||
|
||||
virtual std::string getBodyName() const;
|
||||
|
||||
virtual std::string getLinkName(int linkIndex) const;
|
||||
|
||||
virtual bool getLinkColor(int linkIndex, btVector4& colorRGBA) const;
|
||||
|
||||
virtual bool getLinkColor2(int linkIndex, UrdfMaterialColor& matCol) const;
|
||||
|
||||
virtual void setLinkColor2(int linkIndex, struct UrdfMaterialColor& matCol) const;
|
||||
|
||||
virtual bool getLinkContactInfo(int urdflinkIndex, URDFLinkContactInfo& contactInfo) const;
|
||||
|
||||
virtual bool getLinkAudioSource(int linkIndex, SDFAudioSource& audioSource) const;
|
||||
|
||||
virtual std::string getJointName(int linkIndex) const;
|
||||
|
||||
virtual void getMassAndInertia(int linkIndex, btScalar& mass, btVector3& localInertiaDiagonal, btTransform& inertialFrame) const;
|
||||
virtual void getMassAndInertia2(int urdfLinkIndex, btScalar& mass, btVector3& localInertiaDiagonal, btTransform& inertialFrame, int flags) const;
|
||||
|
||||
virtual bool getJointInfo(int urdfLinkIndex, btTransform& parent2joint, btTransform& linkTransformInWorld, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit, btScalar& jointDamping, btScalar& jointFriction) const;
|
||||
virtual bool getJointInfo2(int urdfLinkIndex, btTransform& parent2joint, btTransform& linkTransformInWorld, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit, btScalar& jointDamping, btScalar& jointFriction, btScalar& jointMaxForce, btScalar& jointMaxVelocity) const;
|
||||
|
||||
virtual bool getRootTransformInWorld(btTransform& rootTransformInWorld) const;
|
||||
virtual void setRootTransformInWorld(const btTransform& rootTransformInWorld);
|
||||
|
||||
|
||||
|
||||
virtual int convertLinkVisualShapes3(
|
||||
int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame,
|
||||
const struct UrdfLink* linkPtr, const UrdfModel* model,
|
||||
int collisionObjectUniqueId, int bodyUniqueId, struct CommonFileIOInterface* fileIO) const;
|
||||
|
||||
virtual void convertLinkVisualShapes2(int linkIndex, int urdfIndex, const char* pathPrefix, const btTransform& inertialFrame, class btCollisionObject* colObj, int bodyUniqueId) const;
|
||||
|
||||
class btCollisionShape* convertURDFToCollisionShape(const struct UrdfCollision* collision, const char* urdfPathPrefix) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int getUrdfFromCollisionShape(const btCollisionShape* collisionShape, UrdfCollision& collision) const;
|
||||
|
||||
///todo(erwincoumans) refactor this convertLinkCollisionShapes/memory allocation
|
||||
|
||||
virtual class btCompoundShape* convertLinkCollisionShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual const struct UrdfLink* getUrdfLink(int urdfLinkIndex) const;
|
||||
|
||||
virtual const struct UrdfModel* getUrdfModel() const;
|
||||
|
||||
virtual int getCollisionGroupAndMask(int linkIndex, int& colGroup, int& colMask) const;
|
||||
|
||||
virtual int getNumAllocatedCollisionShapes() const;
|
||||
virtual class btCollisionShape* getAllocatedCollisionShape(int index);
|
||||
|
||||
virtual int getNumAllocatedMeshInterfaces() const;
|
||||
virtual class btStridingMeshInterface* getAllocatedMeshInterface(int index);
|
||||
|
||||
virtual int getNumAllocatedTextures() const;
|
||||
virtual int getAllocatedTexture(int index) const;
|
||||
|
||||
virtual void setEnableTinyRenderer(bool enable);
|
||||
//void convertURDFToVisualShapeInternal(const struct UrdfVisual* visual, const char* urdfPathPrefix, const class btTransform& visualTransform, btAlignedObjectArray<struct GLInstanceVertex>& verticesOut, btAlignedObjectArray<int>& indicesOut, btAlignedObjectArray<struct PhysXURDFTexture>& texturesOut, struct b3ImportMeshData& meshData) const;
|
||||
|
||||
|
||||
int getNumPhysXLinks() const;
|
||||
|
||||
};
|
||||
|
||||
#endif //PHYSX_URDF_IMPORTER_H
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef PHYSX_USER_DATA_H
|
||||
#define PHYSX_USER_DATA_H
|
||||
|
||||
struct MyPhysXUserData
|
||||
{
|
||||
int m_graphicsUniqueId;
|
||||
int m_bodyUniqueId;
|
||||
int m_linkIndex;
|
||||
};
|
||||
#endif //PHYSX_USER_DATA_H
|
||||
1039
Engine/lib/bullet/examples/SharedMemory/physx/URDF2PhysX.cpp
Normal file
1039
Engine/lib/bullet/examples/SharedMemory/physx/URDF2PhysX.cpp
Normal file
File diff suppressed because it is too large
Load diff
26
Engine/lib/bullet/examples/SharedMemory/physx/URDF2PhysX.h
Normal file
26
Engine/lib/bullet/examples/SharedMemory/physx/URDF2PhysX.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef URDF2PHYSX_H
|
||||
#define URDF2PHYSX_H
|
||||
|
||||
#include "Bullet3Common/b3AlignedObjectArray.h"
|
||||
#include "../../Importers/ImportURDFDemo/URDFJointTypes.h"
|
||||
|
||||
namespace physx
|
||||
{
|
||||
class PxBase;
|
||||
class PxFoundation;
|
||||
class PxPhysics;
|
||||
class PxDefaultCpuDispatcher;
|
||||
class PxScene;
|
||||
class PxCooking;
|
||||
class PxArticulationReducedCoordinate;
|
||||
};
|
||||
|
||||
struct UrdfVisualShapeCache2
|
||||
{
|
||||
b3AlignedObjectArray<UrdfMaterialColor> m_cachedUrdfLinkColors;
|
||||
b3AlignedObjectArray<int> m_cachedUrdfLinkVisualShapeIndices;
|
||||
};
|
||||
|
||||
physx::PxBase* URDF2PhysX(physx::PxFoundation* foundation, physx::PxPhysics* physics, physx::PxCooking* cooking, physx::PxScene* scene, class PhysXURDFImporter& u2p, int flags, const char* pathPrefix, const class btTransform& rootTransformInWorldSpace,struct CommonFileIOInterface* fileIO, bool createActiculation);
|
||||
|
||||
#endif //URDF2PHYSX_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue