Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 13 files). Show all
Unified · Split
| @@ -54,7 +54,7 @@ SharedObjectPointer MetavoxelSystem::findFirstRaySpannerIntersection( · 53 unmodified lines | ||
| 54 | 54 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 55 | 55 | if (node->getType() == NodeType::MetavoxelServer) { |
| 56 | 56 | QMutexLocker locker(&node->getMutex()); |
| 57 | − MetavoxelClient* client = static_cast<MetavoxelClient*>(node->getLinkedData()); | |
| 57 | + MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData()); | |
| 58 | 58 | if (client) { |
| 59 | 59 | float clientDistance; |
| 60 | 60 | SharedObjectPointer clientSpanner = client->getData().findFirstRaySpannerIntersection( |
| @@ -76,7 +76,7 @@ void MetavoxelSystem::applyEdit(const MetavoxelEditMessage& edit, bool reliable) · 15 unmodified lines | ||
| 76 | 76 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 77 | 77 | if (node->getType() == NodeType::MetavoxelServer) { |
| 78 | 78 | QMutexLocker locker(&node->getMutex()); |
| 79 | − MetavoxelClient* client = static_cast<MetavoxelClient*>(node->getLinkedData()); | |
| 79 | + MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData()); | |
| 80 | 80 | if (client) { |
| 81 | 81 | client->applyEdit(edit, reliable); |
| 82 | 82 | } |
| @@ -92,7 +92,7 @@ void MetavoxelSystem::simulate(float deltaTime) { · 9 unmodified lines | ||
| 92 | 92 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 93 | 93 | if (node->getType() == NodeType::MetavoxelServer) { |
| 94 | 94 | QMutexLocker locker(&node->getMutex()); |
| 95 | − MetavoxelClient* client = static_cast<MetavoxelClient*>(node->getLinkedData()); | |
| 95 | + MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData()); | |
| 96 | 96 | if (client) { |
| 97 | 97 | client->simulate(deltaTime); |
| 98 | 98 | client->guide(_simulateVisitor); |
| @@ -153,7 +153,7 @@ void MetavoxelSystem::render() { · 54 unmodified lines | ||
| 153 | 153 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 154 | 154 | if (node->getType() == NodeType::MetavoxelServer) { |
| 155 | 155 | QMutexLocker locker(&node->getMutex()); |
| 156 | − MetavoxelClient* client = static_cast<MetavoxelClient*>(node->getLinkedData()); | |
| 156 | + MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData()); | |
| 157 | 157 | if (client) { |
| 158 | 158 | client->guide(_renderVisitor); |
| 159 | 159 | } |
| @@ -164,7 +164,7 @@ void MetavoxelSystem::render() { · 4 unmodified lines | ||
| 164 | 164 | void MetavoxelSystem::maybeAttachClient(const SharedNodePointer& node) { |
| 165 | 165 | if (node->getType() == NodeType::MetavoxelServer) { |
| 166 | 166 | QMutexLocker locker(&node->getMutex()); |
| 167 | − node->setLinkedData(new MetavoxelClient(NodeList::getInstance()->nodeWithUUID(node->getUUID()))); | |
| 167 | + node->setLinkedData(new MetavoxelSystemClient(NodeList::getInstance()->nodeWithUUID(node->getUUID()))); | |
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
| @@ -235,7 +235,7 @@ bool MetavoxelSystem::RenderVisitor::visit(Spanner* spanner, const glm::vec3& cl · 64 unmodified lines | ||
| 235 | 235 | return true; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | −MetavoxelClient::MetavoxelClient(const SharedNodePointer& node) : | |
| 238 | +MetavoxelSystemClient::MetavoxelSystemClient(const SharedNodePointer& node) : | |
| 239 | 239 | _node(node), |
| 240 | 240 | _sequencer(byteArrayWithPopulatedHeader(PacketTypeMetavoxelData)) { |
| 241 | 241 | |
| @@ -253,7 +253,7 @@ MetavoxelClient::MetavoxelClient(const SharedNodePointer& node) : · 11 unmodified lines | ||
| 253 | 253 | _receiveRecords.append(receiveRecord); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | −MetavoxelClient::~MetavoxelClient() { | |
| 256 | +MetavoxelSystemClient::~MetavoxelSystemClient() { | |
| 257 | 257 | // close the session |
| 258 | 258 | Bitstream& out = _sequencer.startPacket(); |
| 259 | 259 | out << QVariant::fromValue(CloseSessionMessage()); |
| @@ -265,12 +265,12 @@ static MetavoxelLOD getLOD() { · 5 unmodified lines | ||
| 265 | 265 | return MetavoxelLOD(Application::getInstance()->getCamera()->getPosition(), FIXED_LOD_THRESHOLD); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | −void MetavoxelClient::guide(MetavoxelVisitor& visitor) { | |
| 268 | +void MetavoxelSystemClient::guide(MetavoxelVisitor& visitor) { | |
| 269 | 269 | visitor.setLOD(getLOD()); |
| 270 | 270 | _data.guide(visitor); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | −void MetavoxelClient::applyEdit(const MetavoxelEditMessage& edit, bool reliable) { | |
| 273 | +void MetavoxelSystemClient::applyEdit(const MetavoxelEditMessage& edit, bool reliable) { | |
| 274 | 274 | if (reliable) { |
| 275 | 275 | _sequencer.getReliableOutputChannel()->sendMessage(QVariant::fromValue(edit)); |
| 276 | 276 | |
| @@ -283,7 +283,7 @@ void MetavoxelClient::applyEdit(const MetavoxelEditMessage& edit, bool reliable) · 6 unmodified lines | ||
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | −void MetavoxelClient::simulate(float deltaTime) { | |
| 286 | +void MetavoxelSystemClient::simulate(float deltaTime) { | |
| 287 | 287 | Bitstream& out = _sequencer.startPacket(); |
| 288 | 288 | |
| 289 | 289 | ClientStateMessage state = { getLOD() }; |
| @@ -295,19 +295,19 @@ void MetavoxelClient::simulate(float deltaTime) { · 5 unmodified lines | ||
| 295 | 295 | _sendRecords.append(record); |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | −int MetavoxelClient::parseData(const QByteArray& packet) { | |
| 298 | +int MetavoxelSystemClient::parseData(const QByteArray& packet) { | |
| 299 | 299 | // process through sequencer |
| 300 | 300 | QMetaObject::invokeMethod(&_sequencer, "receivedDatagram", Q_ARG(const QByteArray&, packet)); |
| 301 | 301 | Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::METAVOXELS).updateValue(packet.size()); |
| 302 | 302 | return packet.size(); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | −void MetavoxelClient::sendData(const QByteArray& data) { | |
| 305 | +void MetavoxelSystemClient::sendData(const QByteArray& data) { | |
| 306 | 306 | NodeList::getInstance()->writeDatagram(data, _node); |
| 307 | 307 | Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::METAVOXELS).updateValue(data.size()); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | −void MetavoxelClient::readPacket(Bitstream& in) { | |
| 310 | +void MetavoxelSystemClient::readPacket(Bitstream& in) { | |
| 311 | 311 | QVariant message; |
| 312 | 312 | in >> message; |
| 313 | 313 | handleMessage(message, in); |
| @@ -324,15 +324,15 @@ void MetavoxelClient::readPacket(Bitstream& in) { · 10 unmodified lines | ||
| 324 | 324 | } |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | −void MetavoxelClient::clearSendRecordsBefore(int index) { | |
| 327 | +void MetavoxelSystemClient::clearSendRecordsBefore(int index) { | |
| 328 | 328 | _sendRecords.erase(_sendRecords.begin(), _sendRecords.begin() + index + 1); |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | −void MetavoxelClient::clearReceiveRecordsBefore(int index) { | |
| 331 | +void MetavoxelSystemClient::clearReceiveRecordsBefore(int index) { | |
| 332 | 332 | _receiveRecords.erase(_receiveRecords.begin(), _receiveRecords.begin() + index + 1); |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | −void MetavoxelClient::handleMessage(const QVariant& message, Bitstream& in) { | |
| 335 | +void MetavoxelSystemClient::handleMessage(const QVariant& message, Bitstream& in) { | |
| 336 | 336 | int userType = message.userType(); |
| 337 | 337 | if (userType == MetavoxelDeltaMessage::Type) { |
| 338 | 338 | _data.readDelta(_receiveRecords.first().data, _receiveRecords.first().lod, in, _sendRecords.first().lod); |