moving Shape* back into shared lib

removing dependency of entities lib on physics lib
physics lib now depends on entities lib
This commit is contained in:
Andrew Meadows 2014-12-01 16:03:14 -08:00
parent 051b04402f
commit 1df6c32a4e
39 changed files with 81 additions and 105 deletions

View file

@ -2021,8 +2021,8 @@ void Application::init() {
connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::updateMyAvatarTransform); connect(_myAvatar, &MyAvatar::transformChanged, this, &Application::updateMyAvatarTransform);
#ifdef USE_BULLET_PHYSICS #ifdef USE_BULLET_PHYSICS
_physicsEngine.initSafe(_entities.getTree()); // _physicsEngine.initSafe(_entities.getTree());
_entities.getTree()->setPhysicsEngine(&_physicsEngine); // _entities.getTree()->setSimulation(&_physicsEngine);
#endif // USE_BULLET_PHYSICS #endif // USE_BULLET_PHYSICS
} }
@ -4159,15 +4159,14 @@ void Application::updateMyAvatarTransform() {
glm::vec3 avatarPosition = _myAvatar->getPosition(); glm::vec3 avatarPosition = _myAvatar->getPosition();
glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset(); glm::vec3 physicsWorldOffset = _physicsEngine.getOriginOffset();
if (glm::distance(avatarPosition, physicsWorldOffset) > SIMULATION_OFFSET_QUANTIZATION) { if (glm::distance(avatarPosition, physicsWorldOffset) > SIMULATION_OFFSET_QUANTIZATION) {
//_entityCollisionSystem.forgetAllPhysics();
glm::vec3 newOriginOffset = avatarPosition; glm::vec3 newOriginOffset = avatarPosition;
int halfExtent = (int)HALF_SIMULATION_EXTENT; int halfExtent = (int)HALF_SIMULATION_EXTENT;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
newOriginOffset[i] = (float)(glm::max(halfExtent, newOriginOffset[i] = (float)(glm::max(halfExtent,
((int)(avatarPosition[i] / SIMULATION_OFFSET_QUANTIZATION)) * (int)SIMULATION_OFFSET_QUANTIZATION)); ((int)(avatarPosition[i] / SIMULATION_OFFSET_QUANTIZATION)) * (int)SIMULATION_OFFSET_QUANTIZATION));
} }
// TODO: Andrew to replace this with method that actually moves existing object positions in PhysicsEngine
_physicsEngine.setOriginOffset(newOriginOffset); _physicsEngine.setOriginOffset(newOriginOffset);
//_entityCollisionSystem.rememberAllPhysics();
} }
#endif // USE_BULLET_PHYSICS #endif // USE_BULLET_PHYSICS
} }

View file

@ -5,7 +5,7 @@ setup_hifi_library(Network Script)
include_glm() include_glm()
link_hifi_libraries(shared octree voxels networking physics) link_hifi_libraries(shared octree voxels networking)
include_hifi_library_headers(fbx) include_hifi_library_headers(fbx)
# call macro to link our dependencies and bubble them up via a property on our target # call macro to link our dependencies and bubble them up via a property on our target

View file

@ -4,9 +4,8 @@ set(TARGET_NAME entities)
setup_hifi_library(Network Script) setup_hifi_library(Network Script)
include_glm() include_glm()
include_bullet()
link_hifi_libraries(shared octree fbx networking animation physics) link_hifi_libraries(shared octree fbx networking animation)
# call macro to link our dependencies and bubble them up via a property on our target # call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies() link_shared_dependencies()

View file

@ -15,7 +15,6 @@
#include <ByteCountCoding.h> #include <ByteCountCoding.h>
#include "BoxEntityItem.h" #include "BoxEntityItem.h"
#include "EntityMotionState.h"
#include "EntityTree.h" #include "EntityTree.h"
#include "EntityTreeElement.h" #include "EntityTreeElement.h"
@ -97,6 +96,7 @@ void BoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitst
APPEND_ENTITY_PROPERTY(PROP_COLOR, appendColor, getColor()); APPEND_ENTITY_PROPERTY(PROP_COLOR, appendColor, getColor());
} }
/*
#ifdef USE_BULLET_PHYSICS #ifdef USE_BULLET_PHYSICS
EntityMotionState* BoxEntityItem::createMotionState() { EntityMotionState* BoxEntityItem::createMotionState() {
if (!_motionState) { if (!_motionState) {
@ -107,4 +107,5 @@ EntityMotionState* BoxEntityItem::createMotionState() {
return _motionState; return _motionState;
} }
#endif // USE_BULLET_PHYSICS #endif // USE_BULLET_PHYSICS
*/

View file

@ -50,10 +50,6 @@ public:
_color[GREEN_INDEX] = value.green; _color[GREEN_INDEX] = value.green;
_color[BLUE_INDEX] = value.blue; _color[BLUE_INDEX] = value.blue;
} }
#ifdef USE_BULLET_PHYSICS
EntityMotionState* createMotionState();
#endif // USE_BULLET_PHYSICS
protected: protected:
rgbColor _color; rgbColor _color;

View file

@ -21,7 +21,6 @@
#include "EntityScriptingInterface.h" #include "EntityScriptingInterface.h"
#include "EntityItem.h" #include "EntityItem.h"
#include "EntityMotionState.h"
#include "EntityTree.h" #include "EntityTree.h"
const float EntityItem::IMMORTAL = -1.0f; /// special lifetime which means the entity lives for ever. default lifetime const float EntityItem::IMMORTAL = -1.0f; /// special lifetime which means the entity lives for ever. default lifetime
@ -91,7 +90,7 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) {
_lastEditedFromRemoteInRemoteTime = 0; _lastEditedFromRemoteInRemoteTime = 0;
_lastUpdated = 0; _lastUpdated = 0;
_created = 0; _created = 0;
_motionState = NULL; _physicsInfo = NULL;
_updateFlags = 0; _updateFlags = 0;
_changedOnServer = 0; _changedOnServer = 0;
initFromEntityItemID(entityItemID); initFromEntityItemID(entityItemID);
@ -105,7 +104,7 @@ EntityItem::EntityItem(const EntityItemID& entityItemID, const EntityItemPropert
_lastEditedFromRemoteInRemoteTime = 0; _lastEditedFromRemoteInRemoteTime = 0;
_lastUpdated = 0; _lastUpdated = 0;
_created = properties.getCreated(); _created = properties.getCreated();
_motionState = NULL; _physicsInfo = NULL;
_updateFlags = 0; _updateFlags = 0;
_changedOnServer = 0; _changedOnServer = 0;
initFromEntityItemID(entityItemID); initFromEntityItemID(entityItemID);
@ -114,9 +113,6 @@ EntityItem::EntityItem(const EntityItemID& entityItemID, const EntityItemPropert
} }
EntityItem::~EntityItem() { EntityItem::~EntityItem() {
// Make sure the EntityItem has been removed from the physics engine AND
// that its _motionState has been destroyed BEFORE you get here.
assert(_motionState == NULL);
} }
EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& params) const { EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& params) const {
@ -628,7 +624,7 @@ void EntityItem::update(const quint64& updateTime) {
qDebug() << " ********** EntityItem::update() .... SETTING _lastUpdated=" << _lastUpdated; qDebug() << " ********** EntityItem::update() .... SETTING _lastUpdated=" << _lastUpdated;
} }
if (!_motionState) { if (!_physicsInfo) {
if (hasAngularVelocity()) { if (hasAngularVelocity()) {
glm::quat rotation = getRotation(); glm::quat rotation = getRotation();
glm::vec3 angularVelocity = glm::radians(getAngularVelocity()); glm::vec3 angularVelocity = glm::radians(getAngularVelocity());
@ -1072,10 +1068,3 @@ void EntityItem::updateScript(const QString& value) {
} }
} }
void EntityItem::destroyMotionState() {
if (_motionState) {
delete _motionState;
_motionState = NULL;
}
}

View file

@ -22,7 +22,6 @@
#include <Octree.h> // for EncodeBitstreamParams class #include <Octree.h> // for EncodeBitstreamParams class
#include <OctreeElement.h> // for OctreeElement::AppendState #include <OctreeElement.h> // for OctreeElement::AppendState
#include <OctreePacketData.h> #include <OctreePacketData.h>
#include <PhysicsEngine.h>
#include <VoxelDetail.h> #include <VoxelDetail.h>
#include "EntityItemID.h" #include "EntityItemID.h"
@ -46,13 +45,13 @@ class EntityItem {
public: public:
enum EntityUpdateFlags { enum EntityUpdateFlags {
// flags for things that need to be relayed to physics engine // flags for things that need to be relayed to physics engine
UPDATE_POSITION = PHYSICS_UPDATE_POSITION, //0x0001, UPDATE_POSITION = 0x0001,
UPDATE_VELOCITY = PHYSICS_UPDATE_VELOCITY, //0x0002, UPDATE_VELOCITY = 0x0002,
UPDATE_GRAVITY = PHYSICS_UPDATE_GRAVITY, //0x0004, UPDATE_GRAVITY = 0x0004,
UPDATE_MASS = PHYSICS_UPDATE_MASS, //0x0008, UPDATE_MASS = 0x0008,
UPDATE_COLLISION_GROUP = PHYSICS_UPDATE_COLLISION_GROUP, //0x0010, UPDATE_COLLISION_GROUP = 0x0010,
UPDATE_MOTION_TYPE = PHYSICS_UPDATE_MOTION_TYPE, //0x0020, UPDATE_MOTION_TYPE = 0x0020,
UPDATE_SHAPE = PHYSICS_UPDATE_SHAPE, //0x0040, UPDATE_SHAPE = 0x0040,
//... //...
// add new flags here in the middle // add new flags here in the middle
//... //...
@ -303,9 +302,7 @@ public:
uint32_t getUpdateFlags() const { return _updateFlags; } uint32_t getUpdateFlags() const { return _updateFlags; }
void clearUpdateFlags() { _updateFlags = 0; } void clearUpdateFlags() { _updateFlags = 0; }
EntityMotionState* getMotionState() const { return _motionState; } void* getPhysicsInfo() const { return _physicsInfo; }
virtual EntityMotionState* createMotionState() { return NULL; }
void destroyMotionState();
SimulationState getSimulationState() const { return _simulationState; } SimulationState getSimulationState() const { return _simulationState; }
void setSimulationState(SimulationState state) { _simulationState = state; } void setSimulationState(SimulationState state) { _simulationState = state; }
@ -352,7 +349,7 @@ protected:
void setRadius(float value); void setRadius(float value);
AACubeShape _collisionShape; AACubeShape _collisionShape;
EntityMotionState* _motionState; void* _physicsInfo;
SimulationState _simulationState; // only set by EntityTree SimulationState _simulationState; // only set by EntityTree
// UpdateFlags are set whenever a property changes that requires the change to be communicated to other // UpdateFlags are set whenever a property changes that requires the change to be communicated to other

View file

@ -25,7 +25,7 @@ public:
virtual void setEntityTree(EntityTree* tree); virtual void setEntityTree(EntityTree* tree);
/// \param[out] entitiesToDelete list of entities removed from simulation and should be deleted. /// \param[out] entitiesToDelete list of entities removed from simulation and should be deleted.
virtual void update(QSet<EntityItem*>& entitiesToDelete) = 0; virtual void updateEntities(QSet<EntityItem*>& entitiesToDelete) = 0;
/// \param entity pointer to EntityItem to add to the simulation /// \param entity pointer to EntityItem to add to the simulation
/// \sideeffect the EntityItem::_simulationState member may be updated to indicate membership to internal list /// \sideeffect the EntityItem::_simulationState member may be updated to indicate membership to internal list

View file

@ -16,7 +16,6 @@
#include "AddEntityOperator.h" #include "AddEntityOperator.h"
#include "DeleteEntityOperator.h" #include "DeleteEntityOperator.h"
#include "EntityMotionState.h"
#include "MovingEntitiesOperator.h" #include "MovingEntitiesOperator.h"
#include "UpdateEntityOperator.h" #include "UpdateEntityOperator.h"
@ -653,7 +652,7 @@ void EntityTree::update() {
if (_simulation) { if (_simulation) {
lockForWrite(); lockForWrite();
QSet<EntityItem*> entitiesToDelete; QSet<EntityItem*> entitiesToDelete;
_simulation->update(entitiesToDelete); _simulation->updateEntities(entitiesToDelete);
if (entitiesToDelete.size() > 0) { if (entitiesToDelete.size() > 0) {
// translate into list of ID's // translate into list of ID's
QSet<EntityItemID> idsToDelete; QSet<EntityItemID> idsToDelete;

View file

@ -16,9 +16,7 @@
#include <FBXReader.h> #include <FBXReader.h>
#include <GeometryUtil.h> #include <GeometryUtil.h>
#include <PhysicsEngine.h>
#include "EntityMotionState.h"
#include "EntityTree.h" #include "EntityTree.h"
#include "EntityTreeElement.h" #include "EntityTreeElement.h"
@ -655,6 +653,7 @@ EntityItem* EntityTreeElement::getEntityWithEntityItemID(const EntityItemID& id)
return foundEntity; return foundEntity;
} }
/* TODO: probably move the cleanupEntities() stuff into EntityTree
void EntityTreeElement::cleanupEntities(PhysicsEngine* physicsEngine) { void EntityTreeElement::cleanupEntities(PhysicsEngine* physicsEngine) {
uint16_t numberOfEntities = _entityItems->size(); uint16_t numberOfEntities = _entityItems->size();
for (uint16_t i = 0; i < numberOfEntities; i++) { for (uint16_t i = 0; i < numberOfEntities; i++) {
@ -662,13 +661,14 @@ void EntityTreeElement::cleanupEntities(PhysicsEngine* physicsEngine) {
EntityMotionState* motionState = entity->getMotionState(); EntityMotionState* motionState = entity->getMotionState();
if (motionState) { if (motionState) {
assert(physicsEngine); assert(physicsEngine);
physicsEngine->removeEntity(static_cast<CustomMotionState*>(motionState)); physicsEngine->removeObject(static_cast<CustomMotionState*>(motionState));
entity->destroyMotionState(); entity->destroyMotionState();
} }
delete entity; delete entity;
} }
_entityItems->clear(); _entityItems->clear();
} }
*/
bool EntityTreeElement::removeEntityWithEntityItemID(const EntityItemID& id) { bool EntityTreeElement::removeEntityWithEntityItemID(const EntityItemID& id) {
bool foundEntity = false; bool foundEntity = false;

View file

@ -21,7 +21,6 @@
class EntityTree; class EntityTree;
class EntityTreeElement; class EntityTreeElement;
class PhysicsEngine;
class EntityTreeUpdateArgs { class EntityTreeUpdateArgs {
public: public:
@ -176,7 +175,8 @@ public:
EntityItem* getEntityWithEntityItemID(const EntityItemID& id); EntityItem* getEntityWithEntityItemID(const EntityItemID& id);
void cleanupEntities(PhysicsEngine* physicsEngine); // TODO: probably move the cleanupEntities() stuff into EntityTree
//void cleanupEntities(PhysicsEngine* physicsEngine);
bool removeEntityWithEntityItemID(const EntityItemID& id); bool removeEntityWithEntityItemID(const EntityItemID& id);
bool removeEntityItem(EntityItem* entity); bool removeEntityItem(EntityItem* entity);

View file

@ -16,7 +16,7 @@
#include "MovingEntitiesOperator.h" #include "MovingEntitiesOperator.h"
#include "SimpleEntitySimulation.h" #include "SimpleEntitySimulation.h"
void SimpleEntitySimulation::update(QSet<EntityItem*>& entitiesToDelete) { void SimpleEntitySimulation::updateEntities(QSet<EntityItem*>& entitiesToDelete) {
quint64 now = usecTimestampNow(); quint64 now = usecTimestampNow();
updateChangedEntities(now, entitiesToDelete); updateChangedEntities(now, entitiesToDelete);
updateMovingEntities(now, entitiesToDelete); updateMovingEntities(now, entitiesToDelete);

View file

@ -21,7 +21,7 @@ public:
SimpleEntitySimulation() : EntitySimulation() { } SimpleEntitySimulation() : EntitySimulation() { }
virtual ~SimpleEntitySimulation() { setEntityTree(NULL); } virtual ~SimpleEntitySimulation() { setEntityTree(NULL); }
virtual void update(QSet<EntityItem*>& entitiesToDelete); virtual void updateEntities(QSet<EntityItem*>& entitiesToDelete);
virtual void addEntity(EntityItem* entity); virtual void addEntity(EntityItem* entity);
virtual void removeEntity(EntityItem* entity); virtual void removeEntity(EntityItem* entity);

View file

@ -5,7 +5,7 @@ setup_hifi_library()
include_glm() include_glm()
link_hifi_libraries(shared networking physics) link_hifi_libraries(shared networking)
# find ZLIB # find ZLIB
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)

View file

@ -6,7 +6,8 @@ setup_hifi_library()
include_glm() include_glm()
include_bullet() include_bullet()
link_hifi_libraries(shared) link_hifi_libraries(shared fbx entities)
include_hifi_library_headers(fbx)
# call macro to link our dependencies and bubble them up via a property on our target # call macro to link our dependencies and bubble them up via a property on our target
link_shared_dependencies() link_shared_dependencies()

View file

@ -15,7 +15,8 @@
#include <QtGlobal> #include <QtGlobal>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include "CollisionInfo.h" #include <CollisionInfo.h>
#include "VerletPoint.h" #include "VerletPoint.h"
class Shape; class Shape;

View file

@ -9,11 +9,11 @@
// 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 <EntityItem.h>
#include <BulletUtil.h>
#endif // USE_BULLET_PHYSICS
#include "EntityItem.h" #ifdef USE_BULLET_PHYSICS
#include "BulletUtil.h"
#endif // USE_BULLET_PHYSICS
#include "EntityMotionState.h" #include "EntityMotionState.h"
// TODO: store _cachedWorldOffset in a more central location -- VoxelTree and others also need to know about it // TODO: store _cachedWorldOffset in a more central location -- VoxelTree and others also need to know about it
@ -67,7 +67,7 @@ void EntityMotionState::getWorldTransform (btTransform &worldTrans) const {
// iff the corresponding RigidBody is DYNAMIC and has moved. // iff the corresponding RigidBody is DYNAMIC and has moved.
void EntityMotionState::setWorldTransform (const btTransform &worldTrans) { void EntityMotionState::setWorldTransform (const btTransform &worldTrans) {
uint32_t updateFlags = _entity->getUpdateFlags(); uint32_t updateFlags = _entity->getUpdateFlags();
if (! (updateFlags & PHYSICS_UPDATE_POSITION)) { if (! (updateFlags & EntityItem::UPDATE_POSITION)) {
glm::vec3 pos; glm::vec3 pos;
bulletToGLM(worldTrans.getOrigin(), pos); bulletToGLM(worldTrans.getOrigin(), pos);
_entity->setPositionInMeters(pos + _cachedWorldOffset); _entity->setPositionInMeters(pos + _cachedWorldOffset);
@ -77,7 +77,7 @@ void EntityMotionState::setWorldTransform (const btTransform &worldTrans) {
_entity->setRotation(rot); _entity->setRotation(rot);
} }
if (! (updateFlags & PHYSICS_UPDATE_VELOCITY)) { if (! (updateFlags & EntityItem::UPDATE_VELOCITY)) {
glm::vec3 v; glm::vec3 v;
getVelocity(v); getVelocity(v);
_entity->setVelocityInMeters(v); _entity->setVelocityInMeters(v);

View file

@ -13,9 +13,11 @@
#define hifi_EntityMotionState_h #define hifi_EntityMotionState_h
#include <AACube.h> #include <AACube.h>
#ifdef USE_BULLET_PHYSICS #ifdef USE_BULLET_PHYSICS
#include <CustomMotionState.h> #include "CustomMotionState.h"
#else // USE_BULLET_PHYSICS #else // USE_BULLET_PHYSICS
// CustomMotionState stubbery // CustomMotionState stubbery
class CustomMotionState { class CustomMotionState {
public: public:

View file

@ -24,10 +24,10 @@ void PhysicsEngine::init() {
_constraintSolver = new btSequentialImpulseConstraintSolver; _constraintSolver = new btSequentialImpulseConstraintSolver;
_dynamicsWorld = new btDiscreteDynamicsWorld(_collisionDispatcher, _broadphaseFilter, _constraintSolver, _collisionConfig); _dynamicsWorld = new btDiscreteDynamicsWorld(_collisionDispatcher, _broadphaseFilter, _constraintSolver, _collisionConfig);
// TODO: once the initial physics system is working we will set gravity of the world to be zero // default gravity of the world is zero, so each object must specify its own gravity
// and each object will have to specify its own local gravity, or we'll set up gravity zones. // TODO: set up gravity zones
//_dynamicsWorld->setGravity(btVector3(0.0f, 0.0f, 0.0f)); _dynamicsWorld->setGravity(btVector3(0.0f, 0.0f, 0.0f));
//
// GROUND HACK: In the meantime we add a big planar floor to catch falling objects // GROUND HACK: In the meantime we add a big planar floor to catch falling objects
// NOTE: we don't care about memory leaking groundShape and groundObject --> // NOTE: we don't care about memory leaking groundShape and groundObject -->
// they'll exist until the executable exits. // they'll exist until the executable exits.
@ -123,7 +123,7 @@ bool PhysicsEngine::removeVoxel(const glm::vec3& position, float scale) {
// CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing // CF_DISABLE_VISUALIZE_OBJECT = 32, //disable debug drawing
// CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/SPU processing // CF_DISABLE_SPU_COLLISION_PROCESSING = 64//disable parallel/SPU processing
bool PhysicsEngine::addEntity(CustomMotionState* motionState) { bool PhysicsEngine::addObject(CustomMotionState* motionState) {
assert(motionState); assert(motionState);
ShapeInfo info; ShapeInfo info;
motionState->computeShapeInfo(info); motionState->computeShapeInfo(info);
@ -170,7 +170,7 @@ bool PhysicsEngine::addEntity(CustomMotionState* motionState) {
return false; return false;
} }
bool PhysicsEngine::removeEntity(CustomMotionState* motionState) { bool PhysicsEngine::removeObject(CustomMotionState* motionState) {
assert(motionState); assert(motionState);
btRigidBody* body = motionState->_body; btRigidBody* body = motionState->_body;
if (body) { if (body) {
@ -186,7 +186,7 @@ bool PhysicsEngine::removeEntity(CustomMotionState* motionState) {
return false; return false;
} }
bool PhysicsEngine::updateEntity(CustomMotionState* motionState, uint32_t flags) { bool PhysicsEngine::updateObject(CustomMotionState* motionState, uint32_t flags) {
btRigidBody* body = motionState->_body; btRigidBody* body = motionState->_body;
if (!body) { if (!body) {
return false; return false;
@ -194,16 +194,16 @@ bool PhysicsEngine::updateEntity(CustomMotionState* motionState, uint32_t flags)
if (flags & PHYSICS_UPDATE_HARD) { if (flags & PHYSICS_UPDATE_HARD) {
// a hard update requires the body be pulled out of physics engine, changed, then reinserted // a hard update requires the body be pulled out of physics engine, changed, then reinserted
updateEntityHard(body, motionState, flags); updateObjectHard(body, motionState, flags);
} else if (flags & PHYSICS_UPDATE_EASY) { } else if (flags & PHYSICS_UPDATE_EASY) {
// an easy update does not require that the body be pulled out of physics engine // an easy update does not require that the body be pulled out of physics engine
updateEntityEasy(body, motionState, flags); updateObjectEasy(body, motionState, flags);
} }
return true; return true;
} }
// private // private
void PhysicsEngine::updateEntityHard(btRigidBody* body, CustomMotionState* motionState, uint32_t flags) { void PhysicsEngine::updateObjectHard(btRigidBody* body, CustomMotionState* motionState, uint32_t flags) {
MotionType newType = motionState->getMotionType(); MotionType newType = motionState->getMotionType();
// pull body out of physics engine // pull body out of physics engine
@ -227,7 +227,7 @@ void PhysicsEngine::updateEntityHard(btRigidBody* body, CustomMotionState* motio
} }
bool easyUpdate = flags & PHYSICS_UPDATE_EASY; bool easyUpdate = flags & PHYSICS_UPDATE_EASY;
if (easyUpdate) { if (easyUpdate) {
updateEntityEasy(body, motionState, flags); updateObjectEasy(body, motionState, flags);
} }
// update the motion parameters // update the motion parameters
@ -280,7 +280,7 @@ void PhysicsEngine::updateEntityHard(btRigidBody* body, CustomMotionState* motio
} }
// private // private
void PhysicsEngine::updateEntityEasy(btRigidBody* body, CustomMotionState* motionState, uint32_t flags) { void PhysicsEngine::updateObjectEasy(btRigidBody* body, CustomMotionState* motionState, uint32_t flags) {
if (flags & PHYSICS_UPDATE_POSITION) { if (flags & PHYSICS_UPDATE_POSITION) {
btTransform transform; btTransform transform;
motionState->getWorldTransform(transform); motionState->getWorldTransform(transform);

View file

@ -77,22 +77,22 @@ public:
/// \return true if Voxel removed /// \return true if Voxel removed
bool removeVoxel(const glm::vec3& position, float scale); bool removeVoxel(const glm::vec3& position, float scale);
/// \param motionState pointer to Entity's MotionState /// \param motionState pointer to Object's MotionState
/// \return true if Entity added /// \return true if Object added
bool addEntity(CustomMotionState* motionState); bool addObject(CustomMotionState* motionState);
/// \param motionState pointer to Entity's MotionState /// \param motionState pointer to Object's MotionState
/// \return true if Entity removed /// \return true if Object removed
bool removeEntity(CustomMotionState* motionState); bool removeObject(CustomMotionState* motionState);
/// \param motionState pointer to Entity's MotionState /// \param motionState pointer to Object's MotionState
/// \param flags set of bits indicating what categories of properties need to be updated /// \param flags set of bits indicating what categories of properties need to be updated
/// \return true if entity updated /// \return true if entity updated
bool updateEntity(CustomMotionState* motionState, uint32_t flags); bool updateObject(CustomMotionState* motionState, uint32_t flags);
protected: protected:
void updateEntityHard(btRigidBody* body, CustomMotionState* motionState, uint32_t flags); void updateObjectHard(btRigidBody* body, CustomMotionState* motionState, uint32_t flags);
void updateEntityEasy(btRigidBody* body, CustomMotionState* motionState, uint32_t flags); void updateObjectEasy(btRigidBody* body, CustomMotionState* motionState, uint32_t flags);
btClock _clock; btClock _clock;
btDefaultCollisionConfiguration* _collisionConfig; btDefaultCollisionConfiguration* _collisionConfig;

View file

@ -18,13 +18,13 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/quaternion.hpp> #include <glm/gtc/quaternion.hpp>
#include <CollisionInfo.h>
#include <RayIntersectionInfo.h>
#ifdef USE_BULLET_PHYSICS #ifdef USE_BULLET_PHYSICS
#include "PhysicsEngine.h" #include "PhysicsEngine.h"
#endif // USE_BULLET_PHYSICS #endif // USE_BULLET_PHYSICS
#include "CollisionInfo.h"
#include "RayIntersectionInfo.h"
class Shape; class Shape;
class PhysicsSimulation; class PhysicsSimulation;

View file

@ -17,6 +17,7 @@
#include <SharedUtil.h> // for MILLIMETERS_PER_METER #include <SharedUtil.h> // for MILLIMETERS_PER_METER
#include "BulletUtil.h" #include "BulletUtil.h"
#include "DoubleHashKey.h"
#include "ShapeInfo.h" #include "ShapeInfo.h"
void ShapeInfo::collectInfo(const btCollisionShape* shape) { void ShapeInfo::collectInfo(const btCollisionShape* shape) {

View file

@ -18,8 +18,6 @@
#include <LinearMath/btHashMap.h> #include <LinearMath/btHashMap.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include "DoubleHashKey.h"
class ShapeInfo { class ShapeInfo {
public: public:
ShapeInfo() : _type(INVALID_SHAPE_PROXYTYPE) {} ShapeInfo() : _type(INVALID_SHAPE_PROXYTYPE) {}

View file

@ -13,7 +13,7 @@
#include <glm/gtx/norm.hpp> #include <glm/gtx/norm.hpp>
#include "AACubeShape.h" #include "AACubeShape.h"
#include <SharedUtil.h> // for SQUARE_ROOT_OF_3 #include "SharedUtil.h" // for SQUARE_ROOT_OF_3
glm::vec3 faceNormals[3] = { glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f) }; glm::vec3 faceNormals[3] = { glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f) };

View file

@ -12,11 +12,9 @@
#include <iostream> #include <iostream>
#include <glm/gtx/vector_angle.hpp> #include <glm/gtx/vector_angle.hpp>
#include <GeometryUtil.h>
#include <SharedUtil.h>
#include "CapsuleShape.h" #include "CapsuleShape.h"
#include "GeometryUtil.h"
#include "SharedUtil.h"
CapsuleShape::CapsuleShape() : Shape(CAPSULE_SHAPE), _radius(0.0f), _halfHeight(0.0f) {} CapsuleShape::CapsuleShape() : Shape(CAPSULE_SHAPE), _radius(0.0f), _halfHeight(0.0f) {}

View file

@ -12,9 +12,8 @@
#ifndef hifi_CapsuleShape_h #ifndef hifi_CapsuleShape_h
#define hifi_CapsuleShape_h #define hifi_CapsuleShape_h
#include <SharedUtil.h>
#include "Shape.h" #include "Shape.h"
#include "SharedUtil.h"
// default axis of CapsuleShape is Y-axis // default axis of CapsuleShape is Y-axis
const glm::vec3 DEFAULT_CAPSULE_AXIS(0.0f, 1.0f, 0.0f); const glm::vec3 DEFAULT_CAPSULE_AXIS(0.0f, 1.0f, 0.0f);

View file

@ -10,10 +10,10 @@
// //
#include <SharedUtil.h>
#include "CollisionInfo.h" #include "CollisionInfo.h"
#include "Shape.h" #include "Shape.h"
#include "SharedUtil.h"
CollisionInfo::CollisionInfo() : CollisionInfo::CollisionInfo() :
_data(NULL), _data(NULL),

View file

@ -9,10 +9,9 @@
// 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
// //
#include <SharedUtil.h> #include "GLMHelpers.h"
#include <GLMHelpers.h>
#include "PlaneShape.h" #include "PlaneShape.h"
#include "SharedUtil.h"
const glm::vec3 UNROTATED_NORMAL(0.0f, 1.0f, 0.0f); const glm::vec3 UNROTATED_NORMAL(0.0f, 1.0f, 0.0f);

View file

@ -11,16 +11,14 @@
#include <glm/gtx/norm.hpp> #include <glm/gtx/norm.hpp>
#include <GeometryUtil.h>
#include <StreamUtils.h>
#include "ShapeCollider.h"
#include "AACubeShape.h" #include "AACubeShape.h"
#include "CapsuleShape.h" #include "CapsuleShape.h"
#include "GeometryUtil.h"
#include "ListShape.h" #include "ListShape.h"
#include "PlaneShape.h" #include "PlaneShape.h"
#include "ShapeCollider.h"
#include "SphereShape.h" #include "SphereShape.h"
#include "StreamUtils.h"
// NOTE: // NOTE:

View file

@ -14,10 +14,10 @@
#include <QVector> #include <QVector>
#include <SharedUtil.h>
#include "CollisionInfo.h" #include "CollisionInfo.h"
#include "RayIntersectionInfo.h" #include "RayIntersectionInfo.h"
#include "SharedUtil.h"
class Shape; class Shape;
class SphereShape; class SphereShape;

View file

@ -12,9 +12,8 @@
#ifndef hifi_SphereShape_h #ifndef hifi_SphereShape_h
#define hifi_SphereShape_h #define hifi_SphereShape_h
#include <SharedUtil.h>
#include "Shape.h" #include "Shape.h"
#include "SharedUtil.h"
class SphereShape : public Shape { class SphereShape : public Shape {