repairs to build when Bullet not found

This commit is contained in:
Andrew Meadows 2014-12-11 16:05:45 -08:00
parent c3f8f8ab98
commit ad7641c7e0
7 changed files with 32 additions and 17 deletions

View file

@ -97,6 +97,7 @@ void EntityMotionState::computeShapeInfo(ShapeInfo& info) {
} }
void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender) { void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender) {
#ifdef USE_BULLET_PHYSICS
if (_outgoingPhysicsDirtyFlags) { if (_outgoingPhysicsDirtyFlags) {
EntityItemProperties properties = _entity->getProperties(); EntityItemProperties properties = _entity->getProperties();
@ -157,4 +158,5 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender) {
entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties); entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
} }
_outgoingPhysicsDirtyFlags = 0; _outgoingPhysicsDirtyFlags = 0;
#endif // USE_BULLET_PHYSICS
} }

View file

@ -14,9 +14,8 @@
#include <AACube.h> #include <AACube.h>
#ifdef USE_BULLET_PHYSICS
#include "ObjectMotionState.h" #include "ObjectMotionState.h"
#else // USE_BULLET_PHYSICS #ifndef USE_BULLET_PHYSICS
// ObjectMotionState stubbery // ObjectMotionState stubbery
class ObjectMotionState { class ObjectMotionState {
public: public:

View file

@ -12,13 +12,11 @@
#ifndef hifi_ObjectMotionState_h #ifndef hifi_ObjectMotionState_h
#define hifi_ObjectMotionState_h #define hifi_ObjectMotionState_h
#ifdef USE_BULLET_PHYSICS enum MotionType {
MOTION_TYPE_STATIC, // no motion
#include <btBulletDynamicsCommon.h> MOTION_TYPE_DYNAMIC, // motion according to physical laws
#include <glm/glm.hpp> MOTION_TYPE_KINEMATIC // keyframed motion
#include <EntityItem.h> // for EntityItem::DIRTY_FOO bitmasks };
#include "ShapeInfo.h"
// The update flags trigger two varieties of updates: "hard" which require the body to be pulled // 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. // 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: // These are the outgoing flags that the PhysicsEngine can affect:
const uint32_t OUTGOING_DIRTY_PHYSICS_FLAGS = EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY; const uint32_t OUTGOING_DIRTY_PHYSICS_FLAGS = EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY;
enum MotionType { #ifdef USE_BULLET_PHYSICS
MOTION_TYPE_STATIC, // no motion
MOTION_TYPE_DYNAMIC, // motion according to physical laws #include <btBulletDynamicsCommon.h>
MOTION_TYPE_KINEMATIC // keyframed motion #include <glm/glm.hpp>
}; #include <EntityItem.h> // for EntityItem::DIRTY_FOO bitmasks
#include "ShapeInfo.h"
class OctreeEditPacketSender; class OctreeEditPacketSender;

View file

@ -12,9 +12,10 @@
// TODO DONE: make MotionState able to clear incoming flags // TODO DONE: make MotionState able to clear incoming flags
// TODO DONE: make MotionState::setWorldTransform() put itself on _incomingChanges list // TODO DONE: make MotionState::setWorldTransform() put itself on _incomingChanges list
// TODO DONE: give PhysicsEngine instance an _entityPacketSender // 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: make sure incoming and outgoing pipelines are connected
// TODO: provide some sort of "reliable" send for "stopped" update // 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" #include "PhysicsEngine.h"
#ifdef USE_BULLET_PHYSICS #ifdef USE_BULLET_PHYSICS

View file

@ -19,6 +19,7 @@
#include "ThreadSafeDynamicsWorld.h" #include "ThreadSafeDynamicsWorld.h"
#ifdef USE_BULLET_PHYSICS
ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld( ThreadSafeDynamicsWorld::ThreadSafeDynamicsWorld(
btDispatcher* dispatcher, btDispatcher* dispatcher,
btBroadphaseInterface* pairCache, btBroadphaseInterface* pairCache,
@ -87,3 +88,4 @@ int ThreadSafeDynamicsWorld::stepSimulation( btScalar timeStep, int maxSubSteps,
clearForces(); clearForces();
return subSteps; return subSteps;
} }
#endif // USE_BULLET_PHYSICS

View file

@ -18,12 +18,12 @@
#ifndef hifi_ThreadSafeDynamicsWorld_h #ifndef hifi_ThreadSafeDynamicsWorld_h
#define hifi_ThreadSafeDynamicsWorld_h #define hifi_ThreadSafeDynamicsWorld_h
#ifdef USE_BULLET_PHYSICS
#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h> #include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
class EntityTree; class EntityTree;
ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld {
{
public: public:
BT_DECLARE_ALIGNED_ALLOCATOR(); BT_DECLARE_ALIGNED_ALLOCATOR();
@ -47,4 +47,13 @@ private:
EntityTree* _entities; 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 #endif // hifi_ThreadSafeDynamicsWorld_h

View file

@ -11,8 +11,10 @@
#include <iostream> #include <iostream>
#ifdef USE_BULLET_PHYSICS
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <LinearMath/btHashMap.h> #include <LinearMath/btHashMap.h>
#endif // USE_BULLET_PHYSICS
#include <DoubleHashKey.h> #include <DoubleHashKey.h>
#include <ShapeInfo.h> #include <ShapeInfo.h>