diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 91a654592c..66d15115fb 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -97,6 +97,7 @@ void EntityMotionState::computeShapeInfo(ShapeInfo& info) { } void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender) { +#ifdef USE_BULLET_PHYSICS if (_outgoingPhysicsDirtyFlags) { EntityItemProperties properties = _entity->getProperties(); @@ -157,4 +158,5 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender) { entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties); } _outgoingPhysicsDirtyFlags = 0; +#endif // USE_BULLET_PHYSICS } diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index 3391ed3020..b411d256ca 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -14,9 +14,8 @@ #include -#ifdef USE_BULLET_PHYSICS #include "ObjectMotionState.h" -#else // USE_BULLET_PHYSICS +#ifndef USE_BULLET_PHYSICS // ObjectMotionState stubbery class ObjectMotionState { public: diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 6b05740984..9b0db65e0a 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -12,13 +12,11 @@ #ifndef hifi_ObjectMotionState_h #define hifi_ObjectMotionState_h -#ifdef USE_BULLET_PHYSICS - -#include -#include -#include // for EntityItem::DIRTY_FOO bitmasks - -#include "ShapeInfo.h" +enum MotionType { + MOTION_TYPE_STATIC, // no motion + MOTION_TYPE_DYNAMIC, // motion according to physical laws + MOTION_TYPE_KINEMATIC // keyframed motion +}; // The update flags trigger two varieties of updates: "hard" which require the body to be pulled // and re-added to the physics engine and "easy" which just updates the body properties. @@ -33,11 +31,13 @@ const uint32_t DIRTY_PHYSICS_FLAGS = HARD_DIRTY_PHYSICS_FLAGS | EASY_DIRTY_PHYSI // These are the outgoing flags that the PhysicsEngine can affect: const uint32_t OUTGOING_DIRTY_PHYSICS_FLAGS = EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY; -enum MotionType { - MOTION_TYPE_STATIC, // no motion - MOTION_TYPE_DYNAMIC, // motion according to physical laws - MOTION_TYPE_KINEMATIC // keyframed motion -}; +#ifdef USE_BULLET_PHYSICS + +#include +#include +#include // for EntityItem::DIRTY_FOO bitmasks + +#include "ShapeInfo.h" class OctreeEditPacketSender; diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 3b6c48b3b4..465a56c7fc 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -12,9 +12,10 @@ // TODO DONE: make MotionState able to clear incoming flags // TODO DONE: make MotionState::setWorldTransform() put itself on _incomingChanges list // TODO DONE: give PhysicsEngine instance an _entityPacketSender +// TODO DONE: make sure code compiles when BULLET is not found // TODO: make sure incoming and outgoing pipelines are connected // TODO: provide some sort of "reliable" send for "stopped" update -// TODO: make sure code compiles when BULLET is not found +// TODO: test entity updates (second viewer sees physics results from first) #include "PhysicsEngine.h" #ifdef USE_BULLET_PHYSICS diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp index 4660e02c2f..e70bdc7210 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.cpp +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.cpp @@ -19,6 +19,7 @@ #include "ThreadSafeDynamicsWorld.h" +#ifdef USE_BULLET_PHYSICS ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld( btDispatcher* dispatcher, btBroadphaseInterface* pairCache, @@ -87,3 +88,4 @@ int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps, clearForces(); return subSteps; } +#endif // USE_BULLET_PHYSICS diff --git a/libraries/physics/src/ThreadSafeDynamicsWorld.h b/libraries/physics/src/ThreadSafeDynamicsWorld.h index 96cff8bda1..3f3bc2517b 100644 --- a/libraries/physics/src/ThreadSafeDynamicsWorld.h +++ b/libraries/physics/src/ThreadSafeDynamicsWorld.h @@ -18,12 +18,12 @@ #ifndef hifi_ThreadSafeDynamicsWorld_h #define hifi_ThreadSafeDynamicsWorld_h +#ifdef USE_BULLET_PHYSICS #include class EntityTree; -ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld -{ +ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld { public: BT_DECLARE_ALIGNED_ALLOCATOR(); @@ -47,4 +47,13 @@ private: EntityTree* _entities; }; +#else // USE_BULLET_PHYSICS +// stubbery for ThreadSafeDynamicsWorld when Bullet not available +class ThreadSafeDynamicsWorld { +public: + ThreadSafeDynamicsWorld() {} +}; + +#endif // USE_BULLET_PHYSICS + #endif // hifi_ThreadSafeDynamicsWorld_h diff --git a/tests/physics/src/ShapeInfoTests.cpp b/tests/physics/src/ShapeInfoTests.cpp index 8784ce1266..a4db3a5764 100644 --- a/tests/physics/src/ShapeInfoTests.cpp +++ b/tests/physics/src/ShapeInfoTests.cpp @@ -11,8 +11,10 @@ #include +#ifdef USE_BULLET_PHYSICS #include #include +#endif // USE_BULLET_PHYSICS #include #include