mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 05:16:55 +02:00
namechange SimulationEngine --> PhysicsSimulation
This commit is contained in:
parent
7cd1f75282
commit
a8c2003fe6
8 changed files with 70 additions and 70 deletions
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
|
||||||
#include <SimulationEngine.h>
|
#include <PhysicsSimulation.h>
|
||||||
|
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ private:
|
||||||
float _oculusYawOffset;
|
float _oculusYawOffset;
|
||||||
|
|
||||||
QList<AnimationHandlePointer> _animationHandles;
|
QList<AnimationHandlePointer> _animationHandles;
|
||||||
SimulationEngine _simulationEngine;
|
PhysicsSimulation _simulationEngine;
|
||||||
|
|
||||||
// private methods
|
// private methods
|
||||||
float computeDistanceToFloor(const glm::vec3& startPoint);
|
float computeDistanceToFloor(const glm::vec3& startPoint);
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <CapsuleShape.h>
|
#include <CapsuleShape.h>
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
#include <PhysicalEntity.h>
|
#include <PhysicsEntity.h>
|
||||||
#include <ShapeCollider.h>
|
#include <ShapeCollider.h>
|
||||||
#include <SphereShape.h>
|
#include <SphereShape.h>
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ void Model::setJointStates(QVector<JointState> states) {
|
||||||
_jointStates = states;
|
_jointStates = states;
|
||||||
|
|
||||||
// compute an approximate bounding radius for broadphase collision queries
|
// compute an approximate bounding radius for broadphase collision queries
|
||||||
// against SimulationEngine boundaries
|
// against PhysicsSimulation boundaries
|
||||||
int numJoints = _jointStates.size();
|
int numJoints = _jointStates.size();
|
||||||
float radius = 0.0f;
|
float radius = 0.0f;
|
||||||
for (int i = 0; i < numJoints; ++i) {
|
for (int i = 0; i < numJoints; ++i) {
|
||||||
|
@ -785,7 +785,7 @@ AnimationHandlePointer Model::createAnimationHandle() {
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual override from PhysicalEntity
|
// virtual override from PhysicsEntity
|
||||||
void Model::buildShapes() {
|
void Model::buildShapes() {
|
||||||
// TODO: figure out how to load/build collision shapes for general models
|
// TODO: figure out how to load/build collision shapes for general models
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
#include <PhysicalEntity.h>
|
#include <PhysicsEntity.h>
|
||||||
|
|
||||||
#include <AnimationCache.h>
|
#include <AnimationCache.h>
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ typedef QSharedPointer<AnimationHandle> AnimationHandlePointer;
|
||||||
typedef QWeakPointer<AnimationHandle> WeakAnimationHandlePointer;
|
typedef QWeakPointer<AnimationHandle> WeakAnimationHandlePointer;
|
||||||
|
|
||||||
/// A generic 3D model displaying geometry loaded from a URL.
|
/// A generic 3D model displaying geometry loaded from a URL.
|
||||||
class Model : public QObject, public PhysicalEntity {
|
class Model : public QObject, public PhysicsEntity {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -131,7 +131,7 @@ public:
|
||||||
|
|
||||||
const QList<AnimationHandlePointer>& getRunningAnimations() const { return _runningAnimations; }
|
const QList<AnimationHandlePointer>& getRunningAnimations() const { return _runningAnimations; }
|
||||||
|
|
||||||
// virtual overrides from PhysicalEntity
|
// virtual overrides from PhysicsEntity
|
||||||
virtual void buildShapes();
|
virtual void buildShapes();
|
||||||
virtual void updateShapePositions();
|
virtual void updateShapePositions();
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// PhysicalEntity.cpp
|
// PhysicsEntity.cpp
|
||||||
// libraries/shared/src
|
// libraries/shared/src
|
||||||
//
|
//
|
||||||
// Created by Andrew Meadows 2014.06.11
|
// Created by Andrew Meadows 2014.06.11
|
||||||
|
@ -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
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "PhysicalEntity.h"
|
#include "PhysicsEntity.h"
|
||||||
#include "Shape.h"
|
#include "Shape.h"
|
||||||
#include "ShapeCollider.h"
|
#include "ShapeCollider.h"
|
||||||
|
|
||||||
PhysicalEntity::PhysicalEntity() :
|
PhysicsEntity::PhysicsEntity() :
|
||||||
_translation(0.0f),
|
_translation(0.0f),
|
||||||
_rotation(),
|
_rotation(),
|
||||||
_boundingRadius(0.0f),
|
_boundingRadius(0.0f),
|
||||||
|
@ -22,26 +22,26 @@ PhysicalEntity::PhysicalEntity() :
|
||||||
_simulation(NULL) {
|
_simulation(NULL) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicalEntity::~PhysicalEntity() {
|
PhysicsEntity::~PhysicsEntity() {
|
||||||
// entity should be removed from the simulation before it is deleted
|
// entity should be removed from the simulation before it is deleted
|
||||||
assert(_simulation == NULL);
|
assert(_simulation == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntity::setTranslation(const glm::vec3& translation) {
|
void PhysicsEntity::setTranslation(const glm::vec3& translation) {
|
||||||
if (_translation != translation) {
|
if (_translation != translation) {
|
||||||
_shapesAreDirty = !_shapes.isEmpty();
|
_shapesAreDirty = !_shapes.isEmpty();
|
||||||
_translation = translation;
|
_translation = translation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntity::setRotation(const glm::quat& rotation) {
|
void PhysicsEntity::setRotation(const glm::quat& rotation) {
|
||||||
if (_rotation != rotation) {
|
if (_rotation != rotation) {
|
||||||
_shapesAreDirty = !_shapes.isEmpty();
|
_shapesAreDirty = !_shapes.isEmpty();
|
||||||
_rotation = rotation;
|
_rotation = rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntity::setShapeBackPointers() {
|
void PhysicsEntity::setShapeBackPointers() {
|
||||||
for (int i = 0; i < _shapes.size(); i++) {
|
for (int i = 0; i < _shapes.size(); i++) {
|
||||||
Shape* shape = _shapes[i];
|
Shape* shape = _shapes[i];
|
||||||
if (shape) {
|
if (shape) {
|
||||||
|
@ -50,7 +50,7 @@ void PhysicalEntity::setShapeBackPointers() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntity::setEnableShapes(bool enable) {
|
void PhysicsEntity::setEnableShapes(bool enable) {
|
||||||
if (enable != _enableShapes) {
|
if (enable != _enableShapes) {
|
||||||
clearShapes();
|
clearShapes();
|
||||||
_enableShapes = enable;
|
_enableShapes = enable;
|
||||||
|
@ -60,14 +60,14 @@ void PhysicalEntity::setEnableShapes(bool enable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntity::clearShapes() {
|
void PhysicsEntity::clearShapes() {
|
||||||
for (int i = 0; i < _shapes.size(); ++i) {
|
for (int i = 0; i < _shapes.size(); ++i) {
|
||||||
delete _shapes[i];
|
delete _shapes[i];
|
||||||
}
|
}
|
||||||
_shapes.clear();
|
_shapes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhysicalEntity::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const {
|
bool PhysicsEntity::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const {
|
||||||
/* TODO: Andrew to make this work
|
/* TODO: Andrew to make this work
|
||||||
int numShapes = _shapes.size();
|
int numShapes = _shapes.size();
|
||||||
float minDistance = FLT_MAX;
|
float minDistance = FLT_MAX;
|
||||||
|
@ -88,7 +88,7 @@ bool PhysicalEntity::findRayIntersection(const glm::vec3& origin, const glm::vec
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhysicalEntity::findCollisions(const QVector<const Shape*> shapes, CollisionList& collisions) {
|
bool PhysicsEntity::findCollisions(const QVector<const Shape*> shapes, CollisionList& collisions) {
|
||||||
bool collided = false;
|
bool collided = false;
|
||||||
int numTheirShapes = shapes.size();
|
int numTheirShapes = shapes.size();
|
||||||
for (int i = 0; i < numTheirShapes; ++i) {
|
for (int i = 0; i < numTheirShapes; ++i) {
|
||||||
|
@ -107,7 +107,7 @@ bool PhysicalEntity::findCollisions(const QVector<const Shape*> shapes, Collisio
|
||||||
return collided;
|
return collided;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhysicalEntity::findSphereCollisions(const glm::vec3& sphereCenter, float sphereRadius,
|
bool PhysicsEntity::findSphereCollisions(const glm::vec3& sphereCenter, float sphereRadius,
|
||||||
CollisionList& collisions, int skipIndex) {
|
CollisionList& collisions, int skipIndex) {
|
||||||
bool collided = false;
|
bool collided = false;
|
||||||
// TODO: Andrew to implement this or make it unecessary
|
// TODO: Andrew to implement this or make it unecessary
|
||||||
|
@ -144,7 +144,7 @@ bool PhysicalEntity::findSphereCollisions(const glm::vec3& sphereCenter, float s
|
||||||
return collided;
|
return collided;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PhysicalEntity::findPlaneCollisions(const glm::vec4& plane, CollisionList& collisions) {
|
bool PhysicsEntity::findPlaneCollisions(const glm::vec4& plane, CollisionList& collisions) {
|
||||||
bool collided = false;
|
bool collided = false;
|
||||||
PlaneShape planeShape(plane);
|
PlaneShape planeShape(plane);
|
||||||
for (int i = 0; i < _shapes.size(); i++) {
|
for (int i = 0; i < _shapes.size(); i++) {
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// PhysicalEntity.h
|
// PhysicsEntity.h
|
||||||
// libraries/shared/src
|
// libraries/shared/src
|
||||||
//
|
//
|
||||||
// Created by Andrew Meadows 2014.05.30
|
// Created by Andrew Meadows 2014.05.30
|
||||||
|
@ -9,8 +9,8 @@
|
||||||
// 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
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef hifi_PhysicalEntity_h
|
#ifndef hifi_PhysicsEntity_h
|
||||||
#define hifi_PhysicalEntity_h
|
#define hifi_PhysicsEntity_h
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
@ -20,17 +20,17 @@
|
||||||
#include "CollisionInfo.h"
|
#include "CollisionInfo.h"
|
||||||
|
|
||||||
class Shape;
|
class Shape;
|
||||||
class SimulationEngine;
|
class PhysicsSimulation;
|
||||||
|
|
||||||
// PhysicalEntity is the base class for anything that owns one or more Shapes that collide in a
|
// PhysicsEntity is the base class for anything that owns one or more Shapes that collide in a
|
||||||
// SimulationEngine. Each CollisionInfo generated by a SimulationEngine has back pointers to the
|
// PhysicsSimulation. Each CollisionInfo generated by a PhysicsSimulation has back pointers to the
|
||||||
// two Shapes involved, and those Shapes may (optionally) have valid back pointers to their PhysicalEntity.
|
// two Shapes involved, and those Shapes may (optionally) have valid back pointers to their PhysicsEntity.
|
||||||
|
|
||||||
class PhysicalEntity {
|
class PhysicsEntity {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PhysicalEntity();
|
PhysicsEntity();
|
||||||
virtual ~PhysicalEntity();
|
virtual ~PhysicsEntity();
|
||||||
|
|
||||||
void setTranslation(const glm::vec3& translation);
|
void setTranslation(const glm::vec3& translation);
|
||||||
void setRotation(const glm::quat& rotation);
|
void setRotation(const glm::quat& rotation);
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
virtual void buildShapes() = 0;
|
virtual void buildShapes() = 0;
|
||||||
virtual void clearShapes();
|
virtual void clearShapes();
|
||||||
|
|
||||||
SimulationEngine* getSimulation() const { return _simulation; }
|
PhysicsSimulation* getSimulation() const { return _simulation; }
|
||||||
|
|
||||||
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
||||||
bool findCollisions(const QVector<const Shape*> shapes, CollisionList& collisions);
|
bool findCollisions(const QVector<const Shape*> shapes, CollisionList& collisions);
|
||||||
|
@ -54,8 +54,8 @@ public:
|
||||||
bool findPlaneCollisions(const glm::vec4& plane, CollisionList& collisions);
|
bool findPlaneCollisions(const glm::vec4& plane, CollisionList& collisions);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// SimulationEngine is a friend so that it can set the protected _simulation backpointer
|
// PhysicsSimulation is a friend so that it can set the protected _simulation backpointer
|
||||||
friend SimulationEngine;
|
friend PhysicsSimulation;
|
||||||
|
|
||||||
glm::vec3 _translation;
|
glm::vec3 _translation;
|
||||||
glm::quat _rotation;
|
glm::quat _rotation;
|
||||||
|
@ -63,7 +63,7 @@ protected:
|
||||||
bool _shapesAreDirty;
|
bool _shapesAreDirty;
|
||||||
bool _enableShapes;
|
bool _enableShapes;
|
||||||
QVector<Shape*> _shapes;
|
QVector<Shape*> _shapes;
|
||||||
SimulationEngine* _simulation;
|
PhysicsSimulation* _simulation;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_PhysicalEntity_h
|
#endif // hifi_PhysicsEntity_h
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// SimulationEngine.cpp
|
// PhysicsSimulation.cpp
|
||||||
// interface/src/avatar
|
// interface/src/avatar
|
||||||
//
|
//
|
||||||
// Created by Andrew Meadows 2014.06.06
|
// Created by Andrew Meadows 2014.06.06
|
||||||
|
@ -11,29 +11,29 @@
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include "SimulationEngine.h"
|
#include "PhysicsSimulation.h"
|
||||||
|
|
||||||
#include "PhysicalEntity.h"
|
#include "PhysicsEntity.h"
|
||||||
#include "Ragdoll.h"
|
#include "Ragdoll.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
#include "ShapeCollider.h"
|
#include "ShapeCollider.h"
|
||||||
|
|
||||||
int MAX_DOLLS_PER_ENGINE = 16;
|
int MAX_DOLLS_PER_SIMULATION = 16;
|
||||||
int MAX_ENTITIES_PER_ENGINE = 64;
|
int MAX_ENTITIES_PER_SIMULATION = 64;
|
||||||
int MAX_COLLISIONS_PER_ENGINE = 256;
|
int MAX_COLLISIONS_PER_SIMULATION = 256;
|
||||||
|
|
||||||
|
|
||||||
const int NUM_SHAPE_BITS = 6;
|
const int NUM_SHAPE_BITS = 6;
|
||||||
const int SHAPE_INDEX_MASK = (1 << (NUM_SHAPE_BITS + 1)) - 1;
|
const int SHAPE_INDEX_MASK = (1 << (NUM_SHAPE_BITS + 1)) - 1;
|
||||||
|
|
||||||
SimulationEngine::SimulationEngine() : _collisionList(MAX_COLLISIONS_PER_ENGINE) {
|
PhysicsSimulation::PhysicsSimulation() : _collisionList(MAX_COLLISIONS_PER_SIMULATION) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SimulationEngine::~SimulationEngine() {
|
PhysicsSimulation::~PhysicsSimulation() {
|
||||||
_dolls.clear();
|
_dolls.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimulationEngine::addEntity(PhysicalEntity* entity) {
|
bool PhysicsSimulation::addEntity(PhysicsEntity* entity) {
|
||||||
if (!entity) {
|
if (!entity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ bool SimulationEngine::addEntity(PhysicalEntity* entity) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int numEntities = _entities.size();
|
int numEntities = _entities.size();
|
||||||
if (numEntities > MAX_ENTITIES_PER_ENGINE) {
|
if (numEntities > MAX_ENTITIES_PER_SIMULATION) {
|
||||||
// list is full
|
// list is full
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ bool SimulationEngine::addEntity(PhysicalEntity* entity) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulationEngine::removeEntity(PhysicalEntity* entity) {
|
void PhysicsSimulation::removeEntity(PhysicsEntity* entity) {
|
||||||
if (!entity || !entity->_simulation || !(entity->_simulation == this)) {
|
if (!entity || !entity->_simulation || !(entity->_simulation == this)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ void SimulationEngine::removeEntity(PhysicalEntity* entity) {
|
||||||
_entities.pop_back();
|
_entities.pop_back();
|
||||||
} else {
|
} else {
|
||||||
// swap the last for this one
|
// swap the last for this one
|
||||||
PhysicalEntity* lastEntity = _entities[numEntities - 1];
|
PhysicsEntity* lastEntity = _entities[numEntities - 1];
|
||||||
_entities.pop_back();
|
_entities.pop_back();
|
||||||
_entities[i] = lastEntity;
|
_entities[i] = lastEntity;
|
||||||
}
|
}
|
||||||
|
@ -82,12 +82,12 @@ void SimulationEngine::removeEntity(PhysicalEntity* entity) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SimulationEngine::addRagdoll(Ragdoll* doll) {
|
bool PhysicsSimulation::addRagdoll(Ragdoll* doll) {
|
||||||
if (!doll) {
|
if (!doll) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
int numDolls = _dolls.size();
|
int numDolls = _dolls.size();
|
||||||
if (numDolls > MAX_DOLLS_PER_ENGINE) {
|
if (numDolls > MAX_DOLLS_PER_SIMULATION) {
|
||||||
// list is full
|
// list is full
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ bool SimulationEngine::addRagdoll(Ragdoll* doll) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulationEngine::removeRagdoll(Ragdoll* doll) {
|
void PhysicsSimulation::removeRagdoll(Ragdoll* doll) {
|
||||||
int numDolls = _dolls.size();
|
int numDolls = _dolls.size();
|
||||||
for (int i = 0; i < numDolls; ++i) {
|
for (int i = 0; i < numDolls; ++i) {
|
||||||
if (doll == _dolls[i]) {
|
if (doll == _dolls[i]) {
|
||||||
|
@ -120,7 +120,7 @@ void SimulationEngine::removeRagdoll(Ragdoll* doll) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulationEngine::stepForward(float deltaTime, float minError, int maxIterations, quint64 maxUsec) {
|
void PhysicsSimulation::stepForward(float deltaTime, float minError, int maxIterations, quint64 maxUsec) {
|
||||||
/* TODO: Andrew to make this work
|
/* TODO: Andrew to make this work
|
||||||
int iterations = 0;
|
int iterations = 0;
|
||||||
float delta = 0.0f;
|
float delta = 0.0f;
|
||||||
|
@ -143,7 +143,7 @@ void SimulationEngine::stepForward(float deltaTime, float minError, int maxItera
|
||||||
|
|
||||||
// collide
|
// collide
|
||||||
_collisionList.clear();
|
_collisionList.clear();
|
||||||
// TODO: keep track of QSet<PhysicalEntity*> collidedEntities;
|
// TODO: keep track of QSet<PhysicsEntity*> collidedEntities;
|
||||||
for (int i = 0; i < numDolls; ++i) {
|
for (int i = 0; i < numDolls; ++i) {
|
||||||
const QVector<Shape*>* shapesA = _dolls.at(i)->getShapes();
|
const QVector<Shape*>* shapesA = _dolls.at(i)->getShapes();
|
||||||
if (!shapesA) {
|
if (!shapesA) {
|
||||||
|
@ -186,10 +186,10 @@ void SimulationEngine::stepForward(float deltaTime, float minError, int maxItera
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int SimulationEngine::computeCollisions() {
|
int PhysicsSimulation::computeCollisions() {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SimulationEngine::processCollisions() {
|
void PhysicsSimulation::processCollisions() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// SimulationEngine.h
|
// PhysicsSimulation.h
|
||||||
// interface/src/avatar
|
// interface/src/avatar
|
||||||
//
|
//
|
||||||
// Created by Andrew Meadows 2014.06.06
|
// Created by Andrew Meadows 2014.06.06
|
||||||
|
@ -9,26 +9,26 @@
|
||||||
// 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
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef hifi_SimulationEngine_h
|
#ifndef hifi_PhysicsSimulation
|
||||||
#define hifi_SimulationEngine_h
|
#define hifi_PhysicsSimulation
|
||||||
|
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
#include "CollisionInfo.h"
|
#include "CollisionInfo.h"
|
||||||
|
|
||||||
class PhysicalEntity;
|
class PhysicsEntity;
|
||||||
class Ragdoll;
|
class Ragdoll;
|
||||||
|
|
||||||
class SimulationEngine {
|
class PhysicsSimulation {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SimulationEngine();
|
PhysicsSimulation();
|
||||||
~SimulationEngine();
|
~PhysicsSimulation();
|
||||||
|
|
||||||
/// \return true if entity was added to or is already in the list
|
/// \return true if entity was added to or is already in the list
|
||||||
bool addEntity(PhysicalEntity* entity);
|
bool addEntity(PhysicsEntity* entity);
|
||||||
|
|
||||||
void removeEntity(PhysicalEntity* entity);
|
void removeEntity(PhysicsEntity* entity);
|
||||||
|
|
||||||
/// \return true if doll was added to or is already in the list
|
/// \return true if doll was added to or is already in the list
|
||||||
bool addRagdoll(Ragdoll* doll);
|
bool addRagdoll(Ragdoll* doll);
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CollisionList _collisionList;
|
CollisionList _collisionList;
|
||||||
QVector<PhysicalEntity*> _entities;
|
QVector<PhysicsEntity*> _entities;
|
||||||
QVector<Ragdoll*> _dolls;
|
QVector<Ragdoll*> _dolls;
|
||||||
|
|
||||||
// some stats for performance queries
|
// some stats for performance queries
|
||||||
|
@ -61,4 +61,4 @@ private:
|
||||||
quint64 _enforcementTime;
|
quint64 _enforcementTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_SimulationEngine_h
|
#endif // hifi_PhysicsSimulation
|
|
@ -15,7 +15,7 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
|
|
||||||
class PhysicalEntity;
|
class PhysicsEntity;
|
||||||
|
|
||||||
class Shape {
|
class Shape {
|
||||||
public:
|
public:
|
||||||
|
@ -32,8 +32,8 @@ public:
|
||||||
|
|
||||||
int getType() const { return _type; }
|
int getType() const { return _type; }
|
||||||
|
|
||||||
void setEntity(PhysicalEntity* entity) { _owningEntity = entity; }
|
void setEntity(PhysicsEntity* entity) { _owningEntity = entity; }
|
||||||
PhysicalEntity* getEntity() const { return _owningEntity; }
|
PhysicsEntity* getEntity() const { return _owningEntity; }
|
||||||
|
|
||||||
float getBoundingRadius() const { return _boundingRadius; }
|
float getBoundingRadius() const { return _boundingRadius; }
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
||||||
void setBoundingRadius(float radius) { _boundingRadius = radius; }
|
void setBoundingRadius(float radius) { _boundingRadius = radius; }
|
||||||
|
|
||||||
int _type;
|
int _type;
|
||||||
PhysicalEntity* _owningEntity;
|
PhysicsEntity* _owningEntity;
|
||||||
float _boundingRadius;
|
float _boundingRadius;
|
||||||
glm::vec3 _translation;
|
glm::vec3 _translation;
|
||||||
glm::quat _rotation;
|
glm::quat _rotation;
|
||||||
|
|
Loading…
Reference in a new issue