From ef8feec91a1d1a3701873311419322d6bfafa7d1 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 26 Aug 2014 10:42:46 -0700 Subject: [PATCH] fix referentials corruption and removed some debugging --- interface/src/avatar/ModelReferential.cpp | 5 ----- interface/src/avatar/MyAvatar.cpp | 4 ---- .../entities/RenderableModelEntityItem.cpp | 1 - libraries/avatars/src/Referential.cpp | 10 +-------- libraries/entities/src/todo.txt | 21 ++++++++----------- 5 files changed, 10 insertions(+), 31 deletions(-) diff --git a/interface/src/avatar/ModelReferential.cpp b/interface/src/avatar/ModelReferential.cpp index c93b5215f0..063b872f1f 100644 --- a/interface/src/avatar/ModelReferential.cpp +++ b/interface/src/avatar/ModelReferential.cpp @@ -64,7 +64,6 @@ ModelReferential::ModelReferential(const QUuid& entityID, EntityTree* tree, Avat void ModelReferential::update() { const EntityItem* item = _tree->findEntityByID(_entityID); -qDebug() << "ModelReferential::update() _entityID=" << _entityID << " item=" << item; if (!isValid() || item == NULL || _avatar == NULL) { return; } @@ -77,13 +76,11 @@ qDebug() << "ModelReferential::update() _entityID=" << _entityID << " item=" << } if (item->getRotation() != _refRotation) { _refRotation = item->getRotation(); -qDebug() << "ModelReferential::update() _refRotation=" << _refRotation; _avatar->setOrientation(_refRotation * _rotation, true); somethingChanged = true; } if (item->getPosition() != _refPosition || somethingChanged) { _refPosition = item->getPosition(); -qDebug() << "ModelReferential::update() _refPosition=" << _refPosition << " QThread::currentThread()=" << QThread::currentThread(); _avatar->setPosition(_refPosition * (float)TREE_SCALE + _refRotation * (_translation * _refScale), true); } } @@ -91,14 +88,12 @@ qDebug() << "ModelReferential::update() _refPosition=" << _refPosition << " QThr int ModelReferential::packExtraData(unsigned char* destinationBuffer) const { QByteArray encodedEntityID = _entityID.toRfc4122(); memcpy(destinationBuffer, encodedEntityID.constData(), encodedEntityID.size()); -qDebug() << "ModelReferential::packExtraData() encodedEntityID.size()=" << encodedEntityID.size(); return encodedEntityID.size(); } int ModelReferential::unpackExtraData(const unsigned char *sourceBuffer, int size) { QByteArray encodedEntityID((const char*)sourceBuffer, NUM_BYTES_RFC4122_UUID); _entityID = QUuid::fromRfc4122(encodedEntityID); -qDebug() << "ModelReferential::unpackExtraData() encodedEntityID.size()=" << encodedEntityID.size() << " _entityID=" << _entityID; return NUM_BYTES_RFC4122_UUID; } diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index b4db238f76..d6e53259b0 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -383,10 +383,6 @@ void MyAvatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) { return; // exit early } - if (renderMode != SHADOW_RENDER_MODE) { - qDebug() << "MyAvatar::render() position=" << getPosition() / (float)TREE_SCALE << " QThread::currentThread()=" << QThread::currentThread(); - } - Avatar::render(cameraPosition, renderMode); // don't display IK constraints in shadow mode diff --git a/interface/src/entities/RenderableModelEntityItem.cpp b/interface/src/entities/RenderableModelEntityItem.cpp index 5f775d4b5b..7c866ffbb6 100644 --- a/interface/src/entities/RenderableModelEntityItem.cpp +++ b/interface/src/entities/RenderableModelEntityItem.cpp @@ -57,7 +57,6 @@ void RenderableModelEntityItem::render(RenderArgs* args) { bool drawAsModel = hasModel(); glm::vec3 position = getPosition() * (float)TREE_SCALE; -qDebug() << "RenderableModelEntityItem::render() _position=" << _position << "QThread::currentThread()=" << QThread::currentThread(); float radius = getRadius() * (float)TREE_SCALE; float size = getSize() * (float)TREE_SCALE; diff --git a/libraries/avatars/src/Referential.cpp b/libraries/avatars/src/Referential.cpp index d905074b8f..ebfb809471 100644 --- a/libraries/avatars/src/Referential.cpp +++ b/libraries/avatars/src/Referential.cpp @@ -51,20 +51,13 @@ int Referential::packReferential(unsigned char* destinationBuffer) const { char size = packExtraData(destinationBuffer); *sizePosition = size; // write extra data size in saved spot here destinationBuffer += size; - - qDebug() << "Referential::packReferential() size=" << (int)size; - return destinationBuffer - startPosition; } int Referential::unpackReferential(const unsigned char* sourceBuffer) { const unsigned char* startPosition = sourceBuffer; sourceBuffer += unpack(sourceBuffer); - char expectedSize = *sourceBuffer++; - - qDebug() << "Referential::unpackReferential() expectedSize=" << (int)expectedSize; - char bytesRead = unpackExtraData(sourceBuffer, expectedSize); _isValid = (bytesRead == expectedSize); if (!_isValid) { @@ -72,7 +65,6 @@ int Referential::unpackReferential(const unsigned char* sourceBuffer) { qDebug() << "[ERROR] Referential extra data overflow"; } sourceBuffer += expectedSize; - return sourceBuffer - startPosition; } @@ -112,7 +104,7 @@ int Referential::packExtraData(unsigned char *destinationBuffer) const { int Referential::unpackExtraData(const unsigned char* sourceBuffer, int size) { _extraDataBuffer.clear(); - _extraDataBuffer.setRawData(reinterpret_cast(sourceBuffer), size); + _extraDataBuffer.append(reinterpret_cast(sourceBuffer), size); return size; } diff --git a/libraries/entities/src/todo.txt b/libraries/entities/src/todo.txt index dade93eba7..2a90f8abc6 100644 --- a/libraries/entities/src/todo.txt +++ b/libraries/entities/src/todo.txt @@ -34,18 +34,6 @@ Model properties: // REQUIRED TO DO: - 7) Referentials -- basics are working... performance/jutter - - For sitting points and referentials you can kill two birds with one stone. - Put this model in world: http://highfidelity-public.s3-us-west-1.amazonaws.com/ozan/theater.fst - Launch sit.js - See sitting points - Sit somewhere - Move model with another avatar. - Observe first avatar moving. - - - 1) random crashes on moving (I think things going out of bounds???) 2) some jutter with moving entities @@ -258,3 +246,12 @@ Model properties: // SOLVED -- 1) verify lots of models in single element works // -- repro case - run editModelsExample.js -- create 10 models in the same octree element // SOLVED -- 6) support sitpoints and referentials.... +// SOLVED -- 7) Referentials -- working as well as master +// For sitting points and referentials you can kill two birds with one stone. +// Put this model in world: http://highfidelity-public.s3-us-west-1.amazonaws.com/ozan/theater.fst +// Launch sit.js +// See sitting points +// Sit somewhere +// Move model with another avatar. +// Observe first avatar moving. +