mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 08:23:40 +02:00
resolve conflicts on merge with upstream
This commit is contained in:
commit
e538669343
144 changed files with 2194 additions and 808 deletions
|
@ -9,8 +9,7 @@ Please read the [general build guide](BUILD.md) for information on dependencies
|
|||
|
||||
Currently building on Windows has been tested using the following compilers:
|
||||
* Visual Studio 2013
|
||||
|
||||
(If anyone can test using Visual Studio 2013 Express then please update this document)
|
||||
* Visual Studio 2013 Express
|
||||
|
||||
####Visual Studio 2013
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ Agent::Agent(const QByteArray& packet) :
|
|||
void Agent::readPendingDatagrams() {
|
||||
QByteArray receivedPacket;
|
||||
HifiSockAddr senderSockAddr;
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
while (readAvailableDatagram(receivedPacket, senderSockAddr)) {
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
|
@ -103,7 +103,7 @@ void Agent::readPendingDatagrams() {
|
|||
// TODO: this needs to be fixed, the goal is to test the packet version for the piggyback, but
|
||||
// this is testing the version and hash of the original packet
|
||||
// need to use numBytesArithmeticCodingFromBuffer()...
|
||||
if (!NodeList::getInstance()->packetVersionAndHashMatch(receivedPacket)) {
|
||||
if (!DependencyManager::get<NodeList>()->packetVersionAndHashMatch(receivedPacket)) {
|
||||
return; // bail since piggyback data doesn't match our versioning
|
||||
}
|
||||
} else {
|
||||
|
@ -127,7 +127,7 @@ void Agent::readPendingDatagrams() {
|
|||
|
||||
// let this continue through to the NodeList so it updates last heard timestamp
|
||||
// for the sending audio mixer
|
||||
NodeList::getInstance()->processNodeData(senderSockAddr, receivedPacket);
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
|
||||
} else if (datagramPacketType == PacketTypeBulkAvatarData
|
||||
|| datagramPacketType == PacketTypeAvatarIdentity
|
||||
|| datagramPacketType == PacketTypeAvatarBillboard
|
||||
|
@ -137,9 +137,9 @@ void Agent::readPendingDatagrams() {
|
|||
|
||||
// let this continue through to the NodeList so it updates last heard timestamp
|
||||
// for the sending avatar-mixer
|
||||
NodeList::getInstance()->processNodeData(senderSockAddr, receivedPacket);
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
|
||||
} else {
|
||||
NodeList::getInstance()->processNodeData(senderSockAddr, receivedPacket);
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ const QString AGENT_LOGGING_NAME = "agent";
|
|||
void Agent::run() {
|
||||
ThreadedAssignment::commonInit(AGENT_LOGGING_NAME, NodeType::Agent);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->addSetOfNodeTypesToNodeInterestSet(NodeSet()
|
||||
<< NodeType::AudioMixer
|
||||
<< NodeType::AvatarMixer
|
||||
|
@ -161,7 +161,7 @@ void Agent::run() {
|
|||
QUrl scriptURL;
|
||||
if (_payload.isEmpty()) {
|
||||
scriptURL = QUrl(QString("http://%1:%2/assignment/%3")
|
||||
.arg(NodeList::getInstance()->getDomainHandler().getIP().toString())
|
||||
.arg(DependencyManager::get<NodeList>()->getDomainHandler().getIP().toString())
|
||||
.arg(DOMAIN_SERVER_HTTP_PORT)
|
||||
.arg(uuidStringWithoutCurlyBraces(_uuid)));
|
||||
} else {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <QtCore/QTimer>
|
||||
|
||||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <Assignment.h>
|
||||
#include <HifiConfigVariantMap.h>
|
||||
#include <LogHandler.h>
|
||||
|
@ -48,7 +49,12 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
|||
setOrganizationDomain("highfidelity.io");
|
||||
setApplicationName("assignment-client");
|
||||
QSettings::setDefaultFormat(QSettings::IniFormat);
|
||||
|
||||
|
||||
// create a NodeList as an unassigned client
|
||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||
auto addressManager = DependencyManager::set<AddressManager>();
|
||||
auto nodeList = DependencyManager::set<NodeList>(NodeType::Unassigned);
|
||||
|
||||
// setup a shutdown event listener to handle SIGTERM or WM_CLOSE for us
|
||||
#ifdef _WIN32
|
||||
installNativeEventFilter(&ShutdownEventListener::getInstance());
|
||||
|
@ -91,9 +97,6 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
|||
qDebug() << "The destination wallet UUID for credits is" << uuidStringWithoutCurlyBraces(walletUUID);
|
||||
_requestAssignment.setWalletUUID(walletUUID);
|
||||
}
|
||||
|
||||
// create a NodeList as an unassigned client
|
||||
NodeList* nodeList = NodeList::createInstance(NodeType::Unassigned);
|
||||
|
||||
quint16 assignmentServerPort = DEFAULT_DOMAIN_SERVER_PORT;
|
||||
|
||||
|
@ -136,7 +139,7 @@ AssignmentClient::AssignmentClient(int &argc, char **argv) :
|
|||
void AssignmentClient::sendAssignmentRequest() {
|
||||
if (!_currentAssignment) {
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
if (_assignmentServerHostname == "localhost") {
|
||||
// we want to check again for the local domain-server port in case the DS has restarted
|
||||
|
@ -173,7 +176,7 @@ void AssignmentClient::sendAssignmentRequest() {
|
|||
}
|
||||
|
||||
void AssignmentClient::readPendingDatagrams() {
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
QByteArray receivedPacket;
|
||||
HifiSockAddr senderSockAddr;
|
||||
|
@ -260,7 +263,7 @@ void AssignmentClient::assignmentCompleted() {
|
|||
|
||||
qDebug("Assignment finished or never started - waiting for new assignment.");
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
// have us handle incoming NodeList datagrams again
|
||||
disconnect(&nodeList->getNodeSocket(), 0, _currentAssignment.data(), 0);
|
||||
|
|
|
@ -442,7 +442,7 @@ int AudioMixer::prepareMixForListeningNode(Node* node) {
|
|||
// loop through all other nodes that have sufficient audio to mix
|
||||
int streamsMixed = 0;
|
||||
|
||||
NodeList::getInstance()->eachNode([&](const SharedNodePointer& otherNode){
|
||||
DependencyManager::get<NodeList>()->eachNode([&](const SharedNodePointer& otherNode){
|
||||
if (otherNode->getLinkedData()) {
|
||||
AudioMixerClientData* otherNodeClientData = (AudioMixerClientData*) otherNode->getLinkedData();
|
||||
|
||||
|
@ -522,12 +522,12 @@ void AudioMixer::sendAudioEnvironmentPacket(SharedNodePointer node) {
|
|||
memcpy(envDataAt, &wetLevel, sizeof(float));
|
||||
envDataAt += sizeof(float);
|
||||
}
|
||||
NodeList::getInstance()->writeDatagram(clientEnvBuffer, envDataAt - clientEnvBuffer, node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram(clientEnvBuffer, envDataAt - clientEnvBuffer, node);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioMixer::readPendingDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr) {
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
// pull any new audio data from nodes off of the network stack
|
||||
|
@ -608,7 +608,7 @@ void AudioMixer::sendStatsPacket() {
|
|||
somethingToSend = true;
|
||||
sizeOfStats += property.size() + value.size();
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
int clientNumber = 0;
|
||||
|
||||
|
||||
|
@ -641,7 +641,7 @@ void AudioMixer::run() {
|
|||
|
||||
ThreadedAssignment::commonInit(AUDIO_MIXER_LOGGING_TARGET_NAME, NodeType::AudioMixer);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
// we do not want this event loop to be the handler for UDP datagrams, so disconnect
|
||||
disconnect(&nodeList->getNodeSocket(), 0, this, 0);
|
||||
|
@ -894,7 +894,7 @@ void AudioMixer::perSecondActions() {
|
|||
_timeSpentPerHashMatchCallStats.getWindowSum() / WINDOW_LENGTH_USECS * 100.0,
|
||||
_timeSpentPerHashMatchCallStats.getCurrentIntervalSum() / USECS_PER_SECOND * 100.0);
|
||||
|
||||
NodeList::getInstance()->eachNode([](const SharedNodePointer& node) {
|
||||
DependencyManager::get<NodeList>()->eachNode([](const SharedNodePointer& node) {
|
||||
if (node->getLinkedData()) {
|
||||
AudioMixerClientData* nodeData = (AudioMixerClientData*)node->getLinkedData();
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ void AudioMixerClientData::sendAudioStreamStatsPackets(const SharedNodePointer&
|
|||
removeDeadInjectedStreams();
|
||||
|
||||
char packet[MAX_PACKET_SIZE];
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
// The append flag is a boolean value that will be packed right after the header. The first packet sent
|
||||
// inside this method will have 0 for this flag, while every subsequent packet will have 1 for this flag.
|
||||
|
|
|
@ -41,7 +41,7 @@ AvatarMixer::AvatarMixer(const QByteArray& packet) :
|
|||
_sumIdentityPackets(0)
|
||||
{
|
||||
// make sure we hear about node kills so we can tell the other nodes
|
||||
connect(NodeList::getInstance(), &NodeList::nodeKilled, this, &AvatarMixer::nodeKilled);
|
||||
connect(DependencyManager::get<NodeList>().data(), &NodeList::nodeKilled, this, &AvatarMixer::nodeKilled);
|
||||
}
|
||||
|
||||
AvatarMixer::~AvatarMixer() {
|
||||
|
@ -117,7 +117,7 @@ void AvatarMixer::broadcastAvatarData() {
|
|||
|
||||
int numPacketHeaderBytes = populatePacketHeader(mixedAvatarByteArray, PacketTypeBulkAvatarData);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
AvatarMixerClientData* nodeData = NULL;
|
||||
AvatarMixerClientData* otherNodeData = NULL;
|
||||
|
@ -222,7 +222,7 @@ void AvatarMixer::nodeKilled(SharedNodePointer killedNode) {
|
|||
QByteArray killPacket = byteArrayWithPopulatedHeader(PacketTypeKillAvatar);
|
||||
killPacket += killedNode->getUUID().toRfc4122();
|
||||
|
||||
NodeList::getInstance()->broadcastToNodes(killPacket,
|
||||
DependencyManager::get<NodeList>()->broadcastToNodes(killPacket,
|
||||
NodeSet() << NodeType::Agent);
|
||||
}
|
||||
}
|
||||
|
@ -231,7 +231,7 @@ void AvatarMixer::readPendingDatagrams() {
|
|||
QByteArray receivedPacket;
|
||||
HifiSockAddr senderSockAddr;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
while (readAvailableDatagram(receivedPacket, senderSockAddr)) {
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
|
@ -309,7 +309,7 @@ void AvatarMixer::sendStatsPacket() {
|
|||
void AvatarMixer::run() {
|
||||
ThreadedAssignment::commonInit(AVATAR_MIXER_LOGGING_NAME, NodeType::AvatarMixer);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
||||
|
||||
nodeList->linkedDataCreateCallback = attachAvatarDataToNode;
|
||||
|
|
|
@ -76,7 +76,7 @@ void EntityServer::entityCreated(const EntityItem& newEntity, const SharedNodePo
|
|||
copyAt += sizeof(entityID);
|
||||
packetLength += sizeof(entityID);
|
||||
|
||||
NodeList::getInstance()->writeDatagram((char*) outputBuffer, packetLength, senderNode);
|
||||
DependencyManager::get<NodeList>()->writeDatagram((char*) outputBuffer, packetLength, senderNode);
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +114,8 @@ int EntityServer::sendSpecialPacket(const SharedNodePointer& node, OctreeQueryNo
|
|||
hasMoreToSend = tree->encodeEntitiesDeletedSince(queryNode->getSequenceNumber(), deletedEntitiesSentAt,
|
||||
outputBuffer, MAX_PACKET_SIZE, packetLength);
|
||||
|
||||
NodeList::getInstance()->writeDatagram((char*) outputBuffer, packetLength, SharedNodePointer(node));
|
||||
DependencyManager::get<NodeList>()->writeDatagram((char*) outputBuffer, packetLength,
|
||||
SharedNodePointer(node));
|
||||
queryNode->packetSent(outputBuffer, packetLength);
|
||||
packetsSent++;
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ void EntityServer::pruneDeletedEntities() {
|
|||
|
||||
quint64 earliestLastDeletedEntitiesSent = usecTimestampNow() + 1; // in the future
|
||||
|
||||
NodeList::getInstance()->eachNode([&earliestLastDeletedEntitiesSent](const SharedNodePointer& node) {
|
||||
DependencyManager::get<NodeList>()->eachNode([&earliestLastDeletedEntitiesSent](const SharedNodePointer& node) {
|
||||
if (node->getLinkedData()) {
|
||||
EntityNodeData* nodeData = static_cast<EntityNodeData*>(node->getLinkedData());
|
||||
quint64 nodeLastDeletedEntitiesSentAt = nodeData->getLastDeletedEntitiesSentAt();
|
||||
|
|
|
@ -60,11 +60,11 @@ const QString METAVOXEL_SERVER_LOGGING_NAME = "metavoxel-server";
|
|||
void MetavoxelServer::run() {
|
||||
commonInit(METAVOXEL_SERVER_LOGGING_NAME, NodeType::MetavoxelServer);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->addNodeTypeToInterestSet(NodeType::Agent);
|
||||
|
||||
connect(nodeList, &NodeList::nodeAdded, this, &MetavoxelServer::maybeAttachSession);
|
||||
connect(nodeList, &NodeList::nodeKilled, this, &MetavoxelServer::maybeDeleteSession);
|
||||
connect(nodeList.data(), &NodeList::nodeAdded, this, &MetavoxelServer::maybeAttachSession);
|
||||
connect(nodeList.data(), &NodeList::nodeKilled, this, &MetavoxelServer::maybeDeleteSession);
|
||||
|
||||
// initialize Bitstream before using it in multiple threads
|
||||
Bitstream::preThreadingInit();
|
||||
|
@ -101,7 +101,7 @@ void MetavoxelServer::readPendingDatagrams() {
|
|||
QByteArray receivedPacket;
|
||||
HifiSockAddr senderSockAddr;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
while (readAvailableDatagram(receivedPacket, senderSockAddr)) {
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
|
|
|
@ -261,7 +261,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
continue;
|
||||
}
|
||||
|
||||
const SharedNodePointer& destinationNode = NodeList::getInstance()->nodeWithUUID(nodeUUID);
|
||||
const SharedNodePointer& destinationNode = DependencyManager::get<NodeList>()->nodeWithUUID(nodeUUID);
|
||||
|
||||
// retrieve sequence number stats of node, prune its missing set
|
||||
SequenceNumberStats& sequenceNumberStats = nodeStats.getIncomingEditSequenceNumberStats();
|
||||
|
@ -299,7 +299,7 @@ int OctreeInboundPacketProcessor::sendNackPackets() {
|
|||
numSequenceNumbersAvailable -= numSequenceNumbers;
|
||||
|
||||
// send it
|
||||
NodeList::getInstance()->writeUnverifiedDatagram(packet, dataAt - packet, destinationNode);
|
||||
DependencyManager::get<NodeList>()->writeUnverifiedDatagram(packet, dataAt - packet, destinationNode);
|
||||
packetsSent++;
|
||||
|
||||
qDebug() << "NACK Sent back to editor/client... destinationNode=" << nodeUUID;
|
||||
|
|
|
@ -179,12 +179,12 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
|||
|
||||
// actually send it
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram((char*) statsMessage, statsMessageLength, _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram((char*) statsMessage, statsMessageLength, _node);
|
||||
packetSent = true;
|
||||
} else {
|
||||
// not enough room in the packet, send two packets
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram((char*) statsMessage, statsMessageLength, _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram((char*) statsMessage, statsMessageLength, _node);
|
||||
|
||||
// since a stats message is only included on end of scene, don't consider any of these bytes "wasted", since
|
||||
// there was nothing else to send.
|
||||
|
@ -213,7 +213,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
|||
packetsSent++;
|
||||
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
packetSent = true;
|
||||
|
||||
thisWastedBytes = MAX_PACKET_SIZE - nodeData->getPacketLength();
|
||||
|
@ -242,7 +242,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes
|
|||
if (nodeData->isPacketWaiting() && !nodeData->isShuttingDown()) {
|
||||
// just send the octree packet
|
||||
OctreeServer::didCallWriteDatagram(this);
|
||||
NodeList::getInstance()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node);
|
||||
packetSent = true;
|
||||
|
||||
int thisWastedBytes = MAX_PACKET_SIZE - nodeData->getPacketLength();
|
||||
|
@ -575,7 +575,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus
|
|||
while (nodeData->hasNextNackedPacket() && packetsSentThisInterval < maxPacketsPerInterval) {
|
||||
const QByteArray* packet = nodeData->getNextNackedPacket();
|
||||
if (packet) {
|
||||
NodeList::getInstance()->writeDatagram(*packet, _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram(*packet, _node);
|
||||
truePacketsSent++;
|
||||
packetsSentThisInterval++;
|
||||
|
||||
|
|
|
@ -830,7 +830,7 @@ void OctreeServer::parsePayload() {
|
|||
}
|
||||
|
||||
void OctreeServer::readPendingDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr) {
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
PacketType packetType = packetTypeForPacket(receivedPacket);
|
||||
|
@ -866,13 +866,13 @@ void OctreeServer::readPendingDatagram(const QByteArray& receivedPacket, const H
|
|||
_octreeInboundPacketProcessor->queueReceivedPacket(matchingNode, receivedPacket);
|
||||
} else {
|
||||
// let processNodeData handle it.
|
||||
NodeList::getInstance()->processNodeData(senderSockAddr, receivedPacket);
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, receivedPacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OctreeServer::setupDatagramProcessingThread() {
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
// we do not want this event loop to be the handler for UDP datagrams, so disconnect
|
||||
disconnect(&nodeList->getNodeSocket(), 0, this, 0);
|
||||
|
@ -961,7 +961,7 @@ void OctreeServer::readConfiguration() {
|
|||
}
|
||||
|
||||
// wait until we have the domain-server settings, otherwise we bail
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
DomainHandler& domainHandler = nodeList->getDomainHandler();
|
||||
|
||||
qDebug() << "Waiting for domain settings from domain-server.";
|
||||
|
@ -1096,7 +1096,7 @@ void OctreeServer::run() {
|
|||
_tree->setIsServer(true);
|
||||
|
||||
// make sure our NodeList knows what type we are
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->setOwnerType(getMyNodeType());
|
||||
|
||||
|
||||
|
@ -1110,8 +1110,8 @@ void OctreeServer::run() {
|
|||
|
||||
beforeRun(); // after payload has been processed
|
||||
|
||||
connect(nodeList, SIGNAL(nodeAdded(SharedNodePointer)), SLOT(nodeAdded(SharedNodePointer)));
|
||||
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)),SLOT(nodeKilled(SharedNodePointer)));
|
||||
connect(nodeList.data(), SIGNAL(nodeAdded(SharedNodePointer)), SLOT(nodeAdded(SharedNodePointer)));
|
||||
connect(nodeList.data(), SIGNAL(nodeKilled(SharedNodePointer)),SLOT(nodeKilled(SharedNodePointer)));
|
||||
|
||||
|
||||
// we need to ask the DS about agents so we can ping/reply with them
|
||||
|
@ -1212,7 +1212,7 @@ void OctreeServer::aboutToFinish() {
|
|||
qDebug() << qPrintable(_safeServerName) << "inform Octree Inbound Packet Processor that we are shutting down...";
|
||||
_octreeInboundPacketProcessor->shuttingDown();
|
||||
|
||||
NodeList::getInstance()->eachNode([this](const SharedNodePointer& node) {
|
||||
DependencyManager::get<NodeList>()->eachNode([this](const SharedNodePointer& node) {
|
||||
qDebug() << qPrintable(_safeServerName) << "server about to finish while node still connected node:" << *node;
|
||||
forceNodeShutdown(node);
|
||||
});
|
||||
|
@ -1377,7 +1377,7 @@ void OctreeServer::sendStatsPacket() {
|
|||
statsObject2[baseName + QString(".2.outbound.timing.5.avgSendTime")] = getAveragePacketSendingTime();
|
||||
statsObject2[baseName + QString(".2.outbound.timing.5.nodeWaitTime")] = getAverageNodeWaitTime();
|
||||
|
||||
NodeList::getInstance()->sendStatsToDomainServer(statsObject2);
|
||||
DependencyManager::get<NodeList>()->sendStatsToDomainServer(statsObject2);
|
||||
|
||||
static QJsonObject statsObject3;
|
||||
|
||||
|
@ -1396,7 +1396,7 @@ void OctreeServer::sendStatsPacket() {
|
|||
statsObject3[baseName + QString(".3.inbound.timing.5.avgLockWaitTimePerElement")] =
|
||||
(double)_octreeInboundPacketProcessor->getAverageLockWaitTimePerElement();
|
||||
|
||||
NodeList::getInstance()->sendStatsToDomainServer(statsObject3);
|
||||
DependencyManager::get<NodeList>()->sendStatsToDomainServer(statsObject3);
|
||||
}
|
||||
|
||||
QMap<OctreeSendThread*, quint64> OctreeServer::_threadsDidProcess;
|
||||
|
|
|
@ -45,7 +45,7 @@ void OctreeServerDatagramProcessor::readPendingDatagrams() {
|
|||
|
||||
PacketType packetType = packetTypeForPacket(incomingPacket);
|
||||
if (packetType == PacketTypePing) {
|
||||
NodeList::getInstance()->processNodeData(senderSockAddr, incomingPacket);
|
||||
DependencyManager::get<NodeList>()->processNodeData(senderSockAddr, incomingPacket);
|
||||
return; // don't emit
|
||||
}
|
||||
|
||||
|
|
33
cmake/modules/FindRSSDK.cmake
Normal file
33
cmake/modules/FindRSSDK.cmake
Normal file
|
@ -0,0 +1,33 @@
|
|||
# Try to find the RSSDK library
|
||||
#
|
||||
# You must provide a RSSDK_ROOT_DIR which contains lib and include directories
|
||||
#
|
||||
# Once done this will define
|
||||
#
|
||||
# RSSDK_FOUND - system found RSSDK
|
||||
# RSSDK_INCLUDE_DIRS - the RSSDK include directory
|
||||
# RSSDK_LIBRARIES - Link this to use RSSDK
|
||||
#
|
||||
# Created on 12/7/2014 by Thijs Wenker
|
||||
# Copyright (c) 2014 High Fidelity
|
||||
#
|
||||
|
||||
include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
|
||||
hifi_library_search_hints("rssdk")
|
||||
|
||||
find_path(RSSDK_INCLUDE_DIRS pxcbase.h PATH_SUFFIXES include HINTS ${RSSDK_SEARCH_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
find_library(RSSDK_LIBRARY_DEBUG libpxc_d PATH_SUFFIXES lib/Win32 HINTS ${RSSDK_SEARCH_DIRS})
|
||||
find_library(RSSDK_LIBRARY_RELEASE libpxc PATH_SUFFIXES lib/Win32 HINTS ${RSSDK_SEARCH_DIRS})
|
||||
endif ()
|
||||
|
||||
include(SelectLibraryConfigurations)
|
||||
select_library_configurations(RSSDK)
|
||||
|
||||
set(RSSDK_LIBRARIES "${RSSDK_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(RSSDK DEFAULT_MSG RSSDK_INCLUDE_DIRS RSSDK_LIBRARIES)
|
||||
|
||||
mark_as_advanced(RSSDK_INCLUDE_DIRS RSSDK_LIBRARIES RSSDK_SEARCH_DIRS)
|
|
@ -237,7 +237,7 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
|||
// check for scripts the user wants to persist from their domain-server config
|
||||
populateStaticScriptedAssignmentsFromSettings();
|
||||
|
||||
LimitedNodeList* nodeList = LimitedNodeList::createInstance(domainServerPort, domainServerDTLSPort);
|
||||
auto nodeList = DependencyManager::set<LimitedNodeList>(domainServerPort, domainServerDTLSPort);
|
||||
|
||||
// no matter the local port, save it to shared mem so that local assignment clients can ask what it is
|
||||
QSharedMemory* sharedPortMem = new QSharedMemory(DOMAIN_SERVER_LOCAL_PORT_SMEM_KEY, this);
|
||||
|
@ -262,11 +262,11 @@ void DomainServer::setupNodeListAndAssignments(const QUuid& sessionUUID) {
|
|||
nodeList->setSessionUUID(idValueVariant->toString());
|
||||
}
|
||||
|
||||
connect(nodeList, &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
||||
connect(nodeList, &LimitedNodeList::nodeKilled, this, &DomainServer::nodeKilled);
|
||||
connect(nodeList.data(), &LimitedNodeList::nodeAdded, this, &DomainServer::nodeAdded);
|
||||
connect(nodeList.data(), &LimitedNodeList::nodeKilled, this, &DomainServer::nodeKilled);
|
||||
|
||||
QTimer* silentNodeTimer = new QTimer(this);
|
||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||
|
||||
connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(readAvailableDatagrams()));
|
||||
|
@ -346,8 +346,7 @@ bool DomainServer::optionallySetupAssignmentPayment() {
|
|||
}
|
||||
|
||||
void DomainServer::setupAutomaticNetworking() {
|
||||
|
||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
const int STUN_REFLEXIVE_KEEPALIVE_INTERVAL_MSECS = 10 * 1000;
|
||||
const int STUN_IP_ADDRESS_CHECK_INTERVAL_MSECS = 30 * 1000;
|
||||
|
@ -368,8 +367,10 @@ void DomainServer::setupAutomaticNetworking() {
|
|||
iceHeartbeatTimer->start(ICE_HEARBEAT_INTERVAL_MSECS);
|
||||
|
||||
// call our sendHeartbeatToIceServer immediately anytime a local or public socket changes
|
||||
connect(nodeList, &LimitedNodeList::localSockAddrChanged, this, &DomainServer::sendHeartbeatToIceServer);
|
||||
connect(nodeList, &LimitedNodeList::publicSockAddrChanged, this, &DomainServer::sendHeartbeatToIceServer);
|
||||
connect(nodeList.data(), &LimitedNodeList::localSockAddrChanged,
|
||||
this, &DomainServer::sendHeartbeatToIceServer);
|
||||
connect(nodeList.data(), &LimitedNodeList::publicSockAddrChanged,
|
||||
this, &DomainServer::sendHeartbeatToIceServer);
|
||||
|
||||
// attempt to update our public socket now, this will send a heartbeat once we get public socket
|
||||
requestCurrentPublicSocketViaSTUN();
|
||||
|
@ -400,7 +401,8 @@ void DomainServer::setupAutomaticNetworking() {
|
|||
dynamicIPTimer->start(STUN_IP_ADDRESS_CHECK_INTERVAL_MSECS);
|
||||
|
||||
// send public socket changes to the data server so nodes can find us at our new IP
|
||||
connect(nodeList, &LimitedNodeList::publicSockAddrChanged, this, &DomainServer::performIPAddressUpdate);
|
||||
connect(nodeList.data(), &LimitedNodeList::publicSockAddrChanged,
|
||||
this, &DomainServer::performIPAddressUpdate);
|
||||
|
||||
// attempt to update our sockets now
|
||||
requestCurrentPublicSocketViaSTUN();
|
||||
|
@ -617,7 +619,7 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock
|
|||
QByteArray usernameRequestByteArray = byteArrayWithPopulatedHeader(PacketTypeDomainConnectionDenied);
|
||||
|
||||
// send this oauth request datagram back to the client
|
||||
LimitedNodeList::getInstance()->writeUnverifiedDatagram(usernameRequestByteArray, senderSockAddr);
|
||||
DependencyManager::get<LimitedNodeList>()->writeUnverifiedDatagram(usernameRequestByteArray, senderSockAddr);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -637,7 +639,7 @@ void DomainServer::handleConnectRequest(const QByteArray& packet, const HifiSock
|
|||
}
|
||||
|
||||
|
||||
SharedNodePointer newNode = LimitedNodeList::getInstance()->addOrUpdateNode(nodeUUID, nodeType,
|
||||
SharedNodePointer newNode = DependencyManager::get<LimitedNodeList>()->addOrUpdateNode(nodeUUID, nodeType,
|
||||
publicSockAddr, localSockAddr);
|
||||
// when the newNode is created the linked data is also created
|
||||
// if this was a static assignment set the UUID, set the sendingSockAddr
|
||||
|
@ -670,7 +672,7 @@ bool DomainServer::shouldAllowConnectionFromNode(const QString& username,
|
|||
QStringList allowedUsers = allowedUsersVariant ? allowedUsersVariant->toStringList() : QStringList();
|
||||
|
||||
// we always let in a user who is sending a packet from our local socket or from the localhost address
|
||||
if (senderSockAddr.getAddress() == LimitedNodeList::getInstance()->getLocalSockAddr().getAddress()
|
||||
if (senderSockAddr.getAddress() == DependencyManager::get<LimitedNodeList>()->getLocalSockAddr().getAddress()
|
||||
|| senderSockAddr.getAddress() == QHostAddress::LocalHost) {
|
||||
return true;
|
||||
}
|
||||
|
@ -843,8 +845,8 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
|||
int numBroadcastPacketLeadBytes = broadcastDataStream.device()->pos();
|
||||
|
||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||
|
||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
// if we've established a connection via ICE with this peer, use that socket
|
||||
// otherwise just try to reply back to them on their sending socket (although that may not work)
|
||||
|
@ -910,7 +912,7 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
|||
}
|
||||
|
||||
void DomainServer::readAvailableDatagrams() {
|
||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
HifiSockAddr senderSockAddr;
|
||||
QByteArray receivedPacket;
|
||||
|
@ -998,7 +1000,7 @@ void DomainServer::readAvailableDatagrams() {
|
|||
|
||||
void DomainServer::setupPendingAssignmentCredits() {
|
||||
// enumerate the NodeList to find the assigned nodes
|
||||
NodeList::getInstance()->eachNode([&](const SharedNodePointer& node){
|
||||
DependencyManager::get<LimitedNodeList>()->eachNode([&](const SharedNodePointer& node){
|
||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||
|
||||
if (!nodeData->getAssignmentUUID().isNull() && !nodeData->getWalletUUID().isNull()) {
|
||||
|
@ -1112,7 +1114,7 @@ void DomainServer::transactionJSONCallback(const QJsonObject& data) {
|
|||
}
|
||||
|
||||
void DomainServer::requestCurrentPublicSocketViaSTUN() {
|
||||
LimitedNodeList::getInstance()->sendSTUNRequest();
|
||||
DependencyManager::get<LimitedNodeList>()->sendSTUNRequest();
|
||||
}
|
||||
|
||||
QJsonObject jsonForDomainSocketUpdate(const HifiSockAddr& socket) {
|
||||
|
@ -1134,7 +1136,8 @@ void DomainServer::performIPAddressUpdate(const HifiSockAddr& newPublicSockAddr)
|
|||
|
||||
void DomainServer::sendHeartbeatToDataServer(const QString& networkAddress) {
|
||||
const QString DOMAIN_UPDATE = "/api/v1/domains/%1";
|
||||
const QUuid& domainID = LimitedNodeList::getInstance()->getSessionUUID();
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
const QUuid& domainID = nodeList->getSessionUUID();
|
||||
|
||||
// setup the domain object to send to the data server
|
||||
const QString PUBLIC_NETWORK_ADDRESS_KEY = "network_address";
|
||||
|
@ -1158,7 +1161,7 @@ void DomainServer::sendHeartbeatToDataServer(const QString& networkAddress) {
|
|||
// add the number of currently connected agent users
|
||||
int numConnectedAuthedUsers = 0;
|
||||
|
||||
NodeList::getInstance()->eachNode([&numConnectedAuthedUsers](const SharedNodePointer& node){
|
||||
nodeList->eachNode([&numConnectedAuthedUsers](const SharedNodePointer& node){
|
||||
if (node->getLinkedData() && !static_cast<DomainServerNodeData*>(node->getLinkedData())->getUsername().isEmpty()) {
|
||||
++numConnectedAuthedUsers;
|
||||
}
|
||||
|
@ -1187,11 +1190,11 @@ void DomainServer::performICEUpdates() {
|
|||
}
|
||||
|
||||
void DomainServer::sendHeartbeatToIceServer() {
|
||||
LimitedNodeList::getInstance()->sendHeartbeatToIceServer(_iceServerSocket);
|
||||
DependencyManager::get<LimitedNodeList>()->sendHeartbeatToIceServer(_iceServerSocket);
|
||||
}
|
||||
|
||||
void DomainServer::sendICEPingPackets() {
|
||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
QHash<QUuid, NetworkPeer>::iterator peer = _connectingICEPeers.begin();
|
||||
|
||||
|
@ -1259,7 +1262,7 @@ void DomainServer::processICEPingReply(const QByteArray& packet, const HifiSockA
|
|||
}
|
||||
|
||||
void DomainServer::processDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr) {
|
||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(receivedPacket)) {
|
||||
PacketType requestType = packetTypeForPacket(receivedPacket);
|
||||
|
@ -1410,6 +1413,8 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
|
||||
const QString UUID_REGEX_STRING = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
|
||||
|
||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||
|
||||
// allow sub-handlers to handle requests that do not require authentication
|
||||
if (_settingsManager.handlePublicHTTPRequest(connection, url)) {
|
||||
return true;
|
||||
|
@ -1452,7 +1457,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
const QString URI_ID = "/id";
|
||||
if (connection->requestOperation() == QNetworkAccessManager::GetOperation
|
||||
&& url.path() == URI_ID) {
|
||||
QUuid domainID = LimitedNodeList::getInstance()->getSessionUUID();
|
||||
QUuid domainID = nodeList->getSessionUUID();
|
||||
|
||||
connection->respond(HTTPConnection::StatusCode200, uuidStringWithoutCurlyBraces(domainID).toLocal8Bit());
|
||||
return true;
|
||||
|
@ -1474,7 +1479,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
QJsonObject assignedNodesJSON;
|
||||
|
||||
// enumerate the NodeList to find the assigned nodes
|
||||
NodeList::getInstance()->eachNode([this, &assignedNodesJSON](const SharedNodePointer& node){
|
||||
nodeList->eachNode([this, &assignedNodesJSON](const SharedNodePointer& node){
|
||||
DomainServerNodeData* nodeData = reinterpret_cast<DomainServerNodeData*>(node->getLinkedData());
|
||||
|
||||
if (!nodeData->getAssignmentUUID().isNull()) {
|
||||
|
@ -1536,7 +1541,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
QJsonArray nodesJSONArray;
|
||||
|
||||
// enumerate the NodeList to find the assigned nodes
|
||||
LimitedNodeList::getInstance()->eachNode([this, &nodesJSONArray](const SharedNodePointer& node){
|
||||
nodeList->eachNode([this, &nodesJSONArray](const SharedNodePointer& node){
|
||||
// add the node using the UUID as the key
|
||||
nodesJSONArray.append(jsonObjectForNode(node));
|
||||
});
|
||||
|
@ -1559,7 +1564,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
QUuid matchingUUID = QUuid(nodeShowRegex.cap(1));
|
||||
|
||||
// see if we have a node that matches this ID
|
||||
SharedNodePointer matchingNode = LimitedNodeList::getInstance()->nodeWithUUID(matchingUUID);
|
||||
SharedNodePointer matchingNode = nodeList->nodeWithUUID(matchingUUID);
|
||||
if (matchingNode) {
|
||||
// create a QJsonDocument with the stats QJsonObject
|
||||
QJsonObject statsObject =
|
||||
|
@ -1653,14 +1658,14 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
// pull the captured string, if it exists
|
||||
QUuid deleteUUID = QUuid(nodeDeleteRegex.cap(1));
|
||||
|
||||
SharedNodePointer nodeToKill = LimitedNodeList::getInstance()->nodeWithUUID(deleteUUID);
|
||||
SharedNodePointer nodeToKill = nodeList->nodeWithUUID(deleteUUID);
|
||||
|
||||
if (nodeToKill) {
|
||||
// start with a 200 response
|
||||
connection->respond(HTTPConnection::StatusCode200);
|
||||
|
||||
// we have a valid UUID and node - kill the node that has this assignment
|
||||
QMetaObject::invokeMethod(LimitedNodeList::getInstance(), "killNodeWithUUID", Q_ARG(const QUuid&, deleteUUID));
|
||||
QMetaObject::invokeMethod(nodeList.data(), "killNodeWithUUID", Q_ARG(const QUuid&, deleteUUID));
|
||||
|
||||
// successfully processed request
|
||||
return true;
|
||||
|
@ -1669,7 +1674,7 @@ bool DomainServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url
|
|||
return true;
|
||||
} else if (allNodesDeleteRegex.indexIn(url.path()) != -1) {
|
||||
qDebug() << "Received request to kill all nodes.";
|
||||
LimitedNodeList::getInstance()->eraseAllNodes();
|
||||
nodeList->eraseAllNodes();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1989,7 +1994,7 @@ void DomainServer::nodeKilled(SharedNodePointer node) {
|
|||
|
||||
// cleanup the connection secrets that we set up for this node (on the other nodes)
|
||||
foreach (const QUuid& otherNodeSessionUUID, nodeData->getSessionSecretHash().keys()) {
|
||||
SharedNodePointer otherNode = LimitedNodeList::getInstance()->nodeWithUUID(otherNodeSessionUUID);
|
||||
SharedNodePointer otherNode = DependencyManager::get<LimitedNodeList>()->nodeWithUUID(otherNodeSessionUUID);
|
||||
if (otherNode) {
|
||||
reinterpret_cast<DomainServerNodeData*>(otherNode->getLinkedData())->getSessionSecretHash().remove(node->getUUID());
|
||||
}
|
||||
|
@ -2072,7 +2077,7 @@ void DomainServer::addStaticAssignmentsToQueue() {
|
|||
// add any of the un-matched static assignments to the queue
|
||||
|
||||
// enumerate the nodes and check if there is one with an attached assignment with matching UUID
|
||||
if (!NodeList::getInstance()->nodeWithUUID(staticAssignment->data()->getUUID())) {
|
||||
if (!DependencyManager::get<LimitedNodeList>()->nodeWithUUID(staticAssignment->data()->getUUID())) {
|
||||
// this assignment has not been fulfilled - reset the UUID and add it to the assignment queue
|
||||
refreshStaticAssignmentAndAddToQueue(*staticAssignment);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
// Set the following variables to the right value
|
||||
var NUM_AC = 3; // This is the number of AC. Their ID need to be unique and between 0 (included) and NUM_AC (excluded)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
// Set the following variables to the values needed
|
||||
var filename = HIFI_PUBLIC_BUCKET + "ozan/bartender.rec";
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
//
|
||||
|
||||
//For procedural walk animation
|
||||
Script.include("../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
Script.include(HIFI_PUBLIC_BUCKET + "scripts/proceduralAnimationAPI.js");
|
||||
|
||||
var procAnimAPI = new ProcAnimAPI();
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
|
||||
//For procedural walk animation
|
||||
Script.include("../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
Script.include("proceduralAnimationAPI.js");
|
||||
|
||||
var procAnimAPI = new ProcAnimAPI();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
function getRandomFloat(min, max) {
|
||||
return Math.random() * (max - min) + min;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var clapAnimation = HIFI_PUBLIC_BUCKET + "animations/ClapAnimations/ClapHands_Standing.fbx";
|
||||
var ANIMATION_FRAMES_PER_CLAP = 10.0;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
function length(v) {
|
||||
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
function length(v) {
|
||||
return Math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
Script.include("../../libraries/toolBars.js");
|
||||
|
||||
const LEFT_PALM = 0;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
function getRandomFloat(min, max) {
|
||||
return Math.random() * (max - min) + min;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var rightHandAnimation = HIFI_PUBLIC_BUCKET + "animations/RightHandAnimPhilip.fbx";
|
||||
var leftHandAnimation = HIFI_PUBLIC_BUCKET + "animations/LeftHandAnimPhilip.fbx";
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
// maybe we should make these constants...
|
||||
var LEFT_PALM = 0;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
const KBD_UPPERCASE_DEFAULT = 0;
|
||||
const KBD_LOWERCASE_DEFAULT = 1;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
Script.include("libraries/stringHelpers.js");
|
||||
Script.include("libraries/dataviewHelpers.js");
|
||||
Script.include("libraries/httpMultiPart.js");
|
||||
|
@ -527,8 +527,15 @@ function mousePressEvent(event) {
|
|||
|
||||
var highlightedEntityID = { isKnownID: false };
|
||||
var mouseCapturedByTool = false;
|
||||
var lastMousePosition = null;
|
||||
var idleMouseTimerId = null;
|
||||
var IDLE_MOUSE_TIMEOUT = 200;
|
||||
|
||||
function mouseMoveEvent(event) {
|
||||
if (idleMouseTimerId) {
|
||||
Script.clearTimeout(idleMouseTimerId);
|
||||
}
|
||||
|
||||
mouseHasMovedSincePress = true;
|
||||
if (isActive) {
|
||||
// allow the selectionDisplay and cameraManager to handle the event first, if it doesn't handle it, then do our own thing
|
||||
|
@ -536,36 +543,48 @@ function mouseMoveEvent(event) {
|
|||
return;
|
||||
}
|
||||
|
||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||
var entityIntersection = Entities.findRayIntersection(pickRay);
|
||||
if (entityIntersection.accurate) {
|
||||
if(highlightedEntityID.isKnownID && highlightedEntityID.id != entityIntersection.entityID.id) {
|
||||
selectionDisplay.unhighlightSelectable(highlightedEntityID);
|
||||
highlightedEntityID = { id: -1, isKnownID: false };
|
||||
}
|
||||
lastMousePosition = { x: event.x, y: event.y };
|
||||
|
||||
var halfDiagonal = Vec3.length(entityIntersection.properties.dimensions) / 2.0;
|
||||
|
||||
var angularSize = 2 * Math.atan(halfDiagonal / Vec3.distance(Camera.getPosition(),
|
||||
entityIntersection.properties.position)) * 180 / 3.14;
|
||||
|
||||
var sizeOK = (allowLargeModels || angularSize < MAX_ANGULAR_SIZE)
|
||||
&& (allowSmallModels || angularSize > MIN_ANGULAR_SIZE);
|
||||
|
||||
if (entityIntersection.entityID.isKnownID && sizeOK) {
|
||||
if (wantEntityGlow) {
|
||||
Entities.editEntity(entityIntersection.entityID, { glowLevel: 0.25 });
|
||||
}
|
||||
highlightedEntityID = entityIntersection.entityID;
|
||||
selectionDisplay.highlightSelectable(entityIntersection.entityID);
|
||||
}
|
||||
|
||||
}
|
||||
highlightEntityUnderCursor(lastMousePosition, false);
|
||||
idleMouseTimerId = Script.setTimeout(handleIdleMouse, IDLE_MOUSE_TIMEOUT);
|
||||
} else {
|
||||
cameraManager.mouseMoveEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
function handleIdleMouse() {
|
||||
idleMouseTimerId = null;
|
||||
highlightEntityUnderCursor(lastMousePosition, true);
|
||||
}
|
||||
|
||||
function highlightEntityUnderCursor(position, accurateRay) {
|
||||
var pickRay = Camera.computePickRay(position.x, position.y);
|
||||
var entityIntersection = Entities.findRayIntersection(pickRay, accurateRay);
|
||||
if (entityIntersection.accurate) {
|
||||
if(highlightedEntityID.isKnownID && highlightedEntityID.id != entityIntersection.entityID.id) {
|
||||
selectionDisplay.unhighlightSelectable(highlightedEntityID);
|
||||
highlightedEntityID = { id: -1, isKnownID: false };
|
||||
}
|
||||
|
||||
var halfDiagonal = Vec3.length(entityIntersection.properties.dimensions) / 2.0;
|
||||
|
||||
var angularSize = 2 * Math.atan(halfDiagonal / Vec3.distance(Camera.getPosition(),
|
||||
entityIntersection.properties.position)) * 180 / 3.14;
|
||||
|
||||
var sizeOK = (allowLargeModels || angularSize < MAX_ANGULAR_SIZE)
|
||||
&& (allowSmallModels || angularSize > MIN_ANGULAR_SIZE);
|
||||
|
||||
if (entityIntersection.entityID.isKnownID && sizeOK) {
|
||||
if (wantEntityGlow) {
|
||||
Entities.editEntity(entityIntersection.entityID, { glowLevel: 0.25 });
|
||||
}
|
||||
highlightedEntityID = entityIntersection.entityID;
|
||||
selectionDisplay.highlightSelectable(entityIntersection.entityID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function mouseReleaseEvent(event) {
|
||||
if (isActive && selectionManager.hasSelection()) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var sound = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/Animals/mexicanWhipoorwill.raw");
|
||||
var CHANCE_OF_PLAYING_SOUND = 0.01;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var modelURL = HIFI_PUBLIC_BUCKET + "models/entities/radio/Speakers.fbx";
|
||||
var soundURL = HIFI_PUBLIC_BUCKET + "sounds/family.stereo.raw";
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var count = 0;
|
||||
var moveUntil = 2000;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var count = 0;
|
||||
var stopAfter = 1000;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var iteration = 0;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
// The "Swatches" example of this script will create 9 different image overlays, that use the color feature to
|
||||
// display different colors as color swatches. The overlays can be clicked on, to change the "selectedSwatch" variable
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
var elGravityY = document.getElementById("property-grav-y");
|
||||
var elGravityZ = document.getElementById("property-grav-z");
|
||||
|
||||
var elMass = document.getElementById("property-mass");
|
||||
var elDensity = document.getElementById("property-density");
|
||||
var elIgnoreForCollisions = document.getElementById("property-ignore-for-collisions");
|
||||
var elCollisionsWillMove = document.getElementById("property-collisions-will-move");
|
||||
var elLifetime = document.getElementById("property-lifetime");
|
||||
|
@ -181,10 +181,10 @@
|
|||
elLocked.checked = properties.locked;
|
||||
|
||||
if (properties.locked) {
|
||||
disableChildren(document.getElementById("properties-table"), 'input');
|
||||
disableChildren(document.getElementById("properties-list"), 'input');
|
||||
elLocked.removeAttribute('disabled');
|
||||
} else {
|
||||
enableChildren(document.getElementById("properties-table"), 'input');
|
||||
enableChildren(document.getElementById("properties-list"), 'input');
|
||||
}
|
||||
|
||||
elVisible.checked = properties.visible;
|
||||
|
@ -219,7 +219,7 @@
|
|||
elGravityY.value = properties.gravity.y.toFixed(2);
|
||||
elGravityZ.value = properties.gravity.z.toFixed(2);
|
||||
|
||||
elMass.value = properties.mass.toFixed(2);
|
||||
elDensity.value = properties.density.toFixed(2);
|
||||
elIgnoreForCollisions.checked = properties.ignoreForCollisions;
|
||||
elCollisionsWillMove.checked = properties.collisionsWillMove;
|
||||
elLifetime.value = properties.lifetime;
|
||||
|
@ -231,7 +231,7 @@
|
|||
}
|
||||
} else {
|
||||
for (var i = 0; i < elBoxSections.length; i++) {
|
||||
elBoxSections[i].style.display = 'table-row';
|
||||
elBoxSections[i].style.display = 'block';
|
||||
}
|
||||
|
||||
elBoxColorRed.value = properties.color.red;
|
||||
|
@ -245,7 +245,7 @@
|
|||
}
|
||||
} else {
|
||||
for (var i = 0; i < elModelSections.length; i++) {
|
||||
elModelSections[i].style.display = 'table-row';
|
||||
elModelSections[i].style.display = 'block';
|
||||
}
|
||||
|
||||
elModelURL.value = properties.modelURL;
|
||||
|
@ -264,7 +264,7 @@
|
|||
}
|
||||
} else {
|
||||
for (var i = 0; i < elTextSections.length; i++) {
|
||||
elTextSections[i].style.display = 'table-row';
|
||||
elTextSections[i].style.display = 'block';
|
||||
}
|
||||
|
||||
elTextText.value = properties.text;
|
||||
|
@ -283,7 +283,7 @@
|
|||
}
|
||||
} else {
|
||||
for (var i = 0; i < elLightSections.length; i++) {
|
||||
elLightSections[i].style.display = 'table-row';
|
||||
elLightSections[i].style.display = 'block';
|
||||
}
|
||||
|
||||
elLightDiffuseRed.value = properties.diffuseColor.red;
|
||||
|
@ -356,7 +356,7 @@
|
|||
elGravityY.addEventListener('change', gravityChangeFunction);
|
||||
elGravityZ.addEventListener('change', gravityChangeFunction);
|
||||
|
||||
elMass.addEventListener('change', createEmitNumberPropertyUpdateFunction('mass'));
|
||||
elDensity.addEventListener('change', createEmitNumberPropertyUpdateFunction('density'));
|
||||
elIgnoreForCollisions.addEventListener('change', createEmitCheckedPropertyUpdateFunction('ignoreForCollisions'));
|
||||
elCollisionsWillMove.addEventListener('change', createEmitCheckedPropertyUpdateFunction('collisionsWillMove'));
|
||||
elLifetime.addEventListener('change', createEmitNumberPropertyUpdateFunction('lifetime'));
|
||||
|
@ -442,117 +442,60 @@
|
|||
percentage: parseInt(elRescaleDimensionsPct.value),
|
||||
}));
|
||||
});
|
||||
|
||||
var resizing = false;
|
||||
var startX = 0;
|
||||
var originalWidth = 0;
|
||||
var resizeHandleWidth = 10;
|
||||
|
||||
var col1 = document.querySelector("#col-label");
|
||||
|
||||
document.body.addEventListener('mousemove', function(event) {
|
||||
if (resizing) {
|
||||
var dX = event.x - startX;
|
||||
col1.style.width = (originalWidth + dX) + "px";
|
||||
}
|
||||
});
|
||||
document.body.addEventListener('mouseup', function(event) {
|
||||
resizing = false;
|
||||
});
|
||||
document.body.addEventListener('mouseleave', function(event) {
|
||||
resizing = false;
|
||||
});
|
||||
var els = document.querySelectorAll("#properties-table td");
|
||||
for (var i = 0; i < els.length; i++) {
|
||||
var el = els[i];
|
||||
el.addEventListener('mousemove', function(event) {
|
||||
if (!resizing) {
|
||||
var distance = this.offsetWidth - event.offsetX;
|
||||
if (distance < resizeHandleWidth) {
|
||||
document.body.style.cursor = "ew-resize";
|
||||
} else {
|
||||
document.body.style.cursor = "initial";
|
||||
}
|
||||
}
|
||||
});
|
||||
el.addEventListener('mousedown', function(event) {
|
||||
var distance = this.offsetWidth - event.offsetX;
|
||||
if (distance < resizeHandleWidth) {
|
||||
startX = event.x;
|
||||
originalWidth = this.offsetWidth;
|
||||
resizing = true;
|
||||
target = this;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload='loaded();'>
|
||||
<div class="section-header">
|
||||
<label>Entity Properties</label>
|
||||
</div>
|
||||
<table id="properties-table">
|
||||
<colgroup>
|
||||
<col id="col-label">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class="label">
|
||||
ID
|
||||
</td>
|
||||
<td>
|
||||
<body class="properties" onload='loaded();'>
|
||||
<div id="properties-list">
|
||||
<div id="type" class="property">
|
||||
<div class="label">
|
||||
<label>Type: </label><span id="property-type"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property">
|
||||
<div class="value">
|
||||
<label id="property-id" class="selectable"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">
|
||||
Type
|
||||
</td>
|
||||
<td>
|
||||
<label id="property-type"></label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Locked</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property">
|
||||
<div class="label">Locked</div>
|
||||
<div class="value">
|
||||
<input type='checkbox' id="property-locked">
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Visible</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Visible</div>
|
||||
<div class="value">
|
||||
<input type='checkbox' id="property-visible">
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Position</td>
|
||||
<td>
|
||||
<div class="input-area">X <input class="coord" type='number' id="property-pos-x"></input></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-pos-y"></input></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-pos-z"></input></div>
|
||||
<div class="property">
|
||||
<div class="label">Position</div>
|
||||
<div class="value">
|
||||
<div class="input-area">X <br><input class="coord" type='number' id="property-pos-x"></input></div>
|
||||
<div class="input-area">Y <br><input class="coord" type='number' id="property-pos-y"></input></div>
|
||||
<div class="input-area">Z <br><input class="coord" type='number' id="property-pos-z"></input></div>
|
||||
<div>
|
||||
<input type="button" id="move-selection-to-grid" value="Selection to Grid">
|
||||
<input type="button" id="move-all-to-grid" value="All to Grid">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Registration</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Registration</div>
|
||||
<div class="value">
|
||||
<div class="input-area">X <input class="coord" type='number' id="property-reg-x"></input></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-reg-y"></input></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-reg-z"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Dimensions</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Dimensions</div>
|
||||
<div class="value">
|
||||
<div class="input-area">X <input class="coord" type='number' id="property-dim-x"></input></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-dim-y"></input></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-dim-z"></input></div>
|
||||
|
@ -560,248 +503,255 @@
|
|||
<input type="button" id="reset-to-natural-dimensions" value="Reset to Natural Dimensions">
|
||||
</div>
|
||||
<div class="input-area">
|
||||
<input class="coord" type='number' id="dimension-rescale-pct" value=100></input>%
|
||||
<input class="" type='number' id="dimension-rescale-pct" value=100></input>%
|
||||
</div>
|
||||
<span>
|
||||
<input type="button" id="dimension-rescale-button" value="Rescale"></input>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Rotation</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Rotation</div>
|
||||
<div class="value">
|
||||
<div class="input-area">Pitch <input class="coord" type='number' id="property-rot-x"></input></div>
|
||||
<div class="input-area">Yaw <input class="coord" type='number' id="property-rot-y"></input></div>
|
||||
<div class="input-area">Roll <input class="coord" type='number' id="property-rot-z"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Linear Velocity</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Linear Velocity</div>
|
||||
<div class="value">
|
||||
<div class="input-area">X <input class="coord" type='number' id="property-lvel-x"></input></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-lvel-y"></input></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-lvel-z"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Linear Damping</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property">
|
||||
<div class="label">Linear Damping</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-ldamping"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Angular Velocity</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property">
|
||||
<div class="label">Angular Velocity</div>
|
||||
<div class="value">
|
||||
<div class="input-area">Pitch <input class="coord" type='number' id="property-avel-x"></input></div>
|
||||
<div class="input-area">Yaw <input class="coord" type='number' id="property-avel-y"></input></div>
|
||||
<div class="input-area">Roll <input class="coord" type='number' id="property-avel-z"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="label">Angular Damping</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="property">
|
||||
<div class="label">Angular Damping</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-adamping"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Gravity</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Gravity</div>
|
||||
<div class="value">
|
||||
<div class="input-area">X <input class="coord" type='number' id="property-grav-x"></input></div>
|
||||
<div class="input-area">Y <input class="coord" type='number' id="property-grav-y"></input></div>
|
||||
<div class="input-area">Z <input class="coord" type='number' id="property-grav-z"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Mass</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Mass</div>
|
||||
<div class="value">
|
||||
<input type='number' id="property-mass"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Ignore For Collisions</td>
|
||||
<td>
|
||||
<div>
|
||||
<div class="label">Density</div>
|
||||
<div>
|
||||
<input type='number' id="property-density"></input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="property">
|
||||
<div class="label">Ignore For Collisions</div>
|
||||
<div class="value">
|
||||
<input type='checkbox' id="property-ignore-for-collisions"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Collisions Will Move</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Collisions Will Move</div>
|
||||
<div class="value">
|
||||
<input type='checkbox' id="property-collisions-will-move"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Lifetime</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Lifetime</div>
|
||||
<div class="value">
|
||||
<input type='number' id="property-lifetime"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr>
|
||||
<td class="label">Script URL</td>
|
||||
<td>
|
||||
<div class="property">
|
||||
<div class="label">Script URL</div>
|
||||
<div class="value">
|
||||
<input id="property-script-url" class="url"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<tr class="box-section">
|
||||
<td class="label">Color</td>
|
||||
<td>
|
||||
<div class="box-section property">
|
||||
<div class="label">Color</div>
|
||||
<div class="value">
|
||||
<div class="input-area">R <input class="coord" type='number' id="property-box-red"></input></div>
|
||||
<div class="input-area">G <input class="coord" type='number' id="property-box-green"></input></div>
|
||||
<div class="input-area">B <input class="coord" type='number' id="property-box-blue"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<tr class="model-section">
|
||||
<td class="label">Model URL</td>
|
||||
<td>
|
||||
<div class="model-section property">
|
||||
<div class="label">Model URL</div>
|
||||
<div class="value">
|
||||
<input type="text" id="property-model-url" class="url"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Animation URL</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Animation URL</div>
|
||||
<div class="value">
|
||||
<input type="text" id="property-model-animation-url" class="url"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Animation Playing</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Animation Playing</div>
|
||||
<div class="value">
|
||||
<input type='checkbox' id="property-model-animation-playing">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Animation FPS</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Animation FPS</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-model-animation-fps"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Animation Frame</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Animation Frame</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-model-animation-frame"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Animation Settings</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Animation Settings</div>
|
||||
<div class="value">
|
||||
<textarea id="property-model-animation-settings" value='asdfasdf'></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Textures</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Textures</div>
|
||||
<div class="value">
|
||||
<textarea id="property-model-textures" value='asdfasdf'></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="model-section">
|
||||
<td class="label">Original Textures</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="model-section property">
|
||||
<div class="label">Original Textures</div>
|
||||
<div class="value">
|
||||
<textarea id="property-model-original-textures" readonly value='asdfasdf'></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<tr class="text-section">
|
||||
<td class="label">Text</td>
|
||||
<td>
|
||||
<div class="text-section property">
|
||||
<div class="label">Text</div>
|
||||
<div class="value">
|
||||
<input type="text" id="property-text-text"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-section">
|
||||
<td class="label">Line Height</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-section property">
|
||||
<div class="label">Line Height</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-text-line-height"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-section">
|
||||
<td class="label">Text Color</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-section property">
|
||||
<div class="label">Text Color</div>
|
||||
<div class="value">
|
||||
<div class="input-area">R <input class="coord" type='number' id="property-text-text-color-red"></input></div>
|
||||
<div class="input-area">G <input class="coord" type='number' id="property-text-text-color-green"></input></div>
|
||||
<div class="input-area">B <input class="coord" type='number' id="property-text-text-color-blue"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-section">
|
||||
<td class="label">Background Color</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-section property">
|
||||
<div class="label">Background Color</div>
|
||||
<div class="value">
|
||||
<div class="input-area">R <input class="coord" type='number' id="property-text-background-color-red"></input></div>
|
||||
<div class="input-area">G <input class="coord" type='number' id="property-text-background-color-green"></input></div>
|
||||
<div class="input-area">B <input class="coord" type='number' id="property-text-background-color-blue"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<tr class="light-section">
|
||||
<td class="label">Spot Light</td>
|
||||
<td>
|
||||
<div class="light-section property">
|
||||
<div class="label">Spot Light</div>
|
||||
<div class="value">
|
||||
<input type='checkbox' id="property-light-spot-light">
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Diffuse</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Diffuse</div>
|
||||
<div class="value">
|
||||
<div class="input-area">R <input class="coord" type='number' id="property-light-diffuse-red"></input></div>
|
||||
<div class="input-area">G <input class="coord" type='number' id="property-light-diffuse-green"></input></div>
|
||||
<div class="input-area">B <input class="coord" type='number' id="property-light-diffuse-blue"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Ambient</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Ambient</div>
|
||||
<div class="value">
|
||||
<div class="input-area">R <input class="coord" type='number' id="property-light-ambient-red"></input></div>
|
||||
<div class="input-area">G <input class="coord" type='number' id="property-light-ambient-green"></input></div>
|
||||
<div class="input-area">B <input class="coord" type='number' id="property-light-ambient-blue"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Specular</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Specular</div>
|
||||
<div class="value">
|
||||
<div class="input-area">R <input class="coord" type='number' id="property-light-specular-red"></input></div>
|
||||
<div class="input-area">G <input class="coord" type='number' id="property-light-specular-green"></input></div>
|
||||
<div class="input-area">B <input class="coord" type='number' id="property-light-specular-blue"></input></div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Constant Attenuation</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Constant Attenuation</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-light-constant-attenuation"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Linear Attenuation</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Linear Attenuation</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-light-linear-attenuation"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Quadratic Attenuation</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Quadratic Attenuation</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-light-quadratic-attenuation"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Exponent</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Exponent</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-light-exponent"></input>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="light-section">
|
||||
<td class="label">Cutoff (degrees)</td>
|
||||
<td>
|
||||
</div>
|
||||
</div>
|
||||
<div class="light-section property">
|
||||
<div class="label">Cutoff (degrees)</div>
|
||||
<div class="value">
|
||||
<input class="coord" type='number' id="property-light-cutoff"></input>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -6,8 +6,8 @@ body {
|
|||
padding: 0;
|
||||
|
||||
background-color: #efefef;
|
||||
font-family: Sans-Serif;
|
||||
font-size: 12px;
|
||||
font-family: Arial;
|
||||
font-size: 11.5px;
|
||||
|
||||
-webkit-touch-callout: none;
|
||||
-webkit-user-select: none;
|
||||
|
@ -17,6 +17,12 @@ body {
|
|||
user-select: none;
|
||||
}
|
||||
|
||||
body.properties {
|
||||
background-color: rgb(76, 76, 76);
|
||||
color: rgb(204, 204, 204);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.selectable {
|
||||
-webkit-touch-callout: text;
|
||||
-webkit-user-select: text;
|
||||
|
@ -85,12 +91,10 @@ input[type=button] {
|
|||
border: 0;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
margin: 0 2px;
|
||||
margin-top: 5px;
|
||||
font-size: .9em;
|
||||
}
|
||||
|
||||
textarea, input {
|
||||
margin: 0;
|
||||
padding: 2px;
|
||||
border: 1px solid #999;
|
||||
background-color: #eee;
|
||||
|
@ -105,10 +109,15 @@ input.url {
|
|||
width: 100%;
|
||||
}
|
||||
|
||||
input.coord {
|
||||
width: 7em;
|
||||
display: block;
|
||||
}
|
||||
|
||||
table#entity-table {
|
||||
border-collapse: collapse;
|
||||
font-family: Sans-Serif;
|
||||
font-size: 12px;
|
||||
/* font-size: 12px; */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
@ -145,31 +154,62 @@ th#entity-url {
|
|||
|
||||
div.input-area {
|
||||
display: inline-block;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
input {
|
||||
}
|
||||
|
||||
#type {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
#type label {
|
||||
color: rgb(150, 150, 150);
|
||||
}
|
||||
|
||||
#properties-list input, #properties-list textarea {
|
||||
background-color: rgb(102, 102, 102);
|
||||
color: rgb(204, 204, 204);
|
||||
border: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
#properties-list input[type=button] {
|
||||
cursor: pointer;
|
||||
background-color: rgb(51, 102, 102);
|
||||
border-color: #608e96;
|
||||
border-radius: 5px;
|
||||
padding: 5px 10px;
|
||||
border: 0;
|
||||
color: rgb(204, 204, 204);
|
||||
}
|
||||
|
||||
#properties-list .property {
|
||||
padding: 8px 8px;
|
||||
border-top: 1px solid rgb(63, 63, 63);
|
||||
min-height: 1em;
|
||||
}
|
||||
|
||||
|
||||
table#properties-table {
|
||||
table#properties-list {
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
width: 100%;
|
||||
background-color: #efefef;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
#properties-table tr {
|
||||
#properties-list > div {
|
||||
margin: 4px 0;
|
||||
}
|
||||
|
||||
#properties-list {
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
}
|
||||
|
||||
#properties-table td.label {
|
||||
padding-right: 10px;
|
||||
border-right: 1px solid #999;
|
||||
text-align: right;
|
||||
#properties-list .label {
|
||||
font-weight: bold;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
|
@ -179,8 +219,8 @@ table#properties-table {
|
|||
height: 1.2em;
|
||||
}
|
||||
|
||||
#properties-table td {
|
||||
padding: 5px;
|
||||
#properties-list .value > div{
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
col#col-label {
|
||||
|
|
|
@ -68,7 +68,7 @@ function Tooltip() {
|
|||
text += "Lifetime: " + properties.lifetime + "\n"
|
||||
}
|
||||
text += "Age: " + properties.ageAsText + "\n"
|
||||
text += "Mass: " + properties.mass + "\n"
|
||||
text += "Density: " + properties.density + "\n"
|
||||
text += "Script: " + properties.script + "\n"
|
||||
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ EntityPropertyDialogBox = (function () {
|
|||
|
||||
array.push({ label: "Collisions:", type: "header" });
|
||||
index++;
|
||||
array.push({ label: "Mass:", value: properties.mass.toFixed(decimals) });
|
||||
array.push({ label: "Density:", value: properties.density.toFixed(decimals) });
|
||||
index++;
|
||||
array.push({ label: "Ignore for Collisions:", type: "checkbox", value: properties.ignoreForCollisions });
|
||||
index++;
|
||||
|
@ -353,7 +353,7 @@ EntityPropertyDialogBox = (function () {
|
|||
properties.gravity.z = array[index++].value;
|
||||
|
||||
index++; // skip header
|
||||
properties.mass = array[index++].value;
|
||||
properties.density = array[index++].value;
|
||||
properties.ignoreForCollisions = array[index++].value;
|
||||
properties.collisionsWillMove = array[index++].value;
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
SPACE_LOCAL = "local";
|
||||
SPACE_WORLD = "world";
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var panelWall = false;
|
||||
var orbShell = false;
|
||||
|
|
525
examples/realsenseHands.js
Normal file
525
examples/realsenseHands.js
Normal file
|
@ -0,0 +1,525 @@
|
|||
//
|
||||
// realsenseHands.js
|
||||
// examples
|
||||
//
|
||||
// Created by Thijs Wenker on 18 Dec 2014.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// This is an example script that uses the Intel RealSense to make the avatar's hands replicate the user's hand actions.
|
||||
// Most of this script is copied from leapHands.js
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
var leapHands = (function () {
|
||||
|
||||
var isOnHMD,
|
||||
MotionTracker = "RealSense",
|
||||
LEAP_ON_HMD_MENU_ITEM = "Leap Motion on HMD",
|
||||
LEAP_OFFSET = 0.019, // Thickness of Leap Motion plus HMD clip
|
||||
HMD_OFFSET = 0.070, // Eyeballs to front surface of Oculus DK2 TODO: Confirm and make depend on device and eye relief
|
||||
hasHandAndWristJoints,
|
||||
handToWristOffset = [], // For avatars without a wrist joint we control an estimate of a proper hand joint position
|
||||
HAND_OFFSET = 0.4, // Relative distance of wrist to hand versus wrist to index finger knuckle
|
||||
hands,
|
||||
wrists,
|
||||
NUM_HANDS = 2, // 0 = left; 1 = right
|
||||
fingers,
|
||||
NUM_FINGERS = 5, // 0 = thumb; ...; 4 = pinky
|
||||
THUMB = 0,
|
||||
MIDDLE_FINGER = 2,
|
||||
NUM_FINGER_JOINTS = 3, // 0 = metacarpal(hand)-proximal(finger) joint; ...; 2 = intermediate-distal joint
|
||||
MAX_HAND_INACTIVE_COUNT = 20,
|
||||
calibrationStatus,
|
||||
UNCALIBRATED = 0,
|
||||
CALIBRATING = 1,
|
||||
CALIBRATED = 2,
|
||||
CALIBRATION_TIME = 1000, // milliseconds
|
||||
avatarScale,
|
||||
avatarFaceModelURL,
|
||||
avatarSkeletonModelURL,
|
||||
settingsTimer;
|
||||
|
||||
function printSkeletonJointNames() {
|
||||
var jointNames,
|
||||
i;
|
||||
|
||||
print(MyAvatar.skeletonModelURL);
|
||||
|
||||
print("Skeleton joint names ...");
|
||||
jointNames = MyAvatar.getJointNames();
|
||||
for (i = 0; i < jointNames.length; i += 1) {
|
||||
print(i + ": " + jointNames[i]);
|
||||
}
|
||||
print("... skeleton joint names");
|
||||
|
||||
/*
|
||||
http://public.highfidelity.io/models/skeletons/ron_standing.fst
|
||||
Skeleton joint names ...
|
||||
0: Hips
|
||||
1: RightUpLeg
|
||||
2: RightLeg
|
||||
3: RightFoot
|
||||
4: RightToeBase
|
||||
5: RightToe_End
|
||||
6: LeftUpLeg
|
||||
7: LeftLeg
|
||||
8: LeftFoot
|
||||
9: LeftToeBase
|
||||
10: LeftToe_End
|
||||
11: Spine
|
||||
12: Spine1
|
||||
13: Spine2
|
||||
14: RightShoulder
|
||||
15: RightArm
|
||||
16: RightForeArm
|
||||
17: RightHand
|
||||
18: RightHandPinky1
|
||||
19: RightHandPinky2
|
||||
20: RightHandPinky3
|
||||
21: RightHandPinky4
|
||||
22: RightHandRing1
|
||||
23: RightHandRing2
|
||||
24: RightHandRing3
|
||||
25: RightHandRing4
|
||||
26: RightHandMiddle1
|
||||
27: RightHandMiddle2
|
||||
28: RightHandMiddle3
|
||||
29: RightHandMiddle4
|
||||
30: RightHandIndex1
|
||||
31: RightHandIndex2
|
||||
32: RightHandIndex3
|
||||
33: RightHandIndex4
|
||||
34: RightHandThumb1
|
||||
35: RightHandThumb2
|
||||
36: RightHandThumb3
|
||||
37: RightHandThumb4
|
||||
38: LeftShoulder
|
||||
39: LeftArm
|
||||
40: LeftForeArm
|
||||
41: LeftHand
|
||||
42: LeftHandPinky1
|
||||
43: LeftHandPinky2
|
||||
44: LeftHandPinky3
|
||||
45: LeftHandPinky4
|
||||
46: LeftHandRing1
|
||||
47: LeftHandRing2
|
||||
48: LeftHandRing3
|
||||
49: LeftHandRing4
|
||||
50: LeftHandMiddle1
|
||||
51: LeftHandMiddle2
|
||||
52: LeftHandMiddle3
|
||||
53: LeftHandMiddle4
|
||||
54: LeftHandIndex1
|
||||
55: LeftHandIndex2
|
||||
56: LeftHandIndex3
|
||||
57: LeftHandIndex4
|
||||
58: LeftHandThumb1
|
||||
59: LeftHandThumb2
|
||||
60: LeftHandThumb3
|
||||
61: LeftHandThumb4
|
||||
62: Neck
|
||||
63: Head
|
||||
64: HeadTop_End
|
||||
65: body
|
||||
... skeleton joint names
|
||||
*/
|
||||
}
|
||||
|
||||
function finishCalibration() {
|
||||
var avatarPosition,
|
||||
handPosition,
|
||||
middleFingerPosition,
|
||||
leapHandHeight,
|
||||
h;
|
||||
|
||||
if (!isOnHMD) {
|
||||
if (hands[0].controller.isActive() && hands[1].controller.isActive()) {
|
||||
leapHandHeight = (hands[0].controller.getAbsTranslation().y + hands[1].controller.getAbsTranslation().y) / 2.0;
|
||||
} else {
|
||||
calibrationStatus = UNCALIBRATED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
avatarPosition = MyAvatar.position;
|
||||
|
||||
for (h = 0; h < NUM_HANDS; h += 1) {
|
||||
handPosition = MyAvatar.getJointPosition(hands[h].jointName);
|
||||
if (!hasHandAndWristJoints) {
|
||||
middleFingerPosition = MyAvatar.getJointPosition(fingers[h][MIDDLE_FINGER][0].jointName);
|
||||
handToWristOffset[h] = Vec3.multiply(Vec3.subtract(handPosition, middleFingerPosition), 1.0 - HAND_OFFSET);
|
||||
}
|
||||
|
||||
if (isOnHMD) {
|
||||
// Offset of Leap Motion origin from physical eye position
|
||||
hands[h].zeroPosition = { x: 0.0, y: 0.0, z: HMD_OFFSET + LEAP_OFFSET };
|
||||
} else {
|
||||
hands[h].zeroPosition = {
|
||||
x: handPosition.x - avatarPosition.x,
|
||||
y: handPosition.y - avatarPosition.y,
|
||||
z: avatarPosition.z - handPosition.z
|
||||
};
|
||||
hands[h].zeroPosition = Vec3.multiplyQbyV(MyAvatar.orientation, hands[h].zeroPosition);
|
||||
hands[h].zeroPosition.y = hands[h].zeroPosition.y - leapHandHeight;
|
||||
}
|
||||
}
|
||||
|
||||
MyAvatar.clearJointData("LeftHand");
|
||||
MyAvatar.clearJointData("LeftForeArm");
|
||||
MyAvatar.clearJointData("LeftArm");
|
||||
MyAvatar.clearJointData("RightHand");
|
||||
MyAvatar.clearJointData("RightForeArm");
|
||||
MyAvatar.clearJointData("RightArm");
|
||||
|
||||
calibrationStatus = CALIBRATED;
|
||||
print("Leap Motion: Calibrated");
|
||||
}
|
||||
|
||||
function calibrate() {
|
||||
var jointNames,
|
||||
i;
|
||||
|
||||
calibrationStatus = CALIBRATING;
|
||||
|
||||
avatarScale = MyAvatar.scale;
|
||||
avatarFaceModelURL = MyAvatar.faceModelURL;
|
||||
avatarSkeletonModelURL = MyAvatar.skeletonModelURL;
|
||||
|
||||
// Does this skeleton have both wrist and hand joints?
|
||||
hasHandAndWristJoints = false;
|
||||
jointNames = MyAvatar.getJointNames();
|
||||
for (i = 0; i < jointNames.length; i += 1) {
|
||||
hasHandAndWristJoints = hasHandAndWristJoints || jointNames[i].toLowerCase() === "leftwrist";
|
||||
}
|
||||
|
||||
// Set avatar arms vertical, forearms horizontal, as "zero" position for calibration
|
||||
MyAvatar.setJointData("LeftArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, -90.0));
|
||||
MyAvatar.setJointData("LeftForeArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, 180.0));
|
||||
MyAvatar.setJointData("LeftHand", Quat.fromPitchYawRollRadians(0.0, 0.0, 0.0));
|
||||
MyAvatar.setJointData("RightArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, 90.0));
|
||||
MyAvatar.setJointData("RightForeArm", Quat.fromPitchYawRollDegrees(90.0, 0.0, 180.0));
|
||||
MyAvatar.setJointData("RightHand", Quat.fromPitchYawRollRadians(0.0, 0.0, 0.0));
|
||||
|
||||
|
||||
// Wait for arms to assume their positions before calculating
|
||||
Script.setTimeout(finishCalibration, CALIBRATION_TIME);
|
||||
}
|
||||
|
||||
function checkCalibration() {
|
||||
|
||||
if (calibrationStatus === CALIBRATED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (calibrationStatus !== CALIBRATING) {
|
||||
calibrate();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function setIsOnHMD() {
|
||||
isOnHMD = Menu.isOptionChecked(LEAP_ON_HMD_MENU_ITEM);
|
||||
print("Leap Motion: " + (isOnHMD ? "Is on HMD" : "Is on desk"));
|
||||
}
|
||||
|
||||
function checkSettings() {
|
||||
if (calibrationStatus > UNCALIBRATED && (MyAvatar.scale !== avatarScale
|
||||
|| MyAvatar.faceModelURL !== avatarFaceModelURL
|
||||
|| MyAvatar.skeletonModelURL !== avatarSkeletonModelURL
|
||||
|| Menu.isOptionChecked(LEAP_ON_HMD_MENU_ITEM) !== isOnHMD)) {
|
||||
print("Leap Motion: Recalibrate...");
|
||||
calibrationStatus = UNCALIBRATED;
|
||||
|
||||
setIsOnHMD();
|
||||
}
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
|
||||
wrists = [
|
||||
{
|
||||
jointName: "LeftWrist",
|
||||
controller: Controller.createInputController(MotionTracker, "joint_L_wrist")
|
||||
},
|
||||
{
|
||||
jointName: "RightWrist",
|
||||
controller: Controller.createInputController(MotionTracker, "joint_R_wrist")
|
||||
}
|
||||
];
|
||||
|
||||
hands = [
|
||||
{
|
||||
jointName: "LeftHand",
|
||||
controller: Controller.createInputController(MotionTracker, "joint_L_hand"),
|
||||
inactiveCount: 0
|
||||
},
|
||||
{
|
||||
jointName: "RightHand",
|
||||
controller: Controller.createInputController(MotionTracker, "joint_R_hand"),
|
||||
inactiveCount: 0
|
||||
}
|
||||
];
|
||||
|
||||
// The Leap controller's first joint is the hand-metacarpal joint but this joint's data is not used because it's too
|
||||
// dependent on the model skeleton exactly matching the Leap skeleton; using just the second and subsequent joints
|
||||
// seems to work better over all.
|
||||
fingers = [{}, {}];
|
||||
fingers[0] = [
|
||||
[
|
||||
{ jointName: "LeftHandThumb1", controller: Controller.createInputController(MotionTracker, "joint_L_thumb2") },
|
||||
{ jointName: "LeftHandThumb2", controller: Controller.createInputController(MotionTracker, "joint_L_thumb3") },
|
||||
{ jointName: "LeftHandThumb3", controller: Controller.createInputController(MotionTracker, "joint_L_thumb4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "LeftHandIndex1", controller: Controller.createInputController(MotionTracker, "joint_L_index2") },
|
||||
{ jointName: "LeftHandIndex2", controller: Controller.createInputController(MotionTracker, "joint_L_index3") },
|
||||
{ jointName: "LeftHandIndex3", controller: Controller.createInputController(MotionTracker, "joint_L_index4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "LeftHandMiddle1", controller: Controller.createInputController(MotionTracker, "joint_L_middle2") },
|
||||
{ jointName: "LeftHandMiddle2", controller: Controller.createInputController(MotionTracker, "joint_L_middle3") },
|
||||
{ jointName: "LeftHandMiddle3", controller: Controller.createInputController(MotionTracker, "joint_L_middle4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "LeftHandRing1", controller: Controller.createInputController(MotionTracker, "joint_L_ring2") },
|
||||
{ jointName: "LeftHandRing2", controller: Controller.createInputController(MotionTracker, "joint_L_ring3") },
|
||||
{ jointName: "LeftHandRing3", controller: Controller.createInputController(MotionTracker, "joint_L_ring4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "LeftHandPinky1", controller: Controller.createInputController(MotionTracker, "joint_L_pinky2") },
|
||||
{ jointName: "LeftHandPinky2", controller: Controller.createInputController(MotionTracker, "joint_L_pinky3") },
|
||||
{ jointName: "LeftHandPinky3", controller: Controller.createInputController(MotionTracker, "joint_L_pinky4") }
|
||||
]
|
||||
];
|
||||
fingers[1] = [
|
||||
[
|
||||
{ jointName: "RightHandThumb1", controller: Controller.createInputController(MotionTracker, "joint_R_thumb2") },
|
||||
{ jointName: "RightHandThumb2", controller: Controller.createInputController(MotionTracker, "joint_R_thumb3") },
|
||||
{ jointName: "RightHandThumb3", controller: Controller.createInputController(MotionTracker, "joint_R_thumb4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "RightHandIndex1", controller: Controller.createInputController(MotionTracker, "joint_R_index2") },
|
||||
{ jointName: "RightHandIndex2", controller: Controller.createInputController(MotionTracker, "joint_R_index3") },
|
||||
{ jointName: "RightHandIndex3", controller: Controller.createInputController(MotionTracker, "joint_R_index4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "RightHandMiddle1", controller: Controller.createInputController(MotionTracker, "joint_R_middle2") },
|
||||
{ jointName: "RightHandMiddle2", controller: Controller.createInputController(MotionTracker, "joint_R_middle3") },
|
||||
{ jointName: "RightHandMiddle3", controller: Controller.createInputController(MotionTracker, "joint_R_middle4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "RightHandRing1", controller: Controller.createInputController(MotionTracker, "joint_R_ring2") },
|
||||
{ jointName: "RightHandRing2", controller: Controller.createInputController(MotionTracker, "joint_R_ring3") },
|
||||
{ jointName: "RightHandRing3", controller: Controller.createInputController(MotionTracker, "joint_R_ring4") }
|
||||
],
|
||||
[
|
||||
{ jointName: "RightHandPinky1", controller: Controller.createInputController(MotionTracker, "joint_R_pinky2") },
|
||||
{ jointName: "RightHandPinky2", controller: Controller.createInputController(MotionTracker, "joint_R_pinky3") },
|
||||
{ jointName: "RightHandPinky3", controller: Controller.createInputController(MotionTracker, "joint_R_pinky4") }
|
||||
]
|
||||
];
|
||||
|
||||
setIsOnHMD();
|
||||
|
||||
settingsTimer = Script.setInterval(checkSettings, 2000);
|
||||
|
||||
calibrationStatus = UNCALIBRATED;
|
||||
}
|
||||
|
||||
function moveHands() {
|
||||
var h,
|
||||
i,
|
||||
j,
|
||||
side,
|
||||
handOffset,
|
||||
wristOffset,
|
||||
handRotation,
|
||||
locRotation,
|
||||
cameraOrientation,
|
||||
inverseAvatarOrientation;
|
||||
|
||||
for (h = 0; h < NUM_HANDS; h += 1) {
|
||||
side = h === 0 ? -1.0 : 1.0;
|
||||
|
||||
if (hands[h].controller.isActive()) {
|
||||
|
||||
// Calibrate if necessary.
|
||||
if (!checkCalibration()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hand position ...
|
||||
handOffset = hands[h].controller.getAbsTranslation();
|
||||
handRotation = hands[h].controller.getAbsRotation();
|
||||
|
||||
if (isOnHMD) {
|
||||
|
||||
// Adjust to control wrist position if "hand" joint is at wrist ...
|
||||
if (!hasHandAndWristJoints) {
|
||||
wristOffset = Vec3.multiplyQbyV(handRotation, handToWristOffset[h]);
|
||||
handOffset = Vec3.sum(handOffset, wristOffset);
|
||||
}
|
||||
|
||||
// Hand offset in camera coordinates ...
|
||||
handOffset = {
|
||||
x: hands[h].zeroPosition.x - handOffset.x,
|
||||
y: hands[h].zeroPosition.y - handOffset.z,
|
||||
z: hands[h].zeroPosition.z + handOffset.y
|
||||
};
|
||||
handOffset.z = -handOffset.z;
|
||||
|
||||
// Hand offset in world coordinates ...
|
||||
cameraOrientation = Camera.getOrientation();
|
||||
handOffset = Vec3.sum(Camera.getPosition(), Vec3.multiplyQbyV(cameraOrientation, handOffset));
|
||||
|
||||
// Hand offset in avatar coordinates ...
|
||||
inverseAvatarOrientation = Quat.inverse(MyAvatar.orientation);
|
||||
handOffset = Vec3.subtract(handOffset, MyAvatar.position);
|
||||
handOffset = Vec3.multiplyQbyV(inverseAvatarOrientation, handOffset);
|
||||
handOffset.z = -handOffset.z;
|
||||
handOffset.x = -handOffset.x;
|
||||
|
||||
// Hand rotation in camera coordinates ...
|
||||
handRotation = {
|
||||
x: handRotation.z,
|
||||
y: handRotation.y,
|
||||
z: handRotation.x,
|
||||
w: handRotation.w
|
||||
};
|
||||
|
||||
// Hand rotation in avatar coordinates ...
|
||||
if (h === 0) {
|
||||
handRotation.x = -handRotation.x;
|
||||
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 1, y: 0, z: 0 }), handRotation);
|
||||
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 0, y: 0, z: 1 }), handRotation);
|
||||
} else {
|
||||
handRotation.z = -handRotation.z;
|
||||
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 1, y: 0, z: 0 }), handRotation);
|
||||
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 0, y: 0, z: 1 }), handRotation);
|
||||
}
|
||||
|
||||
cameraOrientation.x = -cameraOrientation.x;
|
||||
cameraOrientation.z = -cameraOrientation.z;
|
||||
handRotation = Quat.multiply(cameraOrientation, handRotation);
|
||||
handRotation = Quat.multiply(inverseAvatarOrientation, handRotation);
|
||||
|
||||
} else {
|
||||
|
||||
// Hand offset in camera coordinates ...
|
||||
handOffset = {
|
||||
x: -handOffset.x,
|
||||
y: hands[h].zeroPosition.y + handOffset.y,
|
||||
z: hands[h].zeroPosition.z - handOffset.z
|
||||
};
|
||||
|
||||
// Hand rotation in camera coordinates ...
|
||||
handRotation = {
|
||||
x: handRotation.y,
|
||||
y: handRotation.z,
|
||||
z: -handRotation.x,
|
||||
w: handRotation.w
|
||||
};
|
||||
|
||||
// Hand rotation in avatar coordinates ...
|
||||
if (h === 0) {
|
||||
handRotation = Quat.multiply(Quat.angleAxis(90.0, { x: 0, y: 1, z: 0 }),
|
||||
handRotation);
|
||||
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 1, y: 0, z: 0 }),
|
||||
handRotation);
|
||||
} else {
|
||||
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 0, y: 1, z: 0 }),
|
||||
handRotation);
|
||||
handRotation = Quat.multiply(Quat.angleAxis(-90.0, { x: 1, y: 0, z: 0 }),
|
||||
handRotation);
|
||||
}
|
||||
}
|
||||
|
||||
// Set hand position and orientation ...
|
||||
MyAvatar.setJointModelPositionAndOrientation(hands[h].jointName, handOffset, handRotation, true);
|
||||
|
||||
// Set finger joints ...
|
||||
for (i = 0; i < NUM_FINGERS; i += 1) {
|
||||
for (j = 0; j < NUM_FINGER_JOINTS; j += 1) {
|
||||
if (fingers[h][i][j].controller !== null) {
|
||||
locRotation = fingers[h][i][j].controller.getLocRotation();
|
||||
if (i === THUMB) {
|
||||
locRotation = {
|
||||
x: side * locRotation.y,
|
||||
y: side * -locRotation.z,
|
||||
z: side * -locRotation.x,
|
||||
w: locRotation.w
|
||||
};
|
||||
} else {
|
||||
locRotation = {
|
||||
x: -locRotation.x,
|
||||
y: -locRotation.z,
|
||||
z: -locRotation.y,
|
||||
w: locRotation.w
|
||||
};
|
||||
}
|
||||
MyAvatar.setJointData(fingers[h][i][j].jointName, locRotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hands[h].inactiveCount = 0;
|
||||
|
||||
} else {
|
||||
|
||||
if (hands[h].inactiveCount < MAX_HAND_INACTIVE_COUNT) {
|
||||
|
||||
hands[h].inactiveCount += 1;
|
||||
|
||||
if (hands[h].inactiveCount === MAX_HAND_INACTIVE_COUNT) {
|
||||
if (h === 0) {
|
||||
MyAvatar.clearJointData("LeftHand");
|
||||
MyAvatar.clearJointData("LeftForeArm");
|
||||
MyAvatar.clearJointData("LeftArm");
|
||||
} else {
|
||||
MyAvatar.clearJointData("RightHand");
|
||||
MyAvatar.clearJointData("RightForeArm");
|
||||
MyAvatar.clearJointData("RightArm");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
var h,
|
||||
i,
|
||||
j;
|
||||
|
||||
Script.clearInterval(settingsTimer);
|
||||
|
||||
for (h = 0; h < NUM_HANDS; h += 1) {
|
||||
Controller.releaseInputController(hands[h].controller);
|
||||
Controller.releaseInputController(wrists[h].controller);
|
||||
for (i = 0; i < NUM_FINGERS; i += 1) {
|
||||
for (j = 0; j < NUM_FINGER_JOINTS; j += 1) {
|
||||
if (fingers[h][i][j].controller !== null) {
|
||||
Controller.releaseInputController(fingers[h][i][j].controller);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
printSkeletonJointNames: printSkeletonJointNames,
|
||||
setUp : setUp,
|
||||
moveHands : moveHands,
|
||||
tearDown : tearDown
|
||||
};
|
||||
}());
|
||||
|
||||
|
||||
//leapHands.printSkeletonJointNames();
|
||||
|
||||
leapHands.setUp();
|
||||
Script.update.connect(leapHands.moveHands);
|
||||
Script.scriptEnding.connect(leapHands.tearDown);
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var sound = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/220Sine.wav");
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("../../libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
// A few sample files you may want to try:
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
|
||||
var soundClip = SoundCache.getSound(HIFI_PUBLIC_BUCKET + "sounds/Cocktail%20Party%20Snippets/Walken1.wav");
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
Script.include("libraries/globals.js");
|
||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||
Script.include("libraries/toolBars.js");
|
||||
|
||||
var recordingFile = "recording.rec";
|
||||
|
|
|
@ -2,7 +2,7 @@ set(TARGET_NAME interface)
|
|||
project(${TARGET_NAME})
|
||||
|
||||
# set a default root dir for each of our optional externals if it was not passed
|
||||
set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb")
|
||||
set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb" "RSSDK")
|
||||
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
||||
string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE)
|
||||
if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR)
|
||||
|
|
9
interface/external/rssdk/readme.txt
vendored
Normal file
9
interface/external/rssdk/readme.txt
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
|
||||
Instructions for adding the Intel Realsense (RSSDK) to Interface
|
||||
Thijs Wenker, December 19, 2014
|
||||
|
||||
This is Windows only for now.
|
||||
|
||||
1. Download the SDK at https://software.intel.com/en-us/intel-realsense-sdk/download
|
||||
|
||||
2. Copy the `lib` and `include` folder inside this directory
|
|
@ -85,10 +85,13 @@
|
|||
#include "Util.h"
|
||||
|
||||
#include "audio/AudioToolBox.h"
|
||||
#include "audio/AudioIOStatsRenderer.h"
|
||||
#include "audio/AudioScope.h"
|
||||
|
||||
#include "devices/DdeFaceTracker.h"
|
||||
#include "devices/Faceshift.h"
|
||||
#include "devices/Leapmotion.h"
|
||||
#include "devices/RealSense.h"
|
||||
#include "devices/MIDIManager.h"
|
||||
#include "devices/OculusManager.h"
|
||||
#include "devices/TV3DManager.h"
|
||||
|
@ -142,8 +145,42 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt
|
|||
}
|
||||
}
|
||||
|
||||
bool setupEssentials(int& argc, char** argv) {
|
||||
unsigned int listenPort = 0; // bind to an ephemeral port by default
|
||||
const char** constArgv = const_cast<const char**>(argv);
|
||||
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
||||
if (portStr) {
|
||||
listenPort = atoi(portStr);
|
||||
}
|
||||
|
||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||
|
||||
// Set dependencies
|
||||
auto glCanvas = DependencyManager::set<GLCanvas>();
|
||||
auto addressManager = DependencyManager::set<AddressManager>();
|
||||
auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, listenPort);
|
||||
auto geometryCache = DependencyManager::set<GeometryCache>();
|
||||
auto glowEffect = DependencyManager::set<GlowEffect>();
|
||||
auto faceshift = DependencyManager::set<Faceshift>();
|
||||
auto audio = DependencyManager::set<Audio>();
|
||||
auto audioScope = DependencyManager::set<AudioScope>();
|
||||
auto audioIOStatsRenderer = DependencyManager::set<AudioIOStatsRenderer>();
|
||||
auto deferredLightingEffect = DependencyManager::set<DeferredLightingEffect>();
|
||||
auto ambientOcclusionEffect = DependencyManager::set<AmbientOcclusionEffect>();
|
||||
auto textureCache = DependencyManager::set<TextureCache>();
|
||||
auto animationCache = DependencyManager::set<AnimationCache>();
|
||||
auto visage = DependencyManager::set<Visage>();
|
||||
auto ddeFaceTracker = DependencyManager::set<DdeFaceTracker>();
|
||||
auto modelBlender = DependencyManager::set<ModelBlender>();
|
||||
auto audioToolBox = DependencyManager::set<AudioToolBox>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||
QApplication(argc, argv),
|
||||
_dependencyManagerIsSetup(setupEssentials(argc, argv)),
|
||||
_window(new MainWindow(desktop())),
|
||||
_toolWindow(NULL),
|
||||
_nodeThread(new QThread(this)),
|
||||
|
@ -189,9 +226,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
_isVSyncOn(true),
|
||||
_aboutToQuit(false)
|
||||
{
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
|
||||
|
||||
|
||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||
QSettings applicationInfo(PathUtils::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||
|
||||
|
@ -218,27 +257,20 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
|
||||
qDebug() << "[VERSION] Build sequence: " << qPrintable(applicationVersion());
|
||||
|
||||
_bookmarks = new Bookmarks(); // Before setting up the menu
|
||||
|
||||
// call Menu getInstance static method to set up the menu
|
||||
_window->setMenuBar(Menu::getInstance());
|
||||
|
||||
_runningScriptsWidget = new RunningScriptsWidget(_window);
|
||||
|
||||
unsigned int listenPort = 0; // bind to an ephemeral port by default
|
||||
const char** constArgv = const_cast<const char**>(argv);
|
||||
const char* portStr = getCmdOption(argc, constArgv, "--listenPort");
|
||||
if (portStr) {
|
||||
listenPort = atoi(portStr);
|
||||
}
|
||||
|
||||
// start the nodeThread so its event loop is running
|
||||
_nodeThread->start();
|
||||
|
||||
// make sure the node thread is given highest priority
|
||||
_nodeThread->setPriority(QThread::TimeCriticalPriority);
|
||||
|
||||
|
||||
// put the NodeList and datagram processing on the node thread
|
||||
NodeList* nodeList = NodeList::createInstance(NodeType::Agent, listenPort);
|
||||
|
||||
nodeList->moveToThread(_nodeThread);
|
||||
_datagramProcessor.moveToThread(_nodeThread);
|
||||
|
||||
|
@ -248,7 +280,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
// put the audio processing on a separate thread
|
||||
QThread* audioThread = new QThread(this);
|
||||
|
||||
Audio::SharedPointer audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
audioIO->moveToThread(audioThread);
|
||||
connect(audioThread, &QThread::started, audioIO.data(), &Audio::start);
|
||||
|
||||
|
@ -271,11 +303,11 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
connect(locationUpdateTimer, &QTimer::timeout, this, &Application::updateLocationInServer);
|
||||
locationUpdateTimer->start(DATA_SERVER_LOCATION_CHANGE_UPDATE_MSECS);
|
||||
|
||||
connect(nodeList, &NodeList::nodeAdded, this, &Application::nodeAdded);
|
||||
connect(nodeList, &NodeList::nodeKilled, this, &Application::nodeKilled);
|
||||
connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
|
||||
connect(nodeList, &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID);
|
||||
connect(nodeList, &NodeList::limitOfSilentDomainCheckInsReached, nodeList, &NodeList::reset);
|
||||
connect(nodeList.data(), &NodeList::nodeAdded, this, &Application::nodeAdded);
|
||||
connect(nodeList.data(), &NodeList::nodeKilled, this, &Application::nodeKilled);
|
||||
connect(nodeList.data(), SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer)));
|
||||
connect(nodeList.data(), &NodeList::uuidChanged, _myAvatar, &MyAvatar::setSessionUUID);
|
||||
connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
|
||||
|
||||
// connect to appropriate slots on AccountManager
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
|
@ -301,7 +333,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
// once the event loop has started, check and signal for an access token
|
||||
QMetaObject::invokeMethod(&accountManager, "checkAndSignalForAccessToken", Qt::QueuedConnection);
|
||||
|
||||
AddressManager::SharedPointer addressManager = DependencyManager::get<AddressManager>();
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
|
||||
// use our MyAvatar position and quat for address manager path
|
||||
addressManager->setPositionGetter(getPositionForPath);
|
||||
|
@ -327,7 +359,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
|
||||
// move the silentNodeTimer to the _nodeThread
|
||||
QTimer* silentNodeTimer = new QTimer();
|
||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
|
||||
connect(silentNodeTimer, SIGNAL(timeout()), nodeList.data(), SLOT(removeSilentNodes()));
|
||||
silentNodeTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
|
||||
silentNodeTimer->moveToThread(_nodeThread);
|
||||
|
||||
|
@ -446,7 +478,7 @@ Application::~Application() {
|
|||
// kill any audio injectors that are still around
|
||||
AudioScriptingInterface::getInstance().stopAllInjectors();
|
||||
|
||||
Audio::SharedPointer audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
|
||||
// stop the audio process
|
||||
QMetaObject::invokeMethod(audioIO.data(), "stop", Qt::BlockingQueuedConnection);
|
||||
|
@ -461,6 +493,8 @@ Application::~Application() {
|
|||
Menu::getInstance()->deleteLater();
|
||||
|
||||
_myAvatar = NULL;
|
||||
|
||||
DependencyManager::destroy<GLCanvas>();
|
||||
}
|
||||
|
||||
void Application::saveSettings() {
|
||||
|
@ -736,7 +770,7 @@ void Application::controlledBroadcastToNodes(const QByteArray& packet, const Nod
|
|||
foreach(NodeType_t type, destinationNodeTypes) {
|
||||
|
||||
// Perform the broadcast for one type
|
||||
int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(packet, NodeSet() << type);
|
||||
int nReceivingNodes = DependencyManager::get<NodeList>()->broadcastToNodes(packet, NodeSet() << type);
|
||||
|
||||
// Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
|
||||
BandwidthMeter::ChannelIndex channel;
|
||||
|
@ -948,7 +982,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
if (isShifted) {
|
||||
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
|
||||
if (TV3DManager::isConnected()) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
}
|
||||
} else {
|
||||
|
@ -961,7 +995,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
if (isShifted) {
|
||||
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
|
||||
if (TV3DManager::isConnected()) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
}
|
||||
|
||||
|
@ -1323,7 +1357,7 @@ void Application::dropEvent(QDropEvent *event) {
|
|||
SnapshotMetaData* snapshotData = Snapshot::parseSnapshotData(snapshotPath);
|
||||
if (snapshotData) {
|
||||
if (!snapshotData->getDomain().isEmpty()) {
|
||||
NodeList::getInstance()->getDomainHandler().setHostnameAndPort(snapshotData->getDomain());
|
||||
DependencyManager::get<NodeList>()->getDomainHandler().setHostnameAndPort(snapshotData->getDomain());
|
||||
}
|
||||
|
||||
_myAvatar->setPosition(snapshotData->getLocation());
|
||||
|
@ -1337,7 +1371,7 @@ void Application::dropEvent(QDropEvent *event) {
|
|||
}
|
||||
|
||||
void Application::sendPingPackets() {
|
||||
QByteArray pingPacket = NodeList::getInstance()->constructPingPacket();
|
||||
QByteArray pingPacket = DependencyManager::get<NodeList>()->constructPingPacket();
|
||||
controlledBroadcastToNodes(pingPacket, NodeSet()
|
||||
<< NodeType::EntityServer
|
||||
<< NodeType::AudioMixer << NodeType::AvatarMixer
|
||||
|
@ -1363,7 +1397,7 @@ void Application::timer() {
|
|||
_timerStart.start();
|
||||
|
||||
// ask the node list to check in with the domain server
|
||||
NodeList::getInstance()->sendDomainServerCheckIn();
|
||||
DependencyManager::get<NodeList>()->sendDomainServerCheckIn();
|
||||
}
|
||||
|
||||
void Application::idle() {
|
||||
|
@ -1419,7 +1453,7 @@ void Application::idle() {
|
|||
|
||||
void Application::checkBandwidthMeterClick() {
|
||||
// ... to be called upon button release
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
||||
Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
|
||||
|
@ -1455,7 +1489,7 @@ void Application::setFullscreen(bool fullscreen) {
|
|||
}
|
||||
|
||||
void Application::setEnable3DTVMode(bool enable3DTVMode) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
}
|
||||
|
||||
|
@ -1481,7 +1515,7 @@ void Application::setEnableVRMode(bool enableVRMode) {
|
|||
_myCamera.setHmdRotation(glm::quat());
|
||||
}
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
}
|
||||
|
||||
|
@ -1491,7 +1525,7 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
|
|||
|
||||
bool Application::mouseOnScreen() const {
|
||||
if (OculusManager::isConnected()) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() &&
|
||||
getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight();
|
||||
}
|
||||
|
@ -1533,9 +1567,9 @@ int Application::getMouseDragStartedY() const {
|
|||
}
|
||||
|
||||
FaceTracker* Application::getActiveFaceTracker() {
|
||||
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||
Visage::SharedPointer visage = DependencyManager::get<Visage>();
|
||||
DdeFaceTracker::SharedPointer dde = DependencyManager::get<DdeFaceTracker>();
|
||||
auto faceshift = DependencyManager::get<Faceshift>();
|
||||
auto visage = DependencyManager::get<Visage>();
|
||||
auto dde = DependencyManager::get<DdeFaceTracker>();
|
||||
|
||||
return (dde->isActive() ? static_cast<FaceTracker*>(dde.data()) :
|
||||
(faceshift->isActive() ? static_cast<FaceTracker*>(faceshift.data()) :
|
||||
|
@ -1649,9 +1683,10 @@ void Application::init() {
|
|||
DependencyManager::get<Visage>()->init();
|
||||
|
||||
Leapmotion::init();
|
||||
RealSense::init();
|
||||
|
||||
// fire off an immediate domain-server check in now that settings are loaded
|
||||
NodeList::getInstance()->sendDomainServerCheckIn();
|
||||
DependencyManager::get<NodeList>()->sendDomainServerCheckIn();
|
||||
|
||||
_entities.init();
|
||||
_entities.setViewFrustum(getViewFrustum());
|
||||
|
@ -1679,7 +1714,7 @@ void Application::init() {
|
|||
|
||||
_metavoxels.init();
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
_rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect, _settings);
|
||||
|
||||
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
|
||||
|
@ -1769,7 +1804,7 @@ void Application::updateMouseRay() {
|
|||
void Application::updateFaceshift() {
|
||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||
PerformanceWarning warn(showWarnings, "Application::updateFaceshift()");
|
||||
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||
auto faceshift = DependencyManager::get<Faceshift>();
|
||||
// Update faceshift
|
||||
faceshift->update();
|
||||
|
||||
|
@ -2099,12 +2134,17 @@ void Application::updateMyAvatar(float deltaTime) {
|
|||
|
||||
_myAvatar->update(deltaTime);
|
||||
|
||||
{
|
||||
quint64 now = usecTimestampNow();
|
||||
quint64 dt = now - _lastSendAvatarDataTime;
|
||||
|
||||
if (dt > MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS) {
|
||||
// send head/hand data to the avatar mixer and voxel server
|
||||
PerformanceTimer perfTimer("send");
|
||||
QByteArray packet = byteArrayWithPopulatedHeader(PacketTypeAvatarData);
|
||||
packet.append(_myAvatar->toByteArray());
|
||||
controlledBroadcastToNodes(packet, NodeSet() << NodeType::AvatarMixer);
|
||||
|
||||
_lastSendAvatarDataTime = now;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2118,7 +2158,7 @@ int Application::sendNackPackets() {
|
|||
char packet[MAX_PACKET_SIZE];
|
||||
|
||||
// iterates thru all nodes in NodeList
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
nodeList->eachNode([&](const SharedNodePointer& node){
|
||||
|
||||
|
@ -2216,7 +2256,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
|
|||
int inViewServers = 0;
|
||||
int unknownJurisdictionServers = 0;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
nodeList->eachNode([&](const SharedNodePointer& node) {
|
||||
// only send to the NodeTypes that are serverType
|
||||
|
@ -2580,7 +2620,7 @@ void Application::updateShadowMap() {
|
|||
|
||||
fbo->release();
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
}
|
||||
|
||||
|
@ -2916,7 +2956,7 @@ bool Application::getCascadeShadowsEnabled() {
|
|||
}
|
||||
|
||||
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
float horizontalScale = glCanvas->getDeviceWidth() / 2.0f;
|
||||
float verticalScale = glCanvas->getDeviceHeight() / 2.0f;
|
||||
|
||||
|
@ -3102,7 +3142,7 @@ void Application::setMenuShortcutsEnabled(bool enabled) {
|
|||
void Application::updateWindowTitle(){
|
||||
|
||||
QString buildVersion = " (build " + applicationVersion() + ")";
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
QString connectionStatus = nodeList->getDomainHandler().isConnected() ? "" : " (NOT CONNECTED) ";
|
||||
QString username = AccountManager::getInstance().getAccountInfo().getUsername();
|
||||
|
@ -3185,7 +3225,7 @@ void Application::domainChanged(const QString& domainHostname) {
|
|||
|
||||
void Application::connectedToDomain(const QString& hostname) {
|
||||
AccountManager& accountManager = AccountManager::getInstance();
|
||||
const QUuid& domainID = NodeList::getInstance()->getDomainHandler().getUUID();
|
||||
const QUuid& domainID = DependencyManager::get<NodeList>()->getDomainHandler().getUUID();
|
||||
|
||||
if (accountManager.isLoggedIn() && !domainID.isNull()) {
|
||||
// update our data-server with the domain-server we're logged in with
|
||||
|
@ -3472,8 +3512,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
|||
// when the application is about to quit, stop our script engine so it unwinds properly
|
||||
connect(this, SIGNAL(aboutToQuit()), scriptEngine, SLOT(stop()));
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
connect(nodeList, &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled);
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
connect(nodeList.data(), &NodeList::nodeKilled, scriptEngine, &ScriptEngine::nodeKilled);
|
||||
|
||||
scriptEngine->moveToThread(workerThread);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <ViewFrustum.h>
|
||||
|
||||
#include "Audio.h"
|
||||
#include "Bookmarks.h"
|
||||
#include "Camera.h"
|
||||
#include "DatagramProcessor.h"
|
||||
#include "Environment.h"
|
||||
|
@ -111,6 +112,10 @@ static const float MIRROR_REARVIEW_DISTANCE = 0.722f;
|
|||
static const float MIRROR_REARVIEW_BODY_DISTANCE = 2.56f;
|
||||
static const float MIRROR_FIELD_OF_VIEW = 30.0f;
|
||||
|
||||
// 70 times per second - target is 60hz, but this helps account for any small deviations
|
||||
// in the update loop
|
||||
static const quint64 MIN_TIME_BETWEEN_MY_AVATAR_DATA_SENDS = (1000 * 1000) / 70;
|
||||
|
||||
static const quint64 TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS = 1 * USECS_PER_SECOND;
|
||||
|
||||
static const QString INFO_HELP_PATH = "html/interface-welcome-allsvg.html";
|
||||
|
@ -296,6 +301,8 @@ public:
|
|||
QRect getDesirableApplicationGeometry();
|
||||
RunningScriptsWidget* getRunningScriptsWidget() { return _runningScriptsWidget; }
|
||||
|
||||
Bookmarks* getBookmarks() const { return _bookmarks; }
|
||||
|
||||
signals:
|
||||
|
||||
/// Fired when we're simulating; allows external parties to hook in.
|
||||
|
@ -425,6 +432,7 @@ private:
|
|||
|
||||
int sendNackPackets();
|
||||
|
||||
bool _dependencyManagerIsSetup;
|
||||
MainWindow* _window;
|
||||
|
||||
ToolWindow* _toolWindow;
|
||||
|
@ -566,9 +574,13 @@ private:
|
|||
quint64 _lastNackTime;
|
||||
quint64 _lastSendDownstreamAudioStats;
|
||||
|
||||
quint64 _lastSendAvatarDataTime;
|
||||
|
||||
bool _isVSyncOn;
|
||||
|
||||
bool _aboutToQuit;
|
||||
|
||||
Bookmarks* _bookmarks;
|
||||
};
|
||||
|
||||
#endif // hifi_Application_h
|
||||
|
|
|
@ -685,7 +685,7 @@ void Audio::handleAudioInput() {
|
|||
emit inputReceived(QByteArray(reinterpret_cast<const char*>(networkAudioSamples),
|
||||
AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL));
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
if (_recorder && _recorder.data()->isRecording()) {
|
||||
|
@ -796,11 +796,12 @@ void Audio::sendMuteEnvironmentPacket() {
|
|||
mutePacketStream.writeBytes(reinterpret_cast<const char *>(&MUTE_RADIUS), sizeof(float));
|
||||
|
||||
// grab our audio mixer from the NodeList, if it exists
|
||||
SharedNodePointer audioMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AudioMixer);
|
||||
auto nodelist = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixer = nodelist->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
if (audioMixer) {
|
||||
// send off this mute packet
|
||||
NodeList::getInstance()->writeDatagram(mutePacket, audioMixer);
|
||||
nodelist->writeDatagram(mutePacket, audioMixer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -893,6 +894,7 @@ bool Audio::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* inje
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
void Audio::outputFormatChanged() {
|
||||
int outputFormatChannelCountTimesSampleRate = _outputFormat.channelCount() * _outputFormat.sampleRate();
|
||||
_outputFrameSize = AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * outputFormatChannelCountTimesSampleRate / _desiredOutputFormat.sampleRate();
|
||||
|
|
|
@ -73,9 +73,9 @@ class QAudioInput;
|
|||
class QAudioOutput;
|
||||
class QIODevice;
|
||||
|
||||
class Audio : public AbstractAudioInterface {
|
||||
class Audio : public AbstractAudioInterface, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(Audio)
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
|
||||
class AudioOutputIODevice : public QIODevice {
|
||||
|
|
73
interface/src/Bookmarks.cpp
Normal file
73
interface/src/Bookmarks.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// Bookmarks.cpp
|
||||
// interface/src
|
||||
//
|
||||
// Created by David Rowe on 13 Jan 2015.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <QStandardPaths>
|
||||
|
||||
#include "Bookmarks.h"
|
||||
|
||||
Bookmarks::Bookmarks() {
|
||||
_bookmarksFilename = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/" + BOOKMARKS_FILENAME;
|
||||
readFromFile();
|
||||
}
|
||||
|
||||
void Bookmarks::insert(const QString& name, const QString& address) {
|
||||
_bookmarks.insert(name, address);
|
||||
|
||||
if (contains(name)) {
|
||||
qDebug() << "Added bookmark:" << name << "," << address;
|
||||
persistToFile();
|
||||
} else {
|
||||
qWarning() << "Couldn't add bookmark: " << name << "," << address;
|
||||
}
|
||||
}
|
||||
|
||||
void Bookmarks::remove(const QString& name) {
|
||||
_bookmarks.remove(name);
|
||||
|
||||
if (!contains(name)) {
|
||||
qDebug() << "Deleted bookmark:" << name;
|
||||
persistToFile();
|
||||
} else {
|
||||
qWarning() << "Couldn't delete bookmark:" << name;
|
||||
}
|
||||
}
|
||||
|
||||
bool Bookmarks::contains(const QString& name) const {
|
||||
return _bookmarks.contains(name);
|
||||
}
|
||||
|
||||
void Bookmarks::readFromFile() {
|
||||
QFile loadFile(_bookmarksFilename);
|
||||
|
||||
if (!loadFile.open(QIODevice::ReadOnly)) {
|
||||
qWarning("Couldn't open bookmarks file for reading");
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray data = loadFile.readAll();
|
||||
QJsonDocument json(QJsonDocument::fromJson(data));
|
||||
_bookmarks = json.object().toVariantMap();
|
||||
}
|
||||
|
||||
void Bookmarks::persistToFile() {
|
||||
QFile saveFile(_bookmarksFilename);
|
||||
|
||||
if (!saveFile.open(QIODevice::WriteOnly)) {
|
||||
qWarning("Couldn't open bookmarks file for writing");
|
||||
return;
|
||||
}
|
||||
|
||||
QJsonDocument json(QJsonObject::fromVariantMap(_bookmarks));
|
||||
QByteArray data = json.toJson();
|
||||
saveFile.write(data);
|
||||
}
|
41
interface/src/Bookmarks.h
Normal file
41
interface/src/Bookmarks.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// Bookmarks.h
|
||||
// interface/src
|
||||
//
|
||||
// Created by David Rowe on 13 Jan 2015.
|
||||
// Copyright 2015 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_Bookmarks_h
|
||||
#define hifi_Bookmarks_h
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QDebug>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
class Bookmarks: public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
Bookmarks();
|
||||
|
||||
void insert(const QString& name, const QString& address); // Overwrites any existing entry with same name.
|
||||
void remove(const QString& name);
|
||||
bool contains(const QString& name) const;
|
||||
|
||||
QVariantMap* getBookmarks() { return &_bookmarks; };
|
||||
|
||||
private:
|
||||
QVariantMap _bookmarks; // { name: address, ... }
|
||||
|
||||
const QString BOOKMARKS_FILENAME = "bookmarks.json";
|
||||
QString _bookmarksFilename;
|
||||
void readFromFile();
|
||||
void persistToFile();
|
||||
};
|
||||
|
||||
#endif // hifi_Bookmarks_h
|
|
@ -122,7 +122,7 @@ void Camera::setFarClip(float f) {
|
|||
}
|
||||
|
||||
PickRay Camera::computePickRay(float x, float y) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height());
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ void DatagramProcessor::processDatagrams() {
|
|||
static QByteArray incomingPacket;
|
||||
|
||||
Application* application = Application::getInstance();
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
while (NodeList::getInstance()->getNodeSocket().hasPendingDatagrams()) {
|
||||
while (DependencyManager::get<NodeList>()->getNodeSocket().hasPendingDatagrams()) {
|
||||
incomingPacket.resize(nodeList->getNodeSocket().pendingDatagramSize());
|
||||
nodeList->getNodeSocket().readDatagram(incomingPacket.data(), incomingPacket.size(),
|
||||
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
|
||||
|
@ -88,8 +88,7 @@ void DatagramProcessor::processDatagrams() {
|
|||
case PacketTypeEnvironmentData: {
|
||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||
"Application::networkReceive()... _octreeProcessor.queueReceivedPacket()");
|
||||
|
||||
SharedNodePointer matchedNode = NodeList::getInstance()->sendingNodeForPacket(incomingPacket);
|
||||
SharedNodePointer matchedNode = DependencyManager::get<NodeList>()->sendingNodeForPacket(incomingPacket);
|
||||
|
||||
if (matchedNode) {
|
||||
// add this packet to our list of octree packets and process them on the octree data processing
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
#include <DependencyManager.h>
|
||||
|
||||
/// customized canvas that simply forwards requests/events to the singleton application
|
||||
class GLCanvas : public QGLWidget {
|
||||
class GLCanvas : public QGLWidget, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(GLCanvas)
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
bool isThrottleRendering() const;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <QBoxLayout>
|
||||
#include <QColorDialog>
|
||||
#include <QClipboard>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDoubleSpinBox>
|
||||
#include <QFileDialog>
|
||||
|
@ -43,6 +44,7 @@
|
|||
#include "Audio.h"
|
||||
#include "audio/AudioIOStatsRenderer.h"
|
||||
#include "audio/AudioScope.h"
|
||||
#include "devices/RealSense.h"
|
||||
#include "devices/Visage.h"
|
||||
#include "Menu.h"
|
||||
#include "scripting/LocationScriptingInterface.h"
|
||||
|
@ -122,12 +124,25 @@ Menu::Menu() :
|
|||
addActionToQMenuAndActionHash(fileMenu, MenuOption::RunningScripts, Qt::CTRL | Qt::Key_J,
|
||||
appInstance, SLOT(toggleRunningScriptsWidget()));
|
||||
|
||||
addDisabledActionAndSeparator(fileMenu, "Go");
|
||||
addDisabledActionAndSeparator(fileMenu, "Location");
|
||||
addActionToQMenuAndActionHash(fileMenu, MenuOption::BookmarkLocation, 0,
|
||||
this, SLOT(bookmarkLocation()));
|
||||
_bookmarksMenu = fileMenu->addMenu(MenuOption::Bookmarks);
|
||||
_bookmarksMenu->setEnabled(false);
|
||||
_deleteBookmarksMenu = addActionToQMenuAndActionHash(fileMenu,
|
||||
MenuOption::DeleteBookmark, 0,
|
||||
this, SLOT(deleteBookmark()));
|
||||
_deleteBookmarksMenu->setEnabled(false);
|
||||
loadBookmarks();
|
||||
addActionToQMenuAndActionHash(fileMenu,
|
||||
MenuOption::AddressBar,
|
||||
Qt::Key_Enter,
|
||||
this,
|
||||
SLOT(toggleAddressBar()));
|
||||
addActionToQMenuAndActionHash(fileMenu, MenuOption::CopyAddress, 0,
|
||||
this, SLOT(copyAddress()));
|
||||
addActionToQMenuAndActionHash(fileMenu, MenuOption::CopyPath, 0,
|
||||
this, SLOT(copyPath()));
|
||||
|
||||
addDisabledActionAndSeparator(fileMenu, "Upload Avatar Model");
|
||||
addActionToQMenuAndActionHash(fileMenu, MenuOption::UploadHead, 0,
|
||||
|
@ -251,7 +266,7 @@ Menu::Menu() :
|
|||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ShiftHipsForIdleAnimations, 0, false,
|
||||
avatar, SLOT(updateMotionBehavior()));
|
||||
|
||||
QMenu* collisionsMenu = avatarMenu->addMenu("Collide With...");
|
||||
QMenu* collisionsMenu = avatarMenu->addMenu("Collide With");
|
||||
addCheckableActionToQMenuAndActionHash(collisionsMenu, MenuOption::CollideAsRagdoll, 0, false,
|
||||
avatar, SLOT(onToggleRagdoll()));
|
||||
addCheckableActionToQMenuAndActionHash(collisionsMenu, MenuOption::CollideWithAvatars,
|
||||
|
@ -429,6 +444,11 @@ Menu::Menu() :
|
|||
QMenu* leapOptionsMenu = handOptionsMenu->addMenu("Leap Motion");
|
||||
addCheckableActionToQMenuAndActionHash(leapOptionsMenu, MenuOption::LeapMotionOnHMD, 0, false);
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
QMenu* realSenseOptionsMenu = handOptionsMenu->addMenu("RealSense");
|
||||
addActionToQMenuAndActionHash(realSenseOptionsMenu, MenuOption::LoadRSSDKFile, 0, this, SLOT(loadRSSDKFile()));
|
||||
#endif
|
||||
|
||||
QMenu* networkMenu = developerMenu->addMenu("Network");
|
||||
addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::DisableNackPackets, 0, false);
|
||||
addCheckableActionToQMenuAndActionHash(networkMenu,
|
||||
|
@ -456,7 +476,7 @@ Menu::Menu() :
|
|||
addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::PipelineWarnings);
|
||||
addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::SuppressShortTimings);
|
||||
|
||||
Audio::SharedPointer audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
QMenu* audioDebugMenu = developerMenu->addMenu("Audio");
|
||||
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNoiseReduction,
|
||||
0,
|
||||
|
@ -505,7 +525,7 @@ Menu::Menu() :
|
|||
audioSourceGroup->addAction(sine440);
|
||||
}
|
||||
|
||||
AudioScope::SharedPointer scope = DependencyManager::get<AudioScope>();
|
||||
auto scope = DependencyManager::get<AudioScope>();
|
||||
|
||||
QMenu* audioScopeMenu = audioDebugMenu->addMenu("Audio Scope");
|
||||
addCheckableActionToQMenuAndActionHash(audioScopeMenu, MenuOption::AudioScope,
|
||||
|
@ -543,7 +563,7 @@ Menu::Menu() :
|
|||
audioScopeFramesGroup->addAction(fiftyFrames);
|
||||
}
|
||||
|
||||
AudioIOStatsRenderer::SharedPointer statsRenderer = DependencyManager::get<AudioIOStatsRenderer>();
|
||||
auto statsRenderer = DependencyManager::get<AudioIOStatsRenderer>();
|
||||
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioStats,
|
||||
Qt::CTRL | Qt::SHIFT | Qt::Key_A,
|
||||
false,
|
||||
|
@ -581,7 +601,7 @@ void Menu::loadSettings(QSettings* settings) {
|
|||
_receivedAudioStreamSettings._windowSecondsForDesiredReduction = settings->value("windowSecondsForDesiredReduction", DEFAULT_WINDOW_SECONDS_FOR_DESIRED_REDUCTION).toInt();
|
||||
_receivedAudioStreamSettings._repetitionWithFade = settings->value("repetitionWithFade", DEFAULT_REPETITION_WITH_FADE).toBool();
|
||||
|
||||
QSharedPointer<Audio> audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
audio->setOutputStarveDetectionEnabled(settings->value("audioOutputStarveDetectionEnabled", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED).toBool());
|
||||
audio->setOutputStarveDetectionThreshold(settings->value("audioOutputStarveDetectionThreshold", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD).toInt());
|
||||
audio->setOutputStarveDetectionPeriod(settings->value("audioOutputStarveDetectionPeriod", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD).toInt());
|
||||
|
@ -615,7 +635,7 @@ void Menu::loadSettings(QSettings* settings) {
|
|||
Application::getInstance()->updateWindowTitle();
|
||||
|
||||
// notify that a settings has changed
|
||||
connect(&NodeList::getInstance()->getDomainHandler(), &DomainHandler::hostnameChanged, this, &Menu::bumpSettings);
|
||||
connect(&DependencyManager::get<NodeList>()->getDomainHandler(), &DomainHandler::hostnameChanged, this, &Menu::bumpSettings);
|
||||
|
||||
// MyAvatar caches some menu options, so we have to update them whenever we load settings.
|
||||
// TODO: cache more settings in MyAvatar that are checked with very high frequency.
|
||||
|
@ -646,7 +666,7 @@ void Menu::saveSettings(QSettings* settings) {
|
|||
settings->setValue("windowSecondsForDesiredReduction", _receivedAudioStreamSettings._windowSecondsForDesiredReduction);
|
||||
settings->setValue("repetitionWithFade", _receivedAudioStreamSettings._repetitionWithFade);
|
||||
|
||||
QSharedPointer<Audio> audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
settings->setValue("audioOutputStarveDetectionEnabled", audio->getOutputStarveDetectionEnabled());
|
||||
settings->setValue("audioOutputStarveDetectionThreshold", audio->getOutputStarveDetectionThreshold());
|
||||
settings->setValue("audioOutputStarveDetectionPeriod", audio->getOutputStarveDetectionPeriod());
|
||||
|
@ -897,7 +917,7 @@ void Menu::bumpSettings() {
|
|||
|
||||
void sendFakeEnterEvent() {
|
||||
QPoint lastCursorPosition = QCursor::pos();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
QPoint windowPosition = glCanvas->mapFromGlobal(lastCursorPosition);
|
||||
QEnterEvent enterEvent = QEnterEvent(windowPosition, windowPosition, lastCursorPosition);
|
||||
|
@ -996,10 +1016,143 @@ void Menu::toggleAddressBar() {
|
|||
}
|
||||
}
|
||||
|
||||
void Menu::copyAddress() {
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
QString address = addressManager->currentAddress().toString();
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(address);
|
||||
}
|
||||
|
||||
void Menu::copyPath() {
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
QString path = addressManager->currentPath();
|
||||
QClipboard* clipboard = QApplication::clipboard();
|
||||
clipboard->setText(path);
|
||||
}
|
||||
|
||||
void Menu::changeVSync() {
|
||||
Application::getInstance()->setVSyncEnabled(isOptionChecked(MenuOption::RenderTargetFramerateVSyncOn));
|
||||
}
|
||||
|
||||
void Menu::loadBookmarks() {
|
||||
QVariantMap* bookmarks = Application::getInstance()->getBookmarks()->getBookmarks();
|
||||
if (bookmarks->count() > 0) {
|
||||
|
||||
QMapIterator<QString, QVariant> i(*bookmarks);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
|
||||
QString bookmarkName = i.key();
|
||||
QString bookmarkAddress = i.value().toString();
|
||||
|
||||
QAction* teleportAction = new QAction(getMenu(MenuOption::Bookmarks));
|
||||
teleportAction->setData(bookmarkAddress);
|
||||
connect(teleportAction, SIGNAL(triggered()), this, SLOT(teleportToBookmark()));
|
||||
|
||||
addActionToQMenuAndActionHash(_bookmarksMenu, teleportAction, bookmarkName, 0, QAction::NoRole);
|
||||
}
|
||||
|
||||
_bookmarksMenu->setEnabled(true);
|
||||
_deleteBookmarksMenu->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::bookmarkLocation() {
|
||||
|
||||
QInputDialog bookmarkLocationDialog(Application::getInstance()->getWindow());
|
||||
bookmarkLocationDialog.setWindowTitle("Bookmark Location");
|
||||
bookmarkLocationDialog.setLabelText("Name:");
|
||||
bookmarkLocationDialog.setInputMode(QInputDialog::TextInput);
|
||||
bookmarkLocationDialog.resize(400, 200);
|
||||
|
||||
if (bookmarkLocationDialog.exec() == QDialog::Rejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString bookmarkName = bookmarkLocationDialog.textValue().trimmed();
|
||||
bookmarkName = bookmarkName.replace(QRegExp("(\r\n|[\r\n\t\v ])+"), " ");
|
||||
if (bookmarkName.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
QString bookmarkAddress = addressManager->currentAddress().toString();
|
||||
|
||||
Bookmarks* bookmarks = Application::getInstance()->getBookmarks();
|
||||
if (bookmarks->contains(bookmarkName)) {
|
||||
QMessageBox duplicateBookmarkMessage;
|
||||
duplicateBookmarkMessage.setIcon(QMessageBox::Warning);
|
||||
duplicateBookmarkMessage.setText("The bookmark name you entered already exists in your list.");
|
||||
duplicateBookmarkMessage.setInformativeText("Would you like to overwrite it?");
|
||||
duplicateBookmarkMessage.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
duplicateBookmarkMessage.setDefaultButton(QMessageBox::Yes);
|
||||
if (duplicateBookmarkMessage.exec() == QMessageBox::No) {
|
||||
return;
|
||||
}
|
||||
removeAction(_bookmarksMenu, bookmarkName);
|
||||
}
|
||||
|
||||
QAction* teleportAction = new QAction(getMenu(MenuOption::Bookmarks));
|
||||
teleportAction->setData(bookmarkAddress);
|
||||
connect(teleportAction, SIGNAL(triggered()), this, SLOT(teleportToBookmark()));
|
||||
|
||||
QList<QAction*> menuItems = _bookmarksMenu->actions();
|
||||
int position = 0;
|
||||
while (position < menuItems.count() && bookmarkName > menuItems[position]->text()) {
|
||||
position += 1;
|
||||
}
|
||||
|
||||
addActionToQMenuAndActionHash(_bookmarksMenu, teleportAction, bookmarkName, 0,
|
||||
QAction::NoRole, position);
|
||||
|
||||
bookmarks->insert(bookmarkName, bookmarkAddress); // Overwrites any item with the same bookmarkName.
|
||||
|
||||
_bookmarksMenu->setEnabled(true);
|
||||
_deleteBookmarksMenu->setEnabled(true);
|
||||
}
|
||||
|
||||
void Menu::teleportToBookmark() {
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
QString address = action->data().toString();
|
||||
DependencyManager::get<AddressManager>()->handleLookupString(address);
|
||||
}
|
||||
|
||||
void Menu::deleteBookmark() {
|
||||
|
||||
QStringList bookmarkList;
|
||||
QList<QAction*> menuItems = _bookmarksMenu->actions();
|
||||
for (int i = 0; i < menuItems.count(); i += 1) {
|
||||
bookmarkList.append(menuItems[i]->text());
|
||||
}
|
||||
|
||||
QInputDialog deleteBookmarkDialog(Application::getInstance()->getWindow());
|
||||
deleteBookmarkDialog.setWindowTitle("Delete Bookmark");
|
||||
deleteBookmarkDialog.setLabelText("Select the bookmark to delete");
|
||||
deleteBookmarkDialog.resize(400, 400);
|
||||
deleteBookmarkDialog.setOption(QInputDialog::UseListViewForComboBoxItems);
|
||||
deleteBookmarkDialog.setComboBoxItems(bookmarkList);
|
||||
deleteBookmarkDialog.setOkButtonText("Delete");
|
||||
|
||||
if (deleteBookmarkDialog.exec() == QDialog::Rejected) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString bookmarkName = deleteBookmarkDialog.textValue().trimmed();
|
||||
if (bookmarkName.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeAction(_bookmarksMenu, bookmarkName);
|
||||
|
||||
Bookmarks* bookmarks = Application::getInstance()->getBookmarks();
|
||||
bookmarks->remove(bookmarkName);
|
||||
|
||||
if (_bookmarksMenu->actions().count() == 0) {
|
||||
_bookmarksMenu->setEnabled(false);
|
||||
_deleteBookmarksMenu->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void Menu::displayNameLocationResponse(const QString& errorString) {
|
||||
|
||||
if (!errorString.isEmpty()) {
|
||||
|
@ -1080,6 +1233,10 @@ void Menu::showChat() {
|
|||
}
|
||||
}
|
||||
|
||||
void Menu::loadRSSDKFile() {
|
||||
RealSense::getInstance()->loadRSSDKFile();
|
||||
}
|
||||
|
||||
void Menu::toggleChat() {
|
||||
#ifdef HAVE_QXMPP
|
||||
_chatAction->setEnabled(XmppClient::getInstance().getXMPPClient().isConnected());
|
||||
|
|
|
@ -177,6 +177,8 @@ public slots:
|
|||
void importSettings();
|
||||
void exportSettings();
|
||||
void toggleAddressBar();
|
||||
void copyAddress();
|
||||
void copyPath();
|
||||
|
||||
void toggleLoginMenuItem();
|
||||
void toggleSixense(bool shouldEnable);
|
||||
|
@ -200,6 +202,9 @@ private slots:
|
|||
void editAttachments();
|
||||
void editAnimations();
|
||||
void changePrivateKey();
|
||||
void bookmarkLocation();
|
||||
void teleportToBookmark();
|
||||
void deleteBookmark();
|
||||
void hmdToolsClosed();
|
||||
void runTests();
|
||||
void showMetavoxelEditor();
|
||||
|
@ -212,6 +217,7 @@ private slots:
|
|||
void audioMuteToggled();
|
||||
void displayNameLocationResponse(const QString& errorString);
|
||||
void changeVSync();
|
||||
void loadRSSDKFile();
|
||||
|
||||
private:
|
||||
static Menu* _instance;
|
||||
|
@ -303,6 +309,10 @@ private:
|
|||
|
||||
bool _shouldRenderTableNeedsRebuilding = true;
|
||||
QMap<float, float> _shouldRenderTable;
|
||||
|
||||
void loadBookmarks();
|
||||
QMenu* _bookmarksMenu;
|
||||
QAction* _deleteBookmarksMenu;
|
||||
};
|
||||
|
||||
namespace MenuOption {
|
||||
|
@ -330,6 +340,8 @@ namespace MenuOption {
|
|||
const QString Bandwidth = "Bandwidth Display";
|
||||
const QString BandwidthDetails = "Bandwidth Details";
|
||||
const QString BlueSpeechSphere = "Blue Sphere While Speaking";
|
||||
const QString BookmarkLocation = "Bookmark Location";
|
||||
const QString Bookmarks = "Bookmarks";
|
||||
const QString CascadedShadows = "Cascaded";
|
||||
const QString CachesSize = "Caches Size";
|
||||
const QString Chat = "Chat...";
|
||||
|
@ -339,7 +351,10 @@ namespace MenuOption {
|
|||
const QString CollideWithEnvironment = "Collide With World Boundaries";
|
||||
const QString Collisions = "Collisions";
|
||||
const QString Console = "Console...";
|
||||
const QString CopyAddress = "Copy Address to Clipboard";
|
||||
const QString CopyPath = "Copy Path to Clipboard";
|
||||
const QString ControlWithSpeech = "Control With Speech";
|
||||
const QString DeleteBookmark = "Delete Bookmark...";
|
||||
const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene";
|
||||
const QString DontDoPrecisionPicking = "Don't Do Precision Picking";
|
||||
const QString DecreaseAvatarSize = "Decrease Avatar Size";
|
||||
|
@ -383,6 +398,7 @@ namespace MenuOption {
|
|||
const QString LeapMotionOnHMD = "Leap Motion on HMD";
|
||||
const QString LoadScript = "Open and Run Script File...";
|
||||
const QString LoadScriptURL = "Open and Run Script from URL...";
|
||||
const QString LoadRSSDKFile = "Load .rssdk file";
|
||||
const QString LodTools = "LOD Tools";
|
||||
const QString Login = "Login";
|
||||
const QString Log = "Log";
|
||||
|
|
|
@ -496,7 +496,7 @@ void MetavoxelSystem::render() {
|
|||
}
|
||||
|
||||
void MetavoxelSystem::refreshVoxelData() {
|
||||
NodeList::getInstance()->eachNode([](const SharedNodePointer& node){
|
||||
DependencyManager::get<NodeList>()->eachNode([](const SharedNodePointer& node){
|
||||
if (node->getType() == NodeType::MetavoxelServer) {
|
||||
QMutexLocker locker(&node->getMutex());
|
||||
MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData());
|
||||
|
@ -798,7 +798,7 @@ void MetavoxelSystem::applyMaterialEdit(const MetavoxelEditMessage& message, boo
|
|||
Q_ARG(bool, reliable));
|
||||
return;
|
||||
}
|
||||
QSharedPointer<NetworkTexture> texture = DependencyManager::get<TextureCache>()->getTexture(
|
||||
auto texture = DependencyManager::get<TextureCache>()->getTexture(
|
||||
material->getDiffuse(), SPLAT_TEXTURE);
|
||||
if (texture->isLoaded()) {
|
||||
MetavoxelEditMessage newMessage = message;
|
||||
|
@ -819,7 +819,7 @@ MetavoxelClient* MetavoxelSystem::createClient(const SharedNodePointer& node) {
|
|||
}
|
||||
|
||||
void MetavoxelSystem::guideToAugmented(MetavoxelVisitor& visitor, bool render) {
|
||||
NodeList::getInstance()->eachNode([&visitor, &render](const SharedNodePointer& node){
|
||||
DependencyManager::get<NodeList>()->eachNode([&visitor, &render](const SharedNodePointer& node){
|
||||
if (node->getType() == NodeType::MetavoxelServer) {
|
||||
QMutexLocker locker(&node->getMutex());
|
||||
MetavoxelSystemClient* client = static_cast<MetavoxelSystemClient*>(node->getLinkedData());
|
||||
|
@ -1045,7 +1045,7 @@ SendDelayer::SendDelayer(const SharedNodePointer& node, const QByteArray& data)
|
|||
}
|
||||
|
||||
void SendDelayer::timerEvent(QTimerEvent* event) {
|
||||
NodeList::getInstance()->writeDatagram(_data, _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram(_data, _node);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
|
@ -1068,7 +1068,7 @@ void MetavoxelSystemClient::sendDatagram(const QByteArray& data) {
|
|||
delayer->startTimer(delay);
|
||||
|
||||
} else {
|
||||
NodeList::getInstance()->writeDatagram(data, _node);
|
||||
DependencyManager::get<NodeList>()->writeDatagram(data, _node);
|
||||
}
|
||||
Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::METAVOXELS).updateValue(data.size());
|
||||
}
|
||||
|
@ -1178,7 +1178,7 @@ void VoxelBuffer::render(bool cursor) {
|
|||
|
||||
if (!_materials.isEmpty()) {
|
||||
_networkTextures.resize(_materials.size());
|
||||
TextureCache::SharedPointer textureCache = DependencyManager::get<TextureCache>();
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
for (int i = 0; i < _materials.size(); i++) {
|
||||
const SharedObjectPointer material = _materials.at(i);
|
||||
if (material) {
|
||||
|
@ -2233,7 +2233,7 @@ void HeightfieldNodeRenderer::render(const HeightfieldNodePointer& node, const g
|
|||
|
||||
const QVector<SharedObjectPointer>& materials = node->getMaterial()->getMaterials();
|
||||
_networkTextures.resize(materials.size());
|
||||
TextureCache::SharedPointer textureCache = DependencyManager::get<TextureCache>();
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
for (int i = 0; i < materials.size(); i++) {
|
||||
const SharedObjectPointer& material = materials.at(i);
|
||||
if (material) {
|
||||
|
|
|
@ -502,7 +502,7 @@ void ModelUploader::processCheck() {
|
|||
QString("Your model is now available in the browser."),
|
||||
QMessageBox::Ok);
|
||||
DependencyManager::get<GeometryCache>()->refresh(_url);
|
||||
TextureCache::SharedPointer textureCache = DependencyManager::get<TextureCache>();
|
||||
auto textureCache = DependencyManager::get<TextureCache>();
|
||||
foreach (const QByteArray& filename, _textureFilenames) {
|
||||
textureCache->refresh(_textureBase + filename);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
using namespace std;
|
||||
|
||||
void renderWorldBox() {
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
// Show edge of world
|
||||
float red[] = {1, 0, 0};
|
||||
|
|
|
@ -97,7 +97,7 @@ void AudioIOStats::parseAudioStreamStatsPacket(const QByteArray& packet) {
|
|||
|
||||
void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
||||
|
||||
Audio::SharedPointer audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
|
||||
// since this function is called every second, we'll sample for some of our stats here
|
||||
_inputRingBufferMsecsAvailableStats.update(audioIO->getInputRingBufferMsecsAvailable());
|
||||
|
@ -128,7 +128,7 @@ void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
|||
dataAt += sizeof(AudioStreamStats);
|
||||
|
||||
// send packet
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
nodeList->writeDatagram(packet, dataAt - packet, audioMixer);
|
||||
}
|
|
@ -71,7 +71,7 @@ void AudioIOStatsRenderer::render(const float* color, int width, int height) {
|
|||
float audioInputBufferLatency = 0.0f, inputRingBufferLatency = 0.0f, networkRoundtripLatency = 0.0f, mixerRingBufferLatency = 0.0f, outputRingBufferLatency = 0.0f, audioOutputBufferLatency = 0.0f;
|
||||
|
||||
AudioStreamStats downstreamAudioStreamStats = _stats->getMixerDownstreamStats();
|
||||
SharedNodePointer audioMixerNodePointer = NodeList::getInstance()->soloNodeOfType(NodeType::AudioMixer);
|
||||
SharedNodePointer audioMixerNodePointer = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::AudioMixer);
|
||||
if (!audioMixerNodePointer.isNull()) {
|
||||
audioInputBufferLatency = _stats->getAudioInputMsecsReadStats().getWindowAverage();
|
||||
inputRingBufferLatency = (float) _stats->getInputRungBufferMsecsAvailableStats().getWindowAverage();
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
class AudioIOStats;
|
||||
class AudioStreamStats;
|
||||
|
||||
class AudioIOStatsRenderer : public QObject {
|
||||
class AudioIOStatsRenderer : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(AudioIOStatsRenderer)
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
void render(const float* color, int width, int height);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ AudioScope::AudioScope() :
|
|||
_outputLeftID(DependencyManager::get<GeometryCache>()->allocateID()),
|
||||
_outputRightD(DependencyManager::get<GeometryCache>()->allocateID())
|
||||
{
|
||||
Audio::SharedPointer audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
connect(&audioIO->getReceivedAudioStream(), &MixedProcessedAudioStream::addedSilence,
|
||||
this, &AudioScope::addStereoSilenceToScope);
|
||||
connect(&audioIO->getReceivedAudioStream(), &MixedProcessedAudioStream::addedLastFrameRepeatedWithFade,
|
||||
|
@ -155,7 +155,7 @@ void AudioScope::renderLineStrip(int id, const float* color, int x, int y, int n
|
|||
int remainder = (n - offset) % numSamplesToAverage;
|
||||
y += SCOPE_HEIGHT / 2;
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
QVector<glm::vec2> points;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
#include <QByteArray>
|
||||
#include <QObject>
|
||||
|
||||
class AudioScope : public QObject {
|
||||
class AudioScope : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(AudioScope)
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
// Audio scope methods for allocation/deallocation
|
||||
void allocateScope();
|
||||
|
|
|
@ -25,10 +25,6 @@ const int MUTE_ICON_SIZE = 24;
|
|||
AudioToolBox::AudioToolBox() :
|
||||
_iconPulseTimeReference(usecTimestampNow())
|
||||
{
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
_micTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic.svg"));
|
||||
_muteTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic-mute.svg"));
|
||||
_boxTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/audio-box.svg"));
|
||||
}
|
||||
|
||||
bool AudioToolBox::mousePressEvent(int x, int y) {
|
||||
|
@ -40,10 +36,20 @@ bool AudioToolBox::mousePressEvent(int x, int y) {
|
|||
}
|
||||
|
||||
void AudioToolBox::render(int x, int y, bool boxed) {
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
|
||||
Audio::SharedPointer audioIO = DependencyManager::get<Audio>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
if (_micTextureId == 0) {
|
||||
_micTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic.svg"));
|
||||
}
|
||||
if (_muteTextureId == 0) {
|
||||
_muteTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic-mute.svg"));
|
||||
}
|
||||
if (_boxTextureId == 0) {
|
||||
_boxTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/audio-box.svg"));
|
||||
}
|
||||
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
|
||||
if (boxed) {
|
||||
bool isClipping = ((audioIO->getTimeSinceLastClip() > 0.0f) && (audioIO->getTimeSinceLastClip() < 1.0f));
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
#include <DependencyManager.h>
|
||||
|
||||
class AudioToolBox : public QObject {
|
||||
SINGLETON_DEPENDENCY(AudioToolBox)
|
||||
class AudioToolBox : public Dependency {
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
void render(int x, int y, bool boxed);
|
||||
|
||||
|
@ -23,11 +23,11 @@ public:
|
|||
protected:
|
||||
AudioToolBox();
|
||||
private:
|
||||
GLuint _micTextureId;
|
||||
GLuint _muteTextureId;
|
||||
GLuint _boxTextureId;
|
||||
GLuint _micTextureId = 0;
|
||||
GLuint _muteTextureId = 0;
|
||||
GLuint _boxTextureId = 0;
|
||||
QRect _iconBounds;
|
||||
qint64 _iconPulseTimeReference;
|
||||
qint64 _iconPulseTimeReference = 0;
|
||||
};
|
||||
|
||||
#endif // hifi_AudioToolBox_h
|
|
@ -272,7 +272,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
|||
}
|
||||
|
||||
if (postLighting && glm::distance(Application::getInstance()->getAvatar()->getPosition(), _position) < 10.0f) {
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
// render pointing lasers
|
||||
glm::vec3 laserColor = glm::vec3(1.0f, 0.0f, 1.0f);
|
||||
|
@ -950,7 +950,7 @@ int Avatar::_jointConesID = GeometryCache::UNKNOWN_ID;
|
|||
// render a makeshift cone section that serves as a body part connecting joint spheres
|
||||
void Avatar::renderJointConnectingCone(glm::vec3 position1, glm::vec3 position2, float radius1, float radius2) {
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
if (_jointConesID == GeometryCache::UNKNOWN_ID) {
|
||||
_jointConesID = geometryCache->allocateID();
|
||||
|
|
|
@ -80,8 +80,8 @@ void Head::simulate(float deltaTime, bool isMine, bool billboard) {
|
|||
// Only use face trackers when not playing back a recording.
|
||||
if (!myAvatar->isPlaying()) {
|
||||
FaceTracker* faceTracker = Application::getInstance()->getActiveFaceTracker();
|
||||
DdeFaceTracker::SharedPointer dde = DependencyManager::get<DdeFaceTracker>();
|
||||
Faceshift::SharedPointer faceshift = DependencyManager::get<Faceshift>();
|
||||
auto dde = DependencyManager::get<DdeFaceTracker>();
|
||||
auto faceshift = DependencyManager::get<Faceshift>();
|
||||
|
||||
if ((_isFaceshiftConnected = (faceshift == faceTracker))) {
|
||||
_blendshapeCoefficients = faceTracker->getBlendshapeCoefficients();
|
||||
|
@ -339,7 +339,7 @@ void Head::addLeanDeltas(float sideways, float forward) {
|
|||
}
|
||||
|
||||
void Head::renderLookatVectors(glm::vec3 leftEyePosition, glm::vec3 rightEyePosition, glm::vec3 lookatPosition) {
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
DependencyManager::get<GlowEffect>()->begin();
|
||||
|
||||
glLineWidth(2.0);
|
||||
|
|
|
@ -146,7 +146,7 @@ void MyAvatar::update(float deltaTime) {
|
|||
head->relaxLean(deltaTime);
|
||||
updateFromTrackers(deltaTime);
|
||||
// Get audio loudness data from audio input device
|
||||
Audio::SharedPointer audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
head->setAudioLoudness(audio->getLastInputLoudness());
|
||||
head->setAudioAverageLoudness(audio->getAudioAverageInputLoudness());
|
||||
|
||||
|
@ -864,7 +864,7 @@ int MyAvatar::parseDataAtOffset(const QByteArray& packet, int offset) {
|
|||
|
||||
void MyAvatar::sendKillAvatar() {
|
||||
QByteArray killPacket = byteArrayWithPopulatedHeader(PacketTypeKillAvatar);
|
||||
NodeList::getInstance()->broadcastToNodes(killPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
DependencyManager::get<NodeList>()->broadcastToNodes(killPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
}
|
||||
|
||||
void MyAvatar::updateLookAtTargetAvatar() {
|
||||
|
|
|
@ -339,7 +339,7 @@ void SkeletonModel::renderJointConstraints(int jointIndex) {
|
|||
glScalef(fanScale, fanScale, fanScale);
|
||||
const int AXIS_COUNT = 3;
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
for (int i = 0; i < AXIS_COUNT; i++) {
|
||||
if (joint.rotationMin[i] <= -PI + EPSILON && joint.rotationMax[i] >= PI - EPSILON) {
|
||||
|
@ -381,7 +381,7 @@ void SkeletonModel::renderJointConstraints(int jointIndex) {
|
|||
}
|
||||
|
||||
void SkeletonModel::renderOrientationDirections(int jointIndex, glm::vec3 position, const glm::quat& orientation, float size) {
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
if (!_jointOrientationLines.contains(jointIndex)) {
|
||||
OrientationLineIDs jointLineIDs;
|
||||
|
@ -594,7 +594,7 @@ void SkeletonModel::renderRagdoll() {
|
|||
float radius1 = 0.008f;
|
||||
float radius2 = 0.01f;
|
||||
glm::vec3 simulationTranslation = _ragdoll->getTranslationInSimulationFrame();
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
for (int i = 0; i < numPoints; ++i) {
|
||||
glPushMatrix();
|
||||
// NOTE: ragdollPoints are in simulation-frame but we want them to be model-relative
|
||||
|
@ -954,7 +954,7 @@ void SkeletonModel::renderBoundingCollisionShapes(float alpha) {
|
|||
endPoint = endPoint - _translation;
|
||||
glTranslatef(endPoint.x, endPoint.y, endPoint.z);
|
||||
glColor4f(0.6f, 0.6f, 0.8f, alpha);
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
geometryCache->renderSphere(_boundingShape.getRadius(), BALL_SUBDIVISIONS, BALL_SUBDIVISIONS);
|
||||
|
||||
// draw a yellow sphere at the capsule startpoint
|
||||
|
@ -990,7 +990,7 @@ void SkeletonModel::renderJointCollisionShapes(float alpha) {
|
|||
continue;
|
||||
}
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
glPushMatrix();
|
||||
// shapes are stored in simulation-frame but we want position to be model-relative
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include "FaceTracker.h"
|
||||
|
||||
class DdeFaceTracker : public FaceTracker {
|
||||
class DdeFaceTracker : public FaceTracker, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(DdeFaceTracker)
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
//initialization
|
||||
|
|
|
@ -27,9 +27,9 @@ const float DEFAULT_FACESHIFT_EYE_DEFLECTION = 0.25f;
|
|||
const QString DEFAULT_FACESHIFT_HOSTNAME = "localhost";
|
||||
|
||||
/// Handles interaction with the Faceshift software, which provides head position/orientation and facial features.
|
||||
class Faceshift : public FaceTracker {
|
||||
class Faceshift : public FaceTracker, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(Faceshift)
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
|
|
@ -563,7 +563,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
|||
}
|
||||
|
||||
// restore our normal viewport
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -582,7 +582,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
|
|||
void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) {
|
||||
|
||||
glLoadIdentity();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
glOrtho(0, glCanvas->getDeviceWidth(), 0, glCanvas->getDeviceHeight(), -1.0, 1.0);
|
||||
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
|
|
@ -215,7 +215,7 @@ void PrioVR::renderCalibrationCountdown() {
|
|||
static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold,
|
||||
false, TextRenderer::OUTLINE_EFFECT, 2);
|
||||
QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "...";
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
textRenderer->draw((glCanvas->width() - textRenderer->computeWidth(text.constData())) / 2,
|
||||
glCanvas->height() / 2,
|
||||
text);
|
||||
|
|
250
interface/src/devices/RealSense.cpp
Normal file
250
interface/src/devices/RealSense.cpp
Normal file
|
@ -0,0 +1,250 @@
|
|||
//
|
||||
// RealSense.cpp
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Thijs Wenker on 12/10/14
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
#include "RealSense.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Menu.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
const int PALMROOT_NUM_JOINTS = 2;
|
||||
const int FINGER_NUM_JOINTS = 4;
|
||||
|
||||
const DeviceTracker::Name RealSense::NAME = "RealSense";
|
||||
|
||||
// find the index of a joint from
|
||||
// the side: true = right
|
||||
// the finger & the bone:
|
||||
// finger in [0..4] : bone in [0..3] a finger phalange
|
||||
// [-1] up the hand branch : bone in [0..1] <=> [ hand, forearm]
|
||||
MotionTracker::Index evalRealSenseJointIndex(bool isRightSide, int finger, int bone) {
|
||||
#ifdef HAVE_RSSDK
|
||||
MotionTracker::Index offset = 1 // start after root
|
||||
+ (int(isRightSide) * PXCHandData::NUMBER_OF_JOINTS) // then offset for side
|
||||
+ PALMROOT_NUM_JOINTS; // then add the arm/forearm/hand chain
|
||||
if (finger >= 0) {
|
||||
// from there go down in the correct finger and bone
|
||||
return offset + (finger * FINGER_NUM_JOINTS) + bone;
|
||||
} else {
|
||||
// or go back up for the correct root bone
|
||||
return offset - 1 - bone;
|
||||
}
|
||||
#else
|
||||
return -1;
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
// static
|
||||
void RealSense::init() {
|
||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||
if (!device) {
|
||||
// create a new RealSense and register it
|
||||
RealSense* realSense = new RealSense();
|
||||
DeviceTracker::registerDevice(NAME, realSense);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
RealSense* RealSense::getInstance() {
|
||||
DeviceTracker* device = DeviceTracker::getDevice(NAME);
|
||||
if (!device) {
|
||||
// create a new RealSense and register it
|
||||
RealSense* realSense = new RealSense();
|
||||
DeviceTracker::registerDevice(NAME, realSense);
|
||||
}
|
||||
return dynamic_cast< RealSense* > (device);
|
||||
}
|
||||
|
||||
RealSense::RealSense() :
|
||||
MotionTracker(),
|
||||
_active(false)
|
||||
{
|
||||
#ifdef HAVE_RSSDK
|
||||
_handData = NULL;
|
||||
_session = PXCSession_Create();
|
||||
initSession(false, NULL);
|
||||
|
||||
// Create the RealSense joint hierarchy
|
||||
std::vector< Semantic > sides;
|
||||
sides.push_back("joint_L_");
|
||||
sides.push_back("joint_R_");
|
||||
|
||||
std::vector< Semantic > rootBones;
|
||||
rootBones.push_back("wrist");
|
||||
rootBones.push_back("hand");
|
||||
|
||||
std::vector< Semantic > fingers;
|
||||
fingers.push_back("thumb");
|
||||
fingers.push_back("index");
|
||||
fingers.push_back("middle");
|
||||
fingers.push_back("ring");
|
||||
fingers.push_back("pinky");
|
||||
|
||||
std::vector< Semantic > fingerBones;
|
||||
fingerBones.push_back("1");
|
||||
fingerBones.push_back("2");
|
||||
fingerBones.push_back("3");
|
||||
fingerBones.push_back("4");
|
||||
|
||||
std::vector< Index > palms;
|
||||
for (unsigned int s = 0; s < sides.size(); s++) {
|
||||
Index rootJoint = 0;
|
||||
for (unsigned int rb = 0; rb < rootBones.size(); rb++) {
|
||||
rootJoint = addJoint(sides[s] + rootBones[rb], rootJoint);
|
||||
}
|
||||
|
||||
// capture the hand index for debug
|
||||
palms.push_back(rootJoint);
|
||||
|
||||
for (unsigned int f = 0; f < fingers.size(); f++) {
|
||||
for (unsigned int b = 0; b < fingerBones.size(); b++) {
|
||||
rootJoint = addJoint(sides[s] + fingers[f] + fingerBones[b], rootJoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
RealSense::~RealSense() {
|
||||
#ifdef HAVE_RSSDK
|
||||
_manager->Release();
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
void RealSense::initSession(bool playback, QString filename) {
|
||||
#ifdef HAVE_RSSDK
|
||||
_active = false;
|
||||
_properlyInitialized = false;
|
||||
if (_handData != NULL) {
|
||||
_handData->Release();
|
||||
_handController->Release();
|
||||
_session->Release();
|
||||
_config->Release();
|
||||
}
|
||||
_manager = _session->CreateSenseManager();
|
||||
if (playback) {
|
||||
_manager->QueryCaptureManager()->SetFileName(filename.toStdWString().c_str(), false);
|
||||
}
|
||||
_manager->QueryCaptureManager()->SetRealtime(!playback);
|
||||
_manager->EnableHand(0);
|
||||
_handController = _manager->QueryHand();
|
||||
|
||||
if (_manager->Init() == PXC_STATUS_NO_ERROR) {
|
||||
_handData = _handController->CreateOutput();
|
||||
|
||||
PXCCapture::Device *device = _manager->QueryCaptureManager()->QueryDevice();
|
||||
PXCCapture::DeviceInfo dinfo;
|
||||
_manager->QueryCaptureManager()->QueryDevice()->QueryDeviceInfo(&dinfo);
|
||||
if (dinfo.model == PXCCapture::DEVICE_MODEL_IVCAM)
|
||||
{
|
||||
device->SetDepthConfidenceThreshold(1);
|
||||
device->SetMirrorMode(PXCCapture::Device::MIRROR_MODE_DISABLED);
|
||||
device->SetIVCAMFilterOption(6);
|
||||
}
|
||||
_properlyInitialized = true;
|
||||
}
|
||||
|
||||
_config = _handController->CreateActiveConfiguration();
|
||||
_config->EnableStabilizer(true);
|
||||
_config->SetTrackingMode(PXCHandData::TRACKING_MODE_FULL_HAND);
|
||||
_config->ApplyChanges();
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
glm::quat quatFromPXCPoint4DF32(const PXCPoint4DF32& basis) {
|
||||
return glm::normalize(glm::quat(basis.w, basis.x, basis.y, basis.z) * glm::quat(glm::vec3(0, M_PI, 0)));
|
||||
}
|
||||
|
||||
glm::vec3 vec3FromPXCPoint3DF32(const PXCPoint3DF32& vec) {
|
||||
return glm::vec3(-vec.x, vec.y, -vec.z);
|
||||
}
|
||||
#endif // HAVE_RSSDK
|
||||
|
||||
void RealSense::update() {
|
||||
#ifdef HAVE_RSSDK
|
||||
bool wasActive = _active;
|
||||
_active = _manager->IsConnected() && _properlyInitialized;
|
||||
if (_active || wasActive) {
|
||||
// Go through all the joints and increment their counter since last update.
|
||||
// Increment all counters once after controller first becomes inactive so that each joint reports itself as inactive.
|
||||
// TODO C++11 for (auto jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
|
||||
for (JointTracker::Vector::iterator jointIt = _jointsArray.begin(); jointIt != _jointsArray.end(); jointIt++) {
|
||||
(*jointIt).tickNewFrame();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
pxcStatus sts = _manager->AcquireFrame(true);
|
||||
_handData->Update();
|
||||
PXCHandData::JointData nodes[2][PXCHandData::NUMBER_OF_JOINTS] = {};
|
||||
PXCHandData::ExtremityData extremitiesPointsNodes[2][PXCHandData::NUMBER_OF_EXTREMITIES] = {};
|
||||
for (pxcI32 i = 0; i < _handData->QueryNumberOfHands(); i++) {
|
||||
PXCHandData::IHand* handData;
|
||||
if (_handData->QueryHandData(PXCHandData::ACCESS_ORDER_BY_TIME, i, handData) == PXC_STATUS_NO_ERROR) {
|
||||
int rightSide = handData->QueryBodySide() == PXCHandData::BODY_SIDE_RIGHT;
|
||||
PXCHandData::JointData jointData;
|
||||
JointTracker* parentJointTracker = _jointsArray.data();
|
||||
//Iterate Joints
|
||||
int rootBranchIndex = -1;
|
||||
JointTracker* palmJoint = NULL;
|
||||
for (int j = 0; j < PXCHandData::NUMBER_OF_JOINTS; j++) {
|
||||
handData->QueryTrackedJoint((PXCHandData::JointType)j, jointData);
|
||||
nodes[i][j] = jointData;
|
||||
if (j == PXCHandData::JOINT_WRIST) {
|
||||
JointTracker* wrist = editJointTracker(evalRealSenseJointIndex(rightSide, rootBranchIndex, 1)); // 1 is the index of the wrist joint
|
||||
wrist->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld));
|
||||
wrist->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation));
|
||||
wrist->updateLocFromAbsTransform(parentJointTracker);
|
||||
wrist->activeFrame();
|
||||
parentJointTracker = wrist;
|
||||
continue;
|
||||
} else if (j == PXCHandData::JOINT_CENTER) {
|
||||
palmJoint = editJointTracker(evalRealSenseJointIndex(rightSide, rootBranchIndex, 0)); // 0 is the index of the palm joint
|
||||
palmJoint->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld));
|
||||
palmJoint->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation));
|
||||
palmJoint->updateLocFromAbsTransform(parentJointTracker);
|
||||
palmJoint->activeFrame();
|
||||
parentJointTracker = palmJoint;
|
||||
continue;
|
||||
}
|
||||
int finger_index = j - PALMROOT_NUM_JOINTS;
|
||||
int finger = finger_index / FINGER_NUM_JOINTS;
|
||||
int finger_bone = finger_index % FINGER_NUM_JOINTS;
|
||||
JointTracker* ljointTracker = editJointTracker(evalRealSenseJointIndex(rightSide, finger, finger_bone));
|
||||
if (jointData.confidence > 0) {
|
||||
ljointTracker->editAbsFrame().setTranslation(vec3FromPXCPoint3DF32(jointData.positionWorld));
|
||||
ljointTracker->editAbsFrame().setRotation(quatFromPXCPoint4DF32(jointData.globalOrientation));
|
||||
ljointTracker->updateLocFromAbsTransform(parentJointTracker);
|
||||
ljointTracker->activeFrame();
|
||||
}
|
||||
if (finger_bone == (FINGER_NUM_JOINTS - 1)) {
|
||||
parentJointTracker = palmJoint;
|
||||
continue;
|
||||
}
|
||||
parentJointTracker = ljointTracker;
|
||||
}
|
||||
}
|
||||
}
|
||||
_manager->ReleaseFrame();
|
||||
#endif // HAVE_RSSDK
|
||||
}
|
||||
|
||||
void RealSense::loadRSSDKFile() {
|
||||
QString locationDir(QStandardPaths::displayName(QStandardPaths::DesktopLocation));
|
||||
QString fileNameString = QFileDialog::getOpenFileName(Application::getInstance()->getWindow(), tr("Open RSSDK clip"),
|
||||
locationDir,
|
||||
tr("RSSDK Recordings (*.rssdk)"));
|
||||
if (!fileNameString.isEmpty()) {
|
||||
initSession(true, fileNameString);
|
||||
}
|
||||
}
|
63
interface/src/devices/RealSense.h
Normal file
63
interface/src/devices/RealSense.h
Normal file
|
@ -0,0 +1,63 @@
|
|||
//
|
||||
// RealSense.h
|
||||
// interface/src/devices
|
||||
//
|
||||
// Created by Thijs Wenker on 12/10/14
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_RealSense_h
|
||||
#define hifi_RealSense_h
|
||||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "MotionTracker.h"
|
||||
|
||||
#ifdef HAVE_RSSDK
|
||||
#include <pxcsession.h>
|
||||
#include <pxchandmodule.h>
|
||||
#include <pxchandconfiguration.h>
|
||||
#include <pxcsensemanager.h>
|
||||
#include <pxchanddata.h>
|
||||
#endif
|
||||
|
||||
/// Handles interaction with the RealSense skeleton tracking suit.
|
||||
class RealSense : public QObject, public MotionTracker {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const Name NAME;
|
||||
|
||||
static void init();
|
||||
|
||||
/// RealSense MotionTracker factory
|
||||
static RealSense* getInstance();
|
||||
|
||||
bool isActive() const { return _active; }
|
||||
|
||||
virtual void update();
|
||||
|
||||
void loadRSSDKFile();
|
||||
|
||||
protected:
|
||||
RealSense();
|
||||
virtual ~RealSense();
|
||||
|
||||
void initSession(bool playback, QString filename);
|
||||
|
||||
private:
|
||||
#ifdef HAVE_RSSDK
|
||||
PXCSession* _session;
|
||||
PXCSenseManager* _manager;
|
||||
PXCHandModule* _handController;
|
||||
PXCHandData* _handData;
|
||||
PXCHandConfiguration* _config;
|
||||
#endif
|
||||
bool _properlyInitialized;
|
||||
bool _active;
|
||||
};
|
||||
|
||||
#endif // hifi_RealSense_h
|
|
@ -451,7 +451,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
|
|||
void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||
Application* application = Application::getInstance();
|
||||
MyAvatar* avatar = application->getAvatar();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
QPoint pos;
|
||||
|
||||
Qt::MouseButton bumperButton;
|
||||
|
|
|
@ -35,7 +35,7 @@ bool TV3DManager::isConnected() {
|
|||
}
|
||||
|
||||
void TV3DManager::connect() {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
int width = glCanvas->getDeviceWidth();
|
||||
int height = glCanvas->getDeviceHeight();
|
||||
Camera& camera = *Application::getInstance()->getCamera();
|
||||
|
@ -93,7 +93,7 @@ void TV3DManager::display(Camera& whichCamera) {
|
|||
// left eye portal
|
||||
int portalX = 0;
|
||||
int portalY = 0;
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
QSize deviceSize = glCanvas->getDeviceSize() *
|
||||
Application::getInstance()->getRenderResolutionScale();
|
||||
int portalW = deviceSize.width() / 2;
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace VisageSDK {
|
|||
}
|
||||
|
||||
/// Handles input from the Visage webcam feature tracking software.
|
||||
class Visage : public FaceTracker {
|
||||
class Visage : public FaceTracker, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(Visage)
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
void init();
|
||||
|
|
|
@ -45,7 +45,7 @@ void OctreePacketProcessor::processPacket(const SharedNodePointer& sendingNode,
|
|||
|
||||
// TODO: this does not look correct, the goal is to test the packet version for the piggyback, but
|
||||
// this is testing the version and hash of the original packet
|
||||
if (!NodeList::getInstance()->packetVersionAndHashMatch(packet)) {
|
||||
if (!DependencyManager::get<NodeList>()->packetVersionAndHashMatch(packet)) {
|
||||
return; // bail since piggyback data doesn't match our versioning
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -268,7 +268,7 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) {
|
|||
}
|
||||
|
||||
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
return glm::vec2(glCanvas->width(), glCanvas->height());
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ AddressBarDialog::AddressBarDialog() :
|
|||
setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
setupUI();
|
||||
|
||||
AddressManager::SharedPointer addressManager = DependencyManager::get<AddressManager>();
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
|
||||
connect(addressManager.data(), &AddressManager::lookupResultIsOffline, this, &AddressBarDialog::displayAddressOfflineMessage);
|
||||
connect(addressManager.data(), &AddressManager::lookupResultIsNotFound, this, &AddressBarDialog::displayAddressNotFoundMessage);
|
||||
|
@ -131,7 +131,7 @@ void AddressBarDialog::showEvent(QShowEvent* event) {
|
|||
void AddressBarDialog::accept() {
|
||||
if (!_addressLineEdit->text().isEmpty()) {
|
||||
_goButton->setIcon(QIcon(PathUtils::resourcesPath() + ADDRESSBAR_GO_BUTTON_ACTIVE_ICON));
|
||||
AddressManager::SharedPointer addressManager = DependencyManager::get<AddressManager>();
|
||||
auto addressManager = DependencyManager::get<AddressManager>();
|
||||
connect(addressManager.data(), &AddressManager::lookupResultsFinished, this, &QDialog::hide);
|
||||
addressManager->handleLookupString(_addressLineEdit->text());
|
||||
}
|
||||
|
|
|
@ -142,7 +142,7 @@ ApplicationOverlay::ApplicationOverlay() :
|
|||
memset(_magActive, 0, sizeof(_reticleActive));
|
||||
memset(_magSizeMult, 0, sizeof(_magSizeMult));
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
_reticleQuad = geometryCache->allocateID();
|
||||
_magnifierQuad = geometryCache->allocateID();
|
||||
|
@ -162,7 +162,7 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
|||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
|
||||
Application* application = Application::getInstance();
|
||||
Overlays& overlays = application->getOverlays();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
_textureFov = glm::radians(Menu::getInstance()->getOculusUIAngularSize());
|
||||
_textureAspectRatio = (float)glCanvas->getDeviceWidth() / (float)glCanvas->getDeviceHeight();
|
||||
|
@ -231,7 +231,7 @@ void ApplicationOverlay::displayOverlayTexture() {
|
|||
if (_alpha == 0.0f) {
|
||||
return;
|
||||
}
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -395,7 +395,7 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
|
|||
glm::vec2(0.0f, 1.0f), glm::vec2(1.0f, 1.0f),
|
||||
glm::vec2(1.0f, 0.0f), glm::vec2(0.0f, 0.0f));
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
if (_crosshairTexture == 0) {
|
||||
_crosshairTexture = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png"));
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origi
|
|||
//Caculate the click location using one of the sixense controllers. Scale is not applied
|
||||
QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
||||
Application* application = Application::getInstance();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
MyAvatar* myAvatar = application->getAvatar();
|
||||
|
||||
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
|
||||
|
@ -527,7 +527,7 @@ bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position,
|
|||
//Renders optional pointers
|
||||
void ApplicationOverlay::renderPointers() {
|
||||
Application* application = Application::getInstance();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
//lazily load crosshair texture
|
||||
if (_crosshairTexture == 0) {
|
||||
|
@ -575,7 +575,7 @@ void ApplicationOverlay::renderPointers() {
|
|||
|
||||
void ApplicationOverlay::renderControllerPointers() {
|
||||
Application* application = Application::getInstance();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
MyAvatar* myAvatar = application->getAvatar();
|
||||
|
||||
//Static variables used for storing controller state
|
||||
|
@ -720,7 +720,7 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) {
|
|||
|
||||
//Renders a small magnification of the currently bound texture at the coordinates
|
||||
void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool showBorder) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
const int widgetWidth = glCanvas->width();
|
||||
const int widgetHeight = glCanvas->height();
|
||||
|
@ -746,7 +746,7 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
|
|||
const glm::vec3 topLeft = getPoint(topLeftYawPitch.x, topLeftYawPitch.y);
|
||||
const glm::vec3 topRight = getPoint(bottomRightYawPitch.x, topLeftYawPitch.y);
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
if (bottomLeft != _previousMagnifierBottomLeft || bottomRight != _previousMagnifierBottomRight
|
||||
|| topLeft != _previousMagnifierTopLeft || topRight != _previousMagnifierTopRight) {
|
||||
|
@ -786,9 +786,8 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
|
|||
}
|
||||
|
||||
void ApplicationOverlay::renderAudioMeter() {
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
Audio::SharedPointer audio = DependencyManager::get<Audio>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
|
||||
// Audio VU Meter and Mute Icon
|
||||
const int MUTE_ICON_SIZE = 24;
|
||||
|
@ -907,7 +906,7 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
|||
|
||||
Application* application = Application::getInstance();
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
|
||||
BandwidthMeter* bandwidthMeter = application->getBandwidthMeter();
|
||||
NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay();
|
||||
|
@ -946,11 +945,11 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
|||
}
|
||||
|
||||
void ApplicationOverlay::renderDomainConnectionStatusBorder() {
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
if (nodeList && !nodeList->getDomainHandler().isConnected()) {
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
int width = glCanvas->width();
|
||||
int height = glCanvas->height();
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ void NodeBounds::draw() {
|
|||
glm::vec3 selectedCenter;
|
||||
float selectedScale = 0;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->eachNode([&](const SharedNodePointer& node){
|
||||
NodeType_t nodeType = node->getType();
|
||||
|
||||
|
|
|
@ -228,7 +228,7 @@ void OctreeStatsDialog::showOctreeServersOfType(int& serverCount, NodeType_t ser
|
|||
|
||||
QLocale locale(QLocale::English);
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
nodeList->eachNode([&](const SharedNodePointer& node){
|
||||
|
||||
// only send to the NodeTypes that are NodeType_t_VOXEL_SERVER
|
||||
|
|
|
@ -140,7 +140,7 @@ void PreferencesDialog::loadPreferences() {
|
|||
ui.windowSecondsForDesiredReductionSpin->setValue(streamSettings._windowSecondsForDesiredReduction);
|
||||
ui.repetitionWithFadeCheckBox->setChecked(streamSettings._repetitionWithFade);
|
||||
|
||||
QSharedPointer<Audio> audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
ui.outputBufferSizeSpinner->setValue(audio->getOutputBufferSize());
|
||||
|
||||
ui.outputStarveDetectionCheckBox->setChecked(audio->getOutputStarveDetectionEnabled());
|
||||
|
@ -224,7 +224,7 @@ void PreferencesDialog::savePreferences() {
|
|||
myAvatar->setLeanScale(ui.leanScaleSpin->value());
|
||||
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
|
||||
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
|
||||
|
||||
Menu::getInstance()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());
|
||||
|
@ -256,7 +256,7 @@ void PreferencesDialog::savePreferences() {
|
|||
|
||||
Menu::getInstance()->setReceivedAudioStreamSettings(streamSettings);
|
||||
|
||||
QSharedPointer<Audio> audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
|
||||
QMetaObject::invokeMethod(audio.data(), "setOutputBufferSize", Q_ARG(int, ui.outputBufferSizeSpinner->value()));
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ QTemporaryFile* Snapshot::saveTempSnapshot() {
|
|||
}
|
||||
|
||||
QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
QImage shot = glCanvas->grabFrameBuffer();
|
||||
|
||||
Avatar* avatar = Application::getInstance()->getAvatar();
|
||||
|
@ -101,7 +101,7 @@ QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
|
|||
shot.setText(ORIENTATION_Z, QString::number(orientation.z));
|
||||
shot.setText(ORIENTATION_W, QString::number(orientation.w));
|
||||
|
||||
shot.setText(DOMAIN_KEY, NodeList::getInstance()->getDomainHandler().getHostname());
|
||||
shot.setText(DOMAIN_KEY, DependencyManager::get<NodeList>()->getDomainHandler().getHostname());
|
||||
|
||||
QString formattedLocation = QString("%1_%2_%3").arg(location.x).arg(location.y).arg(location.z);
|
||||
// replace decimal . with '-'
|
||||
|
|
|
@ -56,7 +56,7 @@ Stats::Stats():
|
|||
_metavoxelReceiveProgress(0),
|
||||
_metavoxelReceiveTotal(0)
|
||||
{
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
resetWidth(glCanvas->width(), 0);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void Stats::toggleExpanded() {
|
|||
// called on mouse click release
|
||||
// check for clicks over stats in order to expand or contract them
|
||||
void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) {
|
||||
// not worried about dragging on stats
|
||||
|
@ -122,7 +122,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
|
|||
}
|
||||
|
||||
void Stats::resetWidth(int width, int horizontalOffset) {
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
int extraSpace = glCanvas->width() - horizontalOffset -2
|
||||
- STATS_GENERAL_MIN_WIDTH
|
||||
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
|
||||
|
@ -195,7 +195,7 @@ void Stats::display(
|
|||
int bytesPerSecond,
|
||||
int voxelPacketsToProcess)
|
||||
{
|
||||
GLCanvas::SharedPointer glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
|
||||
unsigned int backgroundColor = 0x33333399;
|
||||
int verticalOffset = 0, lines = 0;
|
||||
|
@ -215,7 +215,7 @@ void Stats::display(
|
|||
|
||||
// we need to take one avatar out so we don't include ourselves
|
||||
int totalAvatars = Application::getInstance()->getAvatarManager().size() - 1;
|
||||
int totalServers = NodeList::getInstance()->size();
|
||||
int totalServers = DependencyManager::get<NodeList>()->size();
|
||||
|
||||
lines = _expanded ? 5 : 3;
|
||||
int columnOneWidth = _generalStatsWidth;
|
||||
|
@ -315,7 +315,7 @@ void Stats::display(
|
|||
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||
int pingAudio = -1, pingAvatar = -1, pingVoxel = -1, pingOctreeMax = -1;
|
||||
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixerNode = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
SharedNodePointer avatarMixerNode = nodeList->soloNodeOfType(NodeType::AvatarMixer);
|
||||
|
||||
|
@ -420,7 +420,7 @@ void Stats::display(
|
|||
drawText(horizontalOffset, verticalOffset, scale, rotation, font, avatarBodyYaw, color);
|
||||
|
||||
if (_expanded) {
|
||||
SharedNodePointer avatarMixer = NodeList::getInstance()->soloNodeOfType(NodeType::AvatarMixer);
|
||||
SharedNodePointer avatarMixer = DependencyManager::get<NodeList>()->soloNodeOfType(NodeType::AvatarMixer);
|
||||
if (avatarMixer) {
|
||||
sprintf(avatarMixerStats, "Avatar Mixer: %.f kbps, %.f pps",
|
||||
roundf(avatarMixer->getAverageKilobitsPerSecond()),
|
||||
|
|
|
@ -124,7 +124,7 @@ void Circle3DOverlay::render(RenderArgs* args) {
|
|||
|
||||
glLineWidth(_lineWidth);
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
// for our overlay, is solid means we draw a ring between the inner and outer radius of the circle, otherwise
|
||||
// we just draw a line...
|
||||
|
|
|
@ -111,7 +111,7 @@ void Cube3DOverlay::render(RenderArgs* args) {
|
|||
glm::vec3 topLeftFar(-halfDimensions.x, halfDimensions.y, halfDimensions.z);
|
||||
glm::vec3 topRightFar(halfDimensions.x, halfDimensions.y, halfDimensions.z);
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
geometryCache->renderDashedLine(bottomLeftNear, bottomRightNear);
|
||||
geometryCache->renderDashedLine(bottomRightNear, bottomRightFar);
|
||||
|
|
|
@ -66,7 +66,7 @@ void Rectangle3DOverlay::render(RenderArgs* args) {
|
|||
|
||||
glLineWidth(_lineWidth);
|
||||
|
||||
GeometryCache::SharedPointer geometryCache = DependencyManager::get<GeometryCache>();
|
||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||
|
||||
// for our overlay, is solid means we draw a solid "filled" rectangle otherwise we just draw a border line...
|
||||
if (getIsSolid()) {
|
||||
|
|
|
@ -24,9 +24,9 @@ class Animation;
|
|||
typedef QSharedPointer<Animation> AnimationPointer;
|
||||
|
||||
/// Scriptable interface for FBX animation loading.
|
||||
class AnimationCache : public ResourceCache {
|
||||
class AnimationCache : public ResourceCache, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY(AnimationCache)
|
||||
SINGLETON_DEPENDENCY
|
||||
|
||||
public:
|
||||
Q_INVOKABLE AnimationPointer getAnimation(const QString& url) { return getAnimation(QUrl(url)); }
|
||||
|
|
|
@ -229,7 +229,7 @@ void AudioInjector::injectToMixer() {
|
|||
_audioData.data() + _currentSendPosition, bytesToCopy);
|
||||
|
||||
// grab our audio mixer from the NodeList, if it exists
|
||||
NodeList* nodeList = NodeList::getInstance();
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer audioMixer = nodeList->soloNodeOfType(NodeType::AudioMixer);
|
||||
|
||||
// send off this audio packet
|
||||
|
|
|
@ -338,9 +338,12 @@ int AvatarData::parseDataAtOffset(const QByteArray& packet, int offset) {
|
|||
}
|
||||
return maxAvailableSize;
|
||||
}
|
||||
_bodyYaw = yaw;
|
||||
_bodyPitch = pitch;
|
||||
_bodyRoll = roll;
|
||||
if (_bodyYaw != yaw || _bodyPitch != pitch || _bodyRoll != roll) {
|
||||
_hasNewJointRotations = true;
|
||||
_bodyYaw = yaw;
|
||||
_bodyPitch = pitch;
|
||||
_bodyRoll = roll;
|
||||
}
|
||||
|
||||
// scale
|
||||
float scale;
|
||||
|
@ -1068,7 +1071,7 @@ void AvatarData::sendIdentityPacket() {
|
|||
QByteArray identityPacket = byteArrayWithPopulatedHeader(PacketTypeAvatarIdentity);
|
||||
identityPacket.append(identityByteArray());
|
||||
|
||||
NodeList::getInstance()->broadcastToNodes(identityPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
DependencyManager::get<NodeList>()->broadcastToNodes(identityPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
}
|
||||
|
||||
void AvatarData::sendBillboardPacket() {
|
||||
|
@ -1076,7 +1079,7 @@ void AvatarData::sendBillboardPacket() {
|
|||
QByteArray billboardPacket = byteArrayWithPopulatedHeader(PacketTypeAvatarBillboard);
|
||||
billboardPacket.append(_billboard);
|
||||
|
||||
NodeList::getInstance()->broadcastToNodes(billboardPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
DependencyManager::get<NodeList>()->broadcastToNodes(billboardPacket, NodeSet() << NodeType::AvatarMixer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ AvatarHashMap::AvatarHashMap() :
|
|||
_avatarHash(),
|
||||
_lastOwnerSessionUUID()
|
||||
{
|
||||
connect(NodeList::getInstance(), &NodeList::uuidChanged, this, &AvatarHashMap::sessionUUIDChanged);
|
||||
connect(DependencyManager::get<NodeList>().data(), &NodeList::uuidChanged, this, &AvatarHashMap::sessionUUIDChanged);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ void Player::startPlaying() {
|
|||
|
||||
if (!isPaused()) {
|
||||
_currentContext.globalTimestamp = usecTimestampNow();
|
||||
_currentContext.domain = NodeList::getInstance()->getDomainHandler().getHostname();
|
||||
_currentContext.domain = DependencyManager::get<NodeList>()->getDomainHandler().getHostname();
|
||||
_currentContext.position = _avatar->getPosition();
|
||||
_currentContext.orientation = _avatar->getOrientation();
|
||||
_currentContext.scale = _avatar->getTargetScale();
|
||||
|
|
|
@ -42,7 +42,7 @@ void Recorder::startRecording() {
|
|||
|
||||
RecordingContext& context = _recording->getContext();
|
||||
context.globalTimestamp = usecTimestampNow();
|
||||
context.domain = NodeList::getInstance()->getDomainHandler().getHostname();
|
||||
context.domain = DependencyManager::get<NodeList>()->getDomainHandler().getHostname();
|
||||
context.position = _avatar->getPosition();
|
||||
context.orientation = _avatar->getOrientation();
|
||||
context.scale = _avatar->getTargetScale();
|
||||
|
|
|
@ -670,7 +670,7 @@ RecordingPointer readRecordingFromRecFile(RecordingPointer recording, const QStr
|
|||
// Fake context
|
||||
RecordingContext& context = recording->getContext();
|
||||
context.globalTimestamp = usecTimestampNow();
|
||||
context.domain = NodeList::getInstance()->getDomainHandler().getHostname();
|
||||
context.domain = DependencyManager::get<NodeList>()->getDomainHandler().getHostname();
|
||||
context.position = glm::vec3(144.5f, 3.3f, 181.3f);
|
||||
context.orientation = glm::angleAxis(glm::radians(-92.5f), glm::vec3(0, 1, 0));;
|
||||
context.scale = baseFrame._scale;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue