mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 17:03:58 +02:00
fix referentials corruption and removed some debugging
This commit is contained in:
parent
4e38cb7c68
commit
ef8feec91a
5 changed files with 10 additions and 31 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<const char*>(sourceBuffer), size);
|
||||
_extraDataBuffer.append(reinterpret_cast<const char*>(sourceBuffer), size);
|
||||
return size;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue