mirror of
https://github.com/overte-org/overte.git
synced 2025-08-17 10:37:01 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into glow
This commit is contained in:
commit
5bca763c14
19 changed files with 123 additions and 26 deletions
|
@ -10,13 +10,17 @@
|
|||
#include <fstream>
|
||||
#include <queue>
|
||||
|
||||
#include <QtCore/QString>
|
||||
|
||||
#include <PacketHeaders.h>
|
||||
#include <SharedUtil.h>
|
||||
#include <UDPSocket.h>
|
||||
|
||||
const int MAX_PACKET_SIZE_BYTES = 1400;
|
||||
|
||||
struct Assignment {};
|
||||
struct Assignment {
|
||||
QString scriptFilename;
|
||||
};
|
||||
|
||||
int main(int argc, const char* argv[]) {
|
||||
|
||||
|
@ -29,27 +33,46 @@ int main(int argc, const char* argv[]) {
|
|||
UDPSocket serverSocket(ASSIGNMENT_SERVER_PORT);
|
||||
|
||||
int numHeaderBytes = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_SEND_ASSIGNMENT);
|
||||
unsigned char assignmentPacket[numHeaderBytes + sizeof(char)];
|
||||
unsigned char assignmentPacket[MAX_PACKET_SIZE_BYTES];
|
||||
populateTypeAndVersion(assignmentPacket, PACKET_TYPE_SEND_ASSIGNMENT);
|
||||
|
||||
while (true) {
|
||||
if (serverSocket.receive((sockaddr*) &senderSocket, &senderData, &receivedBytes)) {
|
||||
|
||||
// int numHeaderBytes = numBytesForPacketHeader(senderData);
|
||||
int numHeaderBytes = numBytesForPacketHeader(senderData);
|
||||
|
||||
if (senderData[0] == PACKET_TYPE_REQUEST_ASSIGNMENT) {
|
||||
if (senderData[0] == PACKET_TYPE_REQUEST_ASSIGNMENT) {
|
||||
qDebug() << "Assignment request received.\n";
|
||||
// grab the FI assignment in the queue, if it exists
|
||||
if (assignmentQueue.size() > 0) {
|
||||
// Assignment firstAssignment = assignmentQueue.front();
|
||||
Assignment firstAssignment = assignmentQueue.front();
|
||||
assignmentQueue.pop();
|
||||
|
||||
QString scriptURL = QString("http://base8-compute.s3.amazonaws.com/%1").arg(firstAssignment.scriptFilename);
|
||||
|
||||
qDebug() << "Sending assignment with URL" << scriptURL << "\n";
|
||||
|
||||
int scriptURLBytes = scriptURL.size();
|
||||
memcpy(assignmentPacket + numHeaderBytes, scriptURL.toLocal8Bit().constData(), scriptURLBytes);
|
||||
|
||||
// send the assignment
|
||||
serverSocket.send((sockaddr*) &senderSocket, assignmentPacket, sizeof(assignmentPacket));
|
||||
serverSocket.send((sockaddr*) &senderSocket, assignmentPacket, numHeaderBytes + scriptURLBytes);
|
||||
}
|
||||
} else if (senderData[0] == PACKET_TYPE_SEND_ASSIGNMENT) {
|
||||
Assignment newAssignment;
|
||||
|
||||
senderData[receivedBytes] = '\0';
|
||||
newAssignment.scriptFilename = QString((const char*)senderData + numHeaderBytes);
|
||||
|
||||
qDebug() << "Added an assignment with script with filename" << newAssignment.scriptFilename << "\n";
|
||||
|
||||
// add this assignment to the queue
|
||||
|
||||
// we're not a queue right now, only keep one assignment
|
||||
if (assignmentQueue.size() > 0) {
|
||||
assignmentQueue.pop();
|
||||
}
|
||||
|
||||
assignmentQueue.push(newAssignment);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,6 +51,11 @@ Pod::Spec.new do |s|
|
|||
sp.dependency 'glm'
|
||||
end
|
||||
|
||||
s.subspec "voxels" do |sp|
|
||||
sp.source_files = 'libraries/voxels/src', 'libraries/voxels/moc_*'
|
||||
sp.dependency 'glm'
|
||||
end
|
||||
|
||||
s.xcconfig = { 'HEADER_SEARCH_PATHS' => '${PODS_ROOT}/../../qt5-device/qtbase/include' }
|
||||
s.libraries = 'libQtCoreCombined', 'libQt5Network', 'libQt5Script'
|
||||
|
||||
|
|
|
@ -1181,6 +1181,13 @@ void Application::sendAvatarVoxelURLMessage(const QUrl& url) {
|
|||
}
|
||||
|
||||
static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
|
||||
// record the packet for stats-tracking
|
||||
Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AVATARS).updateValue(dataBytes);
|
||||
Node* avatarMixerNode = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
|
||||
if (avatarMixerNode) {
|
||||
avatarMixerNode->recordBytesReceived(dataBytes);
|
||||
}
|
||||
|
||||
// skip the header
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(packetData);
|
||||
packetData += numBytesPacketHeader;
|
||||
|
@ -4082,11 +4089,9 @@ void* Application::networkReceive(void* args) {
|
|||
break;
|
||||
case PACKET_TYPE_AVATAR_VOXEL_URL:
|
||||
processAvatarVoxelURLMessage(app->_incomingPacket, bytesReceived);
|
||||
getInstance()->_bandwidthMeter.inputStream(BandwidthMeter::AVATARS).updateValue(bytesReceived);
|
||||
break;
|
||||
case PACKET_TYPE_AVATAR_FACE_VIDEO:
|
||||
processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived);
|
||||
getInstance()->_bandwidthMeter.inputStream(BandwidthMeter::AVATARS).updateValue(bytesReceived);
|
||||
break;
|
||||
default:
|
||||
NodeList::getInstance()->processNodeData(&senderAddress, app->_incomingPacket, bytesReceived);
|
||||
|
|
|
@ -100,6 +100,7 @@ static Closure cmakeBuild(srcDir, instCommand) {
|
|||
|
||||
def targets = [
|
||||
'animation-server':true,
|
||||
'assignment-server':true,
|
||||
'audio-mixer':true,
|
||||
'avatar-mixer':true,
|
||||
'domain-server':true,
|
||||
|
|
|
@ -42,7 +42,7 @@ void Agent::run(QUrl scriptURL) {
|
|||
AvatarData *testAvatarData = new AvatarData;
|
||||
|
||||
QScriptValue avatarDataValue = engine.newQObject(testAvatarData);
|
||||
engine.globalObject().setProperty("AvatarData", avatarDataValue);
|
||||
engine.globalObject().setProperty("Avatar", avatarDataValue);
|
||||
|
||||
QScriptValue agentValue = engine.newQObject(this);
|
||||
engine.globalObject().setProperty("Agent", agentValue);
|
||||
|
@ -55,7 +55,7 @@ void Agent::run(QUrl scriptURL) {
|
|||
timeval lastDomainServerCheckIn = {};
|
||||
int numMicrosecondsSleep = 0;
|
||||
|
||||
const float DATA_SEND_INTERVAL_USECS = (1 / 60) * 1000 * 1000;
|
||||
const float DATA_SEND_INTERVAL_USECS = (1 / 60.0f) * 1000 * 1000;
|
||||
|
||||
sockaddr_in senderAddress;
|
||||
unsigned char receivedData[MAX_PACKET_SIZE];
|
||||
|
|
|
@ -52,6 +52,38 @@ AvatarData::~AvatarData() {
|
|||
delete _handData;
|
||||
}
|
||||
|
||||
void AvatarData::setPositionFromVariantMap(QVariantMap positionMap) {
|
||||
_position = glm::vec3(positionMap.value("x").toFloat(),
|
||||
positionMap.value("y").toFloat(),
|
||||
positionMap.value("z").toFloat());
|
||||
}
|
||||
|
||||
QVariantMap AvatarData::getPositionVariantMap() {
|
||||
QVariantMap positionMap;
|
||||
|
||||
positionMap.insert("x", _position.x);
|
||||
positionMap.insert("y", _position.y);
|
||||
positionMap.insert("z", _position.z);
|
||||
|
||||
return positionMap;
|
||||
}
|
||||
|
||||
void AvatarData::setHandPositionFromVariantMap(QVariantMap handPositionMap) {
|
||||
_handPosition = glm::vec3(handPositionMap.value("x").toFloat(),
|
||||
handPositionMap.value("y").toFloat(),
|
||||
handPositionMap.value("z").toFloat());
|
||||
}
|
||||
|
||||
QVariantMap AvatarData::getHandPositionVariantMap() {
|
||||
QVariantMap positionMap;
|
||||
|
||||
positionMap.insert("x", _handPosition.x);
|
||||
positionMap.insert("y", _handPosition.y);
|
||||
positionMap.insert("z", _handPosition.z);
|
||||
|
||||
return positionMap;
|
||||
}
|
||||
|
||||
void AvatarData::sendData() {
|
||||
|
||||
// called from Agent visual loop to send data
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <glm/gtc/quaternion.hpp>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVariantMap>
|
||||
|
||||
#include <NodeData.h>
|
||||
#include "HeadData.h"
|
||||
|
@ -41,7 +42,14 @@ enum KeyState
|
|||
class JointData;
|
||||
|
||||
class AvatarData : public NodeData {
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QVariantMap position READ getPositionVariantMap WRITE setPositionFromVariantMap)
|
||||
Q_PROPERTY(QVariantMap handPosition READ getHandPositionVariantMap WRITE setHandPositionFromVariantMap)
|
||||
Q_PROPERTY(float bodyYaw READ getBodyYaw WRITE setBodyYaw)
|
||||
Q_PROPERTY(float bodyPitch READ getBodyPitch WRITE setBodyPitch)
|
||||
Q_PROPERTY(float bodyRoll READ getBodyRoll WRITE setBodyRoll)
|
||||
Q_PROPERTY(QString chatMessage READ getQStringChatMessage WRITE setChatMessage)
|
||||
public:
|
||||
AvatarData(Node* owningNode = NULL);
|
||||
~AvatarData();
|
||||
|
@ -51,15 +59,23 @@ public:
|
|||
void setPosition (const glm::vec3 position ) { _position = position; }
|
||||
void setHandPosition (const glm::vec3 handPosition ) { _handPosition = handPosition; }
|
||||
|
||||
void setPositionFromVariantMap(QVariantMap positionMap);
|
||||
QVariantMap getPositionVariantMap();
|
||||
|
||||
void setHandPositionFromVariantMap(QVariantMap handPositionMap);
|
||||
QVariantMap getHandPositionVariantMap();
|
||||
|
||||
int getBroadcastData(unsigned char* destinationBuffer);
|
||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||
|
||||
// Body Rotation
|
||||
float getBodyYaw() const { return _bodyYaw; }
|
||||
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
|
||||
float getBodyPitch() const { return _bodyPitch; }
|
||||
void setBodyPitch(float bodyPitch) { _bodyPitch = bodyPitch; }
|
||||
float getBodyRoll() const {return _bodyRoll; }
|
||||
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
||||
|
||||
|
||||
// Hand State
|
||||
void setHandState(char s) { _handState = s; };
|
||||
|
@ -89,7 +105,9 @@ public:
|
|||
|
||||
// chat message
|
||||
void setChatMessage(const std::string& msg) { _chatMessage = msg; }
|
||||
const std::string& chatMessage () const { return _chatMessage; }
|
||||
void setChatMessage(const QString& string) { _chatMessage = string.toLocal8Bit().constData(); }
|
||||
const std::string& setChatMessage() const { return _chatMessage; }
|
||||
QString getQStringChatMessage() { return QString(_chatMessage.data()); }
|
||||
|
||||
// related to Voxel Sending strategies
|
||||
bool getWantColor() const { return _wantColor; }
|
||||
|
@ -107,8 +125,6 @@ public:
|
|||
void setHandData(HandData* handData) { _handData = handData; }
|
||||
|
||||
public slots:
|
||||
void setPosition(float x, float y, float z) { _position = glm::vec3(x, y, z); }
|
||||
void setBodyYaw(float bodyYaw) { _bodyYaw = bodyYaw; }
|
||||
void sendData();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -94,6 +94,8 @@ const char* Node::getTypeName() const {
|
|||
return NODE_TYPE_NAME_AUDIO_INJECTOR;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -24,5 +24,6 @@ const NODE_TYPE NODE_TYPE_AUDIO_MIXER = 'M';
|
|||
const NODE_TYPE NODE_TYPE_AVATAR_MIXER = 'W';
|
||||
const NODE_TYPE NODE_TYPE_AUDIO_INJECTOR = 'A';
|
||||
const NODE_TYPE NODE_TYPE_ANIMATION_SERVER = 'a';
|
||||
const NODE_TYPE NODE_TYPE_UNASSIGNED = 1;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <cstring>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <SharedUtil.h>
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QString>
|
||||
#include <QtCore/QStringList>
|
||||
|
||||
#include "JurisdictionMap.h"
|
||||
#include "VoxelNode.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define __hifi__JurisdictionMap__
|
||||
|
||||
#include <vector>
|
||||
#include <QString>
|
||||
#include <QtCore/QString>
|
||||
|
||||
class JurisdictionMap {
|
||||
public:
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <glm/gtx/transform.hpp>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "CoverageMap.h"
|
||||
#include "GeometryUtil.h"
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <cstring>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include <NodeList.h>
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "GeometryUtil.h"
|
||||
#include "SharedUtil.h"
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include <glm/gtc/noise.hpp>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "CoverageMap.h"
|
||||
#include "GeometryUtil.h"
|
||||
|
|
|
@ -66,6 +66,7 @@ bool shouldShowAnimationDebug = false;
|
|||
bool displayVoxelStats = false;
|
||||
bool debugVoxelReceiving = false;
|
||||
bool sendEnvironments = true;
|
||||
bool sendMinimalEnvironment = false;
|
||||
|
||||
EnvironmentData environmentData[3];
|
||||
|
||||
|
@ -325,8 +326,9 @@ void deepestLevelVoxelDistributor(NodeList* nodeList,
|
|||
if (shouldSendEnvironments) {
|
||||
int numBytesPacketHeader = populateTypeAndVersion(tempOutputBuffer, PACKET_TYPE_ENVIRONMENT_DATA);
|
||||
int envPacketLength = numBytesPacketHeader;
|
||||
int environmentsToSend = ::sendMinimalEnvironment ? 1 : sizeof(environmentData) / sizeof(EnvironmentData);
|
||||
|
||||
for (int i = 0; i < sizeof(environmentData) / sizeof(EnvironmentData); i++) {
|
||||
for (int i = 0; i < environmentsToSend; i++) {
|
||||
envPacketLength += environmentData[i].getBroadcastData(tempOutputBuffer + envPacketLength);
|
||||
}
|
||||
|
||||
|
@ -482,6 +484,11 @@ int main(int argc, const char * argv[]) {
|
|||
if (dontSendEnvironments) {
|
||||
printf("Sending environments suppressed...\n");
|
||||
::sendEnvironments = false;
|
||||
} else {
|
||||
// should we send environments? Default is yes, but this command line suppresses sending
|
||||
const char* MINIMAL_ENVIRONMENT = "--MinimalEnvironment";
|
||||
::sendMinimalEnvironment = cmdOptionExists(argc, argv, MINIMAL_ENVIRONMENT);
|
||||
printf("Using Minimal Environment=%s\n", debug::valueOf(::sendMinimalEnvironment));
|
||||
}
|
||||
printf("Sending environments=%s\n", debug::valueOf(::sendEnvironments));
|
||||
|
||||
|
@ -494,6 +501,11 @@ int main(int argc, const char * argv[]) {
|
|||
if (::wantLocalDomain) {
|
||||
printf("Local Domain MODE!\n");
|
||||
nodeList->setDomainIPToLocalhost();
|
||||
} else {
|
||||
const char* domainIP = getCmdOption(argc, argv, "--domain");
|
||||
if (domainIP) {
|
||||
NodeList::getInstance()->setDomainHostname(domainIP);
|
||||
}
|
||||
}
|
||||
|
||||
nodeList->linkedDataCreateCallback = &attachVoxelNodeDataToNode;
|
||||
|
|
Loading…
Reference in a new issue