From 838a549abefa3549d2f7362686f7c2d2e114276d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 22 Jan 2015 13:31:09 -0800 Subject: [PATCH] debugging stutter --- .../entities/src/EntityEditPacketSender.cpp | 7 ---- libraries/entities/src/EntityItem.cpp | 6 --- libraries/entities/src/EntityTree.cpp | 4 -- libraries/entities/src/EntityTreeElement.cpp | 2 - libraries/physics/src/EntityMotionState.cpp | 15 -------- libraries/physics/src/ObjectMotionState.cpp | 38 +------------------ libraries/physics/src/PhysicsEngine.cpp | 3 -- 7 files changed, 1 insertion(+), 74 deletions(-) diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 9129cd875e..f2588d0493 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -27,13 +27,7 @@ void EntityEditPacketSender::adjustEditPacketForClockSkew(PacketType type, void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityItemID modelID, const EntityItemProperties& properties) { - - qDebug() << "EntityEditPacketSender::queueEditEntityMessage()..."; - qDebug() << " ID:" << modelID; - qDebug() << " properties:" << properties; - if (!_shouldSend) { - qDebug() << " BAIL EARLY! _shouldSend:" << _shouldSend; return; // bail early } @@ -42,7 +36,6 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityItemI int sizeOut = 0; if (EntityItemProperties::encodeEntityEditPacket(type, modelID, properties, &bufferOut[0], _maxPacketSize, sizeOut)) { - qDebug() << " queueOctreeEditMessage() sizeOut:" << sizeOut; queueOctreeEditMessage(type, bufferOut, sizeOut); } } diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index b413ea2b23..7e3e982fb8 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -1064,9 +1064,6 @@ const float MIN_SPIN_DELTA = 0.0003f; void EntityItem::updatePosition(const glm::vec3& value) { if (glm::distance(_position, value) * (float)TREE_SCALE > MIN_POSITION_DELTA) { - qDebug() << "EntityItem::updatePosition()... "; - qDebug() << " new position:" << value; - qDebug() << " in meters:" << (value * (float) TREE_SCALE); _position = value; recalculateCollisionShape(); _dirtyFlags |= EntityItem::DIRTY_POSITION; @@ -1076,9 +1073,6 @@ void EntityItem::updatePosition(const glm::vec3& value) { void EntityItem::updatePositionInMeters(const glm::vec3& value) { glm::vec3 position = glm::clamp(value / (float) TREE_SCALE, 0.0f, 1.0f); if (glm::distance(_position, position) * (float)TREE_SCALE > MIN_POSITION_DELTA) { - qDebug() << "EntityItem::updatePositionInMeters()... "; - qDebug() << " new position:" << position; - qDebug() << " in meters:" << value; _position = position; recalculateCollisionShape(); _dirtyFlags |= EntityItem::DIRTY_POSITION; diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index 1e6fe51916..580fed8790 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -305,7 +305,6 @@ void EntityTree::processRemovedEntities(const DeleteEntityOperator& theOperator) /// we're not changing the content of the tree, we're only changing the internal IDs that map entities from creator /// based to known IDs. This means we don't have to recurse the tree to mark the changed path as dirty. void EntityTree::handleAddEntityResponse(const QByteArray& packet) { - qDebug() << "EntityTree::handleAddEntityResponse()"; if (!getIsClient()) { qDebug() << "UNEXPECTED!!! EntityTree::handleAddEntityResponse() with !getIsClient() ***"; @@ -330,9 +329,6 @@ void EntityTree::handleAddEntityResponse(const QByteArray& packet) { searchEntityID.id = entityID; searchEntityID.creatorTokenID = creatorTokenID; - qDebug() << " creatorTokenID:" << creatorTokenID; - qDebug() << " entityID:" << entityID; - lockForWrite(); // find the creator token version, it's containing element, and the entity itself diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 923ab8a9ca..aff6e64f57 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -795,13 +795,11 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int } } else { - qDebug() << "EntityTreeElement::readElementDataFromBuffer() about to construct entity item"; entityItem = EntityTypes::constructEntityItem(dataAt, bytesLeftToRead, args); if (entityItem) { bytesForThisEntity = entityItem->readEntityDataFromBuffer(dataAt, bytesLeftToRead, args); addEntityItem(entityItem); // add this new entity to this elements entities entityItemID = entityItem->getEntityItemID(); - qDebug() << " entityItemID:" << entityItemID; _myTree->setContainingElement(entityItemID, this); _myTree->postAddEntity(entityItem); } diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index f08683455c..9453501407 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -159,23 +159,13 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ return; // never update entities that are unknown } if (_outgoingPacketFlags) { - qDebug() << "EntityMotionState::sendUpdate()..."; - qDebug() << " _outgoingPacketFlags:" << _outgoingPacketFlags; - EntityItemProperties properties = _entity->getProperties(); - qDebug() << " _entity->getProperties():" << properties << "line:" << __LINE__; - if (_outgoingPacketFlags & EntityItem::DIRTY_POSITION) { btTransform worldTrans = _body->getWorldTransform(); _sentPosition = bulletToGLM(worldTrans.getOrigin()); properties.setPosition(_sentPosition + ObjectMotionState::getWorldOffset()); - qDebug() << " _sentPosition:" << _sentPosition << "line:" << __LINE__; - qDebug() << " ObjectMotionState::getWorldOffset():" << ObjectMotionState::getWorldOffset() << "line:" << __LINE__; - _sentRotation = bulletToGLM(worldTrans.getRotation()); properties.setRotation(_sentRotation); - - qDebug() << " after position properties:" << properties << "line:" << __LINE__; } if (_outgoingPacketFlags & EntityItem::DIRTY_VELOCITY) { @@ -205,8 +195,6 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ properties.setGravity(_sentAcceleration); // DANGER! EntityItem stores angularVelocity in degrees/sec!!! properties.setAngularVelocity(glm::degrees(_sentAngularVelocity)); - - qDebug() << " after velocity properties:" << properties << "line:" << __LINE__; } // RELIABLE_SEND_HACK: count number of updates for entities at rest so we can stop sending them after some limit. @@ -227,9 +215,6 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ EntityItemID id(_entity->getID()); EntityEditPacketSender* entityPacketSender = static_cast(packetSender); - qDebug() << "EntityMotionState::sendUpdate()... about to call queueEditEntityMessage()"; - qDebug() << " id:" << id; - qDebug() << " properties:" << properties; entityPacketSender->queueEditEntityMessage(PacketTypeEntityAddOrEdit, id, properties); // The outgoing flags only itemized WHAT to send, not WHETHER to send, hence we always set them diff --git a/libraries/physics/src/ObjectMotionState.cpp b/libraries/physics/src/ObjectMotionState.cpp index cacaab614f..effd7c3e4d 100644 --- a/libraries/physics/src/ObjectMotionState.cpp +++ b/libraries/physics/src/ObjectMotionState.cpp @@ -109,7 +109,6 @@ bool ObjectMotionState::doesNotNeedToSendUpdate() const { bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) { assert(_body); - // if we've never checked before, our _sentFrame will be 0, and we need to initialize our state if (_sentFrame == 0) { _sentPosition = bulletToGLM(_body->getWorldTransform().getOrigin()); @@ -119,7 +118,6 @@ bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) { return false; } - uint32_t wasSentFrame = _sentFrame; float dt = (float)(simulationFrame - _sentFrame) * PHYSICS_ENGINE_FIXED_SUBSTEP; _sentFrame = simulationFrame; bool isActive = _body->isActive(); @@ -143,11 +141,6 @@ bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) { // NOTE: math in done the simulation-frame, which is NOT necessarily the same as the world-frame // due to _worldOffset. - - glm::vec3 wasPosition = _sentPosition; - glm::vec3 wasVelocity = _sentVelocity; - glm::vec3 wasAcceleration = _sentAcceleration; - // compute position error if (glm::length2(_sentVelocity) > 0.0f) { _sentVelocity += _sentAcceleration * dt; @@ -161,36 +154,7 @@ bool ObjectMotionState::shouldSendUpdate(uint32_t simulationFrame) { float dx2 = glm::distance2(position, _sentPosition); const float MAX_POSITION_ERROR_SQUARED = 0.001f; // 0.001 m^2 ~~> 0.03 m if (dx2 > MAX_POSITION_ERROR_SQUARED) { -qDebug() << "ObjectMotionState::shouldSendUpdate()... computing position error"; - - glm::vec3 bulletVelocity = bulletToGLM(_body->getLinearVelocity()); - -qDebug() << " was _sentFrame:" << wasSentFrame; -qDebug() << " now _sentFrame:" << _sentFrame; -qDebug() << " dt:" << dt; - -qDebug() << " was _sentAcceleration:" << wasAcceleration; -qDebug() << " now _sentAcceleration:" << _sentAcceleration; - -qDebug() << " bulletVelocity:" << bulletVelocity; -qDebug() << " was _sentVelocity:" << wasVelocity; -qDebug() << " now _sentVelocity:" << _sentVelocity; - -qDebug() << " was _sentPosition:" << wasPosition; -qDebug() << " now _sentPosition:" << _sentPosition; -qDebug() << " bullet position:" << position; - -qDebug() << " dx2:" << dx2; -qDebug() << " (dx2 > MAX_POSITION_ERROR_SQUARED)... considering"; - if (wasSentFrame > 0) { -qDebug() << " (wasSentFrame > 0)... return TRUE"; - return true; - } else { -qDebug() << " (wasSentFrame == 0)... ignore use bullet position for next _sentPosition"; - _sentPosition = position; - } - } else { - //qDebug() << " (dx2 <= MAX_POSITION_ERROR_SQUARED)... FALL THROUGH... likely return false"; + return true; } if (glm::length2(_sentAngularVelocity) > 0.0f) { diff --git a/libraries/physics/src/PhysicsEngine.cpp b/libraries/physics/src/PhysicsEngine.cpp index 58253d1bd4..7f2b139058 100644 --- a/libraries/physics/src/PhysicsEngine.cpp +++ b/libraries/physics/src/PhysicsEngine.cpp @@ -35,9 +35,6 @@ void PhysicsEngine::updateEntitiesInternal(const quint64& now) { // (3) synchronize outgoing motion states // (4) send outgoing packets - - //qDebug() << "_numSubsteps:" << _numSubsteps; - // this is step (4) QSet::iterator stateItr = _outgoingPackets.begin(); while (stateItr != _outgoingPackets.end()) {