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) {
#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
}

View file

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

View file

@ -12,13 +12,11 @@
#ifndef hifi_ObjectMotionState_h
#define hifi_ObjectMotionState_h
#ifdef USE_BULLET_PHYSICS
#include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp>
#include <EntityItem.h> // 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 <btBulletDynamicsCommon.h>
#include <glm/glm.hpp>
#include <EntityItem.h> // for EntityItem::DIRTY_FOO bitmasks
#include "ShapeInfo.h"
class OctreeEditPacketSender;

View file

@ -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

View file

@ -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

View file

@ -18,12 +18,12 @@
#ifndef hifi_ThreadSafeDynamicsWorld_h
#define hifi_ThreadSafeDynamicsWorld_h
#ifdef USE_BULLET_PHYSICS
#include <BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h>
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

View file

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