From 1eeb2e89f803008a892ec93382aefbfc68e0303a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 24 Mar 2015 16:23:51 -0700 Subject: [PATCH] remove some debug spam --- .../src/RenderableModelEntityItem.cpp | 45 ++++-------------- libraries/entities/src/ModelEntityItem.cpp | 6 +-- libraries/physics/src/EntityMotionState.cpp | 4 +- libraries/physics/src/EntityMotionState.h | 2 +- libraries/physics/src/ObjectMotionState.h | 2 +- libraries/physics/src/PhysicsEngine.cpp | 47 +------------------ 6 files changed, 15 insertions(+), 91 deletions(-) diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index 0a7d672189..88827d066c 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -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 collisionNetworkGeometry = _model->getCollisionGeometry(); const FBXGeometry& fbxGeometry = collisionNetworkGeometry->getFBXGeometry(); diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 13eaf0449f..f135f617f4 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -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; } diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index 3ca016c5d8..35eb006655 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -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 { diff --git a/libraries/physics/src/EntityMotionState.h b/libraries/physics/src/EntityMotionState.h index 1910e92150..7214626fc4 100644 --- a/libraries/physics/src/EntityMotionState.h +++ b/libraries/physics/src/EntityMotionState.h @@ -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); diff --git a/libraries/physics/src/ObjectMotionState.h b/libraries/physics/src/ObjectMotionState.h index 12d1d14c2d..fb402a178d 100644 --- a/libraries/physics/src/ObjectMotionState.h +++ b/libraries/physics/src/ObjectMotionState.h @@ -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); diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 7dd989c9ab..5f668b4f37 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -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(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(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(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);