History

Merge branch 'master' of git://github.com/worklist/hifi into 19487

Lucas Crisman committed 12 years ago

Commit f818b072 parents 95837b8 612041650 files · +1151 −458Browse files

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

Unified · Split

interface/src/Application.cpp+96−115
@@ -109,7 +109,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 108 unmodified lines
109109 _window(new QMainWindow(desktop())),
110110 _glWidget(new GLCanvas()),
111111 _nodeThread(new QThread(this)),
112− _datagramProcessor(new DatagramProcessor()),
112+ _datagramProcessor(),
113113 _frameCount(0),
114114 _fps(120.0f),
115115 _justStarted(true),
@@ -145,8 +145,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 29 unmodified lines
145145 _enableProcessVoxelsThread(true),
146146 _voxelProcessor(),
147147 _voxelHideShowThread(&_voxels),
148− _voxelEditSender(this),
149− _particleEditSender(this),
150148 _packetsPerSecond(0),
151149 _bytesPerSecond(0),
152150 _recentMaxPackets(0),
@@ -174,20 +172,20 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 21 unmodified lines
174172 listenPort = atoi(portStr);
175173 }
176174
175+ // start the nodeThread so its event loop is running
176+ _nodeThread->start();
177+
178+ // make sure the node thread is given highest priority
179+ _nodeThread->setPriority(QThread::TimeCriticalPriority);
180+
177181 // put the NodeList and datagram processing on the node thread
178182 NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort);
179183
180184 nodeList->moveToThread(_nodeThread);
181− _datagramProcessor->moveToThread(_nodeThread);
185+ _datagramProcessor.moveToThread(_nodeThread);
182186
183187 // connect the DataProcessor processDatagrams slot to the QUDPSocket readyRead() signal
184− connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), _datagramProcessor, SLOT(processDatagrams()));
185−
186− // make sure the node thread is given highest priority
187− _nodeThread->setPriority(QThread::TimeCriticalPriority);
188−
189− // start the nodeThread so its event loop is running
190− _nodeThread->start();
188+ connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), &_datagramProcessor, SLOT(processDatagrams()));
191189
192190 // put the audio processing on a separate thread
193191 QThread* audioThread = new QThread(this);
@@ -231,12 +229,16 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 37 unmodified lines
231229 #endif
232230
233231 // tell the NodeList instance who to tell the domain server we care about
234− const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER,
235− NODE_TYPE_PARTICLE_SERVER, NODE_TYPE_METAVOXEL_SERVER};
236− nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
232+ nodeList->addSetOfNodeTypesToNodeInterestSet(QSet<NODE_TYPE>() << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
233+ << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER
234+ << NODE_TYPE_METAVOXEL_SERVER);
235+
236+ // connect to the packet sent signal of the _voxelEditSender and the _particleEditSender
237+ connect(&_voxelEditSender, &VoxelEditPacketSender::packetSent, this, &Application::packetSent);
238+ connect(&_particleEditSender, &ParticleEditPacketSender::packetSent, this, &Application::packetSent);
237239
238240 // move the silentNodeTimer to the _nodeThread
239− QTimer* silentNodeTimer = new QTimer(this);
241+ QTimer* silentNodeTimer = new QTimer();
240242 connect(silentNodeTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
241243 silentNodeTimer->moveToThread(_nodeThread);
242244 silentNodeTimer->start(NODE_SILENCE_THRESHOLD_USECS / 1000);
@@ -282,17 +284,35 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 39 unmodified lines
282284 Application::~Application() {
283285
284286 qInstallMessageHandler(NULL);
285−
287+
286288 // make sure we don't call the idle timer any more
287289 delete idleTimer;
288290
291+ Menu::getInstance()->saveSettings();
292+
293+ _rearMirrorTools->saveSettings(_settings);
294+ _settings->sync();
295+
296+ // let the avatar mixer know we're out
297+ NodeList::getInstance()->sendKillNode(QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
298+
289299 // ask the datagram processing thread to quit and wait until it is done
290− _nodeThread->thread()->quit();
291− _nodeThread->thread()->wait();
292−
300+ _nodeThread->quit();
301+ _nodeThread->wait();
302+
293303 // ask the audio thread to quit and wait until it is done
294304 _audio.thread()->quit();
295305 _audio.thread()->wait();
306+
307+ _voxelProcessor.terminate();
308+ _voxelHideShowThread.terminate();
309+ _voxelEditSender.terminate();
310+ _particleEditSender.terminate();
311+ if (_persistThread) {
312+ _persistThread->terminate();
313+ _persistThread->deleteLater();
314+ _persistThread = NULL;
315+ }
296316
297317 storeSizeAndPosition();
298318 saveScripts();
@@ -377,9 +397,6 @@ void Application::initializeGL() { · 78 unmodified lines
377397 qDebug("Voxel parsing thread created.");
378398 }
379399
380− // call terminate before exiting
381− connect(this, SIGNAL(aboutToQuit()), SLOT(terminate()));
382−
383400 // call our timer function every second
384401 QTimer* timer = new QTimer(this);
385402 connect(timer, SIGNAL(timeout()), SLOT(timer()));
@@ -628,21 +645,20 @@ void Application::resetProfile(const QString& username) { · 242 unmodified lines
628645 }
629646
630647 void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_t dataBytes,
631− const char* nodeTypes, int numNodeTypes) {
632− Application* self = getInstance();
633− for (int i = 0; i < numNodeTypes; ++i) {
634−
648+ const QSet<NODE_TYPE>& destinationNodeTypes) {
649+ foreach(NODE_TYPE type, destinationNodeTypes) {
635650 // Intercept data to voxel server when voxels are disabled
636− if (nodeTypes[i] == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
651+ if (type == NODE_TYPE_VOXEL_SERVER && !Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
637652 continue;
638653 }
639−
654+
640655 // Perform the broadcast for one type
641− int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(broadcastData, dataBytes, & nodeTypes[i], 1);
642−
656+ int nReceivingNodes = NodeList::getInstance()->broadcastToNodes(broadcastData, dataBytes,
657+ QSet<NODE_TYPE>() << type);
658+
643659 // Feed number of bytes to corresponding channel of the bandwidth meter, if any (done otherwise)
644660 BandwidthMeter::ChannelIndex channel;
645− switch (nodeTypes[i]) {
661+ switch (type) {
646662 case NODE_TYPE_AGENT:
647663 case NODE_TYPE_AVATAR_MIXER:
648664 channel = BandwidthMeter::AVATARS;
@@ -653,7 +669,7 @@ void Application::controlledBroadcastToNodes(unsigned char* broadcastData, size_ · 4 unmodified lines
653669 default:
654670 continue;
655671 }
656− self->_bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes);
672+ _bandwidthMeter.outputStream(channel).updateValue(nReceivingNodes * dataBytes);
657673 }
658674 }
659675
@@ -1136,13 +1152,12 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 476 unmodified lines
11361152 _seenMouseMove = true;
11371153 }
11381154
1155+ int deltaX = event->x() - _mouseX;
1156+ int deltaY = event->y() - _mouseY;
1157+ _mouseX = event->x();
1158+ _mouseY = event->y();
1159+
11391160 if (activeWindow() == _window) {
1140− int deltaX = event->x() - _mouseX;
1141− int deltaY = event->y() - _mouseY;
1142−
1143− _mouseX = event->x();
1144− _mouseY = event->y();
1145−
11461161 // orbit behavior
11471162 if (_mousePressed && !Menu::getInstance()->isVoxelModeActionChecked()) {
11481163 if (_lookatTargetAvatar) {
@@ -1308,15 +1323,13 @@ void Application::wheelEvent(QWheelEvent* event) { · 159 unmodified lines
13081323 }
13091324
13101325 void Application::sendPingPackets() {
1311−
1312− const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_PARTICLE_SERVER,
1313− NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_METAVOXEL_SERVER};
1314−
13151326 unsigned char pingPacket[MAX_PACKET_SIZE];
13161327 int length = NodeList::getInstance()->fillPingPacket(pingPacket);
13171328
1318− getInstance()->controlledBroadcastToNodes(pingPacket, length,
1319− nodesToPing, sizeof(nodesToPing));
1329+ getInstance()->controlledBroadcastToNodes(pingPacket, length, QSet<NODE_TYPE>()
1330+ << NODE_TYPE_VOXEL_SERVER << NODE_TYPE_PARTICLE_SERVER
1331+ << NODE_TYPE_AUDIO_MIXER << NODE_TYPE_AVATAR_MIXER
1332+ << NODE_TYPE_METAVOXEL_SERVER);
13201333 }
13211334
13221335 // Every second, check the frame rates and other stuff
@@ -1329,11 +1342,11 @@ void Application::timer() { · 6 unmodified lines
13291342
13301343 _fps = (float)_frameCount / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
13311344
1332− _packetsPerSecond = (float) _datagramProcessor->getPacketCount() / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
1333− _bytesPerSecond = (float) _datagramProcessor->getByteCount() / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
1345+ _packetsPerSecond = (float) _datagramProcessor.getPacketCount() / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
1346+ _bytesPerSecond = (float) _datagramProcessor.getByteCount() / ((float)diffclock(&_timerStart, &_timerEnd) / 1000.f);
13341347 _frameCount = 0;
13351348
1336− _datagramProcessor->resetCounters();
1349+ _datagramProcessor.resetCounters();
13371350
13381351 gettimeofday(&_timerStart, NULL);
13391352
@@ -1412,28 +1425,6 @@ void Application::idle() { · 72 unmodified lines
14121425 }
14131426 }
14141427
1415−void Application::terminate() {
1416− // Close serial port
1417− // close(serial_fd);
1418−
1419− Menu::getInstance()->saveSettings();
1420− _rearMirrorTools->saveSettings(_settings);
1421− _settings->sync();
1422−
1423− // let the avatar mixer know we're out
1424− NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1);
1425−
1426− _voxelProcessor.terminate();
1427− _voxelHideShowThread.terminate();
1428− _voxelEditSender.terminate();
1429− _particleEditSender.terminate();
1430− if (_persistThread) {
1431− _persistThread->terminate();
1432− _persistThread->deleteLater();
1433− _persistThread = NULL;
1434− }
1435−}
1436−
14371428 void Application::checkBandwidthMeterClick() {
14381429 // ... to be called upon button release
14391430
@@ -1857,25 +1848,23 @@ const float HEAD_SPHERE_RADIUS = 0.07f; · 417 unmodified lines
18571848
18581849 static QUuid DEFAULT_NODE_ID_REF;
18591850
1860−void Application::updateLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection,
1861− glm::vec3& eyePosition) {
1851+void Application::updateLookatTargetAvatar(glm::vec3& eyePosition) {
18621852 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
18631853 PerformanceWarning warn(showWarnings, "Application::updateLookatTargetAvatar()");
18641854
18651855 if (!_mousePressed) {
1866− _lookatTargetAvatar = findLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, eyePosition, DEFAULT_NODE_ID_REF);
1856+ _lookatTargetAvatar = findLookatTargetAvatar(eyePosition, DEFAULT_NODE_ID_REF);
18671857 }
18681858 }
18691859
1870−Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, const glm::vec3& mouseRayDirection,
1871− glm::vec3& eyePosition, QUuid& nodeUUID = DEFAULT_NODE_ID_REF) {
1860+Avatar* Application::findLookatTargetAvatar(glm::vec3& eyePosition, QUuid& nodeUUID = DEFAULT_NODE_ID_REF) {
18721861
18731862 foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) {
18741863 if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) {
18751864 Avatar* avatar = (Avatar*)node->getLinkedData();
18761865 float distance;
18771866
1878− if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) {
1867+ if (avatar->findRayIntersection(_mouseRayOrigin, _mouseRayDirection, distance)) {
18791868 // rescale to compensate for head embiggening
18801869 eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) *
18811870 (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot();
@@ -1926,7 +1915,7 @@ void Application::renderHighlightVoxel(VoxelDetail voxel) { · 44 unmodified lines
19261915 glPopMatrix();
19271916 }
19281917
1929−void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) {
1918+void Application::updateAvatars(float deltaTime) {
19301919 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
19311920 PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
19321921
@@ -1938,7 +1927,7 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 5 unmodified lines
19381927 avatar->init();
19391928 }
19401929 avatar->simulate(deltaTime, NULL);
1941− avatar->setMouseRay(mouseRayOrigin, mouseRayDirection);
1930+ avatar->setMouseRay(_mouseRayOrigin, _mouseRayDirection);
19421931 }
19431932 }
19441933
@@ -1961,28 +1950,28 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 16 unmodified lines
19611950 }
19621951 }
19631952
1964−void Application::updateMouseRay(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection) {
1953+void Application::updateMouseRay() {
19651954
19661955 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
19671956 PerformanceWarning warn(showWarnings, "Application::updateMouseRay()");
19681957
19691958 _viewFrustum.computePickRay(_mouseX / (float)_glWidget->width(), _mouseY / (float)_glWidget->height(),
1970− mouseRayOrigin, mouseRayDirection);
1959+ _mouseRayOrigin, _mouseRayDirection);
19711960
19721961 // adjust for mirroring
19731962 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
1974− glm::vec3 mouseRayOffset = mouseRayOrigin - _viewFrustum.getPosition();
1975− mouseRayOrigin -= 2.0f * (_viewFrustum.getDirection() * glm::dot(_viewFrustum.getDirection(), mouseRayOffset) +
1963+ glm::vec3 mouseRayOffset = _mouseRayOrigin - _viewFrustum.getPosition();
1964+ _mouseRayOrigin -= 2.0f * (_viewFrustum.getDirection() * glm::dot(_viewFrustum.getDirection(), mouseRayOffset) +
19761965 _viewFrustum.getRight() * glm::dot(_viewFrustum.getRight(), mouseRayOffset));
1977− mouseRayDirection -= 2.0f * (_viewFrustum.getDirection() * glm::dot(_viewFrustum.getDirection(), mouseRayDirection) +
1978− _viewFrustum.getRight() * glm::dot(_viewFrustum.getRight(), mouseRayDirection));
1966+ _mouseRayDirection -= 2.0f * (_viewFrustum.getDirection() * glm::dot(_viewFrustum.getDirection(), _mouseRayDirection) +
1967+ _viewFrustum.getRight() * glm::dot(_viewFrustum.getRight(), _mouseRayDirection));
19791968 }
19801969
19811970 // tell my avatar if the mouse is being pressed...
19821971 _myAvatar.setMousePressed(_mousePressed);
19831972
19841973 // tell my avatar the posiion and direction of the ray projected ino the world based on the mouse position
1985− _myAvatar.setMouseRay(mouseRayOrigin, mouseRayDirection);
1974+ _myAvatar.setMouseRay(_mouseRayOrigin, _mouseRayDirection);
19861975 }
19871976
19881977 void Application::updateFaceshift() {
@@ -1999,8 +1988,7 @@ void Application::updateFaceshift() { · 10 unmodified lines
19991988 }
20001989 }
20011990
2002−void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3& lookAtRayOrigin,
2003− glm::vec3& lookAtRayDirection) {
1991+void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot) {
20041992
20051993 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
20061994 PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()");
@@ -2015,15 +2003,9 @@ void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3& · 8 unmodified lines
20152003 _viewFrustum.computePickRay(0.5f, 0.5f, rayOrigin, rayDirection);
20162004 lookAtSpot = rayOrigin + rayDirection * FAR_AWAY_STARE;
20172005
2018− } else if (!_lookatTargetAvatar) {
2019− if (_isHoverVoxel) {
2020− // Look at the hovered voxel
2021− lookAtSpot = getMouseVoxelWorldCoordinates(_hoverVoxel);
2022−
2023− } else {
2024− // Just look in direction of the mouse ray
2025− lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE;
2026− }
2006+ } else {
2007+ // just look in direction of the mouse ray
2008+ lookAtSpot = _mouseRayOrigin + _mouseRayDirection * FAR_AWAY_STARE;
20272009 }
20282010 if (_faceshift.isActive()) {
20292011 // deflect using Faceshift gaze data
@@ -2037,8 +2019,7 @@ void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3& · 7 unmodified lines
20372019 _myAvatar.getHead().setLookAtPosition(lookAtSpot);
20382020 }
20392021
2040−void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
2041− float& distance, BoxFace& face) {
2022+void Application::updateHoverVoxels(float deltaTime, float& distance, BoxFace& face) {
20422023
20432024 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
20442025 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels()");
@@ -2069,7 +2050,7 @@ void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 24 unmodified lines
20692050 if (!(_voxels.treeIsBusy() || _mousePressed)) {
20702051 {
20712052 PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()");
2072− _isHoverVoxel = _voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _hoverVoxel, distance, face);
2053+ _isHoverVoxel = _voxels.findRayIntersection(_mouseRayOrigin, _mouseRayDirection, _hoverVoxel, distance, face);
20732054 }
20742055 if (MAKE_SOUND_ON_VOXEL_HOVER && _isHoverVoxel &&
20752056 glm::vec4(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s) != oldVoxel) {
@@ -2085,8 +2066,7 @@ void Application::updateHoverVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 9 unmodified lines
20852066 }
20862067 }
20872068
2088−void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, glm::vec3& mouseRayDirection,
2089− float& distance, BoxFace& face) {
2069+void Application::updateMouseVoxels(float deltaTime, float& distance, BoxFace& face) {
20902070
20912071 bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
20922072 PerformanceWarning warn(showWarnings, "Application::updateMouseVoxels()");
@@ -2098,7 +2078,7 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 5 unmodified lines
20982078 fabs(_myAvatar.getVelocity().y) +
20992079 fabs(_myAvatar.getVelocity().z)) / 3 < MAX_AVATAR_EDIT_VELOCITY) {
21002080
2101− if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) {
2081+ if (_voxels.findRayIntersection(_mouseRayOrigin, _mouseRayDirection, _mouseVoxel, distance, face)) {
21022082 if (distance < MAX_VOXEL_EDIT_DISTANCE) {
21032083 // set the voxel scale to that of the first moused-over voxel
21042084 if (!wasInitialized) {
@@ -2118,7 +2098,7 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 13 unmodified lines
21182098 glm::vec3 faceVector = getFaceVector(face);
21192099 if (_mouseVoxelScale < _mouseVoxel.s) {
21202100 // find the closest contained voxel
2121− glm::vec3 pt = (mouseRayOrigin + mouseRayDirection * distance) / (float)TREE_SCALE -
2101+ glm::vec3 pt = (_mouseRayOrigin + _mouseRayDirection * distance) / (float)TREE_SCALE -
21222102 faceVector * (_mouseVoxelScale * 0.5f);
21232103 _mouseVoxel.x = _mouseVoxelScale * floorf(pt.x / _mouseVoxelScale);
21242104 _mouseVoxel.y = _mouseVoxelScale * floorf(pt.y / _mouseVoxelScale);
@@ -2139,7 +2119,7 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 14 unmodified lines
21392119 || Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode)) {
21402120 // place the voxel a fixed distance away
21412121 float worldMouseVoxelScale = _mouseVoxelScale * TREE_SCALE;
2142− glm::vec3 pt = mouseRayOrigin + mouseRayDirection * (2.0f + worldMouseVoxelScale * 0.5f);
2122+ glm::vec3 pt = _mouseRayOrigin + _mouseRayDirection * (2.0f + worldMouseVoxelScale * 0.5f);
21432123 _mouseVoxel.x = _mouseVoxelScale * floorf(pt.x / worldMouseVoxelScale);
21442124 _mouseVoxel.y = _mouseVoxelScale * floorf(pt.y / worldMouseVoxelScale);
21452125 _mouseVoxel.z = _mouseVoxelScale * floorf(pt.z / worldMouseVoxelScale);
@@ -2373,29 +2353,28 @@ void Application::update(float deltaTime) { · 227 unmodified lines
23732353 PerformanceWarning warn(showWarnings, "Application::update()");
23742354
23752355 // check what's under the mouse and update the mouse voxel
2376− glm::vec3 mouseRayOrigin, mouseRayDirection;
2377− updateMouseRay(deltaTime, mouseRayOrigin, mouseRayDirection);
2356+ updateMouseRay();
23782357
23792358 // Set where I am looking based on my mouse ray (so that other people can see)
23802359 glm::vec3 lookAtSpot;
23812360
23822361 updateFaceshift();
2383− updateLookatTargetAvatar(mouseRayOrigin, mouseRayDirection, lookAtSpot);
2384− updateMyAvatarLookAtPosition(lookAtSpot, mouseRayOrigin, mouseRayDirection);
2362+ updateLookatTargetAvatar(lookAtSpot);
2363+ updateMyAvatarLookAtPosition(lookAtSpot);
23852364
23862365 // Find the voxel we are hovering over, and respond if clicked
23872366 float distance;
23882367 BoxFace face;
23892368
2390− updateHoverVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // clicking on voxels and making sounds
2391− updateMouseVoxels(deltaTime, mouseRayOrigin, mouseRayDirection, distance, face); // UI/UX related to voxels
2369+ updateHoverVoxels(deltaTime, distance, face); // clicking on voxels and making sounds
2370+ updateMouseVoxels(deltaTime, distance, face); // UI/UX related to voxels
23922371 updateHandAndTouch(deltaTime); // Update state for touch sensors
23932372 updateLeap(deltaTime); // Leap finger-sensing device
23942373 updateSixense(deltaTime); // Razer Hydra controllers
23952374 updateSerialDevices(deltaTime); // Read serial port interface devices
23962375 updateAvatar(deltaTime); // Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
23972376 updateThreads(deltaTime); // If running non-threaded, then give the threads some time to process...
2398− updateAvatars(deltaTime, mouseRayOrigin, mouseRayDirection); //loop through all the other avatars and simulate them...
2377+ updateAvatars(deltaTime); //loop through all the other avatars and simulate them...
23992378 updateMyAvatarSimulation(deltaTime); // Simulate myself
24002379 updateParticles(deltaTime); // Simulate particle cloud movements
24012380 updateMetavoxels(deltaTime); // update metavoxels
@@ -2466,9 +2445,8 @@ void Application::updateAvatar(float deltaTime) { · 64 unmodified lines
24662445
24672446 endOfBroadcastStringWrite += _myAvatar.getBroadcastData(endOfBroadcastStringWrite);
24682447
2469− const char nodeTypesOfInterest[] = { NODE_TYPE_AVATAR_MIXER };
24702448 controlledBroadcastToNodes(broadcastString, endOfBroadcastStringWrite - broadcastString,
2471− nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
2449+ QSet<NODE_TYPE>() << NODE_TYPE_AVATAR_MIXER);
24722450
24732451 // Update _viewFrustum with latest camera and view frustum data...
24742452 // NOTE: we get this from the view frustum, to make it simpler, since the
@@ -2879,10 +2857,10 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 404 unmodified lines
28792857
28802858 if (!selfAvatarOnly) {
28812859 // draw a red sphere
2882− float sphereRadius = 0.25f;
2860+ float originSphereRadius = 0.05f;
28832861 glColor3f(1,0,0);
28842862 glPushMatrix();
2885− glutSolidSphere(sphereRadius, 15, 15);
2863+ glutSolidSphere(originSphereRadius, 15, 15);
28862864 glPopMatrix();
28872865
28882866 // disable specular lighting for ground and voxels
@@ -3045,6 +3023,9 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 156 unmodified lines
30453023
30463024 glPopMatrix();
30473025 }
3026+
3027+ // give external parties a change to hook in
3028+ emit renderingInWorldInterface();
30483029 }
30493030 }
30503031
@@ -4153,7 +4134,7 @@ int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLen · 1102 unmodified lines
41534134 return statsMessageLength;
41544135 }
41554136
4156−void Application::packetSentNotification(ssize_t length) {
4137+void Application::packetSent(quint64 length) {
41574138 _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(length);
41584139 }
41594140

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