Merge branch 'master' of https://github.com/highfidelity/hifi into metavoxels

This commit is contained in:
Andrzej Kapolka 2015-01-19 12:41:21 -08:00
commit eb320f37c7
21 changed files with 109 additions and 148 deletions

View file

@ -8,11 +8,9 @@
# #
macro(INCLUDE_BULLET) macro(INCLUDE_BULLET)
find_package(Bullet) find_package(Bullet REQUIRED)
if (BULLET_FOUND) include_directories("${BULLET_INCLUDE_DIRS}")
include_directories("${BULLET_INCLUDE_DIRS}") if (APPLE OR UNIX)
if (APPLE OR UNIX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${BULLET_INCLUDE_DIRS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_BULLET_PHYSICS -isystem ${BULLET_INCLUDE_DIRS}") endif()
endif ()
endif (BULLET_FOUND)
endmacro(INCLUDE_BULLET) endmacro(INCLUDE_BULLET)

View file

@ -0,0 +1,93 @@
# - Try to find the Bullet physics engine
#
# This module defines the following variables
#
# BULLET_FOUND - Was bullet found
# BULLET_INCLUDE_DIRS - the Bullet include directories
# BULLET_LIBRARIES - Link to this, by default it includes
# all bullet components (Dynamics,
# Collision, LinearMath, & SoftBody)
#
# This module accepts the following variables
#
# BULLET_ROOT - Can be set to bullet install path or Windows build path
#
# Modified on 2015.01.15 by Andrew Meadows
# This is an adapted version of the FindBullet.cmake module distributed with Cmake 2.8.12.2
# The original license for that file is displayed below.
#
#=============================================================================
# Copyright 2009 Kitware, Inc.
# Copyright 2009 Philip Lowman <philip@yhbt.com>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
hifi_library_search_hints("bullet")
macro(_FIND_BULLET_LIBRARY _var)
find_library(${_var}
NAMES
${ARGN}
HINTS
${BULLET_SEARCH_DIRS}
$ENV{BULLET_ROOT_DIR}
${BULLET_ROOT}
${BULLET_ROOT}/out/release8/libs
${BULLET_ROOT}/out/debug8/libs
PATH_SUFFIXES lib lib/Release lib/Debug
)
mark_as_advanced(${_var})
endmacro()
macro(_BULLET_APPEND_LIBRARIES _list _release)
set(_debug ${_release}_DEBUG)
if(${_debug})
set(${_list} ${${_list}} optimized ${${_release}} debug ${${_debug}})
else()
set(${_list} ${${_list}} ${${_release}})
endif()
endmacro()
find_path(BULLET_INCLUDE_DIR NAMES btBulletCollisionCommon.h
HINTS
${BULLET_SEARCH_DIRS}/include
$ENV{BULLET_ROOT_DIR}
${BULLET_ROOT}/include
${BULLET_ROOT}/src
PATH_SUFFIXES bullet
)
# Find the libraries
_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY BulletDynamics)
_FIND_BULLET_LIBRARY(BULLET_DYNAMICS_LIBRARY_DEBUG BulletDynamics_Debug BulletDynamics_d)
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY BulletCollision)
_FIND_BULLET_LIBRARY(BULLET_COLLISION_LIBRARY_DEBUG BulletCollision_Debug BulletCollision_d)
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY BulletMath LinearMath)
_FIND_BULLET_LIBRARY(BULLET_MATH_LIBRARY_DEBUG BulletMath_Debug BulletMath_d LinearMath_Debug LinearMath_d)
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY BulletSoftBody)
_FIND_BULLET_LIBRARY(BULLET_SOFTBODY_LIBRARY_DEBUG BulletSoftBody_Debug BulletSoftBody_d)
find_package_handle_standard_args(Bullet "Could NOT find Bullet, try to set the path to Bullet root folder in the system variable BULLET_ROOT_DIR"
BULLET_DYNAMICS_LIBRARY BULLET_COLLISION_LIBRARY BULLET_MATH_LIBRARY
BULLET_INCLUDE_DIR
)
set(BULLET_INCLUDE_DIRS ${BULLET_INCLUDE_DIR})
if(BULLET_FOUND)
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_DYNAMICS_LIBRARY)
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_COLLISION_LIBRARY)
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_MATH_LIBRARY)
_BULLET_APPEND_LIBRARIES(BULLET_LIBRARIES BULLET_SOFTBODY_LIBRARY)
endif()

View file

@ -190,9 +190,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
_frameCount(0), _frameCount(0),
_fps(60.0f), _fps(60.0f),
_justStarted(true), _justStarted(true),
#ifdef USE_BULLET_PHYSICS
_physicsEngine(glm::vec3(0.0f)), _physicsEngine(glm::vec3(0.0f)),
#endif // USE_BULLET_PHYSICS
_entities(true, this, this), _entities(true, this, this),
_entityCollisionSystem(), _entityCollisionSystem(),
_entityClipboardRenderer(false, this, this), _entityClipboardRenderer(false, this, this),
@ -1725,12 +1723,10 @@ void Application::init() {
// save settings when avatar changes // save settings when avatar changes
connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings); connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::bumpSettings);
#ifdef USE_BULLET_PHYSICS
EntityTree* tree = _entities.getTree(); EntityTree* tree = _entities.getTree();
_physicsEngine.setEntityTree(tree); _physicsEngine.setEntityTree(tree);
tree->setSimulation(&_physicsEngine); tree->setSimulation(&_physicsEngine);
_physicsEngine.init(&_entityEditSender); _physicsEngine.init(&_entityEditSender);
#endif // USE_BULLET_PHYSICS
// make sure our texture cache knows about window size changes // make sure our texture cache knows about window size changes
DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data()); DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data());
@ -2041,12 +2037,10 @@ void Application::update(float deltaTime) {
updateDialogs(deltaTime); // update various stats dialogs if present updateDialogs(deltaTime); // update various stats dialogs if present
updateCursor(deltaTime); // Handle cursor updates updateCursor(deltaTime); // Handle cursor updates
#ifdef USE_BULLET_PHYSICS
{ {
PerformanceTimer perfTimer("physics"); PerformanceTimer perfTimer("physics");
_physicsEngine.stepSimulation(); _physicsEngine.stepSimulation();
} }
#endif // USE_BULLET_PHYSICS
if (!_aboutToQuit) { if (!_aboutToQuit) {
PerformanceTimer perfTimer("entities"); PerformanceTimer perfTimer("entities");
@ -3682,7 +3676,6 @@ void Application::openUrl(const QUrl& url) {
void Application::updateMyAvatarTransform() { void Application::updateMyAvatarTransform() {
bumpSettings(); bumpSettings();
#ifdef USE_BULLET_PHYSICS
const float SIMULATION_OFFSET_QUANTIZATION = 16.0f; // meters const float SIMULATION_OFFSET_QUANTIZATION = 16.0f; // meters
glm::vec3 avatarPosition = _myAvatar->getPosition(); glm::vec3 avatarPosition = _myAvatar->getPosition();
glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset(); glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset();
@ -3696,7 +3689,6 @@ void Application::updateMyAvatarTransform() {
// TODO: Andrew to replace this with method that actually moves existing object positions in PhysicsEngine // TODO: Andrew to replace this with method that actually moves existing object positions in PhysicsEngine
_physicsEngine.setOriginOffset(newOriginOffset); _physicsEngine.setOriginOffset(newOriginOffset);
} }
#endif // USE_BULLET_PHYSICS
} }
void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) { void Application::domainSettingsReceived(const QJsonObject& domainSettingsObject) {

View file

@ -463,9 +463,7 @@ private:
bool _justStarted; bool _justStarted;
Stars _stars; Stars _stars;
#ifdef USE_BULLET_PHYSICS
PhysicsEngine _physicsEngine; PhysicsEngine _physicsEngine;
#endif // USE_BULLET_PHYSICS
EntityTreeRenderer _entities; EntityTreeRenderer _entities;
EntityCollisionSystem _entityCollisionSystem; EntityCollisionSystem _entityCollisionSystem;

View file

@ -238,8 +238,8 @@ QSizeF Text3DOverlay::textSize(const QString& text) const {
QFont font(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE); // Same font properties as render() QFont font(SANS_FONT_FAMILY, FIXED_FONT_POINT_SIZE); // Same font properties as render()
QFontMetrics fontMetrics(font); QFontMetrics fontMetrics(font);
const float TEXT_SCALE_ADJUST = 1.02f; // Experimentally detemined for the specified font const float TEXT_SCALE_ADJUST = 1.025f; // Experimentally detemined for the specified font
const int TEXT_HEIGHT_ADJUST = -6; const int TEXT_HEIGHT_ADJUST = -10;
float scaleFactor = _lineHeight * TEXT_SCALE_ADJUST * LINE_SCALE_RATIO / (float)FIXED_FONT_POINT_SIZE; float scaleFactor = _lineHeight * TEXT_SCALE_ADJUST * LINE_SCALE_RATIO / (float)FIXED_FONT_POINT_SIZE;
QStringList lines = text.split(QRegExp("\r\n|\r|\n")); QStringList lines = text.split(QRegExp("\r\n|\r|\n"));

View file

@ -12,8 +12,6 @@
#ifndef hifi_BulletUtil_h #ifndef hifi_BulletUtil_h
#define hifi_BulletUtil_h #define hifi_BulletUtil_h
#ifdef USE_BULLET_PHYSICS
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp> #include <glm/gtc/quaternion.hpp>
@ -34,5 +32,4 @@ inline btQuaternion glmToBullet(const glm::quat& g) {
return btQuaternion(g.x, g.y, g.z, g.w); return btQuaternion(g.x, g.y, g.z, g.w);
} }
#endif // USE_BULLET_PHYSICS
#endif // hifi_BulletUtil_h #endif // hifi_BulletUtil_h

View file

@ -12,9 +12,7 @@
#include <EntityItem.h> #include <EntityItem.h>
#include <EntityEditPacketSender.h> #include <EntityEditPacketSender.h>
#ifdef USE_BULLET_PHYSICS
#include "BulletUtil.h" #include "BulletUtil.h"
#endif // USE_BULLET_PHYSICS
#include "EntityMotionState.h" #include "EntityMotionState.h"
#include "SimpleEntityKinematicController.h" #include "SimpleEntityKinematicController.h"
@ -62,7 +60,6 @@ void EntityMotionState::addKinematicController() {
} }
} }
#ifdef USE_BULLET_PHYSICS
// This callback is invoked by the physics simulation in two cases: // This callback is invoked by the physics simulation in two cases:
// (1) when the RigidBody is first added to the world // (1) when the RigidBody is first added to the world
// (irregardless of MotionType: STATIC, DYNAMIC, or KINEMATIC) // (irregardless of MotionType: STATIC, DYNAMIC, or KINEMATIC)
@ -93,10 +90,8 @@ void EntityMotionState::setWorldTransform(const btTransform& worldTrans) {
_outgoingPacketFlags = DIRTY_PHYSICS_FLAGS; _outgoingPacketFlags = DIRTY_PHYSICS_FLAGS;
EntityMotionState::enqueueOutgoingEntity(_entity); EntityMotionState::enqueueOutgoingEntity(_entity);
} }
#endif // USE_BULLET_PHYSICS
void EntityMotionState::updateObjectEasy(uint32_t flags, uint32_t frame) { void EntityMotionState::updateObjectEasy(uint32_t flags, uint32_t frame) {
#ifdef USE_BULLET_PHYSICS
if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY)) { if (flags & (EntityItem::DIRTY_POSITION | EntityItem::DIRTY_VELOCITY)) {
if (flags & EntityItem::DIRTY_POSITION) { if (flags & EntityItem::DIRTY_POSITION) {
_sentPosition = _entity->getPositionInMeters() - ObjectMotionState::getWorldOffset(); _sentPosition = _entity->getPositionInMeters() - ObjectMotionState::getWorldOffset();
@ -132,11 +127,9 @@ void EntityMotionState::updateObjectEasy(uint32_t flags, uint32_t frame) {
_body->updateInertiaTensor(); _body->updateInertiaTensor();
} }
_body->activate(); _body->activate();
#endif // USE_BULLET_PHYSICS
}; };
void EntityMotionState::updateObjectVelocities() { void EntityMotionState::updateObjectVelocities() {
#ifdef USE_BULLET_PHYSICS
if (_body) { if (_body) {
_sentVelocity = _entity->getVelocityInMeters(); _sentVelocity = _entity->getVelocityInMeters();
setVelocity(_sentVelocity); setVelocity(_sentVelocity);
@ -150,7 +143,6 @@ void EntityMotionState::updateObjectVelocities() {
_body->setActivationState(ACTIVE_TAG); _body->setActivationState(ACTIVE_TAG);
} }
#endif // USE_BULLET_PHYSICS
} }
void EntityMotionState::computeShapeInfo(ShapeInfo& shapeInfo) { void EntityMotionState::computeShapeInfo(ShapeInfo& shapeInfo) {
@ -162,7 +154,6 @@ float EntityMotionState::computeMass(const ShapeInfo& shapeInfo) const {
} }
void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame) { void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame) {
#ifdef USE_BULLET_PHYSICS
if (!_entity->isKnownID()) { if (!_entity->isKnownID()) {
return; // never update entities that are unknown return; // never update entities that are unknown
} }
@ -232,12 +223,11 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
_outgoingPacketFlags = DIRTY_PHYSICS_FLAGS; _outgoingPacketFlags = DIRTY_PHYSICS_FLAGS;
_sentFrame = frame; _sentFrame = frame;
} }
#endif // USE_BULLET_PHYSICS
} }
uint32_t EntityMotionState::getIncomingDirtyFlags() const { uint32_t EntityMotionState::getIncomingDirtyFlags() const {
uint32_t dirtyFlags = _entity->getDirtyFlags(); uint32_t dirtyFlags = _entity->getDirtyFlags();
#ifdef USE_BULLET_PHYSICS
// we add DIRTY_MOTION_TYPE if the body's motion type disagrees with entity velocity settings // we add DIRTY_MOTION_TYPE if the body's motion type disagrees with entity velocity settings
int bodyFlags = _body->getCollisionFlags(); int bodyFlags = _body->getCollisionFlags();
bool isMoving = _entity->isMoving(); bool isMoving = _entity->isMoving();
@ -245,6 +235,5 @@ uint32_t EntityMotionState::getIncomingDirtyFlags() const {
(bodyFlags & btCollisionObject::CF_KINEMATIC_OBJECT && !isMoving)) { (bodyFlags & btCollisionObject::CF_KINEMATIC_OBJECT && !isMoving)) {
dirtyFlags |= EntityItem::DIRTY_MOTION_TYPE; dirtyFlags |= EntityItem::DIRTY_MOTION_TYPE;
} }
#endif // USE_BULLET_PHYSICS
return dirtyFlags; return dirtyFlags;
} }

View file

@ -14,18 +14,8 @@
#include <AACube.h> #include <AACube.h>
#include "ObjectMotionState.h"
#ifndef USE_BULLET_PHYSICS
// ObjectMotionState stubbery
#include "KinematicController.h" #include "KinematicController.h"
class ObjectMotionState { #include "ObjectMotionState.h"
public:
// so that this stub implementation is not completely empty we give the class a data member
KinematicController* _kinematicController;
bool _stubData;
};
#endif // USE_BULLET_PHYSICS
class EntityItem; class EntityItem;
@ -52,13 +42,11 @@ public:
// virtual override for ObjectMotionState // virtual override for ObjectMotionState
void addKinematicController(); void addKinematicController();
#ifdef USE_BULLET_PHYSICS
// this relays incoming position/rotation to the RigidBody // this relays incoming position/rotation to the RigidBody
void getWorldTransform(btTransform& worldTrans) const; void getWorldTransform(btTransform& worldTrans) const;
// this relays outgoing position/rotation to the EntityItem // this relays outgoing position/rotation to the EntityItem
void setWorldTransform(const btTransform& worldTrans); void setWorldTransform(const btTransform& worldTrans);
#endif // USE_BULLET_PHYSICS
// these relay incoming values to the RigidBody // these relay incoming values to the RigidBody
void updateObjectEasy(uint32_t flags, uint32_t frame); void updateObjectEasy(uint32_t flags, uint32_t frame);

View file

@ -9,8 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#ifdef USE_BULLET_PHYSICS
#include <math.h> #include <math.h>
#include "BulletUtil.h" #include "BulletUtil.h"
@ -18,14 +16,6 @@
#include "ObjectMotionState.h" #include "ObjectMotionState.h"
#include "PhysicsEngine.h" #include "PhysicsEngine.h"
const float MIN_DENSITY = 200.0f;
const float DEFAULT_DENSITY = 1000.0f;
const float MAX_DENSITY = 20000.0f;
const float MIN_VOLUME = 0.001f;
const float DEFAULT_VOLUME = 1.0f;
const float MAX_VOLUME = 1000000.0f;
const float DEFAULT_FRICTION = 0.5f; const float DEFAULT_FRICTION = 0.5f;
const float MAX_FRICTION = 10.0f; const float MAX_FRICTION = 10.0f;
@ -180,5 +170,3 @@ void ObjectMotionState::removeKinematicController() {
_kinematicController = NULL; _kinematicController = NULL;
} }
} }
#endif // USE_BULLET_PHYSICS

View file

@ -12,8 +12,13 @@
#ifndef hifi_ObjectMotionState_h #ifndef hifi_ObjectMotionState_h
#define hifi_ObjectMotionState_h #define hifi_ObjectMotionState_h
#include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp>
#include <EntityItem.h> #include <EntityItem.h>
#include "ShapeInfo.h"
enum MotionType { enum MotionType {
MOTION_TYPE_STATIC, // no motion MOTION_TYPE_STATIC, // no motion
MOTION_TYPE_DYNAMIC, // motion according to physical laws MOTION_TYPE_DYNAMIC, // motion according to physical laws
@ -32,13 +37,6 @@ 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;
#ifdef USE_BULLET_PHYSICS
#include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp>
#include <EntityItem.h> // for EntityItem::DIRTY_FOO bitmasks
#include "ShapeInfo.h"
class OctreeEditPacketSender; class OctreeEditPacketSender;
class KinematicController; class KinematicController;
@ -117,5 +115,4 @@ protected:
KinematicController* _kinematicController = NULL; KinematicController* _kinematicController = NULL;
}; };
#endif // USE_BULLET_PHYSICS
#endif // hifi_ObjectMotionState_h #endif // hifi_ObjectMotionState_h

View file

@ -10,7 +10,8 @@
// //
#include "PhysicsEngine.h" #include "PhysicsEngine.h"
#include "ShapeInfoUtil.h"
#include "ThreadSafeDynamicsWorld.h"
static uint32_t _frameCount; static uint32_t _frameCount;
@ -19,11 +20,6 @@ uint32_t PhysicsEngine::getFrameCount() {
return _frameCount; return _frameCount;
} }
#ifdef USE_BULLET_PHYSICS
#include "ShapeInfoUtil.h"
#include "ThreadSafeDynamicsWorld.h"
PhysicsEngine::PhysicsEngine(const glm::vec3& offset) PhysicsEngine::PhysicsEngine(const glm::vec3& offset)
: _collisionConfig(NULL), : _collisionConfig(NULL),
_collisionDispatcher(NULL), _collisionDispatcher(NULL),
@ -411,5 +407,3 @@ void PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motio
body->activate(); body->activate();
} }
#endif // USE_BULLET_PHYSICS

View file

@ -16,8 +16,6 @@
const float PHYSICS_ENGINE_FIXED_SUBSTEP = 1.0f / 60.0f; const float PHYSICS_ENGINE_FIXED_SUBSTEP = 1.0f / 60.0f;
#ifdef USE_BULLET_PHYSICS
#include <QSet> #include <QSet>
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
@ -96,11 +94,4 @@ private:
EntityEditPacketSender* _entityPacketSender; EntityEditPacketSender* _entityPacketSender;
}; };
#else // USE_BULLET_PHYSICS
// PhysicsEngine stubbery until Bullet is required
class PhysicsEngine {
public:
static uint32_t getFrameCount();
};
#endif // USE_BULLET_PHYSICS
#endif // hifi_PhysicsEngine_h #endif // hifi_PhysicsEngine_h

View file

@ -15,9 +15,6 @@
#include "ShapeInfoUtil.h" #include "ShapeInfoUtil.h"
#include "BulletUtil.h" #include "BulletUtil.h"
#ifdef USE_BULLET_PHYSICS
int ShapeInfoUtil::toBulletShapeType(int shapeInfoType) { int ShapeInfoUtil::toBulletShapeType(int shapeInfoType) {
int bulletShapeType = INVALID_SHAPE_PROXYTYPE; int bulletShapeType = INVALID_SHAPE_PROXYTYPE;
switch(shapeInfoType) { switch(shapeInfoType) {
@ -168,5 +165,3 @@ DoubleHashKey ShapeInfoUtil::computeHash(const ShapeInfo& info) {
key._hash2 = (int)hash; key._hash2 = (int)hash;
return key; return key;
} }
#endif // USE_BULLET_PHYSICS

View file

@ -12,8 +12,6 @@
#ifndef hifi_ShapeInfoUtil_h #ifndef hifi_ShapeInfoUtil_h
#define hifi_ShapeInfoUtil_h #define hifi_ShapeInfoUtil_h
#ifdef USE_BULLET_PHYSICS
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
@ -35,5 +33,4 @@ namespace ShapeInfoUtil {
int fromBulletShapeType(int bulletShapeType); int fromBulletShapeType(int bulletShapeType);
}; };
#endif // USE_BULLET_PHYSICS
#endif // hifi_ShapeInfoUtil_h #endif // hifi_ShapeInfoUtil_h

View file

@ -9,8 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
// //
#ifdef USE_BULLET_PHYSICS
#include <glm/gtx/norm.hpp> #include <glm/gtx/norm.hpp>
#include "ShapeInfoUtil.h" #include "ShapeInfoUtil.h"
@ -104,6 +102,3 @@ int ShapeManager::getNumReferences(const ShapeInfo& info) const {
} }
return -1; return -1;
} }
#endif // USE_BULLET_PHYSICS

View file

@ -12,8 +12,6 @@
#ifndef hifi_ShapeManager_h #ifndef hifi_ShapeManager_h
#define hifi_ShapeManager_h #define hifi_ShapeManager_h
#ifdef USE_BULLET_PHYSICS
#include <btBulletDynamicsCommon.h> #include <btBulletDynamicsCommon.h>
#include <LinearMath/btHashMap.h> #include <LinearMath/btHashMap.h>
@ -52,5 +50,4 @@ private:
btAlignedObjectArray<DoubleHashKey> _pendingGarbage; btAlignedObjectArray<DoubleHashKey> _pendingGarbage;
}; };
#endif // USE_BULLET_PHYSICS
#endif // hifi_ShapeManager_h #endif // hifi_ShapeManager_h

View file

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

View file

@ -18,7 +18,6 @@
#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>
ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld { ATTRIBUTE_ALIGNED16(class) ThreadSafeDynamicsWorld : public btDiscreteDynamicsWorld {
@ -40,13 +39,4 @@ public:
float getLocalTimeAccumulation() const { return m_localTime; } float getLocalTimeAccumulation() const { return m_localTime; }
}; };
#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

@ -16,7 +16,6 @@
#include "BulletUtilTests.h" #include "BulletUtilTests.h"
#ifdef USE_BULLET_PHYSICS
void BulletUtilTests::fromBulletToGLM() { void BulletUtilTests::fromBulletToGLM() {
btVector3 bV(1.23f, 4.56f, 7.89f); btVector3 bV(1.23f, 4.56f, 7.89f);
glm::vec3 gV = bulletToGLM(bV); glm::vec3 gV = bulletToGLM(bV);
@ -101,14 +100,3 @@ void BulletUtilTests::runAllTests() {
fromBulletToGLM(); fromBulletToGLM();
fromGLMToBullet(); fromGLMToBullet();
} }
#else // USE_BULLET_PHYSICS
void BulletUtilTests::fromBulletToGLM() {
}
void BulletUtilTests::fromGLMToBullet() {
}
void BulletUtilTests::runAllTests() {
}
#endif // USE_BULLET_PHYSICS

View file

@ -11,10 +11,8 @@
#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>
@ -24,7 +22,6 @@
#include "ShapeInfoTests.h" #include "ShapeInfoTests.h"
void ShapeInfoTests::testHashFunctions() { void ShapeInfoTests::testHashFunctions() {
#ifdef USE_BULLET_PHYSICS
int maxTests = 10000000; int maxTests = 10000000;
ShapeInfo info; ShapeInfo info;
btHashMap<btHashInt, int> hashes; btHashMap<btHashInt, int> hashes;
@ -135,11 +132,9 @@ void ShapeInfoTests::testHashFunctions() {
for (int i = 0; i < 32; ++i) { for (int i = 0; i < 32; ++i) {
std::cout << "bit 0x" << std::hex << masks[i] << std::dec << " = " << bits[i] << std::endl; std::cout << "bit 0x" << std::hex << masks[i] << std::dec << " = " << bits[i] << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeInfoTests::testBoxShape() { void ShapeInfoTests::testBoxShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
glm::vec3 halfExtents(1.23f, 4.56f, 7.89f); glm::vec3 halfExtents(1.23f, 4.56f, 7.89f);
info.setBox(halfExtents); info.setBox(halfExtents);
@ -165,11 +160,9 @@ void ShapeInfoTests::testBoxShape() {
} }
delete shape; delete shape;
#endif // USE_BULLET_PHYSICS
} }
void ShapeInfoTests::testSphereShape() { void ShapeInfoTests::testSphereShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
float radius = 1.23f; float radius = 1.23f;
info.setSphere(radius); info.setSphere(radius);
@ -191,11 +184,9 @@ void ShapeInfoTests::testSphereShape() {
} }
delete shape; delete shape;
#endif // USE_BULLET_PHYSICS
} }
void ShapeInfoTests::testCylinderShape() { void ShapeInfoTests::testCylinderShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
float radius = 1.23f; float radius = 1.23f;
float height = 4.56f; float height = 4.56f;
@ -218,11 +209,9 @@ void ShapeInfoTests::testCylinderShape() {
} }
delete shape; delete shape;
#endif // USE_BULLET_PHYSICS
} }
void ShapeInfoTests::testCapsuleShape() { void ShapeInfoTests::testCapsuleShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
float radius = 1.23f; float radius = 1.23f;
float height = 4.56f; float height = 4.56f;
@ -245,7 +234,6 @@ void ShapeInfoTests::testCapsuleShape() {
} }
delete shape; delete shape;
#endif // USE_BULLET_PHYSICS
} }
void ShapeInfoTests::runAllTests() { void ShapeInfoTests::runAllTests() {

View file

@ -17,7 +17,6 @@
#include "ShapeManagerTests.h" #include "ShapeManagerTests.h"
void ShapeManagerTests::testShapeAccounting() { void ShapeManagerTests::testShapeAccounting() {
#ifdef USE_BULLET_PHYSICS
ShapeManager shapeManager; ShapeManager shapeManager;
ShapeInfo info; ShapeInfo info;
info.setBox(glm::vec3(1.0f, 1.0f, 1.0f)); info.setBox(glm::vec3(1.0f, 1.0f, 1.0f));
@ -118,11 +117,9 @@ void ShapeManagerTests::testShapeAccounting() {
std::cout << __FILE__ << ":" << __LINE__ std::cout << __FILE__ << ":" << __LINE__
<< " ERROR: expected refcount = 1 for shape but found refcount = " << numReferences << std::endl; << " ERROR: expected refcount = 1 for shape but found refcount = " << numReferences << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeManagerTests::addManyShapes() { void ShapeManagerTests::addManyShapes() {
#ifdef USE_BULLET_PHYSICS
ShapeManager shapeManager; ShapeManager shapeManager;
int numSizes = 100; int numSizes = 100;
@ -152,11 +149,9 @@ void ShapeManagerTests::addManyShapes() {
std::cout << __FILE__ << ":" << __LINE__ std::cout << __FILE__ << ":" << __LINE__
<< " ERROR: expected numShapes = " << numSizes << " but found numShapes = " << numShapes << std::endl; << " ERROR: expected numShapes = " << numSizes << " but found numShapes = " << numShapes << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeManagerTests::addBoxShape() { void ShapeManagerTests::addBoxShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
glm::vec3 halfExtents(1.23f, 4.56f, 7.89f); glm::vec3 halfExtents(1.23f, 4.56f, 7.89f);
info.setBox(halfExtents); info.setBox(halfExtents);
@ -172,11 +167,9 @@ void ShapeManagerTests::addBoxShape() {
std::cout << __FILE__ << ":" << __LINE__ std::cout << __FILE__ << ":" << __LINE__
<< " ERROR: Box ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl; << " ERROR: Box ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeManagerTests::addSphereShape() { void ShapeManagerTests::addSphereShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
float radius = 1.23f; float radius = 1.23f;
info.setSphere(radius); info.setSphere(radius);
@ -192,11 +185,9 @@ void ShapeManagerTests::addSphereShape() {
std::cout << __FILE__ << ":" << __LINE__ std::cout << __FILE__ << ":" << __LINE__
<< " ERROR: Sphere ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl; << " ERROR: Sphere ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeManagerTests::addCylinderShape() { void ShapeManagerTests::addCylinderShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
float radius = 1.23f; float radius = 1.23f;
float height = 4.56f; float height = 4.56f;
@ -213,11 +204,9 @@ void ShapeManagerTests::addCylinderShape() {
std::cout << __FILE__ << ":" << __LINE__ std::cout << __FILE__ << ":" << __LINE__
<< " ERROR: Cylinder ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl; << " ERROR: Cylinder ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeManagerTests::addCapsuleShape() { void ShapeManagerTests::addCapsuleShape() {
#ifdef USE_BULLET_PHYSICS
ShapeInfo info; ShapeInfo info;
float radius = 1.23f; float radius = 1.23f;
float height = 4.56f; float height = 4.56f;
@ -234,7 +223,6 @@ void ShapeManagerTests::addCapsuleShape() {
std::cout << __FILE__ << ":" << __LINE__ std::cout << __FILE__ << ":" << __LINE__
<< " ERROR: Capsule ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl; << " ERROR: Capsule ShapeInfo --> shape --> ShapeInfo --> shape did not work" << std::endl;
} }
#endif // USE_BULLET_PHYSICS
} }
void ShapeManagerTests::runAllTests() { void ShapeManagerTests::runAllTests() {