mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
cleanup Node types, closes #1726
This commit is contained in:
parent
fe410ae3e9
commit
4de270b832
44 changed files with 176 additions and 184 deletions
|
@ -694,7 +694,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) :
|
|||
{
|
||||
::start = usecTimestampNow();
|
||||
|
||||
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_ANIMATION_SERVER, ANIMATION_LISTEN_PORT);
|
||||
NodeList* nodeList = NodeList::createInstance(NodeType::AnimationServer, ANIMATION_LISTEN_PORT);
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
// Handle Local Domain testing with the --local command line
|
||||
|
@ -806,7 +806,7 @@ AnimationServer::AnimationServer(int &argc, char **argv) :
|
|||
|
||||
pthread_create(&::animateVoxelThread, NULL, animateVoxels, NULL);
|
||||
|
||||
NodeList::getInstance()->addNodeTypeToInterestSet(NODE_TYPE_VOXEL_SERVER);
|
||||
NodeList::getInstance()->addNodeTypeToInterestSet(NodeType::VoxelServer);
|
||||
|
||||
QTimer* domainServerTimer = new QTimer(this);
|
||||
connect(domainServerTimer, SIGNAL(timeout()), nodeList, SLOT(sendDomainServerCheckIn()));
|
||||
|
@ -834,7 +834,7 @@ void AnimationServer::readPendingDatagrams() {
|
|||
if (packetTypeForPacket(receivedPacket) == PacketTypeJurisdiction) {
|
||||
int headerBytes = numBytesForPacketHeader(receivedPacket);
|
||||
// PacketType_JURISDICTION, first byte is the node type...
|
||||
if (receivedPacket.data()[headerBytes] == NODE_TYPE_VOXEL_SERVER && ::jurisdictionListener) {
|
||||
if (receivedPacket.data()[headerBytes] == NodeType::VoxelServer && ::jurisdictionListener) {
|
||||
::jurisdictionListener->queueReceivedPacket(nodeSockAddr, receivedPacket);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,11 @@ void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr&
|
|||
int headerBytes = numBytesForPacketHeader(dataByteArray);
|
||||
// PacketType_JURISDICTION, first byte is the node type...
|
||||
switch (dataByteArray[headerBytes]) {
|
||||
case NODE_TYPE_VOXEL_SERVER:
|
||||
case NodeType::VoxelServer:
|
||||
_scriptEngine.getVoxelsScriptingInterface()->getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
||||
dataByteArray);
|
||||
break;
|
||||
case NODE_TYPE_PARTICLE_SERVER:
|
||||
case NodeType::ParticleServer:
|
||||
_scriptEngine.getParticlesScriptingInterface()->getJurisdictionListener()->queueReceivedPacket(senderSockAddr,
|
||||
dataByteArray);
|
||||
break;
|
||||
|
@ -48,9 +48,9 @@ void Agent::processDatagram(const QByteArray& dataByteArray, const HifiSockAddr&
|
|||
|
||||
void Agent::run() {
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
nodeList->setOwnerType(NODE_TYPE_AGENT);
|
||||
nodeList->setOwnerType(NodeType::Agent);
|
||||
|
||||
nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER);
|
||||
nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer << NodeType::AvatarMixer);
|
||||
|
||||
// figure out the URL for the script for this agent assignment
|
||||
QString scriptURLString("http://%1:8080/assignment/%2");
|
||||
|
|
|
@ -52,7 +52,7 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
|||
_requestAssignment = Assignment(Assignment::RequestCommand, requestAssignmentType, requestAssignmentPool);
|
||||
|
||||
// create a NodeList as an unassigned client
|
||||
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_UNASSIGNED);
|
||||
NodeList* nodeList = NodeList::createInstance(NodeType::Unassigned);
|
||||
|
||||
const char CUSTOM_ASSIGNMENT_SERVER_HOSTNAME_OPTION[] = "-a";
|
||||
const char CUSTOM_ASSIGNMENT_SERVER_PORT_OPTION[] = "-p";
|
||||
|
@ -174,6 +174,6 @@ void AssignmentClient::assignmentCompleted() {
|
|||
NodeList* nodeList = NodeList::getInstance();
|
||||
|
||||
// reset our NodeList by switching back to unassigned and clearing the list
|
||||
nodeList->setOwnerType(NODE_TYPE_UNASSIGNED);
|
||||
nodeList->setOwnerType(NodeType::Unassigned);
|
||||
nodeList->reset();
|
||||
}
|
||||
|
|
|
@ -237,11 +237,11 @@ void AudioMixer::processDatagram(const QByteArray& dataByteArray, const HifiSock
|
|||
|
||||
void AudioMixer::run() {
|
||||
|
||||
commonInit(AUDIO_MIXER_LOGGING_TARGET_NAME, NODE_TYPE_AUDIO_MIXER);
|
||||
commonInit(AUDIO_MIXER_LOGGING_TARGET_NAME, NodeType::AudioMixer);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
|
||||
nodeList->addNodeTypeToInterestSet(NODE_TYPE_AGENT);
|
||||
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
||||
|
||||
nodeList->linkedDataCreateCallback = attachNewBufferToNode;
|
||||
|
||||
|
@ -274,7 +274,7 @@ void AudioMixer::run() {
|
|||
}
|
||||
|
||||
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
||||
if (node->getType() == NODE_TYPE_AGENT && node->getActiveSocket() && node->getLinkedData()
|
||||
if (node->getType() == NodeType::Agent && node->getActiveSocket() && node->getLinkedData()
|
||||
&& ((AudioMixerClientData*) node->getLinkedData())->getAvatarAudioRingBuffer()) {
|
||||
prepareMixForListeningNode(node.data());
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ void broadcastAvatarData() {
|
|||
NodeList* nodeList = NodeList::getInstance();
|
||||
|
||||
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
||||
if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT && node->getActiveSocket()) {
|
||||
if (node->getLinkedData() && node->getType() == NodeType::Agent && node->getActiveSocket()) {
|
||||
|
||||
// reset packet pointers for this node
|
||||
mixedAvatarByteArray.resize(numPacketHeaderBytes);
|
||||
|
@ -100,7 +100,7 @@ void broadcastAvatarData() {
|
|||
}
|
||||
|
||||
void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
|
||||
if (killedNode->getType() == NODE_TYPE_AGENT
|
||||
if (killedNode->getType() == NodeType::Agent
|
||||
&& killedNode->getLinkedData()) {
|
||||
// this was an avatar we were sending to other people
|
||||
// send a kill packet for it to our other nodes
|
||||
|
@ -108,7 +108,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
|
|||
killPacket += killedNode->getUUID().toRfc4122();
|
||||
|
||||
NodeList::getInstance()->broadcastToNodes(killPacket,
|
||||
QSet<NODE_TYPE>() << NODE_TYPE_AGENT);
|
||||
NodeSet() << NodeType::Agent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,10 +144,10 @@ void AvatarMixer::processDatagram(const QByteArray& dataByteArray, const HifiSoc
|
|||
}
|
||||
|
||||
void AvatarMixer::run() {
|
||||
commonInit(AVATAR_MIXER_LOGGING_NAME, NODE_TYPE_AVATAR_MIXER);
|
||||
commonInit(AVATAR_MIXER_LOGGING_NAME, NodeType::AvatarMixer);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
nodeList->addNodeTypeToInterestSet(NODE_TYPE_AGENT);
|
||||
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
||||
|
||||
nodeList->linkedDataCreateCallback = attachAvatarDataToNode;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void MetavoxelServer::removeSession(const QUuid& sessionId) {
|
|||
const char METAVOXEL_SERVER_LOGGING_NAME[] = "metavoxel-server";
|
||||
|
||||
void MetavoxelServer::run() {
|
||||
commonInit(METAVOXEL_SERVER_LOGGING_NAME, NODE_TYPE_METAVOXEL_SERVER);
|
||||
commonInit(METAVOXEL_SERVER_LOGGING_NAME, NodeType::MetavoxelServer);
|
||||
|
||||
_lastSend = QDateTime::currentMSecsSinceEpoch();
|
||||
_sendTimer.start(SEND_INTERVAL);
|
||||
|
|
|
@ -66,7 +66,7 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
|||
_metavoxelServerConfig = getCmdOption(argc, (const char**) argv, metavoxelConfigOption.constData());
|
||||
}
|
||||
|
||||
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_DOMAIN, domainServerPort);
|
||||
NodeList* nodeList = NodeList::createInstance(NodeType::DomainServer, domainServerPort);
|
||||
|
||||
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), this, SLOT(nodeKilled(SharedNodePointer)));
|
||||
|
||||
|
@ -110,7 +110,7 @@ void DomainServer::readAvailableDatagrams() {
|
|||
static int numAssignmentPacketHeaderBytes = assignmentPacket.size();
|
||||
|
||||
QByteArray receivedPacket;
|
||||
NODE_TYPE nodeType;
|
||||
NodeType_t nodeType;
|
||||
QUuid nodeUUID;
|
||||
|
||||
while (nodeList->getNodeSocket().hasPendingDatagrams()) {
|
||||
|
@ -144,9 +144,9 @@ void DomainServer::readAvailableDatagrams() {
|
|||
}
|
||||
}
|
||||
|
||||
const QSet<NODE_TYPE> STATICALLY_ASSIGNED_NODES = QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER
|
||||
<< NODE_TYPE_AVATAR_MIXER << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER
|
||||
<< NODE_TYPE_METAVOXEL_SERVER;
|
||||
const QSet<NodeType_t> STATICALLY_ASSIGNED_NODES = QSet<NodeType_t>() << NodeType::AudioMixer
|
||||
<< NodeType::AvatarMixer << NodeType::VoxelServer << NodeType::ParticleServer
|
||||
<< NodeType::MetavoxelServer;
|
||||
|
||||
Assignment* matchingStaticAssignment = NULL;
|
||||
|
||||
|
@ -183,7 +183,7 @@ void DomainServer::readAvailableDatagrams() {
|
|||
quint8 numInterestTypes = 0;
|
||||
packetStream >> numInterestTypes;
|
||||
|
||||
NODE_TYPE* nodeTypesOfInterest = reinterpret_cast<NODE_TYPE*>(receivedPacket.data()
|
||||
NodeType_t* nodeTypesOfInterest = reinterpret_cast<NodeType_t*>(receivedPacket.data()
|
||||
+ packetStream.device()->pos());
|
||||
|
||||
if (numInterestTypes > 0) {
|
||||
|
@ -262,7 +262,7 @@ QJsonObject jsonObjectForNode(Node* node) {
|
|||
QJsonObject nodeJson;
|
||||
|
||||
// re-format the type name so it matches the target name
|
||||
QString nodeTypeName(node->getTypeName());
|
||||
QString nodeTypeName = NodeType::getNodeTypeName(node->getType());
|
||||
nodeTypeName = nodeTypeName.toLower();
|
||||
nodeTypeName.replace(' ', '-');
|
||||
|
||||
|
@ -642,7 +642,7 @@ void DomainServer::prepopulateStaticAssignmentFile() {
|
|||
_staticAssignmentFile.close();
|
||||
}
|
||||
|
||||
Assignment* DomainServer::matchingStaticAssignmentForCheckIn(const QUuid& checkInUUID, NODE_TYPE nodeType) {
|
||||
Assignment* DomainServer::matchingStaticAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType) {
|
||||
// pull the UUID passed with the check in
|
||||
|
||||
if (_hasCompletedRestartHold) {
|
||||
|
|
|
@ -39,7 +39,7 @@ private:
|
|||
QString readServerAssignmentConfig(QJsonObject jsonObj, const char* nodeName);
|
||||
|
||||
void prepopulateStaticAssignmentFile();
|
||||
Assignment* matchingStaticAssignmentForCheckIn(const QUuid& checkInUUID, NODE_TYPE nodeType);
|
||||
Assignment* matchingStaticAssignmentForCheckIn(const QUuid& checkInUUID, NodeType_t nodeType);
|
||||
Assignment* deployableAssignmentForRequest(Assignment& requestAssignment);
|
||||
void removeAssignmentFromQueue(Assignment* removableAssignment);
|
||||
bool checkInWithUUIDMatchesExistingNode(const HifiSockAddr& nodePublicSocket,
|
||||
|
|
|
@ -182,7 +182,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
_nodeThread->setPriority(QThread::TimeCriticalPriority);
|
||||
|
||||
// put the NodeList and datagram processing on the node thread
|
||||
NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort);
|
||||
NodeList* nodeList = NodeList::createInstance(NodeType::Agent, listenPort);
|
||||
|
||||
nodeList->moveToThread(_nodeThread);
|
||||
_datagramProcessor.moveToThread(_nodeThread);
|
||||
|
@ -229,9 +229,9 @@ Application::Application(int& argc, char** argv, timeval &startup_time) :
|
|||
#endif
|
||||
|
||||
// tell the NodeList instance who to tell the domain server we care about
|
||||
nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
|
||||
<< NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER
|
||||
<< NODE_TYPE_METAVOXEL_SERVER);
|
||||
nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NodeType_t>() << NodeType::AudioMixer << NodeType::AvatarMixer
|
||||
<< NodeType::VoxelServer << NodeType::ParticleServer
|
||||
<< NodeType::MetavoxelServer);
|
||||
|
||||
// connect to the packet sent signal of the _voxelEditSender and the _particleEditSender
|
||||
connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent);
|
||||
|
@ -649,24 +649,24 @@ void Application::resetProfile(const QString& username) {
|
|||
}
|
||||
|
||||
void Application::controlledBroadcastToNodes(const QByteArray& packet,
|
||||
const QSet<NODE_TYPE>& destinationNodeTypes) {
|
||||
foreach(NODE_TYPE type, destinationNodeTypes) {
|
||||
const QSet<NodeType_t>& destinationNodeTypes) {
|
||||
foreach(NodeType_t type, destinationNodeTypes) {
|
||||
// Intercept data to voxel server when voxels are disabled
|
||||
if (type == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
||||
if (type == NodeType::VoxelServer && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Perform the broadcast for one type
|
||||
int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NODE_TYPE>() << type);
|
||||
int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, QSet<NodeType_t>() << type);
|
||||
|
||||
// Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
|
||||
BandwidthMeter::ChannelIndex channel;
|
||||
switch (type) {
|
||||
case NODE_TYPE_AGENT:
|
||||
case NODE_TYPE_AVATAR_MIXER:
|
||||
case NodeType::Agent:
|
||||
case NodeType::AvatarMixer:
|
||||
channel = BandwidthMeter::AVATARS;
|
||||
break;
|
||||
case NODE_TYPE_VOXEL_SERVER:
|
||||
case NodeType::VoxelServer:
|
||||
channel = BandwidthMeter::VOXELS;
|
||||
break;
|
||||
default:
|
||||
|
@ -1332,10 +1332,10 @@ void Application::wheelEvent(QWheelEvent* event) {
|
|||
|
||||
void Application::sendPingPackets() {
|
||||
QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
|
||||
getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NODE_TYPE>() << NODE_TYPE_VOXEL_SERVER
|
||||
<< NODE_TYPE_PARTICLE_SERVER
|
||||
<< NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
|
||||
<< NODE_TYPE_METAVOXEL_SERVER);
|
||||
getInstance()->controlledBroadcastToNodes(pingPacket, QSet<NodeType_t>() << NodeType::VoxelServer
|
||||
<< NodeType::ParticleServer
|
||||
<< NodeType::AudioMixer << NodeType::AvatarMixer
|
||||
<< NodeType::MetavoxelServer);
|
||||
}
|
||||
|
||||
// Every second, check the frame rates and other stuff
|
||||
|
@ -2363,7 +2363,7 @@ void Application::updateAvatar(float deltaTime) {
|
|||
QByteArray avatarData = byteArrayWithPopluatedHeader(PacketTypeAvatarData);
|
||||
avatarData.append(_myAvatar.toByteArray());
|
||||
|
||||
controlledBroadcastToNodes(avatarData, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
|
||||
controlledBroadcastToNodes(avatarData, QSet<NodeType_t>() << NodeType::AvatarMixer);
|
||||
|
||||
// Update _viewFrustum with latest camera and view frustum data...
|
||||
// NOTE: we get this from the view frustum, to make it simpler, since the
|
||||
|
@ -2374,11 +2374,11 @@ void Application::updateAvatar(float deltaTime) {
|
|||
loadViewFrustum(_myCamera, _viewFrustum);
|
||||
|
||||
// Update my voxel servers with my current voxel query...
|
||||
queryOctree(NODE_TYPE_VOXEL_SERVER, PacketTypeVoxelQuery, _voxelServerJurisdictions);
|
||||
queryOctree(NODE_TYPE_PARTICLE_SERVER, PacketTypeParticleQuery, _particleServerJurisdictions);
|
||||
queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions);
|
||||
queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions);
|
||||
}
|
||||
|
||||
void Application::queryOctree(NODE_TYPE serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
|
||||
void Application::queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions) {
|
||||
|
||||
// if voxels are disabled, then don't send this at all...
|
||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
|
||||
|
@ -3192,8 +3192,8 @@ void Application::displayStats() {
|
|||
int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
||||
SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
|
||||
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
|
||||
|
||||
pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;
|
||||
pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0;
|
||||
|
@ -3203,7 +3203,7 @@ void Application::displayStats() {
|
|||
int voxelServerCount = 0;
|
||||
|
||||
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::VoxelServer) {
|
||||
totalPingVoxel += node->getPingMs();
|
||||
voxelServerCount++;
|
||||
if (pingVoxelMax < node->getPingMs()) {
|
||||
|
@ -3274,7 +3274,7 @@ void Application::displayStats() {
|
|||
drawtext(horizontalOffset, verticalOffset, 0.10f, 0, 1.0, 2, avatarBodyYaw, .93f, .93f, .93f);
|
||||
|
||||
if (_statsExpanded) {
|
||||
SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
|
||||
SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);
|
||||
if (avatarMixer) {
|
||||
sprintf(avatarMixerStats, "Avatar Mixer: %.f kbps, %.f pps",
|
||||
roundf(avatarMixer->getAverageKilobitsPerSecond()),
|
||||
|
@ -3952,7 +3952,7 @@ void Application::domainChanged(const QString& domainHostname) {
|
|||
}
|
||||
|
||||
void Application::nodeKilled(SharedNodePointer node) {
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::VoxelServer) {
|
||||
QUuid nodeUUID = node->getUUID();
|
||||
// see if this is the first we've heard of this node...
|
||||
if (_voxelServerJurisdictions.find(nodeUUID) != _voxelServerJurisdictions.end()) {
|
||||
|
@ -3983,7 +3983,7 @@ void Application::nodeKilled(SharedNodePointer node) {
|
|||
}
|
||||
_voxelSceneStatsLock.unlock();
|
||||
|
||||
} else if (node->getType() == NODE_TYPE_PARTICLE_SERVER) {
|
||||
} else if (node->getType() == NodeType::ParticleServer) {
|
||||
QUuid nodeUUID = node->getUUID();
|
||||
// see if this is the first we've heard of this node...
|
||||
if (_particleServerJurisdictions.find(nodeUUID) != _particleServerJurisdictions.end()) {
|
||||
|
@ -4014,7 +4014,7 @@ void Application::nodeKilled(SharedNodePointer node) {
|
|||
}
|
||||
_voxelSceneStatsLock.unlock();
|
||||
|
||||
} else if (node->getType() == NODE_TYPE_AVATAR_MIXER) {
|
||||
} else if (node->getType() == NodeType::AvatarMixer) {
|
||||
// our avatar mixer has gone away - clear the hash of avatars
|
||||
_avatarManager.clearHash();
|
||||
}
|
||||
|
@ -4066,7 +4066,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const HifiSockAddr&
|
|||
|
||||
// see if this is the first we've heard of this node...
|
||||
NodeToJurisdictionMap* jurisdiction = NULL;
|
||||
if (server->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
if (server->getType() == NodeType::VoxelServer) {
|
||||
jurisdiction = &_voxelServerJurisdictions;
|
||||
} else {
|
||||
jurisdiction = &_particleServerJurisdictions;
|
||||
|
|
|
@ -175,7 +175,7 @@ public:
|
|||
Profile* getProfile() { return &_profile; }
|
||||
void resetProfile(const QString& username);
|
||||
|
||||
void controlledBroadcastToNodes(const QByteArray& packet, const QSet<NODE_TYPE>& destinationNodeTypes);
|
||||
void controlledBroadcastToNodes(const QByteArray& packet, const QSet<NodeType_t>& destinationNodeTypes);
|
||||
|
||||
void setupWorldLight();
|
||||
|
||||
|
@ -298,7 +298,7 @@ private:
|
|||
void renderHighlightVoxel(VoxelDetail voxel);
|
||||
|
||||
void updateAvatar(float deltaTime);
|
||||
void queryOctree(NODE_TYPE serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions);
|
||||
void queryOctree(NodeType_t serverType, PacketType packetType, NodeToJurisdictionMap& jurisdictions);
|
||||
void loadViewFrustum(Camera& camera, ViewFrustum& viewFrustum);
|
||||
|
||||
glm::vec3 getSunDirection();
|
||||
|
|
|
@ -365,7 +365,7 @@ void Audio::handleAudioInput() {
|
|||
NETWORK_BUFFER_LENGTH_SAMPLES_PER_CHANNEL);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
if (audioMixer && nodeList->getNodeActiveSocketOrPing(audioMixer.data())) {
|
||||
MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
||||
|
|
|
@ -107,14 +107,14 @@ void MetavoxelSystem::render() {
|
|||
}
|
||||
|
||||
void MetavoxelSystem::nodeAdded(SharedNodePointer node) {
|
||||
if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::MetavoxelServer) {
|
||||
QMetaObject::invokeMethod(this, "addClient", Q_ARG(const QUuid&, node->getUUID()),
|
||||
Q_ARG(const HifiSockAddr&, node->getLocalSocket()));
|
||||
}
|
||||
}
|
||||
|
||||
void MetavoxelSystem::nodeKilled(SharedNodePointer node) {
|
||||
if (node->getType() == NODE_TYPE_METAVOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::MetavoxelServer) {
|
||||
QMetaObject::invokeMethod(this, "removeClient", Q_ARG(const QUuid&, node->getUUID()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public:
|
|||
virtual ~ParticleTreeRenderer();
|
||||
|
||||
virtual Octree* createTree() { return new ParticleTree(true); }
|
||||
virtual NODE_TYPE getMyNodeType() const { return NODE_TYPE_PARTICLE_SERVER; }
|
||||
virtual NodeType_t getMyNodeType() const { return NodeType::ParticleServer; }
|
||||
virtual PacketType getMyQueryMessageType() const { return PacketTypeParticleQuery; }
|
||||
virtual PacketType getExpectedPacketType() const { return PacketTypeParticleData; }
|
||||
virtual void renderElement(OctreeElement* element, RenderArgs* args);
|
||||
|
|
|
@ -1591,7 +1591,7 @@ void VoxelSystem::falseColorizeBySource() {
|
|||
// create a bunch of colors we'll use during colorization
|
||||
|
||||
foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::VoxelServer) {
|
||||
uint16_t nodeID = VoxelTreeElement::getSourceNodeUUIDKey(node->getUUID());
|
||||
int groupColor = voxelServerCount % NUMBER_OF_COLOR_GROUPS;
|
||||
args.colors[nodeID] = groupColors[groupColor];
|
||||
|
@ -2663,7 +2663,7 @@ void VoxelSystem::falseColorizeOccludedV2() {
|
|||
}
|
||||
|
||||
void VoxelSystem::nodeAdded(SharedNodePointer node) {
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::VoxelServer) {
|
||||
qDebug("VoxelSystem... voxel server %s added...", node->getUUID().toString().toLocal8Bit().constData());
|
||||
_voxelServerCount++;
|
||||
}
|
||||
|
@ -2684,7 +2684,7 @@ bool VoxelSystem::killSourceVoxelsOperation(OctreeElement* element, void* extraD
|
|||
}
|
||||
|
||||
void VoxelSystem::nodeKilled(SharedNodePointer node) {
|
||||
if (node->getType() == NODE_TYPE_VOXEL_SERVER) {
|
||||
if (node->getType() == NodeType::VoxelServer) {
|
||||
_voxelServerCount--;
|
||||
QUuid nodeUUID = node->getUUID();
|
||||
qDebug("VoxelSystem... voxel server %s removed...", nodeUUID.toString().toLocal8Bit().constData());
|
||||
|
|
|
@ -473,7 +473,7 @@ void MyAvatar::loadData(QSettings* settings) {
|
|||
|
||||
void MyAvatar::sendKillAvatar() {
|
||||
QByteArray killPacket = byteArrayWithPopluatedHeader(PacketTypeKillAvatar);
|
||||
NodeList::getInstance()->broadcastToNodes(killPacket, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
|
||||
NodeList::getInstance()->broadcastToNodes(killPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
}
|
||||
|
||||
void MyAvatar::orbit(const glm::vec3& position, int deltaX, int deltaY) {
|
||||
|
|
|
@ -224,9 +224,9 @@ void VoxelStatsDialog::paintEvent(QPaintEvent* event) {
|
|||
void VoxelStatsDialog::showAllOctreeServers() {
|
||||
int serverCount = 0;
|
||||
|
||||
showOctreeServersOfType(serverCount, NODE_TYPE_VOXEL_SERVER, "Voxel",
|
||||
showOctreeServersOfType(serverCount, NodeType::VoxelServer, "Voxel",
|
||||
Application::getInstance()->getVoxelServerJurisdictions());
|
||||
showOctreeServersOfType(serverCount, NODE_TYPE_PARTICLE_SERVER, "Particle",
|
||||
showOctreeServersOfType(serverCount, NodeType::ParticleServer, "Particle",
|
||||
Application::getInstance()->getParticleServerJurisdictions());
|
||||
|
||||
if (_voxelServerLabelsCount > serverCount) {
|
||||
|
@ -239,7 +239,7 @@ void VoxelStatsDialog::showAllOctreeServers() {
|
|||
}
|
||||
}
|
||||
|
||||
void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NODE_TYPE serverType, const char* serverTypeName,
|
||||
void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t serverType, const char* serverTypeName,
|
||||
NodeToJurisdictionMap& serverJurisdictions) {
|
||||
|
||||
QLocale locale(QLocale::English);
|
||||
|
@ -247,7 +247,7 @@ void VoxelStatsDialog::showOctreeServersOfType(int& serverCount, NODE_TYPE serve
|
|||
NodeList* nodeList = NodeList::getInstance();
|
||||
|
||||
foreach (const SharedNodePointer& node, nodeList->getNodeHash()) {
|
||||
// only send to the NodeTypes that are NODE_TYPE_VOXEL_SERVER
|
||||
// only send to the NodeTypes that are NodeType_t_VOXEL_SERVER
|
||||
if (node->getType() == serverType) {
|
||||
serverCount++;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ protected:
|
|||
void RemoveStatItem(int item);
|
||||
void showAllOctreeServers();
|
||||
|
||||
void showOctreeServersOfType(int& serverNumber, NODE_TYPE serverType,
|
||||
void showOctreeServersOfType(int& serverNumber, NodeType_t serverType,
|
||||
const char* serverTypeName, NodeToJurisdictionMap& serverJurisdictions);
|
||||
|
||||
private:
|
||||
|
|
|
@ -89,7 +89,7 @@ void AudioInjector::injectAudio() {
|
|||
memcpy(injectAudioPacket.data() + numPreAudioDataBytes, soundByteArray.data() + currentSendPosition, bytesToCopy);
|
||||
|
||||
// grab our audio mixer from the NodeList, if it exists
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
if (audioMixer && nodeList->getNodeActiveSocketOrPing(audioMixer.data())) {
|
||||
// send off this audio packet
|
||||
|
|
|
@ -469,7 +469,7 @@ void OctreeServer::processDatagram(const QByteArray& dataByteArray, const HifiSo
|
|||
qDebug() << "Got PacketType_VOXEL_QUERY at" << usecTimestampNow();
|
||||
}
|
||||
|
||||
// If we got a PacketType_VOXEL_QUERY, then we're talking to an NODE_TYPE_AVATAR, and we
|
||||
// If we got a PacketType_VOXEL_QUERY, then we're talking to an NodeType_t_AVATAR, and we
|
||||
// need to make sure we have it in our nodeList.
|
||||
QUuid nodeUUID;
|
||||
deconstructPacketHeader(dataByteArray, nodeUUID);
|
||||
|
@ -552,7 +552,7 @@ void OctreeServer::run() {
|
|||
nodeList->setOwnerType(getMyNodeType());
|
||||
|
||||
// we need to ask the DS about agents so we can ping/reply with them
|
||||
nodeList->addNodeTypeToInterestSet(NODE_TYPE_AGENT);
|
||||
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
||||
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
|
|
|
@ -15,14 +15,14 @@
|
|||
#include <PacketHeaders.h>
|
||||
#include "JurisdictionListener.h"
|
||||
|
||||
JurisdictionListener::JurisdictionListener(NODE_TYPE type) :
|
||||
JurisdictionListener::JurisdictionListener(NodeType_t type) :
|
||||
_packetSender(JurisdictionListener::DEFAULT_PACKETS_PER_SECOND)
|
||||
{
|
||||
_nodeType = type;
|
||||
ReceivedPacketProcessor::_dontSleep = true; // we handle sleeping so this class doesn't need to
|
||||
|
||||
connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &JurisdictionListener::nodeKilled);
|
||||
//qDebug("JurisdictionListener::JurisdictionListener(NODE_TYPE type=%c)", type);
|
||||
//qDebug("JurisdictionListener::JurisdictionListener(NodeType_t type=%c)", type);
|
||||
|
||||
// tell our NodeList we want to hear about nodes with our node type
|
||||
NodeList::getInstance()->addNodeTypeToInterestSet(type);
|
||||
|
|
|
@ -28,15 +28,15 @@ public:
|
|||
static const int DEFAULT_PACKETS_PER_SECOND = 1;
|
||||
static const int NO_SERVER_CHECK_RATE = 60; // if no servers yet detected, keep checking at 60fps
|
||||
|
||||
JurisdictionListener(NODE_TYPE type = NODE_TYPE_VOXEL_SERVER);
|
||||
JurisdictionListener(NodeType_t type = NodeType::VoxelServer);
|
||||
|
||||
virtual bool process();
|
||||
|
||||
NodeToJurisdictionMap* getJurisdictions() { return &_jurisdictions; };
|
||||
|
||||
|
||||
NODE_TYPE getNodeType() const { return _nodeType; }
|
||||
void setNodeType(NODE_TYPE type) { _nodeType = type; }
|
||||
NodeType_t getNodeType() const { return _nodeType; }
|
||||
void setNodeType(NodeType_t type) { _nodeType = type; }
|
||||
|
||||
public slots:
|
||||
/// Called by NodeList to inform us that a node has been killed.
|
||||
|
@ -53,7 +53,7 @@ protected:
|
|||
|
||||
private:
|
||||
NodeToJurisdictionMap _jurisdictions;
|
||||
NODE_TYPE _nodeType;
|
||||
NodeType_t _nodeType;
|
||||
|
||||
bool queueJurisdictionRequest();
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void JurisdictionMap::clear() {
|
|||
_endNodes.clear();
|
||||
}
|
||||
|
||||
JurisdictionMap::JurisdictionMap(NODE_TYPE type) : _rootOctalCode(NULL) {
|
||||
JurisdictionMap::JurisdictionMap(NodeType_t type) : _rootOctalCode(NULL) {
|
||||
_nodeType = type;
|
||||
unsigned char* rootCode = new unsigned char[1];
|
||||
*rootCode = 0;
|
||||
|
@ -262,7 +262,7 @@ bool JurisdictionMap::writeToFile(const char* filename) {
|
|||
return true;
|
||||
}
|
||||
|
||||
int JurisdictionMap::packEmptyJurisdictionIntoMessage(NODE_TYPE type, unsigned char* destinationBuffer, int availableBytes) {
|
||||
int JurisdictionMap::packEmptyJurisdictionIntoMessage(NodeType_t type, unsigned char* destinationBuffer, int availableBytes) {
|
||||
unsigned char* bufferStart = destinationBuffer;
|
||||
|
||||
int headerLength = populatePacketHeader(reinterpret_cast<char*>(destinationBuffer), PacketTypeJurisdiction);
|
||||
|
@ -287,7 +287,7 @@ int JurisdictionMap::packIntoMessage(unsigned char* destinationBuffer, int avail
|
|||
destinationBuffer += headerLength;
|
||||
|
||||
// Pack the Node Type in first byte
|
||||
NODE_TYPE type = getNodeType();
|
||||
NodeType_t type = getNodeType();
|
||||
memcpy(destinationBuffer, &type, sizeof(type));
|
||||
destinationBuffer += sizeof(type);
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public:
|
|||
};
|
||||
|
||||
// standard constructors
|
||||
JurisdictionMap(NODE_TYPE type = NODE_TYPE_VOXEL_SERVER); // default constructor
|
||||
JurisdictionMap(NodeType_t type = NodeType::VoxelServer); // default constructor
|
||||
JurisdictionMap(const JurisdictionMap& other); // copy constructor
|
||||
|
||||
// standard assignment
|
||||
|
@ -60,12 +60,12 @@ public:
|
|||
int packIntoMessage(unsigned char* destinationBuffer, int availableBytes);
|
||||
|
||||
/// Available to pack an empty or unknown jurisdiction into a network packet, used when no JurisdictionMap is available
|
||||
static int packEmptyJurisdictionIntoMessage(NODE_TYPE type, unsigned char* destinationBuffer, int availableBytes);
|
||||
static int packEmptyJurisdictionIntoMessage(NodeType_t type, unsigned char* destinationBuffer, int availableBytes);
|
||||
|
||||
void displayDebugDetails() const;
|
||||
|
||||
NODE_TYPE getNodeType() const { return _nodeType; }
|
||||
void setNodeType(NODE_TYPE type) { _nodeType = type; }
|
||||
NodeType_t getNodeType() const { return _nodeType; }
|
||||
void setNodeType(NodeType_t type) { _nodeType = type; }
|
||||
|
||||
private:
|
||||
void copyContents(const JurisdictionMap& other); // use assignment instead
|
||||
|
@ -74,7 +74,7 @@ private:
|
|||
|
||||
unsigned char* _rootOctalCode;
|
||||
std::vector<unsigned char*> _endNodes;
|
||||
NODE_TYPE _nodeType;
|
||||
NodeType_t _nodeType;
|
||||
};
|
||||
|
||||
/// Map between node IDs and their reported JurisdictionMap. Typically used by classes that need to know which nodes are
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "JurisdictionSender.h"
|
||||
|
||||
|
||||
JurisdictionSender::JurisdictionSender(JurisdictionMap* map, NODE_TYPE type) :
|
||||
JurisdictionSender::JurisdictionSender(JurisdictionMap* map, NodeType_t type) :
|
||||
ReceivedPacketProcessor(),
|
||||
_jurisdictionMap(map),
|
||||
_packetSender(JurisdictionSender::DEFAULT_PACKETS_PER_SECOND)
|
||||
|
|
|
@ -26,15 +26,15 @@ class JurisdictionSender : public ReceivedPacketProcessor {
|
|||
public:
|
||||
static const int DEFAULT_PACKETS_PER_SECOND = 1;
|
||||
|
||||
JurisdictionSender(JurisdictionMap* map, NODE_TYPE type = NODE_TYPE_VOXEL_SERVER);
|
||||
JurisdictionSender(JurisdictionMap* map, NodeType_t type = NodeType::VoxelServer);
|
||||
~JurisdictionSender();
|
||||
|
||||
void setJurisdiction(JurisdictionMap* map) { _jurisdictionMap = map; }
|
||||
|
||||
virtual bool process();
|
||||
|
||||
NODE_TYPE getNodeType() const { return _nodeType; }
|
||||
void setNodeType(NODE_TYPE type) { _nodeType = type; }
|
||||
NodeType_t getNodeType() const { return _nodeType; }
|
||||
void setNodeType(NodeType_t type) { _nodeType = type; }
|
||||
|
||||
protected:
|
||||
virtual void processPacket(const HifiSockAddr& senderAddress, const QByteArray& packet);
|
||||
|
@ -50,7 +50,7 @@ private:
|
|||
QMutex _requestingNodeMutex;
|
||||
JurisdictionMap* _jurisdictionMap;
|
||||
std::queue<QUuid> _nodesRequestingJurisdictions;
|
||||
NODE_TYPE _nodeType;
|
||||
NodeType_t _nodeType;
|
||||
|
||||
PacketSender _packetSender;
|
||||
};
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
virtual ~OctreeRenderer();
|
||||
|
||||
virtual Octree* createTree() = 0;
|
||||
virtual NODE_TYPE getMyNodeType() const = 0;
|
||||
virtual NodeType_t getMyNodeType() const = 0;
|
||||
virtual PacketType getMyQueryMessageType() const = 0;
|
||||
virtual PacketType getExpectedPacketType() const = 0;
|
||||
virtual void renderElement(OctreeElement* element, RenderArgs* args) = 0;
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void setJurisdictionListener(JurisdictionListener* jurisdictionListener);
|
||||
void init();
|
||||
|
||||
virtual NODE_TYPE getServerNodeType() const = 0;
|
||||
virtual NodeType_t getServerNodeType() const = 0;
|
||||
virtual OctreeEditPacketSender* createPacketSender() = 0;
|
||||
|
||||
public slots:
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
// Subclasses must implement these methods
|
||||
virtual OctreeQueryNode* createOctreeQueryNode();
|
||||
virtual Octree* createTree();
|
||||
virtual unsigned char getMyNodeType() const { return NODE_TYPE_PARTICLE_SERVER; }
|
||||
virtual unsigned char getMyNodeType() const { return NodeType::ParticleServer; }
|
||||
virtual PacketType getMyQueryMessageType() const { return PacketTypeParticleQuery; }
|
||||
virtual const char* getMyServerName() const { return PARTICLE_SERVER_NAME; }
|
||||
virtual const char* getMyLoggingServerTargetName() const { return PARTICLE_SERVER_LOGGING_TARGET_NAME; }
|
||||
|
|
|
@ -193,7 +193,7 @@ void ParticleCollisionSystem::updateCollisionWithAvatars(Particle* particle) {
|
|||
// loop through all the other avatars for potential interactions...
|
||||
// foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
|
||||
// //qDebug() << "updateCollisionWithAvatars()... node:" << *node << "\n";
|
||||
// if (node->getLinkedData() && node->getType() == NODE_TYPE_AGENT) {
|
||||
// if (node->getLinkedData() && node->getType() == NodeType_t_AGENT) {
|
||||
// AvatarData* avatar = static_cast<AvatarData*>(node->getLinkedData());
|
||||
// CollisionInfo collisionInfo;
|
||||
// if (avatar->findSphereCollision(center, radius, collisionInfo)) {
|
||||
|
|
|
@ -29,7 +29,7 @@ public:
|
|||
void queueParticleEditMessage(PacketType type, ParticleID particleID, const ParticleProperties& properties);
|
||||
|
||||
// My server type is the particle server
|
||||
virtual unsigned char getMyNodeType() const { return NODE_TYPE_PARTICLE_SERVER; }
|
||||
virtual unsigned char getMyNodeType() const { return NodeType::ParticleServer; }
|
||||
virtual void adjustEditPacketForClockSkew(unsigned char* codeColorBuffer, ssize_t length, int clockSkew);
|
||||
};
|
||||
#endif // __shared__ParticleEditPacketSender__
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
ParticlesScriptingInterface();
|
||||
|
||||
ParticleEditPacketSender* getParticlePacketSender() const { return (ParticleEditPacketSender*)getPacketSender(); }
|
||||
virtual NODE_TYPE getServerNodeType() const { return NODE_TYPE_PARTICLE_SERVER; }
|
||||
virtual NodeType_t getServerNodeType() const { return NodeType::ParticleServer; }
|
||||
virtual OctreeEditPacketSender* createPacketSender() { return new ParticleEditPacketSender(); }
|
||||
|
||||
void setParticleTree(ParticleTree* particleTree) { _particleTree = particleTree; }
|
||||
|
|
|
@ -249,7 +249,7 @@ void ScriptEngine::run() {
|
|||
avatarPacket.resize(numAvatarHeaderBytes);
|
||||
avatarPacket.append(_avatarData->toByteArray());
|
||||
|
||||
nodeList->broadcastToNodes(avatarPacket, QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
|
||||
nodeList->broadcastToNodes(avatarPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
}
|
||||
|
||||
if (willSendVisualDataCallBack) {
|
||||
|
|
|
@ -17,19 +17,19 @@
|
|||
const char IPv4_ADDRESS_DESIGNATOR = 4;
|
||||
const char IPv6_ADDRESS_DESIGNATOR = 6;
|
||||
|
||||
Assignment::Type Assignment::typeForNodeType(NODE_TYPE nodeType) {
|
||||
Assignment::Type Assignment::typeForNodeType(NodeType_t nodeType) {
|
||||
switch (nodeType) {
|
||||
case NODE_TYPE_AUDIO_MIXER:
|
||||
case NodeType::AudioMixer:
|
||||
return Assignment::AudioMixerType;
|
||||
case NODE_TYPE_AVATAR_MIXER:
|
||||
case NodeType::AvatarMixer:
|
||||
return Assignment::AvatarMixerType;
|
||||
case NODE_TYPE_AGENT:
|
||||
case NodeType::Agent:
|
||||
return Assignment::AgentType;
|
||||
case NODE_TYPE_VOXEL_SERVER:
|
||||
case NodeType::VoxelServer:
|
||||
return Assignment::VoxelServerType;
|
||||
case NODE_TYPE_PARTICLE_SERVER:
|
||||
case NodeType::ParticleServer:
|
||||
return Assignment::ParticleServerType;
|
||||
case NODE_TYPE_METAVOXEL_SERVER:
|
||||
case NodeType::MetavoxelServer:
|
||||
return Assignment::MetavoxelServerType;
|
||||
default:
|
||||
return Assignment::AllTypes;
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
LocalLocation
|
||||
};
|
||||
|
||||
static Assignment::Type typeForNodeType(NODE_TYPE nodeType);
|
||||
static Assignment::Type typeForNodeType(NodeType_t nodeType);
|
||||
|
||||
Assignment();
|
||||
Assignment(Assignment::Command command,
|
||||
|
|
|
@ -20,6 +20,29 @@
|
|||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
const QString UNKNOWN_NodeType_t_NAME = "Unknown";
|
||||
|
||||
namespace NodeType {
|
||||
QHash<NodeType_t, QString> TypeNameHash;
|
||||
}
|
||||
|
||||
void NodeType::init() {
|
||||
TypeNameHash.insert(NodeType::DomainServer, "Domain Server");
|
||||
TypeNameHash.insert(NodeType::VoxelServer, "Voxel Server");
|
||||
TypeNameHash.insert(NodeType::ParticleServer, "Particle Server");
|
||||
TypeNameHash.insert(NodeType::MetavoxelServer, "Metavoxel Server");
|
||||
TypeNameHash.insert(NodeType::Agent, "Agent");
|
||||
TypeNameHash.insert(NodeType::AudioMixer, "Audio Mixer");
|
||||
TypeNameHash.insert(NodeType::AvatarMixer, "Avatar Mixer");
|
||||
TypeNameHash.insert(NodeType::AnimationServer, "Animation Server");
|
||||
TypeNameHash.insert(NodeType::Unassigned, "Unassigned");
|
||||
}
|
||||
|
||||
const QString& NodeType::getNodeTypeName(NodeType_t nodeType) {
|
||||
QHash<NodeType_t, QString>::iterator matchedTypeName = TypeNameHash.find(nodeType);
|
||||
return matchedTypeName != TypeNameHash.end() ? matchedTypeName.value() : UNKNOWN_NodeType_t_NAME;
|
||||
}
|
||||
|
||||
Node::Node(const QUuid& uuid, char type, const HifiSockAddr& publicSocket, const HifiSockAddr& localSocket) :
|
||||
_type(type),
|
||||
_uuid(uuid),
|
||||
|
@ -44,44 +67,6 @@ Node::~Node() {
|
|||
delete _bytesReceivedMovingAverage;
|
||||
}
|
||||
|
||||
// Names of Node Types
|
||||
const char* NODE_TYPE_NAME_DOMAIN = "Domain";
|
||||
const char* NODE_TYPE_NAME_VOXEL_SERVER = "Voxel Server";
|
||||
const char* NODE_TYPE_NAME_PARTICLE_SERVER = "Particle Server";
|
||||
const char* NODE_TYPE_NAME_METAVOXEL_SERVER = "Metavoxel Server";
|
||||
const char* NODE_TYPE_NAME_AGENT = "Agent";
|
||||
const char* NODE_TYPE_NAME_AUDIO_MIXER = "Audio Mixer";
|
||||
const char* NODE_TYPE_NAME_AVATAR_MIXER = "Avatar Mixer";
|
||||
const char* NODE_TYPE_NAME_AUDIO_INJECTOR = "Audio Injector";
|
||||
const char* NODE_TYPE_NAME_ANIMATION_SERVER = "Animation Server";
|
||||
const char* NODE_TYPE_NAME_UNASSIGNED = "Unassigned";
|
||||
const char* NODE_TYPE_NAME_UNKNOWN = "Unknown";
|
||||
|
||||
const char* Node::getTypeName() const {
|
||||
switch (this->_type) {
|
||||
case NODE_TYPE_DOMAIN:
|
||||
return NODE_TYPE_NAME_DOMAIN;
|
||||
case NODE_TYPE_VOXEL_SERVER:
|
||||
return NODE_TYPE_NAME_VOXEL_SERVER;
|
||||
case NODE_TYPE_PARTICLE_SERVER:
|
||||
return NODE_TYPE_NAME_PARTICLE_SERVER;
|
||||
case NODE_TYPE_METAVOXEL_SERVER:
|
||||
return NODE_TYPE_NAME_METAVOXEL_SERVER;
|
||||
case NODE_TYPE_AGENT:
|
||||
return NODE_TYPE_NAME_AGENT;
|
||||
case NODE_TYPE_AUDIO_MIXER:
|
||||
return NODE_TYPE_NAME_AUDIO_MIXER;
|
||||
case NODE_TYPE_AVATAR_MIXER:
|
||||
return NODE_TYPE_NAME_AVATAR_MIXER;
|
||||
case NODE_TYPE_ANIMATION_SERVER:
|
||||
return NODE_TYPE_NAME_ANIMATION_SERVER;
|
||||
case NODE_TYPE_UNASSIGNED:
|
||||
return NODE_TYPE_NAME_UNASSIGNED;
|
||||
default:
|
||||
return NODE_TYPE_NAME_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
void Node::setPublicSocket(const HifiSockAddr& publicSocket) {
|
||||
if (_activeSocket == &_publicSocket) {
|
||||
// if the active socket was the public socket then reset it to NULL
|
||||
|
@ -153,7 +138,7 @@ QDataStream& operator>>(QDataStream& in, Node& node) {
|
|||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const Node &node) {
|
||||
debug.nospace() << node.getTypeName() << " (" << node.getType() << ")";
|
||||
debug.nospace() << NodeType::getNodeTypeName(node.getType()) << " (" << node.getType() << ")";
|
||||
debug << " " << node.getUUID().toString().toLocal8Bit().constData() << " ";
|
||||
debug.nospace() << node.getPublicSocket() << "/" << node.getLocalSocket();
|
||||
return debug.nospace();
|
||||
|
|
|
@ -27,17 +27,23 @@
|
|||
#include "NodeData.h"
|
||||
#include "SimpleMovingAverage.h"
|
||||
|
||||
typedef quint8 NODE_TYPE;
|
||||
const NODE_TYPE NODE_TYPE_DOMAIN = 'D';
|
||||
const NODE_TYPE NODE_TYPE_VOXEL_SERVER = 'V';
|
||||
const NODE_TYPE NODE_TYPE_PARTICLE_SERVER = 'P';
|
||||
const NODE_TYPE NODE_TYPE_METAVOXEL_SERVER = 'm';
|
||||
const NODE_TYPE NODE_TYPE_ENVIRONMENT_SERVER = 'E';
|
||||
const NODE_TYPE NODE_TYPE_AGENT = 'I';
|
||||
const NODE_TYPE NODE_TYPE_AUDIO_MIXER = 'M';
|
||||
const NODE_TYPE NODE_TYPE_AVATAR_MIXER = 'W';
|
||||
const NODE_TYPE NODE_TYPE_ANIMATION_SERVER = 'a';
|
||||
const NODE_TYPE NODE_TYPE_UNASSIGNED = 1;
|
||||
typedef quint8 NodeType_t;
|
||||
|
||||
namespace NodeType {
|
||||
const NodeType_t DomainServer = 'D';
|
||||
const NodeType_t VoxelServer = 'V';
|
||||
const NodeType_t ParticleServer = 'P';
|
||||
const NodeType_t MetavoxelServer = 'm';
|
||||
const NodeType_t EnvironmentServer = 'E';
|
||||
const NodeType_t Agent = 'I';
|
||||
const NodeType_t AudioMixer = 'M';
|
||||
const NodeType_t AvatarMixer = 'W';
|
||||
const NodeType_t AnimationServer = 'a';
|
||||
const NodeType_t Unassigned = 1;
|
||||
|
||||
void init();
|
||||
const QString& getNodeTypeName(NodeType_t nodeType);
|
||||
}
|
||||
|
||||
class Node : public QObject {
|
||||
Q_OBJECT
|
||||
|
@ -50,7 +56,7 @@ public:
|
|||
|
||||
char getType() const { return _type; }
|
||||
void setType(char type) { _type = type; }
|
||||
const char* getTypeName() const;
|
||||
|
||||
|
||||
const QUuid& getUUID() const { return _uuid; }
|
||||
void setUUID(const QUuid& uuid) { _uuid = uuid; }
|
||||
|
@ -96,7 +102,7 @@ private:
|
|||
Node(const Node &otherNode);
|
||||
Node& operator=(Node otherNode);
|
||||
|
||||
NODE_TYPE _type;
|
||||
NodeType_t _type;
|
||||
QUuid _uuid;
|
||||
quint64 _wakeMicrostamp;
|
||||
quint64 _lastHeardMicrostamp;
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
#include "UUID.h"
|
||||
|
||||
const char SOLO_NODE_TYPES[2] = {
|
||||
NODE_TYPE_AVATAR_MIXER,
|
||||
NODE_TYPE_AUDIO_MIXER
|
||||
NodeType::AvatarMixer,
|
||||
NodeType::AudioMixer
|
||||
};
|
||||
|
||||
const QString DEFAULT_DOMAIN_HOSTNAME = "alpha.highfidelity.io";
|
||||
|
@ -33,6 +33,8 @@ NodeList* NodeList::_sharedInstance = NULL;
|
|||
|
||||
NodeList* NodeList::createInstance(char ownerType, unsigned short int socketListenPort) {
|
||||
if (!_sharedInstance) {
|
||||
NodeType::init();
|
||||
|
||||
_sharedInstance = new NodeList(ownerType, socketListenPort);
|
||||
|
||||
// register the SharedNodePointer meta-type for signals/slots
|
||||
|
@ -257,11 +259,11 @@ void NodeList::reset() {
|
|||
_ownerUUID = QUuid::createUuid();
|
||||
}
|
||||
|
||||
void NodeList::addNodeTypeToInterestSet(NODE_TYPE nodeTypeToAdd) {
|
||||
void NodeList::addNodeTypeToInterestSet(NodeType_t nodeTypeToAdd) {
|
||||
_nodeTypesOfInterest << nodeTypeToAdd;
|
||||
}
|
||||
|
||||
void NodeList::addSetOfNodeTypesToNodeInterestSet(const QSet<NODE_TYPE>& setOfNodeTypes) {
|
||||
void NodeList::addSetOfNodeTypesToNodeInterestSet(const QSet<NodeType_t>& setOfNodeTypes) {
|
||||
_nodeTypesOfInterest.unite(setOfNodeTypes);
|
||||
}
|
||||
|
||||
|
@ -471,7 +473,7 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
<< (quint8) _nodeTypesOfInterest.size();
|
||||
|
||||
// copy over the bytes for node types of interest, if required
|
||||
foreach (NODE_TYPE nodeTypeOfInterest, _nodeTypesOfInterest) {
|
||||
foreach (NodeType_t nodeTypeOfInterest, _nodeTypesOfInterest) {
|
||||
packetStream << nodeTypeOfInterest;
|
||||
}
|
||||
|
||||
|
@ -595,9 +597,9 @@ SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
|
|||
|
||||
QMutexLocker locker(&matchingNode->getMutex());
|
||||
|
||||
if (matchingNode->getType() == NODE_TYPE_AUDIO_MIXER ||
|
||||
matchingNode->getType() == NODE_TYPE_VOXEL_SERVER ||
|
||||
matchingNode->getType() == NODE_TYPE_METAVOXEL_SERVER) {
|
||||
if (matchingNode->getType() == NodeType::AudioMixer ||
|
||||
matchingNode->getType() == NodeType::VoxelServer ||
|
||||
matchingNode->getType() == NodeType::MetavoxelServer) {
|
||||
// until the Audio class also uses our nodeList, we need to update
|
||||
// the lastRecvTimeUsecs for the audio mixer so it doesn't get killed and re-added continously
|
||||
matchingNode->setLastHeardMicrostamp(usecTimestampNow());
|
||||
|
@ -619,7 +621,7 @@ SharedNodePointer NodeList::addOrUpdateNode(const QUuid& uuid, char nodeType,
|
|||
}
|
||||
|
||||
unsigned NodeList::broadcastToNodes(const QByteArray& packet,
|
||||
const QSet<NODE_TYPE>& destinationNodeTypes) {
|
||||
const QSet<NodeType_t>& destinationNodeTypes) {
|
||||
unsigned n = 0;
|
||||
|
||||
foreach (const SharedNodePointer& node, getNodeHash()) {
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
|
||||
#include "Node.h"
|
||||
|
||||
const int MAX_NUM_NODES = 10000;
|
||||
const int NODES_PER_BUCKET = 100;
|
||||
|
||||
const int MAX_PACKET_SIZE = 1500;
|
||||
|
||||
const quint64 NODE_SILENCE_THRESHOLD_USECS = 2 * 1000 * 1000;
|
||||
|
@ -53,6 +50,8 @@ const int MAX_SILENT_DOMAIN_SERVER_CHECK_INS = 5;
|
|||
class Assignment;
|
||||
class HifiSockAddr;
|
||||
|
||||
typedef QSet<NodeType_t> NodeSet;
|
||||
|
||||
typedef QSharedPointer<Node> SharedNodePointer;
|
||||
typedef QHash<QUuid, SharedNodePointer> NodeHash;
|
||||
Q_DECLARE_METATYPE(SharedNodePointer)
|
||||
|
@ -62,8 +61,8 @@ class NodeList : public QObject {
|
|||
public:
|
||||
static NodeList* createInstance(char ownerType, unsigned short int socketListenPort = 0);
|
||||
static NodeList* getInstance();
|
||||
NODE_TYPE getOwnerType() const { return _ownerType; }
|
||||
void setOwnerType(NODE_TYPE ownerType) { _ownerType = ownerType; }
|
||||
NodeType_t getOwnerType() const { return _ownerType; }
|
||||
void setOwnerType(NodeType_t ownerType) { _ownerType = ownerType; }
|
||||
|
||||
const QString& getDomainHostname() const { return _domainHostname; }
|
||||
void setDomainHostname(const QString& domainHostname);
|
||||
|
@ -89,9 +88,9 @@ public:
|
|||
|
||||
void reset();
|
||||
|
||||
const QSet<NODE_TYPE>& getNodeInterestSet() const { return _nodeTypesOfInterest; }
|
||||
void addNodeTypeToInterestSet(NODE_TYPE nodeTypeToAdd);
|
||||
void addSetOfNodeTypesToNodeInterestSet(const QSet<NODE_TYPE>& setOfNodeTypes);
|
||||
const NodeSet& getNodeInterestSet() const { return _nodeTypesOfInterest; }
|
||||
void addNodeTypeToInterestSet(NodeType_t nodeTypeToAdd);
|
||||
void addSetOfNodeTypesToNodeInterestSet(const NodeSet& setOfNodeTypes);
|
||||
|
||||
int processDomainServerList(const QByteArray& packet);
|
||||
|
||||
|
@ -112,7 +111,7 @@ public:
|
|||
|
||||
int updateNodeWithData(Node *node, const HifiSockAddr& senderSockAddr, const QByteArray& packet);
|
||||
|
||||
unsigned broadcastToNodes(const QByteArray& packet, const QSet<NODE_TYPE>& destinationNodeTypes);
|
||||
unsigned broadcastToNodes(const QByteArray& packet, const NodeSet& destinationNodeTypes);
|
||||
SharedNodePointer soloNodeOfType(char nodeType);
|
||||
|
||||
void loadData(QSettings* settings);
|
||||
|
@ -146,8 +145,8 @@ private:
|
|||
QString _domainHostname;
|
||||
HifiSockAddr _domainSockAddr;
|
||||
QUdpSocket _nodeSocket;
|
||||
NODE_TYPE _ownerType;
|
||||
QSet<NODE_TYPE> _nodeTypesOfInterest;
|
||||
NodeType_t _ownerType;
|
||||
NodeSet _nodeTypesOfInterest;
|
||||
QUuid _ownerUUID;
|
||||
int _numNoReplyDomainCheckIns;
|
||||
HifiSockAddr _assignmentServerSocket;
|
||||
|
|
|
@ -33,7 +33,7 @@ void ThreadedAssignment::setFinished(bool isFinished) {
|
|||
}
|
||||
}
|
||||
|
||||
void ThreadedAssignment::commonInit(const char* targetName, NODE_TYPE nodeType) {
|
||||
void ThreadedAssignment::commonInit(const char* targetName, NodeType_t nodeType) {
|
||||
// change the logging target name while the assignment is running
|
||||
Logging::setTargetName(targetName);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public slots:
|
|||
|
||||
virtual void processDatagram(const QByteArray& dataByteArray, const HifiSockAddr& senderSockAddr) = 0;
|
||||
protected:
|
||||
void commonInit(const char* targetName, NODE_TYPE nodeType);
|
||||
void commonInit(const char* targetName, NodeType_t nodeType);
|
||||
bool _isFinished;
|
||||
private slots:
|
||||
void checkInWithDomainServerOrExit();
|
||||
|
|
|
@ -69,5 +69,5 @@ void VoxelServer::beforeRun() {
|
|||
}
|
||||
qDebug("Sending environments=%s", debug::valueOf(_sendEnvironments));
|
||||
|
||||
NodeList::getInstance()->addNodeTypeToInterestSet(NODE_TYPE_ANIMATION_SERVER);
|
||||
NodeList::getInstance()->addNodeTypeToInterestSet(NodeType::AnimationServer);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
// Subclasses must implement these methods
|
||||
virtual OctreeQueryNode* createOctreeQueryNode();
|
||||
virtual Octree* createTree();
|
||||
virtual unsigned char getMyNodeType() const { return NODE_TYPE_VOXEL_SERVER; }
|
||||
virtual unsigned 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; }
|
||||
|
|
|
@ -44,6 +44,6 @@ public:
|
|||
bool voxelServersExist() const { return serversExist(); }
|
||||
|
||||
// My server type is the voxel server
|
||||
virtual unsigned char getMyNodeType() const { return NODE_TYPE_VOXEL_SERVER; }
|
||||
virtual unsigned char getMyNodeType() const { return NodeType::VoxelServer; }
|
||||
};
|
||||
#endif // __shared__VoxelEditPacketSender__
|
||||
|
|
|
@ -22,7 +22,7 @@ class VoxelsScriptingInterface : public OctreeScriptingInterface {
|
|||
public:
|
||||
VoxelEditPacketSender* getVoxelPacketSender() { return (VoxelEditPacketSender*)getPacketSender(); }
|
||||
|
||||
virtual NODE_TYPE getServerNodeType() const { return NODE_TYPE_VOXEL_SERVER; }
|
||||
virtual NodeType_t getServerNodeType() const { return NodeType::VoxelServer; }
|
||||
virtual OctreeEditPacketSender* createPacketSender() { return new VoxelEditPacketSender(); }
|
||||
|
||||
public slots:
|
||||
|
|
Loading…
Reference in a new issue