History

More work on delta streaming.

Andrzej Kapolka committed 12 years ago

Commit 67ed0451 parent a08afae9 files · +91 −39Browse files

Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 9 files). Show all

Unified · Split

interface/src/MetavoxelSystem.cpp+28−1
@@ -190,6 +190,11 @@ MetavoxelClient::MetavoxelClient(const HifiSockAddr& address) : · 189 unmodified lines
190190
191191 connect(&_sequencer, SIGNAL(readyToWrite(const QByteArray&)), SLOT(sendData(const QByteArray&)));
192192 connect(&_sequencer, SIGNAL(readyToRead(Bitstream&)), SLOT(readPacket(Bitstream&)));
193+ connect(&_sequencer, SIGNAL(receiveAcknowledged(int)), SLOT(clearReceiveRecordsBefore(int)));
194+
195+ // insert the baseline receive record
196+ ReceiveRecord record = { 0 };
197+ _receiveRecords.append(record);
193198 }
194199
195200 void MetavoxelClient::simulate(float deltaTime) {
@@ -212,5 +217,27 @@ void MetavoxelClient::sendData(const QByteArray& data) { · 16 unmodified lines
212217 }
213218
214219 void MetavoxelClient::readPacket(Bitstream& in) {
215− qDebug("got packet from server!\n");
220+ QVariant message;
221+ in >> message;
222+ handleMessage(message);
223+
224+ // record the receipt
225+ ReceiveRecord record = { _sequencer.getIncomingPacketNumber() };
226+ _receiveRecords.append(record);
227+}
228+
229+void MetavoxelClient::clearReceiveRecordsBefore(int index) {
230+ _receiveRecords.erase(_receiveRecords.begin(), _receiveRecords.begin() + index + 1);
231+}
232+
233+void MetavoxelClient::handleMessage(const QVariant& message) {
234+ int userType = message.userType();
235+ if (userType == MetavoxelDeltaMessage::Type) {
236+
237+
238+ } else if (userType == QMetaType::QVariantList) {
239+ foreach (const QVariant& element, message.toList()) {
240+ handleMessage(element);
241+ }
242+ }
216243 }