mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 09:44:21 +02:00
debugging
This commit is contained in:
parent
cd2b6473ba
commit
ebae87136f
5 changed files with 34 additions and 13 deletions
|
@ -432,6 +432,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
// If this is from the same sever packet, then check against any local changes since we got
|
||||
// the most recent packet from this server time
|
||||
if (_lastEdited > _lastEditedFromRemote) {
|
||||
qDebug() << "_lastEdited > _lastEditedFromRemote";
|
||||
ignoreServerPacket = true;
|
||||
}
|
||||
} else {
|
||||
|
@ -439,6 +440,14 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
|
|||
// If we've changed our local tree more recently than the new data from this packet
|
||||
// then we will not be changing our values, instead we just read and skip the data
|
||||
if (_lastEdited > lastEditedFromBufferAdjusted) {
|
||||
qDebug() << "_lastEdited > lastEditedFromBufferAdjusted";
|
||||
qDebug() << "_lastEdited =" << _lastEdited;
|
||||
qDebug() << "lastEditedFromBuffer - clockSkew =" << lastEditedFromBuffer - clockSkew;
|
||||
qDebug() << "lastEditedFromBufferAdjusted =" << lastEditedFromBufferAdjusted;
|
||||
qDebug() << "lastEditedFromBuffer =" << lastEditedFromBuffer;
|
||||
qDebug() << "clockSkew =" << clockSkew;
|
||||
qDebug() << "now = " << now;
|
||||
|
||||
ignoreServerPacket = true;
|
||||
}
|
||||
}
|
||||
|
@ -660,12 +669,12 @@ void EntityItem::adjustEditPacketForClockSkew(unsigned char* editPacketBuffer, s
|
|||
memcpy(&lastEditedInLocalTime, dataAt, sizeof(lastEditedInLocalTime));
|
||||
quint64 lastEditedInServerTime = lastEditedInLocalTime + clockSkew;
|
||||
memcpy(dataAt, &lastEditedInServerTime, sizeof(lastEditedInServerTime));
|
||||
#ifdef WANT_DEBUG
|
||||
//#ifdef WANT_DEBUG
|
||||
qCDebug(entities, "EntityItem::adjustEditPacketForClockSkew()...");
|
||||
qCDebug(entities) << " lastEditedInLocalTime: " << lastEditedInLocalTime;
|
||||
qCDebug(entities) << " clockSkew: " << clockSkew;
|
||||
qCDebug(entities) << " lastEditedInServerTime: " << lastEditedInServerTime;
|
||||
#endif
|
||||
//#endif
|
||||
}
|
||||
|
||||
float EntityItem::computeMass() const {
|
||||
|
|
|
@ -539,7 +539,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object) {
|
|||
_stage.copyFromScriptValue(object, _defaultSettings);
|
||||
_atmosphere.copyFromScriptValue(object, _defaultSettings);
|
||||
_skybox.copyFromScriptValue(object, _defaultSettings);
|
||||
_lastEdited = usecTimestampNow();
|
||||
_lastEdited = usecTimestampNow(); // ???
|
||||
}
|
||||
|
||||
QScriptValue EntityItemPropertiesToScriptValue(QScriptEngine* engine, const EntityItemProperties& properties) {
|
||||
|
|
|
@ -402,6 +402,7 @@ bool EntityScriptingInterface::setVoxelSphere(QUuid entityID, const glm::vec3& c
|
|||
PolyVoxEntityItem* polyVoxEntity = static_cast<PolyVoxEntityItem*>(entity);
|
||||
_entityTree->lockForWrite();
|
||||
polyVoxEntity->setSphere(center, radius, value);
|
||||
// entity->setLastEdited(usecTimestampNow());
|
||||
_entityTree->unlock();
|
||||
|
||||
_entityTree->lockForRead();
|
||||
|
|
|
@ -62,8 +62,11 @@ bool PolyVoxEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(voxelVolumeSize, setVoxelVolumeSize);
|
||||
SET_ENTITY_PROPERTY_FROM_PROPERTIES(voxelData, setVoxelData);
|
||||
|
||||
qDebug() << "PolyVoxEntityItem::setProperties somethingChanged =" << somethingChanged
|
||||
<< "prop has voxel-data =" << properties.getChangedProperties().getHasProperty(PROP_VOXEL_DATA);
|
||||
|
||||
if (somethingChanged) {
|
||||
bool wantDebug = false;
|
||||
bool wantDebug = true;
|
||||
if (wantDebug) {
|
||||
uint64_t now = usecTimestampNow();
|
||||
int elapsed = now - getLastEdited();
|
||||
|
@ -76,18 +79,23 @@ bool PolyVoxEntityItem::setProperties(const EntityItemProperties& properties) {
|
|||
}
|
||||
|
||||
int PolyVoxEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data, int bytesLeftToRead,
|
||||
ReadBitstreamToTreeParams& args,
|
||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) {
|
||||
ReadBitstreamToTreeParams& args,
|
||||
EntityPropertyFlags& propertyFlags, bool overwriteLocalData) {
|
||||
|
||||
int bytesRead = 0;
|
||||
const unsigned char* dataAt = data;
|
||||
|
||||
qDebug() << "PolyVoxEntityItem::readEntitySubclassDataFromBuffer";
|
||||
qDebug() << "PolyVoxEntityItem::readEntitySubclassDataFromBuffer"
|
||||
<< "propertyFlags.getHasProperty(PROP_VOXEL_DATA) =" << propertyFlags.getHasProperty(PROP_VOXEL_DATA)
|
||||
<< "overwriteLocalData =" << overwriteLocalData;
|
||||
|
||||
|
||||
READ_ENTITY_PROPERTY(PROP_COLOR, rgbColor, setColor);
|
||||
READ_ENTITY_PROPERTY(PROP_VOXEL_VOLUME_SIZE, glm::vec3, setVoxelVolumeSize);
|
||||
READ_ENTITY_PROPERTY(PROP_VOXEL_DATA, QByteArray, setVoxelData);
|
||||
|
||||
|
||||
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
|
@ -102,18 +110,20 @@ EntityPropertyFlags PolyVoxEntityItem::getEntityProperties(EncodeBitstreamParams
|
|||
}
|
||||
|
||||
void PolyVoxEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBitstreamParams& params,
|
||||
EntityTreeElementExtraEncodeData* modelTreeElementExtraEncodeData,
|
||||
EntityPropertyFlags& requestedProperties,
|
||||
EntityPropertyFlags& propertyFlags,
|
||||
EntityPropertyFlags& propertiesDidntFit,
|
||||
int& propertyCount,
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
EntityTreeElementExtraEncodeData* modelTreeElementExtraEncodeData,
|
||||
EntityPropertyFlags& requestedProperties,
|
||||
EntityPropertyFlags& propertyFlags,
|
||||
EntityPropertyFlags& propertiesDidntFit,
|
||||
int& propertyCount,
|
||||
OctreeElement::AppendState& appendState) const {
|
||||
|
||||
bool successPropertyFits = true;
|
||||
|
||||
APPEND_ENTITY_PROPERTY(PROP_COLOR, getColor());
|
||||
APPEND_ENTITY_PROPERTY(PROP_VOXEL_VOLUME_SIZE, getVoxelVolumeSize());
|
||||
APPEND_ENTITY_PROPERTY(PROP_VOXEL_DATA, getVoxelData());
|
||||
|
||||
qDebug() << "PolyVoxEntityItem::appendSubclassData successPropertyFits =" << successPropertyFits;
|
||||
}
|
||||
|
||||
void PolyVoxEntityItem::debugDump() const {
|
||||
|
|
|
@ -591,5 +591,6 @@ int OctreePacketData::uppackDataFromBytes(const unsigned char* dataBytes, QByteA
|
|||
dataBytes += sizeof(length);
|
||||
QByteArray value((const char*)dataBytes, length);
|
||||
result = value;
|
||||
qDebug() << "OctreePacketData::uppackDataFromBytes uppacked " << length;
|
||||
return sizeof(length) + length;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue