overte/assignment-client/src/voxels/VoxelServer.h

58 lines
2 KiB
C++

//
// VoxelServer.h
// assignment-client/src/voxels
//
// Created by Brad Hefta-Gaub on 8/21/13.
// Copyright 2013 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_VoxelServer_h
#define hifi_VoxelServer_h
#include <QStringList>
#include <QDateTime>
#include <QtCore/QCoreApplication>
#include <ThreadedAssignment.h>
#include <EnvironmentData.h>
#include "../octree/OctreeServer.h"
#include "VoxelServerConsts.h"
/// Handles assignments of type VoxelServer - sending voxels to various clients.
class VoxelServer : public OctreeServer {
public:
VoxelServer(const QByteArray& packet);
~VoxelServer();
bool wantSendEnvironments() const { return _sendEnvironments; }
bool getSendMinimalEnvironment() const { return _sendMinimalEnvironment; }
EnvironmentData* getEnvironmentData(int i) { return &_environmentData[i]; }
int getEnvironmentDataCount() const { return sizeof(_environmentData)/sizeof(EnvironmentData); }
// Subclasses must implement these methods
virtual OctreeQueryNode* createOctreeQueryNode();
virtual Octree* createTree();
virtual char getMyNodeType() const { return NodeType::VoxelServer; }
virtual PacketType getMyQueryMessageType() const { return PacketTypeVoxelQuery; }
virtual const char* getMyServerName() const { return VOXEL_SERVER_NAME; }
virtual const char* getMyLoggingServerTargetName() const { return VOXEL_SERVER_LOGGING_TARGET_NAME; }
virtual const char* getMyDefaultPersistFilename() const { return LOCAL_VOXELS_PERSIST_FILE; }
// subclass may implement these method
virtual void beforeRun();
virtual bool hasSpecialPacketToSend(const SharedNodePointer& node);
virtual int sendSpecialPacket(OctreeQueryNode* queryNode, const SharedNodePointer& node);
private:
bool _sendEnvironments;
bool _sendMinimalEnvironment;
EnvironmentData _environmentData[3];
unsigned char _tempOutputBuffer[MAX_PACKET_SIZE];
};
#endif // hifi_VoxelServer_h