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
190 190
191 connect(&_sequencer, SIGNAL(readyToWrite(const QByteArray&)), SLOT(sendData(const QByteArray&)));191 connect(&_sequencer, SIGNAL(readyToWrite(const QByteArray&)), SLOT(sendData(const QByteArray&)));
192 connect(&_sequencer, SIGNAL(readyToRead(Bitstream&)), SLOT(readPacket(Bitstream&)));192 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);
193}198}
194 199
195void MetavoxelClient::simulate(float deltaTime) {200void MetavoxelClient::simulate(float deltaTime) {
@@ -212,5 +217,27 @@ void MetavoxelClient::sendData(const QByteArray& data) { · 16 unmodified lines
212}217}
213 218
214void MetavoxelClient::readPacket(Bitstream& in) {219void 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
229void MetavoxelClient::clearReceiveRecordsBefore(int index) {
230 _receiveRecords.erase(_receiveRecords.begin(), _receiveRecords.begin() + index + 1);
231}
232
233void 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 }
216}243}