History

Merge branch 'master' of https://github.com/worklist/hifi

Philip Rosedale committed 13 years ago

Commit 98ec2ef2 parents c742871 934b15274 files · +5799 −642Browse files

Showing the changes to interface/src/Application.cpp (1 of 74 files). Show all

Unified · Split

interface/src/Application.cpp+217−62
@@ -56,6 +56,8 @@ · 55 unmodified lines
5656 #include <PairingHandler.h>
5757 #include <PerfStat.h>
5858
59+#include <VoxelSceneStats.h>
60+
5961 #include "Application.h"
6062 #include "InterfaceConfig.h"
6163 #include "LogDisplay.h"
@@ -73,8 +75,6 @@ using namespace std; · 11 unmodified lines
7375 static char STAR_FILE[] = "http://s3-us-west-1.amazonaws.com/highfidelity/stars.txt";
7476 static char STAR_CACHE_FILE[] = "cachedStars.txt";
7577
76−static const bool TESTING_PARTICLE_SYSTEM = true;
77−
7878 static const int BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH = 6; // farther dragged clicks are ignored
7979
8080 const glm::vec3 START_LOCATION(4.f, 0.f, 5.f); // Where one's own node begins in the world
@@ -174,6 +174,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 93 unmodified lines
174174 _window(new QMainWindow(desktop())),
175175 _glWidget(new GLCanvas()),
176176 _bandwidthDialog(NULL),
177+ _voxelStatsDialog(NULL),
177178 _displayLevels(false),
178179 _frameCount(0),
179180 _fps(120.0f),
@@ -201,6 +202,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 21 unmodified lines
201202 _isHoverVoxelSounding(false),
202203 _mouseVoxelScale(1.0f / 1024.0f),
203204 _justEditedVoxel(false),
205+ _isLookingAtOtherAvatar(false),
206+ _lookatIndicatorScale(1.0f),
204207 _paintOn(false),
205208 _dominantColor(0),
206209 _perfStatsOn(false),
@@ -237,6 +240,31 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 30 unmodified lines
237240 NodeList::getInstance()->getNodeSocket()->setBlocking(false);
238241 }
239242
243+ // setup QSettings
244+#ifdef Q_WS_MAC
245+ QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
246+#else
247+ QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
248+#endif
249+
250+ // read the ApplicationInfo.ini file for Name/Version/Domain information
251+ QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
252+
253+ // set the associated application properties
254+ applicationInfo.beginGroup("INFO");
255+
256+ setApplicationName(applicationInfo.value("name").toString());
257+ setApplicationVersion(applicationInfo.value("version").toString());
258+ setOrganizationName(applicationInfo.value("organizationName").toString());
259+ setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
260+
261+ _settings = new QSettings(this);
262+
263+ // check if there is a saved domain server hostname
264+ // this must be done now instead of with the other setting checks to allow manual override with
265+ // --domain or --local options
266+ NodeList::getInstance()->loadData(_settings);
267+
240268 const char* domainIP = getCmdOption(argc, constArgv, "--domain");
241269 if (domainIP) {
242270 NodeList::getInstance()->setDomainIP(domainIP);
@@ -270,23 +298,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 27 unmodified lines
270298
271299 _window->setCentralWidget(_glWidget);
272300
273−#ifdef Q_WS_MAC
274− QString resourcesPath = QCoreApplication::applicationDirPath() + "/../Resources";
275−#else
276− QString resourcesPath = QCoreApplication::applicationDirPath() + "/resources";
277−#endif
278−
279− // read the ApplicationInfo.ini file for Name/Version/Domain information
280− QSettings applicationInfo(resourcesPath + "/info/ApplicationInfo.ini", QSettings::IniFormat);
281−
282− // set the associated application properties
283− applicationInfo.beginGroup("INFO");
284−
285− setApplicationName(applicationInfo.value("name").toString());
286− setApplicationVersion(applicationInfo.value("version").toString());
287− setOrganizationName(applicationInfo.value("organizationName").toString());
288− setOrganizationDomain(applicationInfo.value("organizationDomain").toString());
289−
290301 #if defined(Q_WS_MAC) && defined(QT_NO_DEBUG)
291302 // if this is a release OS X build use fervor to check for an update
292303 FvUpdater::sharedUpdater()->SetFeedURL("https://s3-us-west-1.amazonaws.com/highfidelity/appcast.xml");
@@ -396,7 +407,7 @@ void Application::paintGL() { · 103 unmodified lines
396407
397408 } else if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
398409 _myCamera.setTightness(0.0f); // In first person, camera follows head exactly without delay
399− _myCamera.setTargetPosition(_myAvatar.getUprightHeadPosition());
410+ _myCamera.setTargetPosition(_myAvatar.getUprightEyeLevelPosition());
400411 _myCamera.setTargetRotation(_myAvatar.getHead().getCameraOrientation());
401412
402413 } else if (_myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
@@ -939,6 +950,36 @@ void Application::sendPingPackets() { · 536 unmodified lines
939950 nodesToPing, sizeof(nodesToPing));
940951 }
941952
953+void Application::sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data) {
954+ unsigned char packet[MAX_PACKET_SIZE];
955+ unsigned char* packetPosition = packet;
956+
957+ packetPosition += populateTypeAndVersion(packetPosition, PACKET_TYPE_AVATAR_FACE_VIDEO);
958+
959+ *(uint16_t*)packetPosition = NodeList::getInstance()->getOwnerID();
960+ packetPosition += sizeof(uint16_t);
961+
962+ *(uint32_t*)packetPosition = frameCount;
963+ packetPosition += sizeof(uint32_t);
964+
965+ *(uint32_t*)packetPosition = data.size();
966+ packetPosition += sizeof(uint32_t);
967+
968+ uint32_t* offsetPosition = (uint32_t*)packetPosition;
969+ packetPosition += sizeof(uint32_t);
970+
971+ int headerSize = packetPosition - packet;
972+
973+ // break the data up into submessages of the maximum size
974+ *offsetPosition = 0;
975+ while (*offsetPosition < data.size()) {
976+ int payloadSize = min(data.size() - (int)*offsetPosition, MAX_PACKET_SIZE - headerSize);
977+ memcpy(packetPosition, data.constData() + *offsetPosition, payloadSize);
978+ getInstance()->controlledBroadcastToNodes(packet, headerSize + payloadSize, &NODE_TYPE_AVATAR_MIXER, 1);
979+ *offsetPosition += payloadSize;
980+ }
981+}
982+
942983 // Every second, check the frame rates and other stuff
943984 void Application::timer() {
944985 gettimeofday(&_timerEnd, NULL);
@@ -1048,7 +1089,7 @@ void Application::sendAvatarVoxelURLMessage(const QUrl& url) { · 103 unmodified lines
10481089 controlledBroadcastToNodes((unsigned char*)message.data(), message.size(), & NODE_TYPE_AVATAR_MIXER, 1);
10491090 }
10501091
1051−void Application::processAvatarVoxelURLMessage(unsigned char *packetData, size_t dataBytes) {
1092+static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
10521093 // skip the header
10531094 int numBytesPacketHeader = numBytesForPacketHeader(packetData);
10541095 packetData += numBytesPacketHeader;
@@ -1062,18 +1103,31 @@ void Application::processAvatarVoxelURLMessage(unsigned char *packetData, size_t · 7 unmodified lines
10621103 // make sure the node exists
10631104 Node* node = NodeList::getInstance()->nodeWithID(nodeID);
10641105 if (!node || !node->getLinkedData()) {
1065− return;
1106+ return NULL;
10661107 }
10671108 Avatar* avatar = static_cast<Avatar*>(node->getLinkedData());
1068− if (!avatar->isInitialized()) {
1069− return; // wait until initialized
1070− }
1109+ return avatar->isInitialized() ? avatar : NULL;
1110+}
1111+
1112+void Application::processAvatarVoxelURLMessage(unsigned char* packetData, size_t dataBytes) {
1113+ Avatar* avatar = processAvatarMessageHeader(packetData, dataBytes);
1114+ if (!avatar) {
1115+ return;
1116+ }
10711117 QUrl url = QUrl::fromEncoded(QByteArray((char*)packetData, dataBytes));
10721118
10731119 // invoke the set URL function on the simulate/render thread
10741120 QMetaObject::invokeMethod(avatar->getVoxels(), "setVoxelURL", Q_ARG(QUrl, url));
10751121 }
10761122
1123+void Application::processAvatarFaceVideoMessage(unsigned char* packetData, size_t dataBytes) {
1124+ Avatar* avatar = processAvatarMessageHeader(packetData, dataBytes);
1125+ if (!avatar) {
1126+ return;
1127+ }
1128+ avatar->getHead().getFace().processVideoMessage(packetData, dataBytes);
1129+}
1130+
10771131 void Application::checkBandwidthMeterClick() {
10781132 // ... to be called upon button release
10791133
@@ -1105,6 +1159,21 @@ void Application::bandwidthDetailsClosed() { · 25 unmodified lines
11051159 delete dlg;
11061160 }
11071161
1162+void Application::voxelStatsDetails() {
1163+ if (!_voxelStatsDialog) {
1164+ _voxelStatsDialog = new VoxelStatsDialog(_glWidget, &_voxelSceneStats);
1165+ connect(_voxelStatsDialog, SIGNAL(closed()), SLOT(voxelStatsDetailsClosed()));
1166+ _voxelStatsDialog->show();
1167+ }
1168+ _voxelStatsDialog->raise();
1169+}
1170+
1171+void Application::voxelStatsDetailsClosed() {
1172+ QDialog* dlg = _voxelStatsDialog;
1173+ _voxelStatsDialog = NULL;
1174+ delete dlg;
1175+}
1176+
11081177 void Application::editPreferences() {
11091178 QDialog dialog(_glWidget);
11101179 dialog.setWindowTitle("Interface Preferences");
@@ -1153,11 +1222,18 @@ void Application::editPreferences() { · 42 unmodified lines
11531222 return;
11541223 }
11551224
1156− char newHostname[MAX_HOSTNAME_BYTES] = {};
1157− memcpy(newHostname, domainServerHostname->text().toAscii().data(), domainServerHostname->text().size());
1225+ QByteArray newHostname;
1226+
1227+ if (domainServerHostname->text().size() > 0) {
1228+ // the user input a new hostname, use that
1229+ newHostname = domainServerHostname->text().toAscii();
1230+ } else {
1231+ // the user left the field blank, use the default hostname
1232+ newHostname = QByteArray(DEFAULT_DOMAIN_HOSTNAME);
1233+ }
11581234
11591235 // check if the domain server hostname is new
1160− if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname, strlen(newHostname)) != 0) {
1236+ if (memcmp(NodeList::getInstance()->getDomainHostname(), newHostname.constData(), newHostname.size()) != 0) {
11611237
11621238 NodeList::getInstance()->clear();
11631239
@@ -1167,7 +1243,8 @@ void Application::editPreferences() { · 3 unmodified lines
11671243 // reset the environment to default
11681244 _environment.resetToDefault();
11691245
1170− NodeList::getInstance()->setDomainHostname(newHostname);
1246+ // set the new hostname
1247+ NodeList::getInstance()->setDomainHostname(newHostname.constData());
11711248 }
11721249
11731250 QUrl url(avatarURL->text());
@@ -1428,11 +1505,11 @@ bool Application::sendVoxelsOperation(VoxelNode* node, void* extraData) { · 254 unmodified lines
14281505 int usecToSleep = CLIENT_TO_SERVER_VOXEL_SEND_INTERVAL_USECS - elapsed;
14291506 if (usecToSleep > 0) {
14301507 qDebug("sendVoxelsOperation: packet: %d bytes:%lld elapsed %lld usecs, sleeping for %d usecs!\n",
1431− args->packetsSent, args->bytesSent, elapsed, usecToSleep);
1508+ args->packetsSent, (long long int)args->bytesSent, (long long int)elapsed, usecToSleep);
14321509 usleep(usecToSleep);
14331510 } else {
14341511 qDebug("sendVoxelsOperation: packet: %d bytes:%lld elapsed %lld usecs, no need to sleep!\n",
1435− args->packetsSent, args->bytesSent, elapsed);
1512+ args->packetsSent, (long long int)args->bytesSent, (long long int)elapsed);
14361513 }
14371514 args->lastSendTime = now;
14381515 }
@@ -1617,7 +1694,7 @@ void Application::pasteVoxels() { · 178 unmodified lines
16171694 controlledBroadcastToNodes(args.messageBuffer, args.bufferInUse, & NODE_TYPE_VOXEL_SERVER, 1);
16181695 qDebug("sending packet: %d\n", ++args.packetsSent);
16191696 args.bytesSent += args.bufferInUse;
1620− qDebug("total bytes sent: %lld\n", args.bytesSent);
1697+ qDebug("total bytes sent: %lld\n", (long long int)args.bytesSent);
16211698 }
16221699
16231700 if (calculatedOctCode) {
@@ -1675,10 +1752,15 @@ void Application::initMenu() { · 51 unmodified lines
16751752 (_renderAvatarBalls = renderMenu->addAction("Avatar as Balls"))->setCheckable(true);
16761753 _renderAvatarBalls->setChecked(false);
16771754 renderMenu->addAction("Cycle Voxel Mode", _myAvatar.getVoxels(), SLOT(cycleMode()));
1755+ renderMenu->addAction("Cycle Face Mode", &_myAvatar.getHead().getFace(), SLOT(cycleRenderMode()));
16781756 (_renderFrameTimerOn = renderMenu->addAction("Show Timer"))->setCheckable(true);
16791757 _renderFrameTimerOn->setChecked(false);
16801758 (_renderLookatOn = renderMenu->addAction("Lookat Vectors"))->setCheckable(true);
16811759 _renderLookatOn->setChecked(false);
1760+ (_renderLookatIndicatorOn = renderMenu->addAction("Lookat Indicator"))->setCheckable(true);
1761+ _renderLookatIndicatorOn->setChecked(true);
1762+ (_renderParticleSystemOn = renderMenu->addAction("Particle System"))->setCheckable(true);
1763+ _renderParticleSystemOn->setChecked(true);
16821764 (_manualFirstPerson = renderMenu->addAction(
16831765 "First Person", this, SLOT(setRenderFirstPerson(bool)), Qt::Key_P))->setCheckable(true);
16841766 (_manualThirdPerson = renderMenu->addAction(
@@ -1698,6 +1780,7 @@ void Application::initMenu() { · 13 unmodified lines
16981780 (_bandwidthDisplayOn = toolsMenu->addAction("Bandwidth Display"))->setCheckable(true);
16991781 _bandwidthDisplayOn->setChecked(true);
17001782 toolsMenu->addAction("Bandwidth Details", this, SLOT(bandwidthDetails()));
1783+ toolsMenu->addAction("Voxel Stats Details", this, SLOT(voxelStatsDetails()));
17011784
17021785
17031786 QMenu* voxelMenu = menuBar->addMenu("Voxels");
@@ -1782,6 +1865,11 @@ void Application::initMenu() { · 78 unmodified lines
17821865 (_simulateLeapHand = debugMenu->addAction("Simulate Leap Hand"))->setCheckable(true);
17831866 (_testRaveGlove = debugMenu->addAction("Test RaveGlove"))->setCheckable(true);
17841867
1868+ QMenu* audioDebugMenu = debugMenu->addMenu("Audio Debugging Tools");
1869+ audioDebugMenu->addAction("Listen Mode Normal", this, SLOT(setListenModeNormal()), Qt::CTRL | Qt::Key_1);
1870+ audioDebugMenu->addAction("Listen Mode Point/Radius", this, SLOT(setListenModePoint()), Qt::CTRL | Qt::Key_2);
1871+ audioDebugMenu->addAction("Listen Mode Single Source", this, SLOT(setListenModeSingleSource()), Qt::CTRL | Qt::Key_3);
1872+
17851873 QMenu* settingsMenu = menuBar->addMenu("Settings");
17861874 (_settingsAutosave = settingsMenu->addAction("Autosave"))->setCheckable(true);
17871875 _settingsAutosave->setChecked(true);
@@ -1791,9 +1879,32 @@ void Application::initMenu() { · 3 unmodified lines
17911879 settingsMenu->addAction("Export settings", this, SLOT(exportSettings()));
17921880
17931881 _networkAccessManager = new QNetworkAccessManager(this);
1794− _settings = new QSettings(this);
17951882 }
17961883
1884+void Application::setListenModeNormal() {
1885+ _audio.setListenMode(AudioRingBuffer::NORMAL);
1886+}
1887+
1888+void Application::setListenModePoint() {
1889+ _audio.setListenMode(AudioRingBuffer::OMNI_DIRECTIONAL_POINT);
1890+ _audio.setListenRadius(1.0);
1891+}
1892+
1893+void Application::setListenModeSingleSource() {
1894+ _audio.setListenMode(AudioRingBuffer::SELECTED_SOURCES);
1895+ _audio.clearListenSources();
1896+
1897+ glm::vec3 mouseRayOrigin = _myAvatar.getMouseRayOrigin();
1898+ glm::vec3 mouseRayDirection = _myAvatar.getMouseRayDirection();
1899+ glm::vec3 eyePositionIgnored;
1900+ uint16_t nodeID;
1901+
1902+ if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePositionIgnored, nodeID)) {
1903+ _audio.addListenSource(nodeID);
1904+ }
1905+}
1906+
1907+
17971908 void Application::updateFrustumRenderModeAction() {
17981909 switch (_frustumDrawingMode) {
17991910 default:
@@ -1882,7 +1993,10 @@ const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; · 82 unmodified lines
18821993 const float MAX_VOXEL_EDIT_DISTANCE = 20.0f;
18831994 const float HEAD_SPHERE_RADIUS = 0.07;
18841995
1885−bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection, glm::vec3& eyePosition) {
1996+
1997+bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
1998+ glm::vec3& eyePosition, uint16_t& nodeID) {
1999+
18862000 NodeList* nodeList = NodeList::getInstance();
18872001 for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
18882002 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
@@ -1890,6 +2004,9 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1 unmodified line
18902004 glm::vec3 headPosition = avatar->getHead().getPosition();
18912005 if (rayIntersectsSphere(mouseRayOrigin, mouseRayDirection, headPosition, HEAD_SPHERE_RADIUS)) {
18922006 eyePosition = avatar->getHead().getEyeLevelPosition();
2007+ _lookatIndicatorScale = avatar->getScale();
2008+ _lookatOtherPosition = headPosition;
2009+ nodeID = avatar->getOwningNode()->getNodeID();
18932010 return true;
18942011 }
18952012 }
@@ -1897,6 +2014,17 @@ bool Application::isLookingAtOtherAvatar(glm::vec3& mouseRayOrigin, glm::vec3& m · 1 unmodified line
18972014 return false;
18982015 }
18992016
2017+void Application::renderLookatIndicator(glm::vec3 pointOfInterest, Camera& whichCamera) {
2018+
2019+ const float DISTANCE_FROM_HEAD_SPHERE = 0.1f * _lookatIndicatorScale;
2020+ const float INDICATOR_RADIUS = 0.1f * _lookatIndicatorScale;
2021+ const float YELLOW[] = { 1.0f, 1.0f, 0.0f };
2022+ const int NUM_SEGMENTS = 30;
2023+ glm::vec3 haloOrigin(pointOfInterest.x, pointOfInterest.y + DISTANCE_FROM_HEAD_SPHERE, pointOfInterest.z);
2024+ glColor3f(YELLOW[0], YELLOW[1], YELLOW[2]);
2025+ renderCircle(haloOrigin, INDICATOR_RADIUS, IDENTITY_UP, NUM_SEGMENTS);
2026+}
2027+
19002028 void Application::update(float deltaTime) {
19012029 // Use Transmitter Hand to move hand if connected, else use mouse
19022030 if (_myTransmitter.isConnected()) {
@@ -1924,7 +2052,9 @@ void Application::update(float deltaTime) { · 21 unmodified lines
19242052
19252053 // Set where I am looking based on my mouse ray (so that other people can see)
19262054 glm::vec3 eyePosition;
1927− if (isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition)) {
2055+ uint16_t ignored;
2056+ _isLookingAtOtherAvatar = isLookingAtOtherAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, ignored);
2057+ if (_isLookingAtOtherAvatar) {
19282058 // If the mouse is over another avatar's head...
19292059 glm::vec3 myLookAtFromMouse(eyePosition);
19302060 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
@@ -2075,10 +2205,8 @@ void Application::update(float deltaTime) { · 144 unmodified lines
20752205
20762206 // Leap finger-sensing device
20772207 LeapManager::enableFakeFingers(_simulateLeapHand->isChecked() || _testRaveGlove->isChecked());
2078− LeapManager::nextFrame();
20792208 _myAvatar.getHand().setRaveGloveActive(_testRaveGlove->isChecked());
2080− _myAvatar.getHand().setLeapFingers(LeapManager::getFingerTips(), LeapManager::getFingerRoots());
2081− _myAvatar.getHand().setLeapHands(LeapManager::getHandPositions(), LeapManager::getHandNormals());
2209+ LeapManager::nextFrame(_myAvatar);
20822210
20832211 // Read serial port interface devices
20842212 if (_serialHeadSensor.isActive()) {
@@ -2165,6 +2293,9 @@ void Application::update(float deltaTime) { · 80 unmodified lines
21652293 if (_bandwidthDialog) {
21662294 _bandwidthDialog->update();
21672295 }
2296+ if (_voxelStatsDialog) {
2297+ _voxelStatsDialog->update();
2298+ }
21682299
21692300 // Update audio stats for procedural sounds
21702301 #ifndef _WIN32
@@ -2173,7 +2304,7 @@ void Application::update(float deltaTime) { · 2 unmodified lines
21732304 _audio.eventuallyAnalyzePing();
21742305 #endif
21752306
2176− if (TESTING_PARTICLE_SYSTEM) {
2307+ if (_renderParticleSystemOn->isChecked()) {
21772308 updateParticleSystem(deltaTime);
21782309 }
21792310 }
@@ -2222,7 +2353,9 @@ void Application::updateAvatar(float deltaTime) { · 42 unmodified lines
22222353 _viewFrustum.computePickRay(MIDPOINT_OF_SCREEN, MIDPOINT_OF_SCREEN, screenCenterRayOrigin, screenCenterRayDirection);
22232354
22242355 glm::vec3 eyePosition;
2225− if (isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition)) {
2356+ uint16_t ignored;
2357+ _isLookingAtOtherAvatar = isLookingAtOtherAvatar(screenCenterRayOrigin, screenCenterRayDirection, eyePosition, ignored);
2358+ if (_isLookingAtOtherAvatar) {
22262359 glm::vec3 myLookAtFromMouse(eyePosition);
22272360 _myAvatar.getHead().setLookAtPosition(myLookAtFromMouse);
22282361 }
@@ -2620,10 +2753,13 @@ void Application::displaySide(Camera& whichCamera) { · 391 unmodified lines
26202753 _myAvatar.getHead().setLookAtPosition(_myCamera.getPosition());
26212754 }
26222755 _myAvatar.render(_lookingInMirror->isChecked(), _renderAvatarBalls->isChecked());
2623− _myAvatar.setDisplayingLookatVectors(_renderLookatOn->isChecked());
2756+
2757+ if (_renderLookatIndicatorOn->isChecked() && _isLookingAtOtherAvatar) {
2758+ renderLookatIndicator(_lookatOtherPosition, whichCamera);
2759+ }
26242760 }
26252761
2626− if (TESTING_PARTICLE_SYSTEM) {
2762+ if (_renderParticleSystemOn->isChecked()) {
26272763 if (_particleSystemInitialized) {
26282764 _particleSystem.render();
26292765 }
@@ -2813,27 +2949,19 @@ void Application::displayStats() { · 183 unmodified lines
28132949 drawtext(10, statsVerticalOffset + 230, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
28142950
28152951 voxelStats.str("");
2816− voxelStats << "Voxels Created: " << _voxels.getVoxelsCreated() / 1000.f << "K (" << _voxels.getVoxelsCreatedPerSecondAverage() / 1000.f
2817− << "Kps) ";
2952+ char* voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_VOXELS);
2953+ voxelStats << "Voxels Sent from Server: " << voxelDetails;
28182954 drawtext(10, statsVerticalOffset + 250, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
2819−
2955+
28202956 voxelStats.str("");
2821− voxelStats << "Voxels Colored: " << _voxels.getVoxelsColored() / 1000.f << "K (" << _voxels.getVoxelsColoredPerSecondAverage() / 1000.f
2822− << "Kps) ";
2957+ voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ELAPSED);
2958+ voxelStats << "Scene Send Time from Server: " << voxelDetails;
28232959 drawtext(10, statsVerticalOffset + 270, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
2824−
2825− voxelStats.str("");
2826− voxelStats << "Voxel Bits Read: " << _voxels.getVoxelsBytesRead() * 8.f / 1000000.f
2827− << "M (" << _voxels.getVoxelsBytesReadPerSecondAverage() * 8.f / 1000000.f << " Mbps)";
2828− drawtext(10, statsVerticalOffset + 290,0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
28292960
28302961 voxelStats.str("");
2831− float voxelsBytesPerColored = _voxels.getVoxelsColored()
2832− ? ((float) _voxels.getVoxelsBytesRead() / _voxels.getVoxelsColored())
2833− : 0;
2834−
2835− voxelStats << "Voxels Bits per Colored: " << voxelsBytesPerColored * 8;
2836− drawtext(10, statsVerticalOffset + 310, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
2962+ voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ENCODE);
2963+ voxelStats << "Encode Time on Server: " << voxelDetails;
2964+ drawtext(10, statsVerticalOffset + 290, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
28372965
28382966 Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
28392967 char avatarMixerStats[200];
@@ -3388,16 +3516,37 @@ void* Application::networkReceive(void* args) { · 548 unmodified lines
33883516 case PACKET_TYPE_VOXEL_DATA_MONOCHROME:
33893517 case PACKET_TYPE_Z_COMMAND:
33903518 case PACKET_TYPE_ERASE_VOXEL:
3519+ case PACKET_TYPE_VOXEL_STATS:
33913520 case PACKET_TYPE_ENVIRONMENT_DATA: {
3521+
3522+ unsigned char* messageData = app->_incomingPacket;
3523+ ssize_t messageLength = bytesReceived;
3524+
3525+ // note: PACKET_TYPE_VOXEL_STATS can have PACKET_TYPE_VOXEL_DATA or PACKET_TYPE_VOXEL_DATA_MONOCHROME
3526+ // immediately following them inside the same packet. So, we process the PACKET_TYPE_VOXEL_STATS first
3527+ // then process any remaining bytes as if it was another packet
3528+ if (messageData[0] == PACKET_TYPE_VOXEL_STATS) {
3529+ int statsMessageLength = app->_voxelSceneStats.unpackFromMessage(messageData, messageLength);
3530+ if (messageLength > statsMessageLength) {
3531+ messageData += statsMessageLength;
3532+ messageLength -= statsMessageLength;
3533+ if (!packetVersionMatch(messageData)) {
3534+ break; // bail since piggyback data doesn't match our versioning
3535+ }
3536+ } else {
3537+ break; // bail since no piggyback data
3538+ }
3539+ } // fall through to piggyback message
3540+
33923541 if (app->_renderVoxels->isChecked()) {
33933542 Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
33943543 if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) {
33953544 voxelServer->lock();
33963545
3397− if (app->_incomingPacket[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
3398− app->_environment.parseData(&senderAddress, app->_incomingPacket, bytesReceived);
3546+ if (messageData[0] == PACKET_TYPE_ENVIRONMENT_DATA) {
3547+ app->_environment.parseData(&senderAddress, messageData, messageLength);
33993548 } else {
3400− app->_voxels.parseData(app->_incomingPacket, bytesReceived);
3549+ app->_voxels.parseData(messageData, messageLength);
34013550 }
34023551
34033552 voxelServer->unlock();
@@ -3414,6 +3563,9 @@ void* Application::networkReceive(void* args) { · 10 unmodified lines
34143563 case PACKET_TYPE_AVATAR_VOXEL_URL:
34153564 processAvatarVoxelURLMessage(app->_incomingPacket, bytesReceived);
34163565 break;
3566+ case PACKET_TYPE_AVATAR_FACE_VIDEO:
3567+ processAvatarFaceVideoMessage(app->_incomingPacket, bytesReceived);
3568+ break;
34173569 default:
34183570 NodeList::getInstance()->processNodeData(&senderAddress, app->_incomingPacket, bytesReceived);
34193571 break;
@@ -3495,7 +3647,7 @@ void Application::saveSettings(QSettings* settings) { · 75 unmodified lines
34953647 if (!settings) {
34963648 settings = getSettings();
34973649 }
3498−
3650+
34993651 settings->setValue("headCameraPitchYawScale", _headCameraPitchYawScale);
35003652 settings->setValue("audioJitterBufferSamples", _audioJitterBufferSamples);
35013653 settings->setValue("horizontalFieldOfView", _horizontalFieldOfView);
@@ -3510,6 +3662,9 @@ void Application::saveSettings(QSettings* settings) { · 8 unmodified lines
35103662 scanMenuBar(&Application::saveAction, settings);
35113663 getAvatar()->saveData(settings);
35123664 _swatch.saveData(settings);
3665+
3666+ // ask the NodeList to save its data
3667+ NodeList::getInstance()->saveData(settings);
35133668 }
35143669
35153670 void Application::importSettings() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t