mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 09:29:02 +02:00
added basic particle server renamed voxel packet names to fit standard
This commit is contained in:
parent
3ca7dc7196
commit
aec0e9f4aa
32 changed files with 202 additions and 122 deletions
|
@ -159,7 +159,7 @@ static void renderMovingBug() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the "erase message" first...
|
// send the "erase message" first...
|
||||||
PACKET_TYPE message = PACKET_TYPE_ERASE_VOXEL;
|
PACKET_TYPE message = PACKET_TYPE_VOXEL_ERASE;
|
||||||
::voxelEditPacketSender->queueVoxelEditMessages(message, VOXELS_PER_BUG, (VoxelDetail*)&details);
|
::voxelEditPacketSender->queueVoxelEditMessages(message, VOXELS_PER_BUG, (VoxelDetail*)&details);
|
||||||
|
|
||||||
// Move the bug...
|
// Move the bug...
|
||||||
|
@ -219,7 +219,7 @@ static void renderMovingBug() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the "create message" ...
|
// send the "create message" ...
|
||||||
message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE;
|
message = PACKET_TYPE_VOXEL_SET_DESTRUCTIVE;
|
||||||
::voxelEditPacketSender->queueVoxelEditMessages(message, VOXELS_PER_BUG, (VoxelDetail*)&details);
|
::voxelEditPacketSender->queueVoxelEditMessages(message, VOXELS_PER_BUG, (VoxelDetail*)&details);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ static void sendVoxelBlinkMessage() {
|
||||||
detail.green = 0 * ::intensity;
|
detail.green = 0 * ::intensity;
|
||||||
detail.blue = 0 * ::intensity;
|
detail.blue = 0 * ::intensity;
|
||||||
|
|
||||||
PACKET_TYPE message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE;
|
PACKET_TYPE message = PACKET_TYPE_VOXEL_SET_DESTRUCTIVE;
|
||||||
|
|
||||||
::voxelEditPacketSender->sendVoxelEditMessage(message, detail);
|
::voxelEditPacketSender->sendVoxelEditMessage(message, detail);
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ unsigned char onColor[3] = { 0, 255, 255 };
|
||||||
const float STRING_OF_LIGHTS_SIZE = 0.125f / TREE_SCALE; // approximately 1/8th meter
|
const float STRING_OF_LIGHTS_SIZE = 0.125f / TREE_SCALE; // approximately 1/8th meter
|
||||||
|
|
||||||
static void sendBlinkingStringOfLights() {
|
static void sendBlinkingStringOfLights() {
|
||||||
PACKET_TYPE message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE; // we're a bully!
|
PACKET_TYPE message = PACKET_TYPE_VOXEL_SET_DESTRUCTIVE; // we're a bully!
|
||||||
float lightScale = STRING_OF_LIGHTS_SIZE;
|
float lightScale = STRING_OF_LIGHTS_SIZE;
|
||||||
static VoxelDetail details[LIGHTS_PER_SEGMENT];
|
static VoxelDetail details[LIGHTS_PER_SEGMENT];
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ const int PACKETS_PER_DANCE_FLOOR = DANCE_FLOOR_VOXELS_PER_PACKET / (DANCE_FLOOR
|
||||||
int danceFloorColors[DANCE_FLOOR_WIDTH][DANCE_FLOOR_LENGTH];
|
int danceFloorColors[DANCE_FLOOR_WIDTH][DANCE_FLOOR_LENGTH];
|
||||||
|
|
||||||
void sendDanceFloor() {
|
void sendDanceFloor() {
|
||||||
PACKET_TYPE message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE; // we're a bully!
|
PACKET_TYPE message = PACKET_TYPE_VOXEL_SET_DESTRUCTIVE; // we're a bully!
|
||||||
float lightScale = DANCE_FLOOR_LIGHT_SIZE;
|
float lightScale = DANCE_FLOOR_LIGHT_SIZE;
|
||||||
static VoxelDetail details[DANCE_FLOOR_VOXELS_PER_PACKET];
|
static VoxelDetail details[DANCE_FLOOR_VOXELS_PER_PACKET];
|
||||||
|
|
||||||
|
@ -493,7 +493,7 @@ bool billboardMessage[BILLBOARD_HEIGHT][BILLBOARD_WIDTH] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static void sendBillboard() {
|
static void sendBillboard() {
|
||||||
PACKET_TYPE message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE; // we're a bully!
|
PACKET_TYPE message = PACKET_TYPE_VOXEL_SET_DESTRUCTIVE; // we're a bully!
|
||||||
float lightScale = BILLBOARD_LIGHT_SIZE;
|
float lightScale = BILLBOARD_LIGHT_SIZE;
|
||||||
static VoxelDetail details[VOXELS_PER_PACKET];
|
static VoxelDetail details[VOXELS_PER_PACKET];
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ void doBuildStreet() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PACKET_TYPE message = PACKET_TYPE_SET_VOXEL_DESTRUCTIVE; // we're a bully!
|
PACKET_TYPE message = PACKET_TYPE_VOXEL_SET_DESTRUCTIVE; // we're a bully!
|
||||||
static VoxelDetail details[BRICKS_PER_PACKET];
|
static VoxelDetail details[BRICKS_PER_PACKET];
|
||||||
|
|
||||||
for (int z = 0; z < ROAD_LENGTH; z++) {
|
for (int z = 0; z < ROAD_LENGTH; z++) {
|
||||||
|
@ -864,7 +864,7 @@ int main(int argc, const char * argv[])
|
||||||
nodeSockAddr.getPortPointer())) &&
|
nodeSockAddr.getPortPointer())) &&
|
||||||
packetVersionMatch(packetData)) {
|
packetVersionMatch(packetData)) {
|
||||||
|
|
||||||
if (packetData[0] == PACKET_TYPE_VOXEL_JURISDICTION) {
|
if (packetData[0] == PACKET_TYPE_JURISDICTION) {
|
||||||
if (::jurisdictionListener) {
|
if (::jurisdictionListener) {
|
||||||
::jurisdictionListener->queueReceivedPacket(nodeSockAddr, packetData, receivedBytes);
|
::jurisdictionListener->queueReceivedPacket(nodeSockAddr, packetData, receivedBytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ link_hifi_library(octree ${TARGET_NAME} ${ROOT_DIR})
|
||||||
link_hifi_library(voxels ${TARGET_NAME} ${ROOT_DIR})
|
link_hifi_library(voxels ${TARGET_NAME} ${ROOT_DIR})
|
||||||
link_hifi_library(particles ${TARGET_NAME} ${ROOT_DIR})
|
link_hifi_library(particles ${TARGET_NAME} ${ROOT_DIR})
|
||||||
link_hifi_library(octree-server ${TARGET_NAME} ${ROOT_DIR})
|
link_hifi_library(octree-server ${TARGET_NAME} ${ROOT_DIR})
|
||||||
link_hifi_library(voxel-server-library ${TARGET_NAME} ${ROOT_DIR})
|
link_hifi_library(particle-server ${TARGET_NAME} ${ROOT_DIR})
|
||||||
|
link_hifi_library(voxel-server ${TARGET_NAME} ${ROOT_DIR})
|
||||||
|
|
||||||
include_directories(${ROOT_DIR}/externals/civetweb/include)
|
include_directories(${ROOT_DIR}/externals/civetweb/include)
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ void vec3FromScriptValue(const QScriptValue &object, glm::vec3 &vec3) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) {
|
void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) {
|
||||||
if (dataByteArray[0] == PACKET_TYPE_VOXEL_JURISDICTION) {
|
if (dataByteArray[0] == PACKET_TYPE_JURISDICTION) {
|
||||||
_voxelScriptingInterface.getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
_voxelScriptingInterface.getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
||||||
(unsigned char*) dataByteArray.data(),
|
(unsigned char*) dataByteArray.data(),
|
||||||
dataByteArray.size());
|
dataByteArray.size());
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "audio/AudioMixer.h"
|
#include "audio/AudioMixer.h"
|
||||||
#include "avatars/AvatarMixer.h"
|
#include "avatars/AvatarMixer.h"
|
||||||
#include <VoxelServer.h>
|
#include <VoxelServer.h>
|
||||||
|
#include <ParticleServer.h>
|
||||||
|
|
||||||
#include "AssignmentFactory.h"
|
#include "AssignmentFactory.h"
|
||||||
|
|
||||||
|
@ -30,6 +31,8 @@ ThreadedAssignment* AssignmentFactory::unpackAssignment(const unsigned char* dat
|
||||||
return new Agent(dataBuffer, numBytes);
|
return new Agent(dataBuffer, numBytes);
|
||||||
case Assignment::VoxelServerType:
|
case Assignment::VoxelServerType:
|
||||||
return new VoxelServer(dataBuffer, numBytes);
|
return new VoxelServer(dataBuffer, numBytes);
|
||||||
|
case Assignment::ParticleServerType:
|
||||||
|
return new ParticleServer(dataBuffer, numBytes);
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float sca
|
||||||
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
||||||
|
|
||||||
// queue the packet
|
// queue the packet
|
||||||
queueVoxelAdd(PACKET_TYPE_SET_VOXEL, addVoxelDetail);
|
queueVoxelAdd(PACKET_TYPE_VOXEL_SET, addVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z, float scale,
|
void VoxelScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z, float scale,
|
||||||
|
@ -31,7 +31,7 @@ void VoxelScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z
|
||||||
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
||||||
|
|
||||||
// queue the destructive add
|
// queue the destructive add
|
||||||
queueVoxelAdd(PACKET_TYPE_SET_VOXEL_DESTRUCTIVE, addVoxelDetail);
|
queueVoxelAdd(PACKET_TYPE_VOXEL_SET_DESTRUCTIVE, addVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float scale) {
|
void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float scale) {
|
||||||
|
@ -39,6 +39,6 @@ void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float
|
||||||
// setup a VoxelDetail struct with data
|
// setup a VoxelDetail struct with data
|
||||||
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
||||||
|
|
||||||
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
|
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_VOXEL_ERASE, 1, &deleteVoxelDetail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,48 @@ void DomainServer::prepopulateStaticAssignmentFile() {
|
||||||
freshStaticAssignments[numFreshStaticAssignments++] = rootVoxelServerAssignment;
|
freshStaticAssignments[numFreshStaticAssignments++] = rootVoxelServerAssignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle Domain/Particle Server configuration command line arguments
|
||||||
|
if (_particleServerConfig) {
|
||||||
|
qDebug("Reading Particle Server Configuration.\n");
|
||||||
|
qDebug() << "config: " << _particleServerConfig << "\n";
|
||||||
|
|
||||||
|
QString multiConfig((const char*) _particleServerConfig);
|
||||||
|
QStringList multiConfigList = multiConfig.split(";");
|
||||||
|
|
||||||
|
// read each config to a payload for a VS assignment
|
||||||
|
for (int i = 0; i < multiConfigList.size(); i++) {
|
||||||
|
QString config = multiConfigList.at(i);
|
||||||
|
|
||||||
|
qDebug("config[%d]=%s\n", i, config.toLocal8Bit().constData());
|
||||||
|
|
||||||
|
// Now, parse the config to check for a pool
|
||||||
|
const char ASSIGNMENT_CONFIG_POOL_OPTION[] = "--pool";
|
||||||
|
QString assignmentPool;
|
||||||
|
|
||||||
|
int poolIndex = config.indexOf(ASSIGNMENT_CONFIG_POOL_OPTION);
|
||||||
|
|
||||||
|
if (poolIndex >= 0) {
|
||||||
|
int spaceBeforePoolIndex = config.indexOf(' ', poolIndex);
|
||||||
|
int spaceAfterPoolIndex = config.indexOf(' ', spaceBeforePoolIndex);
|
||||||
|
|
||||||
|
assignmentPool = config.mid(spaceBeforePoolIndex + 1, spaceAfterPoolIndex);
|
||||||
|
qDebug() << "The pool for this particle-assignment is" << assignmentPool << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
Assignment particleServerAssignment(Assignment::CreateCommand,
|
||||||
|
Assignment::ParticleServerType,
|
||||||
|
(assignmentPool.isEmpty() ? NULL : assignmentPool.toLocal8Bit().constData()));
|
||||||
|
|
||||||
|
int payloadLength = config.length() + sizeof(char);
|
||||||
|
particleServerAssignment.setPayload((uchar*)config.toLocal8Bit().constData(), payloadLength);
|
||||||
|
|
||||||
|
freshStaticAssignments[numFreshStaticAssignments++] = particleServerAssignment;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Assignment rootParticleServerAssignment(Assignment::CreateCommand, Assignment::ParticleServerType);
|
||||||
|
freshStaticAssignments[numFreshStaticAssignments++] = rootParticleServerAssignment;
|
||||||
|
}
|
||||||
|
|
||||||
qDebug() << "Adding" << numFreshStaticAssignments << "static assignments to fresh file.\n";
|
qDebug() << "Adding" << numFreshStaticAssignments << "static assignments to fresh file.\n";
|
||||||
|
|
||||||
_staticAssignmentFile.open(QIODevice::WriteOnly);
|
_staticAssignmentFile.open(QIODevice::WriteOnly);
|
||||||
|
|
|
@ -64,6 +64,7 @@ private:
|
||||||
Assignment* _staticAssignments;
|
Assignment* _staticAssignments;
|
||||||
|
|
||||||
const char* _voxelServerConfig;
|
const char* _voxelServerConfig;
|
||||||
|
const char* _particleServerConfig;
|
||||||
|
|
||||||
bool _hasCompletedRestartHold;
|
bool _hasCompletedRestartHold;
|
||||||
};
|
};
|
||||||
|
|
|
@ -547,7 +547,7 @@ void OctreeServer::processDatagram(const QByteArray& dataByteArray, const HifiSo
|
||||||
nodeData->initializeOctreeSendThread(this);
|
nodeData->initializeOctreeSendThread(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (_jurisdictionSender && packetType == PACKET_TYPE_VOXEL_JURISDICTION_REQUEST) {
|
} else if (_jurisdictionSender && packetType == PACKET_TYPE_JURISDICTION_REQUEST) {
|
||||||
_jurisdictionSender->queueReceivedPacket(senderSockAddr, (unsigned char*) dataByteArray.data(),
|
_jurisdictionSender->queueReceivedPacket(senderSockAddr, (unsigned char*) dataByteArray.data(),
|
||||||
dataByteArray.size());
|
dataByteArray.size());
|
||||||
} else if (_octreeInboundPacketProcessor && getOctree()->handlesEditPacketType(packetType)) {
|
} else if (_octreeInboundPacketProcessor && getOctree()->handlesEditPacketType(packetType)) {
|
||||||
|
|
|
@ -55,11 +55,11 @@ public:
|
||||||
virtual const char* getMyServerName() const = 0;
|
virtual const char* getMyServerName() const = 0;
|
||||||
virtual const char* getMyLoggingServerTargetName() const = 0;
|
virtual const char* getMyLoggingServerTargetName() const = 0;
|
||||||
virtual const char* getMyDefaultPersistFilename() const = 0;
|
virtual const char* getMyDefaultPersistFilename() const = 0;
|
||||||
virtual bool hasSpecialPacketToSend() = 0;
|
|
||||||
virtual int sendSpecialPacket(Node* node) = 0;
|
|
||||||
|
|
||||||
// subclass may implement these method
|
// subclass may implement these method
|
||||||
virtual void beforeRun() { };
|
virtual void beforeRun() { };
|
||||||
|
virtual bool hasSpecialPacketToSend() { return false; }
|
||||||
|
virtual int sendSpecialPacket(Node* node) { return 0; }
|
||||||
|
|
||||||
static void attachQueryNodeToNode(Node* newNode);
|
static void attachQueryNodeToNode(Node* newNode);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void JurisdictionListener::nodeKilled(Node* node) {
|
||||||
bool JurisdictionListener::queueJurisdictionRequest() {
|
bool JurisdictionListener::queueJurisdictionRequest() {
|
||||||
static unsigned char buffer[MAX_PACKET_SIZE];
|
static unsigned char buffer[MAX_PACKET_SIZE];
|
||||||
unsigned char* bufferOut = &buffer[0];
|
unsigned char* bufferOut = &buffer[0];
|
||||||
ssize_t sizeOut = populateTypeAndVersion(bufferOut, PACKET_TYPE_VOXEL_JURISDICTION_REQUEST);
|
ssize_t sizeOut = populateTypeAndVersion(bufferOut, PACKET_TYPE_JURISDICTION_REQUEST);
|
||||||
int nodeCount = 0;
|
int nodeCount = 0;
|
||||||
|
|
||||||
NodeList* nodeList = NodeList::getInstance();
|
NodeList* nodeList = NodeList::getInstance();
|
||||||
|
@ -65,7 +65,7 @@ bool JurisdictionListener::queueJurisdictionRequest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void JurisdictionListener::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
|
void JurisdictionListener::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
|
||||||
if (packetData[0] == PACKET_TYPE_VOXEL_JURISDICTION) {
|
if (packetData[0] == PACKET_TYPE_JURISDICTION) {
|
||||||
Node* node = NodeList::getInstance()->nodeWithAddress(senderAddress);
|
Node* node = NodeList::getInstance()->nodeWithAddress(senderAddress);
|
||||||
if (node) {
|
if (node) {
|
||||||
QUuid nodeUUID = node->getUUID();
|
QUuid nodeUUID = node->getUUID();
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
#include "JurisdictionMap.h"
|
#include "JurisdictionMap.h"
|
||||||
|
|
||||||
/// Sends out PACKET_TYPE_VOXEL_JURISDICTION_REQUEST packets to all voxel servers and then listens for and processes
|
/// Sends out PACKET_TYPE_JURISDICTION_REQUEST packets to all voxel servers and then listens for and processes
|
||||||
/// the PACKET_TYPE_VOXEL_JURISDICTION packets it receives in order to maintain an accurate state of all jurisidictions
|
/// the PACKET_TYPE_JURISDICTION packets it receives in order to maintain an accurate state of all jurisidictions
|
||||||
/// within the domain. As with other ReceivedPacketProcessor classes the user is responsible for reading inbound packets
|
/// within the domain. As with other ReceivedPacketProcessor classes the user is responsible for reading inbound packets
|
||||||
/// and adding them to the processing queue by calling queueReceivedPacket()
|
/// and adding them to the processing queue by calling queueReceivedPacket()
|
||||||
class JurisdictionListener : public NodeListHook, public PacketSender, public ReceivedPacketProcessor {
|
class JurisdictionListener : public NodeListHook, public PacketSender, public ReceivedPacketProcessor {
|
||||||
|
@ -39,7 +39,7 @@ public:
|
||||||
void nodeKilled(Node* node);
|
void nodeKilled(Node* node);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Callback for processing of received packets. Will process any queued PACKET_TYPE_VOXEL_JURISDICTION and update the
|
/// Callback for processing of received packets. Will process any queued PACKET_TYPE_JURISDICTION and update the
|
||||||
/// jurisdiction map member variable
|
/// jurisdiction map member variable
|
||||||
/// \param sockaddr& senderAddress the address of the sender
|
/// \param sockaddr& senderAddress the address of the sender
|
||||||
/// \param packetData pointer to received data
|
/// \param packetData pointer to received data
|
||||||
|
|
|
@ -263,7 +263,7 @@ bool JurisdictionMap::writeToFile(const char* filename) {
|
||||||
int JurisdictionMap::packEmptyJurisdictionIntoMessage(unsigned char* destinationBuffer, int availableBytes) {
|
int JurisdictionMap::packEmptyJurisdictionIntoMessage(unsigned char* destinationBuffer, int availableBytes) {
|
||||||
unsigned char* bufferStart = destinationBuffer;
|
unsigned char* bufferStart = destinationBuffer;
|
||||||
|
|
||||||
int headerLength = populateTypeAndVersion(destinationBuffer, PACKET_TYPE_VOXEL_JURISDICTION);
|
int headerLength = populateTypeAndVersion(destinationBuffer, PACKET_TYPE_JURISDICTION);
|
||||||
destinationBuffer += headerLength;
|
destinationBuffer += headerLength;
|
||||||
|
|
||||||
// No root or end node details to pack!
|
// No root or end node details to pack!
|
||||||
|
@ -277,7 +277,7 @@ int JurisdictionMap::packEmptyJurisdictionIntoMessage(unsigned char* destination
|
||||||
int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int availableBytes) {
|
int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int availableBytes) {
|
||||||
unsigned char* bufferStart = destinationBuffer;
|
unsigned char* bufferStart = destinationBuffer;
|
||||||
|
|
||||||
int headerLength = populateTypeAndVersion(destinationBuffer, PACKET_TYPE_VOXEL_JURISDICTION);
|
int headerLength = populateTypeAndVersion(destinationBuffer, PACKET_TYPE_JURISDICTION);
|
||||||
destinationBuffer += headerLength;
|
destinationBuffer += headerLength;
|
||||||
|
|
||||||
// add the root jurisdiction
|
// add the root jurisdiction
|
||||||
|
|
|
@ -30,7 +30,7 @@ JurisdictionSender::~JurisdictionSender() {
|
||||||
|
|
||||||
|
|
||||||
void JurisdictionSender::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
|
void JurisdictionSender::processPacket(const HifiSockAddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
|
||||||
if (packetData[0] == PACKET_TYPE_VOXEL_JURISDICTION_REQUEST) {
|
if (packetData[0] == PACKET_TYPE_JURISDICTION_REQUEST) {
|
||||||
Node* node = NodeList::getInstance()->nodeWithAddress(senderAddress);
|
Node* node = NodeList::getInstance()->nodeWithAddress(senderAddress);
|
||||||
if (node) {
|
if (node) {
|
||||||
QUuid nodeUUID = node->getUUID();
|
QUuid nodeUUID = node->getUUID();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include <ReceivedPacketProcessor.h>
|
#include <ReceivedPacketProcessor.h>
|
||||||
#include "JurisdictionMap.h"
|
#include "JurisdictionMap.h"
|
||||||
|
|
||||||
/// Will process PACKET_TYPE_VOXEL_JURISDICTION_REQUEST packets and send out PACKET_TYPE_VOXEL_JURISDICTION packets
|
/// Will process PACKET_TYPE_JURISDICTION_REQUEST packets and send out PACKET_TYPE_JURISDICTION packets
|
||||||
/// to requesting parties. As with other ReceivedPacketProcessor classes the user is responsible for reading inbound packets
|
/// to requesting parties. As with other ReceivedPacketProcessor classes the user is responsible for reading inbound packets
|
||||||
/// and adding them to the processing queue by calling queueReceivedPacket()
|
/// and adding them to the processing queue by calling queueReceivedPacket()
|
||||||
class JurisdictionSender : public PacketSender, public ReceivedPacketProcessor {
|
class JurisdictionSender : public PacketSender, public ReceivedPacketProcessor {
|
||||||
|
|
|
@ -379,7 +379,7 @@ void OctreeSceneStats::childBitsRemoved(bool includesExistsBits, bool includesCo
|
||||||
int OctreeSceneStats::packIntoMessage(unsigned char* destinationBuffer, int availableBytes) {
|
int OctreeSceneStats::packIntoMessage(unsigned char* destinationBuffer, int availableBytes) {
|
||||||
unsigned char* bufferStart = destinationBuffer;
|
unsigned char* bufferStart = destinationBuffer;
|
||||||
|
|
||||||
int headerLength = populateTypeAndVersion(destinationBuffer, PACKET_TYPE_VOXEL_STATS);
|
int headerLength = populateTypeAndVersion(destinationBuffer, PACKET_TYPE_OCTREE_STATS);
|
||||||
destinationBuffer += headerLength;
|
destinationBuffer += headerLength;
|
||||||
|
|
||||||
memcpy(destinationBuffer, &_start, sizeof(_start));
|
memcpy(destinationBuffer, &_start, sizeof(_start));
|
||||||
|
|
22
libraries/particle-server/src/ParticleNodeData.h
Normal file
22
libraries/particle-server/src/ParticleNodeData.h
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
//
|
||||||
|
// ParticleNodeData.h
|
||||||
|
// hifi
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 12/4/13
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __hifi__ParticleNodeData__
|
||||||
|
#define __hifi__ParticleNodeData__
|
||||||
|
|
||||||
|
#include <OctreeQueryNode.h>
|
||||||
|
#include <PacketHeaders.h>
|
||||||
|
|
||||||
|
class ParticleNodeData : public OctreeQueryNode {
|
||||||
|
public:
|
||||||
|
ParticleNodeData(Node* owningNode) : OctreeQueryNode(owningNode) { };
|
||||||
|
virtual PACKET_TYPE getMyPacketType() const { return PACKET_TYPE_PARTICLE_DATA; }
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* defined(__hifi__ParticleNodeData__) */
|
37
libraries/particle-server/src/ParticleServer.cpp
Normal file
37
libraries/particle-server/src/ParticleServer.cpp
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// ParticleServer.cpp
|
||||||
|
// hifi
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 12/4/13
|
||||||
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <ParticleTree.h>
|
||||||
|
|
||||||
|
#include "ParticleServer.h"
|
||||||
|
#include "ParticleServerConsts.h"
|
||||||
|
#include "ParticleNodeData.h"
|
||||||
|
|
||||||
|
const char* PARTICLE_SERVER_NAME = "Particle";
|
||||||
|
const char* PARTICLE_SERVER_LOGGING_TARGET_NAME = "particle-server";
|
||||||
|
const char* LOCAL_PARTICLES_PERSIST_FILE = "resources/particles.svo";
|
||||||
|
|
||||||
|
ParticleServer::ParticleServer(const unsigned char* dataBuffer, int numBytes) : OctreeServer(dataBuffer, numBytes) {
|
||||||
|
// nothing special to do here...
|
||||||
|
}
|
||||||
|
|
||||||
|
ParticleServer::~ParticleServer() {
|
||||||
|
// nothing special to do here...
|
||||||
|
}
|
||||||
|
|
||||||
|
OctreeQueryNode* ParticleServer::createOctreeQueryNode(Node* newNode) {
|
||||||
|
return new ParticleNodeData(newNode);
|
||||||
|
}
|
||||||
|
|
||||||
|
Octree* ParticleServer::createTree() {
|
||||||
|
return new ParticleTree(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ParticleServer::beforeRun() {
|
||||||
|
// nothing special to do...
|
||||||
|
}
|
|
@ -10,82 +10,29 @@
|
||||||
#ifndef __particle_server__ParticleServer__
|
#ifndef __particle_server__ParticleServer__
|
||||||
#define __particle_server__ParticleServer__
|
#define __particle_server__ParticleServer__
|
||||||
|
|
||||||
#include <QStringList>
|
#include <OctreeServer.h>
|
||||||
#include <QDateTime>
|
|
||||||
#include <QtCore/QCoreApplication>
|
|
||||||
|
|
||||||
#include <Assignment.h>
|
|
||||||
|
|
||||||
#include "civetweb.h"
|
|
||||||
|
|
||||||
#include "ParticlePersistThread.h"
|
|
||||||
#include "ParticleSendThread.h"
|
|
||||||
#include "ParticleServerConsts.h"
|
#include "ParticleServerConsts.h"
|
||||||
#include "ParticleServerPacketProcessor.h"
|
|
||||||
|
|
||||||
/// Handles assignments of type ParticleServer - sending particles to various clients.
|
/// Handles assignments of type ParticleServer - sending particles to various clients.
|
||||||
class ParticleServer : public ThreadedAssignment {
|
class ParticleServer : public OctreeServer {
|
||||||
public:
|
public:
|
||||||
ParticleServer(const unsigned char* dataBuffer, int numBytes);
|
ParticleServer(const unsigned char* dataBuffer, int numBytes);
|
||||||
|
|
||||||
~ParticleServer();
|
~ParticleServer();
|
||||||
|
|
||||||
/// runs the particle server assignment
|
// Subclasses must implement these methods
|
||||||
void run();
|
virtual OctreeQueryNode* createOctreeQueryNode(Node* newNode);
|
||||||
|
virtual Octree* createTree();
|
||||||
|
virtual unsigned char getMyNodeType() const { return NODE_TYPE_PARTICLE_SERVER; }
|
||||||
|
virtual PACKET_TYPE getMyQueryMessageType() const { return PACKET_TYPE_PARTICLE_QUERY; }
|
||||||
|
virtual const char* getMyServerName() const { return PARTICLE_SERVER_NAME; }
|
||||||
|
virtual const char* getMyLoggingServerTargetName() const { return PARTICLE_SERVER_LOGGING_TARGET_NAME; }
|
||||||
|
virtual const char* getMyDefaultPersistFilename() const { return LOCAL_PARTICLES_PERSIST_FILE; }
|
||||||
|
|
||||||
/// allows setting of run arguments
|
// subclass may implement these method
|
||||||
void setArguments(int argc, char** argv);
|
virtual void beforeRun();
|
||||||
|
|
||||||
bool wantsDebugParticleSending() const { return _debugParticleSending; }
|
|
||||||
bool wantsDebugParticleReceiving() const { return _debugParticleReceiving; }
|
|
||||||
bool wantsVerboseDebug() const { return _verboseDebug; }
|
|
||||||
bool wantShowAnimationDebug() const { return _shouldShowAnimationDebug; }
|
|
||||||
bool wantDumpParticlesOnMove() const { return _dumpParticlesOnMove; }
|
|
||||||
bool wantDisplayParticleStats() const { return _displayParticleStats; }
|
|
||||||
|
|
||||||
ParticleTree& getServerTree() { return _serverTree; }
|
|
||||||
JurisdictionMap* getJurisdiction() { return _jurisdiction; }
|
|
||||||
|
|
||||||
int getPacketsPerClientPerInterval() const { return _packetsPerClientPerInterval; }
|
|
||||||
|
|
||||||
static ParticleServer* GetInstance() { return _theInstance; }
|
|
||||||
|
|
||||||
bool isInitialLoadComplete() const { return (_particlePersistThread) ? _particlePersistThread->isInitialLoadComplete() : true; }
|
|
||||||
time_t* getLoadCompleted() { return (_particlePersistThread) ? _particlePersistThread->getLoadCompleted() : NULL; }
|
|
||||||
uint64_t getLoadElapsedTime() const { return (_particlePersistThread) ? _particlePersistThread->getLoadElapsedTime() : 0; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _argc;
|
|
||||||
const char** _argv;
|
|
||||||
char** _parsedArgV;
|
|
||||||
|
|
||||||
char _particlePersistFilename[MAX_FILENAME_LENGTH];
|
|
||||||
int _packetsPerClientPerInterval;
|
|
||||||
ParticleTree _serverTree; // this IS a reaveraging tree
|
|
||||||
bool _wantParticlePersist;
|
|
||||||
bool _wantLocalDomain;
|
|
||||||
bool _debugParticleSending;
|
|
||||||
bool _shouldShowAnimationDebug;
|
|
||||||
bool _displayParticleStats;
|
|
||||||
bool _debugParticleReceiving;
|
|
||||||
bool _dumpParticlesOnMove;
|
|
||||||
bool _verboseDebug;
|
|
||||||
JurisdictionMap* _jurisdiction;
|
|
||||||
JurisdictionSender* _jurisdictionSender;
|
|
||||||
ParticleServerPacketProcessor* _particleServerPacketProcessor;
|
|
||||||
ParticlePersistThread* _particlePersistThread;
|
|
||||||
|
|
||||||
NodeWatcher _nodeWatcher; // used to cleanup AGENT data when agents are killed
|
|
||||||
|
|
||||||
void parsePayload();
|
|
||||||
|
|
||||||
void initMongoose(int port);
|
|
||||||
|
|
||||||
static int civetwebRequestHandler(struct mg_connection *connection);
|
|
||||||
static ParticleServer* _theInstance;
|
|
||||||
|
|
||||||
time_t _started;
|
|
||||||
uint64_t _startedUSecs;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __particle_server__ParticleServer__
|
#endif // __particle_server__ParticleServer__
|
||||||
|
|
16
libraries/particle-server/src/ParticleServerConsts.h
Normal file
16
libraries/particle-server/src/ParticleServerConsts.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
// ParticleServerConsts.h
|
||||||
|
// particle-server
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on 8/21/13
|
||||||
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef __particle_server__ParticleServerConsts__
|
||||||
|
#define __particle_server__ParticleServerConsts__
|
||||||
|
|
||||||
|
extern const char* PARTICLE_SERVER_NAME;
|
||||||
|
extern const char* PARTICLE_SERVER_LOGGING_TARGET_NAME;
|
||||||
|
extern const char* LOCAL_PARTICLES_PERSIST_FILE;
|
||||||
|
|
||||||
|
#endif // __particle_server__ParticleServerConsts__
|
|
@ -26,14 +26,14 @@ public:
|
||||||
virtual ~ParticleTreeElement();
|
virtual ~ParticleTreeElement();
|
||||||
virtual void init(unsigned char * octalCode);
|
virtual void init(unsigned char * octalCode);
|
||||||
|
|
||||||
virtual bool hasContent() const;
|
virtual bool hasContent() const { return isLeaf(); }
|
||||||
virtual void splitChildren() {}
|
virtual void splitChildren() {}
|
||||||
virtual bool requiresSplit() const { return false; }
|
virtual bool requiresSplit() const { return false; }
|
||||||
virtual bool appendElementData(OctreePacketData* packetData) const;
|
virtual bool appendElementData(OctreePacketData* packetData) const;
|
||||||
virtual int readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args);
|
virtual int readElementDataFromBuffer(const unsigned char* data, int bytesLeftToRead, ReadBitstreamToTreeParams& args);
|
||||||
virtual void calculateAverageFromChildren();
|
virtual void calculateAverageFromChildren();
|
||||||
virtual bool collapseChildren();
|
virtual bool collapseChildren();
|
||||||
virtual bool isRendered() const;
|
virtual bool isRendered() const { return getShouldRender(); }
|
||||||
|
|
||||||
// type safe versions of OctreeElement methods
|
// type safe versions of OctreeElement methods
|
||||||
ParticleTreeElement* getChildAtIndex(int index) { return (ParticleTreeElement*)OctreeElement::getChildAtIndex(index); }
|
ParticleTreeElement* getChildAtIndex(int index) { return (ParticleTreeElement*)OctreeElement::getChildAtIndex(index); }
|
||||||
|
|
|
@ -27,6 +27,8 @@ Assignment::Type Assignment::typeForNodeType(NODE_TYPE nodeType) {
|
||||||
return Assignment::AgentType;
|
return Assignment::AgentType;
|
||||||
case NODE_TYPE_VOXEL_SERVER:
|
case NODE_TYPE_VOXEL_SERVER:
|
||||||
return Assignment::VoxelServerType;
|
return Assignment::VoxelServerType;
|
||||||
|
case NODE_TYPE_PARTICLE_SERVER:
|
||||||
|
return Assignment::ParticleServerType;
|
||||||
default:
|
default:
|
||||||
return Assignment::AllTypes;
|
return Assignment::AllTypes;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +178,8 @@ const char* Assignment::getTypeName() const {
|
||||||
return "agent";
|
return "agent";
|
||||||
case Assignment::VoxelServerType:
|
case Assignment::VoxelServerType:
|
||||||
return "voxel-server";
|
return "voxel-server";
|
||||||
|
case Assignment::ParticleServerType:
|
||||||
|
return "particle-server";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public:
|
||||||
AvatarMixerType,
|
AvatarMixerType,
|
||||||
AgentType,
|
AgentType,
|
||||||
VoxelServerType,
|
VoxelServerType,
|
||||||
|
ParticleServerType,
|
||||||
AllTypes
|
AllTypes
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
typedef char NODE_TYPE;
|
typedef char NODE_TYPE;
|
||||||
const NODE_TYPE NODE_TYPE_DOMAIN = 'D';
|
const NODE_TYPE NODE_TYPE_DOMAIN = 'D';
|
||||||
const NODE_TYPE NODE_TYPE_VOXEL_SERVER = 'V';
|
const NODE_TYPE NODE_TYPE_VOXEL_SERVER = 'V';
|
||||||
|
const NODE_TYPE NODE_TYPE_PARTICLE_SERVER = 'P';
|
||||||
|
const NODE_TYPE NODE_TYPE_ENVIRONMENT_SERVER = 'E';
|
||||||
const NODE_TYPE NODE_TYPE_AGENT = 'I';
|
const NODE_TYPE NODE_TYPE_AGENT = 'I';
|
||||||
const NODE_TYPE NODE_TYPE_AUDIO_MIXER = 'M';
|
const NODE_TYPE NODE_TYPE_AUDIO_MIXER = 'M';
|
||||||
const NODE_TYPE NODE_TYPE_AVATAR_MIXER = 'W';
|
const NODE_TYPE NODE_TYPE_AVATAR_MIXER = 'W';
|
||||||
|
|
|
@ -28,7 +28,7 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_VOXEL_STATS:
|
case PACKET_TYPE_OCTREE_STATS:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_DOMAIN:
|
case PACKET_TYPE_DOMAIN:
|
||||||
|
@ -39,9 +39,9 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
case PACKET_TYPE_VOXEL_QUERY:
|
case PACKET_TYPE_VOXEL_QUERY:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_SET_VOXEL:
|
case PACKET_TYPE_VOXEL_SET:
|
||||||
case PACKET_TYPE_SET_VOXEL_DESTRUCTIVE:
|
case PACKET_TYPE_VOXEL_SET_DESTRUCTIVE:
|
||||||
case PACKET_TYPE_ERASE_VOXEL:
|
case PACKET_TYPE_VOXEL_ERASE:
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case PACKET_TYPE_VOXEL_DATA:
|
case PACKET_TYPE_VOXEL_DATA:
|
||||||
|
|
|
@ -40,12 +40,16 @@ const PACKET_TYPE PACKET_TYPE_DATA_SERVER_SEND = 'u';
|
||||||
const PACKET_TYPE PACKET_TYPE_DATA_SERVER_CONFIRM = 'c';
|
const PACKET_TYPE PACKET_TYPE_DATA_SERVER_CONFIRM = 'c';
|
||||||
const PACKET_TYPE PACKET_TYPE_VOXEL_QUERY = 'q';
|
const PACKET_TYPE PACKET_TYPE_VOXEL_QUERY = 'q';
|
||||||
const PACKET_TYPE PACKET_TYPE_VOXEL_DATA = 'V';
|
const PACKET_TYPE PACKET_TYPE_VOXEL_DATA = 'V';
|
||||||
const PACKET_TYPE PACKET_TYPE_VOXEL_STATS = '#';
|
const PACKET_TYPE PACKET_TYPE_VOXEL_SET = 'S';
|
||||||
const PACKET_TYPE PACKET_TYPE_VOXEL_JURISDICTION = 'J';
|
const PACKET_TYPE PACKET_TYPE_VOXEL_SET_DESTRUCTIVE = 'O';
|
||||||
const PACKET_TYPE PACKET_TYPE_VOXEL_JURISDICTION_REQUEST = 'j';
|
const PACKET_TYPE PACKET_TYPE_VOXEL_ERASE = 'E';
|
||||||
const PACKET_TYPE PACKET_TYPE_SET_VOXEL = 'S';
|
const PACKET_TYPE PACKET_TYPE_OCTREE_STATS = '#';
|
||||||
const PACKET_TYPE PACKET_TYPE_SET_VOXEL_DESTRUCTIVE = 'O';
|
const PACKET_TYPE PACKET_TYPE_JURISDICTION = 'J';
|
||||||
const PACKET_TYPE PACKET_TYPE_ERASE_VOXEL = 'E';
|
const PACKET_TYPE PACKET_TYPE_JURISDICTION_REQUEST = 'j';
|
||||||
|
const PACKET_TYPE PACKET_TYPE_PARTICLE_QUERY = 'Q';
|
||||||
|
const PACKET_TYPE PACKET_TYPE_PARTICLE_DATA = 'v';
|
||||||
|
const PACKET_TYPE PACKET_TYPE_PARTICLE_ADD = 'a';
|
||||||
|
const PACKET_TYPE PACKET_TYPE_PARTICLE_ERASE = 'x';
|
||||||
|
|
||||||
typedef char PACKET_VERSION;
|
typedef char PACKET_VERSION;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ set(MACRO_DIR ${ROOT_DIR}/cmake/macros)
|
||||||
# setup for find modules
|
# setup for find modules
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/")
|
||||||
|
|
||||||
set(TARGET_NAME voxel-server-library)
|
set(TARGET_NAME voxel-server)
|
||||||
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
|
|
|
@ -43,11 +43,11 @@ public:
|
||||||
virtual const char* getMyLoggingServerTargetName() const { return VOXEL_SERVER_LOGGING_TARGET_NAME; }
|
virtual const char* getMyLoggingServerTargetName() const { return VOXEL_SERVER_LOGGING_TARGET_NAME; }
|
||||||
virtual const char* getMyDefaultPersistFilename() const { return LOCAL_VOXELS_PERSIST_FILE; }
|
virtual const char* getMyDefaultPersistFilename() const { return LOCAL_VOXELS_PERSIST_FILE; }
|
||||||
|
|
||||||
|
// subclass may implement these method
|
||||||
|
virtual void beforeRun();
|
||||||
virtual bool hasSpecialPacketToSend();
|
virtual bool hasSpecialPacketToSend();
|
||||||
virtual int sendSpecialPacket(Node* node);
|
virtual int sendSpecialPacket(Node* node);
|
||||||
|
|
||||||
// subclass may implement these method
|
|
||||||
virtual void beforeRun();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _sendEnvironments;
|
bool _sendEnvironments;
|
|
@ -137,14 +137,14 @@ void VoxelEditPacketSender::queuePacketToNode(const QUuid& nodeUUID, unsigned ch
|
||||||
|
|
||||||
const char* messageName;
|
const char* messageName;
|
||||||
switch (buffer[0]) {
|
switch (buffer[0]) {
|
||||||
case PACKET_TYPE_SET_VOXEL:
|
case PACKET_TYPE_VOXEL_SET:
|
||||||
messageName = "PACKET_TYPE_SET_VOXEL";
|
messageName = "PACKET_TYPE_VOXEL_SET";
|
||||||
break;
|
break;
|
||||||
case PACKET_TYPE_SET_VOXEL_DESTRUCTIVE:
|
case PACKET_TYPE_VOXEL_SET_DESTRUCTIVE:
|
||||||
messageName = "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE";
|
messageName = "PACKET_TYPE_VOXEL_SET_DESTRUCTIVE";
|
||||||
break;
|
break;
|
||||||
case PACKET_TYPE_ERASE_VOXEL:
|
case PACKET_TYPE_VOXEL_ERASE:
|
||||||
messageName = "PACKET_TYPE_ERASE_VOXEL";
|
messageName = "PACKET_TYPE_VOXEL_ERASE";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("VoxelEditPacketSender::queuePacketToNode() queued %s - command to node bytes=%ld sequence=%d transitTimeSoFar=%llu usecs\n",
|
printf("VoxelEditPacketSender::queuePacketToNode() queued %s - command to node bytes=%ld sequence=%d transitTimeSoFar=%llu usecs\n",
|
||||||
|
|
|
@ -355,7 +355,7 @@ void VoxelTree::nudgeLeaf(VoxelTreeElement* element, void* extraData) {
|
||||||
glm::vec3 nudge = args->nudgeVec;
|
glm::vec3 nudge = args->nudgeVec;
|
||||||
|
|
||||||
// delete the old element
|
// delete the old element
|
||||||
args->voxelEditSenderPtr->sendVoxelEditMessage(PACKET_TYPE_ERASE_VOXEL, voxelDetails);
|
args->voxelEditSenderPtr->sendVoxelEditMessage(PACKET_TYPE_VOXEL_ERASE, voxelDetails);
|
||||||
|
|
||||||
// nudge the old element
|
// nudge the old element
|
||||||
voxelDetails.x += nudge.x;
|
voxelDetails.x += nudge.x;
|
||||||
|
@ -363,7 +363,7 @@ void VoxelTree::nudgeLeaf(VoxelTreeElement* element, void* extraData) {
|
||||||
voxelDetails.z += nudge.z;
|
voxelDetails.z += nudge.z;
|
||||||
|
|
||||||
// create a new voxel in its stead
|
// create a new voxel in its stead
|
||||||
args->voxelEditSenderPtr->sendVoxelEditMessage(PACKET_TYPE_SET_VOXEL_DESTRUCTIVE, voxelDetails);
|
args->voxelEditSenderPtr->sendVoxelEditMessage(PACKET_TYPE_VOXEL_SET_DESTRUCTIVE, voxelDetails);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recurses voxel element with an operation function
|
// Recurses voxel element with an operation function
|
||||||
|
@ -642,9 +642,9 @@ void VoxelTree::readCodeColorBufferToTreeRecursion(VoxelTreeElement* node, ReadC
|
||||||
bool VoxelTree::handlesEditPacketType(PACKET_TYPE packetType) const {
|
bool VoxelTree::handlesEditPacketType(PACKET_TYPE packetType) const {
|
||||||
// we handle these types of "edit" packets
|
// we handle these types of "edit" packets
|
||||||
switch (packetType) {
|
switch (packetType) {
|
||||||
case PACKET_TYPE_SET_VOXEL:
|
case PACKET_TYPE_VOXEL_SET:
|
||||||
case PACKET_TYPE_SET_VOXEL_DESTRUCTIVE:
|
case PACKET_TYPE_VOXEL_SET_DESTRUCTIVE:
|
||||||
case PACKET_TYPE_ERASE_VOXEL:
|
case PACKET_TYPE_VOXEL_ERASE:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -656,9 +656,9 @@ int VoxelTree::processEditPacketData(PACKET_TYPE packetType, unsigned char* pack
|
||||||
int processedBytes = 0;
|
int processedBytes = 0;
|
||||||
// we handle these types of "edit" packets
|
// we handle these types of "edit" packets
|
||||||
switch (packetType) {
|
switch (packetType) {
|
||||||
case PACKET_TYPE_SET_VOXEL:
|
case PACKET_TYPE_VOXEL_SET:
|
||||||
case PACKET_TYPE_SET_VOXEL_DESTRUCTIVE: {
|
case PACKET_TYPE_VOXEL_SET_DESTRUCTIVE: {
|
||||||
bool destructive = (packetType == PACKET_TYPE_SET_VOXEL_DESTRUCTIVE);
|
bool destructive = (packetType == PACKET_TYPE_VOXEL_SET_DESTRUCTIVE);
|
||||||
int octets = numberOfThreeBitSectionsInCode(editData, maxLength);
|
int octets = numberOfThreeBitSectionsInCode(editData, maxLength);
|
||||||
|
|
||||||
if (octets == OVERFLOWED_OCTCODE_BUFFER) {
|
if (octets == OVERFLOWED_OCTCODE_BUFFER) {
|
||||||
|
@ -682,7 +682,7 @@ int VoxelTree::processEditPacketData(PACKET_TYPE packetType, unsigned char* pack
|
||||||
return voxelDataSize;
|
return voxelDataSize;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case PACKET_TYPE_ERASE_VOXEL:
|
case PACKET_TYPE_VOXEL_ERASE:
|
||||||
processRemoveOctreeElementsBitstream((unsigned char*)packetData, packetLength);
|
processRemoveOctreeElementsBitstream((unsigned char*)packetData, packetLength);
|
||||||
return maxLength;
|
return maxLength;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue