mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 22:10:25 +02:00
Fix for local edits.
This commit is contained in:
parent
6bf4182804
commit
aaae07087c
2 changed files with 14 additions and 17 deletions
|
@ -116,30 +116,26 @@ void MetavoxelClient::writeUpdateMessage(Bitstream& out) {
|
||||||
out << QVariant::fromValue(state);
|
out << QVariant::fromValue(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetavoxelClient::readMessage(Bitstream& in) {
|
|
||||||
Endpoint::readMessage(in);
|
|
||||||
|
|
||||||
// reapply local edits
|
|
||||||
foreach (const DatagramSequencer::HighPriorityMessage& message, _sequencer.getHighPriorityMessages()) {
|
|
||||||
if (message.data.userType() == MetavoxelEditMessage::Type) {
|
|
||||||
message.data.value<MetavoxelEditMessage>().apply(_data, _sequencer.getWeakSharedObjectHash());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) {
|
void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) {
|
||||||
int userType = message.userType();
|
int userType = message.userType();
|
||||||
if (userType == MetavoxelDeltaMessage::Type) {
|
if (userType == MetavoxelDeltaMessage::Type) {
|
||||||
PacketRecord* receiveRecord = getLastAcknowledgedReceiveRecord();
|
PacketRecord* receiveRecord = getLastAcknowledgedReceiveRecord();
|
||||||
if (_reliableDeltaChannel) {
|
if (_reliableDeltaChannel) {
|
||||||
_data.readDelta(receiveRecord->getData(), receiveRecord->getLOD(), in, _dataLOD = _reliableDeltaLOD);
|
_remoteData.readDelta(receiveRecord->getData(), receiveRecord->getLOD(), in, _remoteDataLOD = _reliableDeltaLOD);
|
||||||
_sequencer.getInputStream().persistReadMappings(in.getAndResetReadMappings());
|
_sequencer.getInputStream().persistReadMappings(in.getAndResetReadMappings());
|
||||||
in.clearPersistentMappings();
|
in.clearPersistentMappings();
|
||||||
_reliableDeltaChannel = NULL;
|
_reliableDeltaChannel = NULL;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
_data.readDelta(receiveRecord->getData(), receiveRecord->getLOD(), in,
|
_remoteData.readDelta(receiveRecord->getData(), receiveRecord->getLOD(), in,
|
||||||
_dataLOD = getLastAcknowledgedSendRecord()->getLOD());
|
_remoteDataLOD = getLastAcknowledgedSendRecord()->getLOD());
|
||||||
|
}
|
||||||
|
// copy to local and reapply local edits
|
||||||
|
_data = _remoteData;
|
||||||
|
foreach (const DatagramSequencer::HighPriorityMessage& message, _sequencer.getHighPriorityMessages()) {
|
||||||
|
if (message.data.userType() == MetavoxelEditMessage::Type) {
|
||||||
|
message.data.value<MetavoxelEditMessage>().apply(_data, _sequencer.getWeakSharedObjectHash());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (userType == MetavoxelDeltaPendingMessage::Type) {
|
} else if (userType == MetavoxelDeltaPendingMessage::Type) {
|
||||||
if (!_reliableDeltaChannel) {
|
if (!_reliableDeltaChannel) {
|
||||||
|
@ -157,5 +153,6 @@ PacketRecord* MetavoxelClient::maybeCreateSendRecord() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
PacketRecord* MetavoxelClient::maybeCreateReceiveRecord() const {
|
PacketRecord* MetavoxelClient::maybeCreateReceiveRecord() const {
|
||||||
return new PacketRecord(_dataLOD, _data);
|
return new PacketRecord(_remoteDataLOD, _remoteData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void writeUpdateMessage(Bitstream& out);
|
virtual void writeUpdateMessage(Bitstream& out);
|
||||||
virtual void readMessage(Bitstream& in);
|
|
||||||
virtual void handleMessage(const QVariant& message, Bitstream& in);
|
virtual void handleMessage(const QVariant& message, Bitstream& in);
|
||||||
|
|
||||||
virtual PacketRecord* maybeCreateSendRecord() const;
|
virtual PacketRecord* maybeCreateSendRecord() const;
|
||||||
|
@ -70,7 +69,8 @@ private:
|
||||||
|
|
||||||
MetavoxelClientManager* _manager;
|
MetavoxelClientManager* _manager;
|
||||||
MetavoxelData _data;
|
MetavoxelData _data;
|
||||||
MetavoxelLOD _dataLOD;
|
MetavoxelData _remoteData;
|
||||||
|
MetavoxelLOD _remoteDataLOD;
|
||||||
|
|
||||||
ReliableChannel* _reliableDeltaChannel;
|
ReliableChannel* _reliableDeltaChannel;
|
||||||
MetavoxelLOD _reliableDeltaLOD;
|
MetavoxelLOD _reliableDeltaLOD;
|
||||||
|
|
Loading…
Reference in a new issue