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
10 10
11#include <SharedUtil.h>11#include <SharedUtil.h>
12 12
13#include <MetavoxelMessages.h>
14#include <MetavoxelUtil.h>13#include <MetavoxelUtil.h>
15 14
16#include "Application.h"15#include "Application.h"
@@ -42,6 +41,12 @@ void MetavoxelSystem::init() { · 25 unmodified lines
42 _buffer.create();41 _buffer.create();
43}42}
44 43
44void MetavoxelSystem::applyEdit(const MetavoxelEdit& edit) {
45 foreach (MetavoxelClient* client, _clients) {
46 client->applyEdit(edit);
47 }
48}
49
45void MetavoxelSystem::processData(const QByteArray& data, const HifiSockAddr& sender) {50void MetavoxelSystem::processData(const QByteArray& data, const HifiSockAddr& sender) {
46 QMetaObject::invokeMethod(this, "receivedData", Q_ARG(const QByteArray&, data), Q_ARG(const HifiSockAddr&, sender));51 QMetaObject::invokeMethod(this, "receivedData", Q_ARG(const QByteArray&, data), Q_ARG(const HifiSockAddr&, sender));
47}52}
@@ -187,6 +192,14 @@ MetavoxelClient::MetavoxelClient(const HifiSockAddr& address) : · 139 unmodified lines
187 _receiveRecords.append(record);192 _receiveRecords.append(record);
188}193}
189 194
195void 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
190void MetavoxelClient::simulate(float deltaTime, MetavoxelVisitor& visitor) {203void MetavoxelClient::simulate(float deltaTime, MetavoxelVisitor& visitor) {
191 Bitstream& out = _sequencer.startPacket();204 Bitstream& out = _sequencer.startPacket();
192 ClientStateMessage state = { Application::getInstance()->getCamera()->getPosition() };205 ClientStateMessage state = { Application::getInstance()->getCamera()->getPosition() };