History

Working on sending edits.

Andrzej Kapolka committed 12 years ago

Commit 7f207501 parent f73f16b10 files · +168 −75Browse files

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

Unified · Split

interface/src/MetavoxelSystem.cpp+14−1
@@ -10,7 +10,6 @@ · 9 unmodified lines
1010
1111 #include <SharedUtil.h>
1212
13−#include <MetavoxelMessages.h>
1413 #include <MetavoxelUtil.h>
1514
1615 #include "Application.h"
@@ -42,6 +41,12 @@ void MetavoxelSystem::init() { · 25 unmodified lines
4241 _buffer.create();
4342 }
4443
44+void MetavoxelSystem::applyEdit(const MetavoxelEdit& edit) {
45+ foreach (MetavoxelClient* client, _clients) {
46+ client->applyEdit(edit);
47+ }
48+}
49+
4550 void MetavoxelSystem::processData(const QByteArray& data, const HifiSockAddr& sender) {
4651 QMetaObject::invokeMethod(this, "receivedData", Q_ARG(const QByteArray&, data), Q_ARG(const HifiSockAddr&, sender));
4752 }
@@ -187,6 +192,14 @@ MetavoxelClient::MetavoxelClient(const HifiSockAddr& address) : · 139 unmodified lines
187192 _receiveRecords.append(record);
188193 }
189194
195+void MetavoxelClient::applyEdit(const MetavoxelEdit& edit) {
196+ // apply immediately to local tree
197+ edit.apply(_data);
198+
199+ // start sending it out
200+ _sequencer.sendHighPriorityMessage(QVariant::fromValue(edit));
201+}
202+
190203 void MetavoxelClient::simulate(float deltaTime, MetavoxelVisitor& visitor) {
191204 Bitstream& out = _sequencer.startPacket();
192205 ClientStateMessage state = { Application::getInstance()->getCamera()->getPosition() };