overte-HifiExperiments/libraries/entities/src/EntityEditPacketSender.h
2015-07-14 13:52:38 -07:00

41 lines
1.6 KiB
C++

//
// EntityEditPacketSender.h
// libraries/models/src
//
// Created by Brad Hefta-Gaub on 8/12/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_EntityEditPacketSender_h
#define hifi_EntityEditPacketSender_h
#include <OctreeEditPacketSender.h>
#include <PacketListener.h>
#include "EntityItem.h"
/// Utility for processing, packing, queueing and sending of outbound edit voxel messages.
class EntityEditPacketSender : public OctreeEditPacketSender, public PacketListener {
Q_OBJECT
public:
EntityEditPacketSender();
/// Queues an array of several voxel edit messages. Will potentially send a pending multi-command packet. Determines
/// which voxel-server node or nodes the packet should be sent to. Can be called even before voxel servers are known, in
/// which case up to MaxPendingMessages will be buffered and processed when voxel servers are known.
/// NOTE: EntityItemProperties assumes that all distances are in meter units
void queueEditEntityMessage(PacketType::Value type, EntityItemID modelID, const EntityItemProperties& properties);
void queueEraseEntityMessage(const EntityItemID& entityItemID);
void processEntityEditNackPacket(QSharedPointer<NLPacket> packet, HifiSockAddr senderSockAddr);
// My server type is the model server
virtual char getMyNodeType() const { return NodeType::EntityServer; }
virtual void adjustEditPacketForClockSkew(PacketType::Value type, QByteArray& buffer, int clockSkew);
};
#endif // hifi_EntityEditPacketSender_h