remove some debug spam

This commit is contained in:
Seth Alves 2015-03-24 16:23:51 -07:00
parent 6e3be26013
commit 1eeb2e89f8
6 changed files with 15 additions and 91 deletions

View file

@ -267,50 +267,26 @@ bool RenderableModelEntityItem::findDetailedRayIntersection(const glm::vec3& ori
return _model->findRayIntersectionAgainstSubMeshes(origin, direction, distance, face, extraInfo, precisionPicking);
}
// void RenderableModelEntityItem::setCollisionModelURL(const QString& url) {
// // XXX PhysicsEngine::entityChangedInternal(this);
// // EntityTree* x = this->getElement()->_myTree;
// // EntityTreeRenderer* _myRenderer;
// qDebug() << "--------------------------------";
// this->ModelEntityItem::setCollisionModelURL(url);
// if ((_dirtyFlags & (EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS)) ==
// (EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS)) {
// EntityTreeElement* element = this->getElement();
// if (element) {
// qDebug() << "element =" << element;
// EntityTree* tree = element->getTree();
// qDebug() << "tree =" << tree;
// tree->reconfigureEntity(this);
// }
// }
// }
void RenderableModelEntityItem::setCollisionModelURL(const QString& url) {
ModelEntityItem::setCollisionModelURL(url);
_model->setCollisionModelURL(QUrl(url));
if (_model) {
_model->setCollisionModelURL(QUrl(url));
}
}
bool RenderableModelEntityItem::hasCollisionModel() const {
// return !_collisionModelURL.isEmpty();
return ! _model->getCollisionURL().isEmpty();
if (_model) {
return ! _model->getCollisionURL().isEmpty();
} else {
return !_collisionModelURL.isEmpty();
}
}
const QString& RenderableModelEntityItem::getCollisionModelURL() const {
// return _collisionModelURL;
_collisionModelURL = _model->getCollisionURL().toString();
assert (!_model || _collisionModelURL == _model->getCollisionURL().toString());
return _collisionModelURL;
}
void RenderableModelEntityItem::updateDimensions(const glm::vec3& value) {
if (glm::distance(_dimensions, value) > MIN_DIMENSIONS_DELTA) {
_dimensions = value;
@ -342,12 +318,9 @@ bool RenderableModelEntityItem::isReadyToComputeShape() {
}
void RenderableModelEntityItem::computeShapeInfo(ShapeInfo& info) {
qDebug() << "RenderableModelEntityItem::computeShapeInfo";
if (_model->getCollisionURL().isEmpty()) {
qDebug() << " _model->getCollisionURL().isEmpty()";
info.setParams(getShapeType(), 0.5f * getDimensions());
} else {
qDebug() << " _model->getCollisionURL() wasn't empty.";
const QSharedPointer<NetworkGeometry> collisionNetworkGeometry = _model->getCollisionGeometry();
const FBXGeometry& fbxGeometry = collisionNetworkGeometry->getFBXGeometry();

View file

@ -74,7 +74,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(shapeType, updateShapeType);
if (somethingChanged) {
bool wantDebug = true;
bool wantDebug = false;
if (wantDebug) {
uint64_t now = usecTimestampNow();
int elapsed = now - getLastEdited();
@ -284,10 +284,6 @@ void ModelEntityItem::updateShapeType(ShapeType type) {
void ModelEntityItem::setCollisionModelURL(const QString& url)
{
if (_collisionModelURL != url) {
qDebug() << "\n\n----";
qDebug() << "ModelEntityItem::setCollisionModelURL";
_collisionModelURL = url;
_dirtyFlags |= EntityItem::DIRTY_SHAPE | EntityItem::DIRTY_MASS;
}

View file

@ -168,12 +168,10 @@ void EntityMotionState::updateObjectVelocities() {
}
}
bool EntityMotionState::computeShapeInfo(ShapeInfo& shapeInfo) {
void EntityMotionState::computeShapeInfo(ShapeInfo& shapeInfo) {
if (_entity->isReadyToComputeShape()) {
_entity->computeShapeInfo(shapeInfo);
return true;
}
return false;
}
float EntityMotionState::computeMass(const ShapeInfo& shapeInfo) const {

View file

@ -53,7 +53,7 @@ public:
virtual void updateObjectEasy(uint32_t flags, uint32_t frame);
virtual void updateObjectVelocities();
virtual bool computeShapeInfo(ShapeInfo& shapeInfo);
virtual void computeShapeInfo(ShapeInfo& shapeInfo);
virtual float computeMass(const ShapeInfo& shapeInfo) const;
virtual void sendUpdate(OctreeEditPacketSender* packetSender, uint32_t frame);

View file

@ -67,7 +67,7 @@ public:
MotionStateType getType() const { return _type; }
virtual MotionType getMotionType() const { return _motionType; }
virtual bool computeShapeInfo(ShapeInfo& info) = 0;
virtual void computeShapeInfo(ShapeInfo& info) = 0;
virtual float computeMass(const ShapeInfo& shapeInfo) const = 0;
void setFriction(float friction);

View file

@ -59,33 +59,21 @@ void PhysicsEngine::updateEntitiesInternal(const quint64& now) {
}
bool PhysicsEngine::addEntityInternal(EntityItem* entity) {
qDebug() << "PhysicsEngine::addEntityInternal";
assert(entity);
void* physicsInfo = entity->getPhysicsInfo();
if (!physicsInfo) {
qDebug() << " PhysicsEngine::addEntityInternal no physicsInfo";
if (! entity->isReadyToComputeShape()) {
qDebug() << " PhysicsEngine::addEntityInternal not ready to compute";
return false;
}
qDebug() << " PhysicsEngine::addEntityInternal ready to compute";
ShapeInfo shapeInfo;
entity->computeShapeInfo(shapeInfo);
DoubleHashKey hkey = shapeInfo.getHash();
qDebug() << " shapeInfo hash:" << hkey.getHash() << hkey.getHash2();
btCollisionShape* shape = _shapeManager.getShape(shapeInfo);
if (shape) {
qDebug() << " got a shape";
EntityMotionState* motionState = new EntityMotionState(entity);
entity->setPhysicsInfo(static_cast<void*>(motionState));
_entityMotionStates.insert(motionState);
addObject(shapeInfo, shape, motionState);
} else if (entity->isMoving()) {
qDebug() << " no shape but is moving";
EntityMotionState* motionState = new EntityMotionState(entity);
entity->setPhysicsInfo(static_cast<void*>(motionState));
_entityMotionStates.insert(motionState);
@ -94,11 +82,7 @@ bool PhysicsEngine::addEntityInternal(EntityItem* entity) {
_nonPhysicalKinematicObjects.insert(motionState);
// We failed to add the entity to the simulation. Probably because we couldn't create a shape for it.
//qDebug() << "failed to add entity " << entity->getEntityItemID() << " to physics engine";
} else {
qDebug() << " no shape and not moving";
}
} else {
qDebug() << " PhysicsEngine::addEntityInternal already had physicsInfo";
}
return true;
}
@ -123,28 +107,18 @@ void PhysicsEngine::removeEntityInternal(EntityItem* entity) {
}
void PhysicsEngine::entityChangedInternal(EntityItem* entity) {
qDebug() << "PhysicsEngine::entityChangedInternal";
// queue incoming changes: from external sources (script, EntityServer, etc) to physics engine
assert(entity);
void* physicsInfo = entity->getPhysicsInfo();
if (physicsInfo) {
qDebug() << " PhysicsEngine::entityChangedInternal had physicsInfo";
ObjectMotionState* motionState = static_cast<ObjectMotionState*>(physicsInfo);
_incomingChanges.insert(motionState);
} else {
qDebug() << " PhysicsEngine::entityChangedInternal had no physicsInfo";
// try to add this entity again (maybe something changed such that it will work this time)
addEntity(entity);
}
}
// void PhysicsEngine::reconfigureEntity(EntityItem* entity) {
// qDebug() << "PhysicsEngine::reconfigureEntity";
// entityChangedInternal(entity);
// }
void PhysicsEngine::sortEntitiesThatMovedInternal() {
// entities that have been simulated forward (hence in the _entitiesToBeSorted list)
// also need to be put in the outgoingPackets list
@ -537,20 +511,8 @@ bool PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motio
// get new shape
btCollisionShape* oldShape = body->getCollisionShape();
ShapeInfo shapeInfo;
bool computeShapeInfoResult = motionState->computeShapeInfo(shapeInfo);
qDebug() << "\n\n---";
qDebug() << "PhysicsEngine::updateObjectHard #1 computeShapeInfoResult =" << computeShapeInfoResult;
motionState->computeShapeInfo(shapeInfo);
btCollisionShape* newShape = _shapeManager.getShape(shapeInfo);
DoubleHashKey hkey = shapeInfo.getHash();
qDebug() << " shapeInfo hash:" << hkey.getHash() << hkey.getHash2();
qDebug() << " newShape =" << newShape;
if (!newShape) {
// FAIL! we are unable to support these changes!
_shapeManager.releaseShape(oldShape);
@ -603,12 +565,7 @@ bool PhysicsEngine::updateObjectHard(btRigidBody* body, ObjectMotionState* motio
if (! (flags & EntityItem::DIRTY_MASS)) {
// always update mass properties when going dynamic (unless it's already been done above)
ShapeInfo shapeInfo;
bool computeShapeInfoResult = motionState->computeShapeInfo(shapeInfo);
qDebug() << "\n\n---";
qDebug() << "PhysicsEngine::updateObjectHard #2 computeShapeInfoResult =" << computeShapeInfoResult;
motionState->computeShapeInfo(shapeInfo);
float mass = motionState->computeMass(shapeInfo);
btVector3 inertia(0.0f, 0.0f, 0.0f);
body->getCollisionShape()->calculateLocalInertia(mass, inertia);