Showing the changes to interface/src/Application.cpp (1 of 304 files). Show all
Unified · Split
| @@ -5,10 +5,16 @@ · 4 unmodified lines | ||
| 5 | 5 | // Created by Andrzej Kapolka on 5/10/13. |
| 6 | 6 | // Copyright (c) 2013 High Fidelity, Inc. All rights reserved. |
| 7 | 7 | |
| 8 | +#ifdef WIN32 | |
| 9 | +#include <Systime.h> | |
| 10 | +#endif | |
| 11 | + | |
| 8 | 12 | #include <sstream> |
| 9 | 13 | |
| 10 | 14 | #include <stdlib.h> |
| 11 | 15 | #include <cmath> |
| 16 | +#include <math.h> | |
| 17 | + | |
| 12 | 18 | |
| 13 | 19 | #include <glm/gtx/component_wise.hpp> |
| 14 | 20 | #include <glm/gtx/quaternion.hpp> |
| @@ -130,7 +136,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 115 unmodified lines | ||
| 130 | 136 | _lookingAwayFromOrigin(true), |
| 131 | 137 | _lookatTargetAvatar(NULL), |
| 132 | 138 | _lookatIndicatorScale(1.0f), |
| 133 | − _perfStatsOn(false), | |
| 134 | 139 | _chatEntryOn(false), |
| 135 | 140 | _audio(&_audioScope, STARTUP_JITTER_SAMPLES), |
| 136 | 141 | _enableProcessVoxelsThread(true), |
| @@ -168,7 +173,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 31 unmodified lines | ||
| 168 | 173 | } |
| 169 | 174 | |
| 170 | 175 | NodeList* nodeList = NodeList::createInstance(NODE_TYPE_AGENT, listenPort); |
| 171 | − | |
| 176 | + | |
| 172 | 177 | // connect our processDatagrams slot to the QUDPSocket readyRead() signal |
| 173 | 178 | connect(&nodeList->getNodeSocket(), SIGNAL(readyRead()), SLOT(processDatagrams())); |
| 174 | 179 | |
| @@ -179,7 +184,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 4 unmodified lines | ||
| 179 | 184 | connect(audioThread, SIGNAL(started()), &_audio, SLOT(start())); |
| 180 | 185 | |
| 181 | 186 | audioThread->start(); |
| 182 | − | |
| 187 | + | |
| 183 | 188 | connect(nodeList, SIGNAL(domainChanged(const QString&)), SLOT(domainChanged(const QString&))); |
| 184 | 189 | |
| 185 | 190 | connect(nodeList, SIGNAL(nodeKilled(SharedNodePointer)), SLOT(nodeKilled(SharedNodePointer))); |
| @@ -216,7 +221,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 30 unmodified lines | ||
| 216 | 221 | #endif |
| 217 | 222 | |
| 218 | 223 | // tell the NodeList instance who to tell the domain server we care about |
| 219 | − const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER, | |
| 224 | + const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER, | |
| 220 | 225 | NODE_TYPE_PARTICLE_SERVER, NODE_TYPE_METAVOXEL_SERVER}; |
| 221 | 226 | nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); |
| 222 | 227 | |
| @@ -323,11 +328,21 @@ void Application::initializeGL() { · 100 unmodified lines | ||
| 323 | 328 | glutInit(&argc, 0); |
| 324 | 329 | #endif |
| 325 | 330 | |
| 331 | + #ifdef WIN32 | |
| 332 | + GLenum err = glewInit(); | |
| 333 | + if (GLEW_OK != err) { | |
| 334 | + /* Problem: glewInit failed, something is seriously wrong. */ | |
| 335 | + qDebug("Error: %s\n", glewGetErrorString(err)); | |
| 336 | + } | |
| 337 | + qDebug("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION)); | |
| 338 | + #endif | |
| 339 | + | |
| 340 | + | |
| 326 | 341 | // Before we render anything, let's set up our viewFrustumOffsetCamera with a sufficiently large |
| 327 | 342 | // field of view and near and far clip to make it interesting. |
| 328 | 343 | //viewFrustumOffsetCamera.setFieldOfView(90.0); |
| 329 | − _viewFrustumOffsetCamera.setNearClip(0.1); | |
| 330 | − _viewFrustumOffsetCamera.setFarClip(500.0 * TREE_SCALE); | |
| 344 | + _viewFrustumOffsetCamera.setNearClip(0.1f); | |
| 345 | + _viewFrustumOffsetCamera.setFarClip(500.0f * TREE_SCALE); | |
| 331 | 346 | |
| 332 | 347 | initDisplay(); |
| 333 | 348 | qDebug( "Initialized Display."); |
| @@ -461,7 +476,7 @@ void Application::paintGL() { · 127 unmodified lines | ||
| 461 | 476 | bool eyeRelativeCamera = false; |
| 462 | 477 | if (_rearMirrorTools->getZoomLevel() == BODY) { |
| 463 | 478 | _mirrorCamera.setDistance(MIRROR_REARVIEW_BODY_DISTANCE * _myAvatar.getScale()); |
| 464 | − _mirrorCamera.setTargetPosition(_myAvatar.getChestJointPosition()); | |
| 479 | + _mirrorCamera.setTargetPosition(_myAvatar.getChestPosition()); | |
| 465 | 480 | } else { // HEAD zoom level |
| 466 | 481 | _mirrorCamera.setDistance(MIRROR_REARVIEW_DISTANCE * _myAvatar.getScale()); |
| 467 | 482 | if (_myAvatar.getSkeletonModel().isActive() && _myAvatar.getHead().getFaceModel().isActive()) { |
| @@ -1288,38 +1303,6 @@ void Application::sendPingPackets() { · 820 unmodified lines | ||
| 1288 | 1303 | nodesToPing, sizeof(nodesToPing)); |
| 1289 | 1304 | } |
| 1290 | 1305 | |
| 1291 | −void Application::sendAvatarFaceVideoMessage(int frameCount, const QByteArray& data) { | |
| 1292 | − unsigned char packet[MAX_PACKET_SIZE]; | |
| 1293 | − unsigned char* packetPosition = packet; | |
| 1294 | − | |
| 1295 | − packetPosition += populateTypeAndVersion(packetPosition, PACKET_TYPE_AVATAR_FACE_VIDEO); | |
| 1296 | − | |
| 1297 | − QByteArray rfcUUID = NodeList::getInstance()->getOwnerUUID().toRfc4122(); | |
| 1298 | − memcpy(packetPosition, rfcUUID.constData(), rfcUUID.size()); | |
| 1299 | − packetPosition += rfcUUID.size(); | |
| 1300 | − | |
| 1301 | − *(uint32_t*)packetPosition = frameCount; | |
| 1302 | − packetPosition += sizeof(uint32_t); | |
| 1303 | − | |
| 1304 | − *(uint32_t*)packetPosition = data.size(); | |
| 1305 | − packetPosition += sizeof(uint32_t); | |
| 1306 | − | |
| 1307 | − uint32_t* offsetPosition = (uint32_t*)packetPosition; | |
| 1308 | − packetPosition += sizeof(uint32_t); | |
| 1309 | − | |
| 1310 | − int headerSize = packetPosition - packet; | |
| 1311 | − | |
| 1312 | − // break the data up into submessages of the maximum size (at least one, for zero-length packets) | |
| 1313 | − *offsetPosition = 0; | |
| 1314 | − do { | |
| 1315 | − int payloadSize = min(data.size() - (int)*offsetPosition, MAX_PACKET_SIZE - headerSize); | |
| 1316 | − memcpy(packetPosition, data.constData() + *offsetPosition, payloadSize); | |
| 1317 | − getInstance()->controlledBroadcastToNodes(packet, headerSize + payloadSize, &NODE_TYPE_AVATAR_MIXER, 1); | |
| 1318 | − *offsetPosition += payloadSize; | |
| 1319 | − | |
| 1320 | − } while (*offsetPosition < data.size()); | |
| 1321 | −} | |
| 1322 | − | |
| 1323 | 1306 | // Every second, check the frame rates and other stuff |
| 1324 | 1307 | void Application::timer() { |
| 1325 | 1308 | gettimeofday(&_timerEnd, NULL); |
| @@ -1362,6 +1345,7 @@ static glm::vec3 getFaceVector(BoxFace face) { · 36 unmodified lines | ||
| 1362 | 1345 | case MIN_Z_FACE: |
| 1363 | 1346 | return glm::vec3(0, 0, -1); |
| 1364 | 1347 | |
| 1348 | + default: // quiet windows warnings | |
| 1365 | 1349 | case MAX_Z_FACE: |
| 1366 | 1350 | return glm::vec3(0, 0, 1); |
| 1367 | 1351 | } |
| @@ -1419,13 +1403,15 @@ void Application::terminate() { · 51 unmodified lines | ||
| 1419 | 1403 | // let the avatar mixer know we're out |
| 1420 | 1404 | NodeList::getInstance()->sendKillNode(&NODE_TYPE_AVATAR_MIXER, 1); |
| 1421 | 1405 | |
| 1422 | − printf(""); | |
| 1423 | 1406 | _voxelProcessor.terminate(); |
| 1424 | 1407 | _voxelHideShowThread.terminate(); |
| 1425 | 1408 | _voxelEditSender.terminate(); |
| 1426 | 1409 | _particleEditSender.terminate(); |
| 1427 | − _persistThread->terminate(); | |
| 1428 | − _persistThread = NULL; | |
| 1410 | + if (_persistThread) { | |
| 1411 | + _persistThread->terminate(); | |
| 1412 | + _persistThread->deleteLater(); | |
| 1413 | + _persistThread = NULL; | |
| 1414 | + } | |
| 1429 | 1415 | } |
| 1430 | 1416 | |
| 1431 | 1417 | static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) { |
| @@ -1477,14 +1463,6 @@ void Application::processAvatarURLsMessage(unsigned char* packetData, size_t dat · 45 unmodified lines | ||
| 1477 | 1463 | avatar->getUUID()); |
| 1478 | 1464 | } |
| 1479 | 1465 | |
| 1480 | −void Application::processAvatarFaceVideoMessage(unsigned char* packetData, size_t dataBytes) { | |
| 1481 | − Avatar* avatar = processAvatarMessageHeader(packetData, dataBytes); | |
| 1482 | − if (!avatar) { | |
| 1483 | − return; | |
| 1484 | − } | |
| 1485 | − avatar->getHead().getVideoFace().processVideoMessage(packetData, dataBytes); | |
| 1486 | −} | |
| 1487 | − | |
| 1488 | 1466 | void Application::checkBandwidthMeterClick() { |
| 1489 | 1467 | // ... to be called upon button release |
| 1490 | 1468 | |
| @@ -1504,6 +1482,11 @@ void Application::setFullscreen(bool fullscreen) { · 13 unmodified lines | ||
| 1504 | 1482 | (_window->windowState() & ~Qt::WindowFullScreen)); |
| 1505 | 1483 | } |
| 1506 | 1484 | |
| 1485 | +void Application::setEnable3DTVMode(bool enable3DTVMode) { | |
| 1486 | + resizeGL(_glWidget->width(),_glWidget->height()); | |
| 1487 | +} | |
| 1488 | + | |
| 1489 | + | |
| 1507 | 1490 | void Application::setRenderVoxels(bool voxelRender) { |
| 1508 | 1491 | _voxelEditSender.setShouldSend(voxelRender); |
| 1509 | 1492 | if (!voxelRender) { |
| @@ -1953,7 +1936,7 @@ void Application::shrinkMirrorView() { · 443 unmodified lines | ||
| 1953 | 1936 | |
| 1954 | 1937 | const float MAX_AVATAR_EDIT_VELOCITY = 1.0f; |
| 1955 | 1938 | const float MAX_VOXEL_EDIT_DISTANCE = 50.0f; |
| 1956 | −const float HEAD_SPHERE_RADIUS = 0.07; | |
| 1939 | +const float HEAD_SPHERE_RADIUS = 0.07f; | |
| 1957 | 1940 | |
| 1958 | 1941 | static QUuid DEFAULT_NODE_ID_REF; |
| 1959 | 1942 | |
| @@ -1974,12 +1957,12 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 14 unmodified lines | ||
| 1974 | 1957 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 1975 | 1958 | Avatar* avatar = (Avatar*)node->getLinkedData(); |
| 1976 | 1959 | float distance; |
| 1977 | − | |
| 1960 | + | |
| 1978 | 1961 | if (avatar->findRayIntersection(mouseRayOrigin, mouseRayDirection, distance)) { |
| 1979 | 1962 | // rescale to compensate for head embiggening |
| 1980 | 1963 | eyePosition = (avatar->getHead().calculateAverageEyePosition() - avatar->getHead().getScalePivot()) * |
| 1981 | 1964 | (avatar->getScale() / avatar->getHead().getScale()) + avatar->getHead().getScalePivot(); |
| 1982 | − | |
| 1965 | + | |
| 1983 | 1966 | _lookatIndicatorScale = avatar->getHead().getScale(); |
| 1984 | 1967 | _lookatOtherPosition = avatar->getHead().getPosition(); |
| 1985 | 1968 | nodeUUID = avatar->getOwningNode()->getUUID(); |
| @@ -1987,7 +1970,7 @@ Avatar* Application::findLookatTargetAvatar(const glm::vec3& mouseRayOrigin, con · 1 unmodified line | ||
| 1987 | 1970 | } |
| 1988 | 1971 | } |
| 1989 | 1972 | } |
| 1990 | − | |
| 1973 | + | |
| 1991 | 1974 | return NULL; |
| 1992 | 1975 | } |
| 1993 | 1976 | |
| @@ -2029,7 +2012,7 @@ void Application::renderHighlightVoxel(VoxelDetail voxel) { · 35 unmodified lines | ||
| 2029 | 2012 | void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) { |
| 2030 | 2013 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2031 | 2014 | PerformanceWarning warn(showWarnings, "Application::updateAvatars()"); |
| 2032 | − | |
| 2015 | + | |
| 2033 | 2016 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 2034 | 2017 | QMutexLocker(&node->getMutex()); |
| 2035 | 2018 | if (node->getLinkedData()) { |
| @@ -2046,11 +2029,11 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 10 unmodified lines | ||
| 2046 | 2029 | for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) { |
| 2047 | 2030 | Avatar* avatar = *fade; |
| 2048 | 2031 | const float SHRINK_RATE = 0.9f; |
| 2049 | − | |
| 2032 | + | |
| 2050 | 2033 | avatar->setTargetScale(avatar->getScale() * SHRINK_RATE); |
| 2051 | − | |
| 2052 | − const float MIN_FADE_SCALE = 0.001; | |
| 2053 | − | |
| 2034 | + | |
| 2035 | + const float MIN_FADE_SCALE = 0.001f; | |
| 2036 | + | |
| 2054 | 2037 | if (avatar->getTargetScale() < MIN_FADE_SCALE) { |
| 2055 | 2038 | delete avatar; |
| 2056 | 2039 | _avatarFades.erase(fade--); |
| @@ -2105,17 +2088,23 @@ void Application::updateMyAvatarLookAtPosition(glm::vec3& lookAtSpot, glm::vec3& · 48 unmodified lines | ||
| 2105 | 2088 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2106 | 2089 | PerformanceWarning warn(showWarnings, "Application::updateMyAvatarLookAtPosition()"); |
| 2107 | 2090 | |
| 2091 | + const float FAR_AWAY_STARE = TREE_SCALE; | |
| 2108 | 2092 | if (_myCamera.getMode() == CAMERA_MODE_MIRROR) { |
| 2109 | 2093 | lookAtSpot = _myCamera.getPosition(); |
| 2110 | 2094 | |
| 2095 | + } else if (_mouseHidden) { | |
| 2096 | + // if the mouse cursor is hidden, just look straight ahead | |
| 2097 | + glm::vec3 rayOrigin, rayDirection; | |
| 2098 | + _viewFrustum.computePickRay(0.5f, 0.5f, rayOrigin, rayDirection); | |
| 2099 | + lookAtSpot = rayOrigin + rayDirection * FAR_AWAY_STARE; | |
| 2100 | + | |
| 2111 | 2101 | } else if (!_lookatTargetAvatar) { |
| 2112 | 2102 | if (_isHoverVoxel) { |
| 2113 | 2103 | // Look at the hovered voxel |
| 2114 | 2104 | lookAtSpot = getMouseVoxelWorldCoordinates(_hoverVoxel); |
| 2115 | 2105 | |
| 2116 | 2106 | } else { |
| 2117 | − // Just look in direction of the mouse ray | |
| 2118 | − const float FAR_AWAY_STARE = TREE_SCALE; | |
| 2107 | + // Just look in direction of the mouse ray | |
| 2119 | 2108 | lookAtSpot = lookAtRayOrigin + lookAtRayDirection * FAR_AWAY_STARE; |
| 2120 | 2109 | } |
| 2121 | 2110 | } |
| @@ -2268,6 +2257,7 @@ void Application::updateMouseVoxels(float deltaTime, glm::vec3& mouseRayOrigin, · 146 unmodified lines | ||
| 2268 | 2257 | } |
| 2269 | 2258 | } |
| 2270 | 2259 | |
| 2260 | + | |
| 2271 | 2261 | void Application::updateHandAndTouch(float deltaTime) { |
| 2272 | 2262 | bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); |
| 2273 | 2263 | PerformanceWarning warn(showWarnings, "Application::updateHandAndTouch()"); |
| @@ -2311,7 +2301,9 @@ void Application::updateThreads(float deltaTime) { · 37 unmodified lines | ||
| 2311 | 2301 | _voxelHideShowThread.threadRoutine(); |
| 2312 | 2302 | _voxelEditSender.threadRoutine(); |
| 2313 | 2303 | _particleEditSender.threadRoutine(); |
| 2314 | − _persistThread->threadRoutine(); | |
| 2304 | + if (_persistThread) { | |
| 2305 | + _persistThread->threadRoutine(); | |
| 2306 | + } | |
| 2315 | 2307 | } |
| 2316 | 2308 | } |
| 2317 | 2309 | |
| @@ -2357,7 +2349,7 @@ void Application::updateTransmitter(float deltaTime) { · 39 unmodified lines | ||
| 2357 | 2349 | |
| 2358 | 2350 | // no transmitter drive implies transmitter pick |
| 2359 | 2351 | if (!Menu::getInstance()->isOptionChecked(MenuOption::TransmitterDrive) && _myTransmitter.isConnected()) { |
| 2360 | − _transmitterPickStart = _myAvatar.getSkeleton().joint[AVATAR_JOINT_CHEST].position; | |
| 2352 | + _transmitterPickStart = _myAvatar.getChestPosition(); | |
| 2361 | 2353 | glm::vec3 direction = _myAvatar.getOrientation() * |
| 2362 | 2354 | glm::quat(glm::radians(_myTransmitter.getEstimatedRotation())) * IDENTITY_FRONT; |
| 2363 | 2355 | |
| @@ -2406,12 +2398,6 @@ void Application::updateCamera(float deltaTime) { · 42 unmodified lines | ||
| 2406 | 2398 | glm::vec3 position = _faceshift.getHeadTranslation() * EYE_OFFSET_SCALE; |
| 2407 | 2399 | _myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, position.y, -position.z)); |
| 2408 | 2400 | updateProjectionMatrix(); |
| 2409 | − | |
| 2410 | − } else if (_webcam.isActive()) { | |
| 2411 | − const float EYE_OFFSET_SCALE = 0.5f; | |
| 2412 | − glm::vec3 position = _webcam.getEstimatedPosition() * EYE_OFFSET_SCALE; | |
| 2413 | − _myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, -position.y, position.z)); | |
| 2414 | − updateProjectionMatrix(); | |
| 2415 | 2401 | } |
| 2416 | 2402 | } |
| 2417 | 2403 | } |
| @@ -2523,8 +2509,8 @@ void Application::updateAvatar(float deltaTime) { · 105 unmodified lines | ||
| 2523 | 2509 | _myAvatar.getHand().setPitchUpdate(0.f); |
| 2524 | 2510 | _pitchFromTouch = 0.0f; |
| 2525 | 2511 | |
| 2526 | − // Update my avatar's state from gyros and/or webcam | |
| 2527 | − _myAvatar.updateFromGyrosAndOrWebcam(Menu::getInstance()->isOptionChecked(MenuOption::TurnWithHead)); | |
| 2512 | + // Update my avatar's state from gyros | |
| 2513 | + _myAvatar.updateFromGyros(Menu::getInstance()->isOptionChecked(MenuOption::TurnWithHead)); | |
| 2528 | 2514 | |
| 2529 | 2515 | // Update head mouse from faceshift if active |
| 2530 | 2516 | if (_faceshift.isActive()) { |
| @@ -2621,32 +2607,32 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 90 unmodified lines | ||
| 2621 | 2607 | int totalServers = 0; |
| 2622 | 2608 | int inViewServers = 0; |
| 2623 | 2609 | int unknownJurisdictionServers = 0; |
| 2624 | − | |
| 2610 | + | |
| 2625 | 2611 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 2626 | 2612 | // only send to the NodeTypes that are serverType |
| 2627 | 2613 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { |
| 2628 | 2614 | totalServers++; |
| 2629 | − | |
| 2615 | + | |
| 2630 | 2616 | // get the server bounds for this server |
| 2631 | 2617 | QUuid nodeUUID = node->getUUID(); |
| 2632 | − | |
| 2618 | + | |
| 2633 | 2619 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2634 | 2620 | // can get the jurisdiction... |
| 2635 | 2621 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { |
| 2636 | 2622 | unknownJurisdictionServers++; |
| 2637 | 2623 | } else { |
| 2638 | 2624 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; |
| 2639 | − | |
| 2625 | + | |
| 2640 | 2626 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2641 | − | |
| 2627 | + | |
| 2642 | 2628 | if (rootCode) { |
| 2643 | 2629 | VoxelPositionSize rootDetails; |
| 2644 | 2630 | voxelDetailsForCode(rootCode, rootDetails); |
| 2645 | 2631 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); |
| 2646 | 2632 | serverBounds.scale(TREE_SCALE); |
| 2647 | − | |
| 2633 | + | |
| 2648 | 2634 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); |
| 2649 | − | |
| 2635 | + | |
| 2650 | 2636 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { |
| 2651 | 2637 | inViewServers++; |
| 2652 | 2638 | } |
| @@ -2679,20 +2665,20 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 26 unmodified lines | ||
| 2679 | 2665 | if (wantExtraDebugging && unknownJurisdictionServers > 0) { |
| 2680 | 2666 | qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); |
| 2681 | 2667 | } |
| 2682 | − | |
| 2668 | + | |
| 2683 | 2669 | NodeList* nodeList = NodeList::getInstance(); |
| 2684 | − | |
| 2670 | + | |
| 2685 | 2671 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { |
| 2686 | 2672 | // only send to the NodeTypes that are serverType |
| 2687 | 2673 | if (node->getActiveSocket() != NULL && node->getType() == serverType) { |
| 2688 | − | |
| 2689 | − | |
| 2674 | + | |
| 2675 | + | |
| 2690 | 2676 | // get the server bounds for this server |
| 2691 | 2677 | QUuid nodeUUID = node->getUUID(); |
| 2692 | − | |
| 2678 | + | |
| 2693 | 2679 | bool inView = false; |
| 2694 | 2680 | bool unknownView = false; |
| 2695 | − | |
| 2681 | + | |
| 2696 | 2682 | // if we haven't heard from this voxel server, go ahead and send it a query, so we |
| 2697 | 2683 | // can get the jurisdiction... |
| 2698 | 2684 | if (jurisdictions.find(nodeUUID) == jurisdictions.end()) { |
| @@ -2702,15 +2688,15 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 3 unmodified lines | ||
| 2702 | 2688 | } |
| 2703 | 2689 | } else { |
| 2704 | 2690 | const JurisdictionMap& map = (jurisdictions)[nodeUUID]; |
| 2705 | − | |
| 2691 | + | |
| 2706 | 2692 | unsigned char* rootCode = map.getRootOctalCode(); |
| 2707 | − | |
| 2693 | + | |
| 2708 | 2694 | if (rootCode) { |
| 2709 | 2695 | VoxelPositionSize rootDetails; |
| 2710 | 2696 | voxelDetailsForCode(rootCode, rootDetails); |
| 2711 | 2697 | AABox serverBounds(glm::vec3(rootDetails.x, rootDetails.y, rootDetails.z), rootDetails.s); |
| 2712 | 2698 | serverBounds.scale(TREE_SCALE); |
| 2713 | − | |
| 2699 | + | |
| 2714 | 2700 | ViewFrustum::location serverFrustumLocation = _viewFrustum.boxInFrustum(serverBounds); |
| 2715 | 2701 | if (serverFrustumLocation != ViewFrustum::OUTSIDE) { |
| 2716 | 2702 | inView = true; |
| @@ -2723,7 +2709,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 6 unmodified lines | ||
| 2723 | 2709 | } |
| 2724 | 2710 | } |
| 2725 | 2711 | } |
| 2726 | − | |
| 2712 | + | |
| 2727 | 2713 | if (inView) { |
| 2728 | 2714 | _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS); |
| 2729 | 2715 | } else if (unknownView) { |
| @@ -2731,7 +2717,7 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 1 unmodified line | ||
| 2731 | 2717 | qDebug() << "no known jurisdiction for node " << *node << ", give it budget of " |
| 2732 | 2718 | << perUnknownServer << " to send us jurisdiction."; |
| 2733 | 2719 | } |
| 2734 | − | |
| 2720 | + | |
| 2735 | 2721 | // set the query's position/orientation to be degenerate in a manner that will get the scene quickly |
| 2736 | 2722 | // If there's only one server, then don't do this, and just let the normal voxel query pass through |
| 2737 | 2723 | // as expected... this way, we will actually get a valid scene if there is one to be seen |
| @@ -2739,8 +2725,8 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 1 unmodified line | ||
| 2739 | 2725 | _voxelQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1)); |
| 2740 | 2726 | const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0); |
| 2741 | 2727 | _voxelQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE); |
| 2742 | − _voxelQuery.setCameraNearClip(0.1); | |
| 2743 | − _voxelQuery.setCameraFarClip(0.1); | |
| 2728 | + _voxelQuery.setCameraNearClip(0.1f); | |
| 2729 | + _voxelQuery.setCameraFarClip(0.1f); | |
| 2744 | 2730 | if (wantExtraDebugging) { |
| 2745 | 2731 | qDebug() << "Using 'minimal' camera position for node" << *node; |
| 2746 | 2732 | } |
| @@ -2755,24 +2741,24 @@ void Application::queryOctree(NODE_TYPE serverType, PACKET_TYPE packetType, Node · 8 unmodified lines | ||
| 2755 | 2741 | } |
| 2756 | 2742 | // set up the packet for sending... |
| 2757 | 2743 | unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; |
| 2758 | − | |
| 2744 | + | |
| 2759 | 2745 | // insert packet type/version and node UUID |
| 2760 | 2746 | endOfVoxelQueryPacket += populateTypeAndVersion(endOfVoxelQueryPacket, packetType); |
| 2761 | 2747 | QByteArray ownerUUID = nodeList->getOwnerUUID().toRfc4122(); |
| 2762 | 2748 | memcpy(endOfVoxelQueryPacket, ownerUUID.constData(), ownerUUID.size()); |
| 2763 | 2749 | endOfVoxelQueryPacket += ownerUUID.size(); |
| 2764 | − | |
| 2750 | + | |
| 2765 | 2751 | // encode the query data... |
| 2766 | 2752 | endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); |
| 2767 | − | |
| 2753 | + | |
| 2768 | 2754 | int packetLength = endOfVoxelQueryPacket - voxelQueryPacket; |
| 2769 | − | |
| 2755 | + | |
| 2770 | 2756 | // make sure we still have an active socket |
| 2771 | 2757 | if (node->getActiveSocket()) { |
| 2772 | 2758 | nodeList->getNodeSocket().writeDatagram((char*) voxelQueryPacket, packetLength, |
| 2773 | 2759 | node->getActiveSocket()->getAddress(), node->getActiveSocket()->getPort()); |
| 2774 | 2760 | } |
| 2775 | − | |
| 2761 | + | |
| 2776 | 2762 | // Feed number of bytes to corresponding channel of the bandwidth meter |
| 2777 | 2763 | _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength); |
| 2778 | 2764 | } |
| @@ -2898,9 +2884,9 @@ void Application::setupWorldLight() { · 119 unmodified lines | ||
| 2898 | 2884 | glm::vec3 sunDirection = getSunDirection(); |
| 2899 | 2885 | GLfloat light_position0[] = { sunDirection.x, sunDirection.y, sunDirection.z, 0.0 }; |
| 2900 | 2886 | glLightfv(GL_LIGHT0, GL_POSITION, light_position0); |
| 2901 | − GLfloat ambient_color[] = { 0.7, 0.7, 0.8 }; | |
| 2887 | + GLfloat ambient_color[] = { 0.7f, 0.7f, 0.8f }; | |
| 2902 | 2888 | glLightfv(GL_LIGHT0, GL_AMBIENT, ambient_color); |
| 2903 | − GLfloat diffuse_color[] = { 0.8, 0.7, 0.7 }; | |
| 2889 | + GLfloat diffuse_color[] = { 0.8f, 0.7f, 0.7f }; | |
| 2904 | 2890 | glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse_color); |
| 2905 | 2891 | |
| 2906 | 2892 | glLightfv(GL_LIGHT0, GL_SPECULAR, WHITE_SPECULAR_COLOR); |
| @@ -2981,7 +2967,6 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 74 unmodified lines | ||
| 2981 | 2967 | glEnable(GL_DEPTH_TEST); |
| 2982 | 2968 | |
| 2983 | 2969 | // Enable to show line from me to the voxel I am touching |
| 2984 | − //renderLineToTouchedVoxel(); | |
| 2985 | 2970 | //renderThrustAtVoxel(_voxelThrust); |
| 2986 | 2971 | |
| 2987 | 2972 | if (!selfAvatarOnly) { |
| @@ -3161,10 +3146,10 @@ void Application::loadTranslatedViewMatrix(const glm::vec3& translation) { · 173 unmodified lines | ||
| 3161 | 3146 | translation.z + _viewMatrixTranslation.z); |
| 3162 | 3147 | } |
| 3163 | 3148 | |
| 3164 | −void Application::computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& near, | |
| 3165 | − float& far, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const { | |
| 3149 | +void Application::computeOffAxisFrustum(float& left, float& right, float& bottom, float& top, float& nearVal, | |
| 3150 | + float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const { | |
| 3166 | 3151 | |
| 3167 | − _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, near, far, nearClipPlane, farClipPlane); | |
| 3152 | + _viewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane); | |
| 3168 | 3153 | } |
| 3169 | 3154 | |
| 3170 | 3155 | void Application::displayOverlay() { |
| @@ -3252,13 +3237,13 @@ void Application::displayOverlay() { · 81 unmodified lines | ||
| 3252 | 3237 | char nodes[100]; |
| 3253 | 3238 | |
| 3254 | 3239 | int totalAvatars = 0, totalServers = 0; |
| 3255 | − | |
| 3240 | + | |
| 3256 | 3241 | foreach (const SharedNodePointer& node, NodeList::getInstance()->getNodeHash()) { |
| 3257 | 3242 | node->getType() == NODE_TYPE_AGENT ? totalAvatars++ : totalServers++; |
| 3258 | 3243 | } |
| 3259 | 3244 | |
| 3260 | 3245 | sprintf(nodes, "Servers: %d, Avatars: %d\n", totalServers, totalAvatars); |
| 3261 | − drawtext(_glWidget->width() - 150, 20, 0.10, 0, 1.0, 0, nodes, 1, 0, 0); | |
| 3246 | + drawtext(_glWidget->width() - 150, 20, 0.10f, 0, 1.0f, 0, nodes, 1, 0, 0); | |
| 3262 | 3247 | } |
| 3263 | 3248 | |
| 3264 | 3249 | // testing rendering coverage map |
| @@ -3280,14 +3265,10 @@ void Application::displayOverlay() { · 15 unmodified lines | ||
| 3280 | 3265 | char frameTimer[10]; |
| 3281 | 3266 | uint64_t mSecsNow = floor(usecTimestampNow() / 1000.0 + 0.5); |
| 3282 | 3267 | sprintf(frameTimer, "%d\n", (int)(mSecsNow % 1000)); |
| 3283 | − drawtext(_glWidget->width() - 100, _glWidget->height() - 20, 0.30, 0, 1.0, 0, frameTimer, 0, 0, 0); | |
| 3284 | − drawtext(_glWidget->width() - 102, _glWidget->height() - 22, 0.30, 0, 1.0, 0, frameTimer, 1, 1, 1); | |
| 3268 | + drawtext(_glWidget->width() - 100, _glWidget->height() - 20, 0.30f, 0, 1.0f, 0, frameTimer, 0, 0, 0); | |
| 3269 | + drawtext(_glWidget->width() - 102, _glWidget->height() - 22, 0.30f, 0, 1.0f, 0, frameTimer, 1, 1, 1); | |
| 3285 | 3270 | } |
| 3286 | 3271 | |
| 3287 | − | |
| 3288 | − // render the webcam input frame | |
| 3289 | − _webcam.renderPreview(_glWidget->width(), _glWidget->height()); | |
| 3290 | − | |
| 3291 | 3272 | _palette.render(_glWidget->width(), _glWidget->height()); |
| 3292 | 3273 | |
| 3293 | 3274 | QAction* paintColorAction = NULL; |
| @@ -3343,6 +3324,7 @@ void Application::displayOverlay() { · 49 unmodified lines | ||
| 3343 | 3324 | glPopMatrix(); |
| 3344 | 3325 | } |
| 3345 | 3326 | |
| 3327 | + | |
| 3346 | 3328 | void Application::displayStats() { |
| 3347 | 3329 | int statsVerticalOffset = 8; |
| 3348 | 3330 | const int PELS_PER_LINE = 15; |
| @@ -3366,7 +3348,7 @@ void Application::displayStats() { · 17 unmodified lines | ||
| 3366 | 3348 | // Now handle voxel servers, since there could be more than one, we average their ping times |
| 3367 | 3349 | unsigned long totalPingVoxel = 0; |
| 3368 | 3350 | int voxelServerCount = 0; |
| 3369 | − | |
| 3351 | + | |
| 3370 | 3352 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { |
| 3371 | 3353 | if (node->getType() == NODE_TYPE_VOXEL_SERVER) { |
| 3372 | 3354 | totalPingVoxel += node->getPingMs(); |
| @@ -3376,7 +3358,7 @@ void Application::displayStats() { · 3 unmodified lines | ||
| 3376 | 3358 | } |
| 3377 | 3359 | } |
| 3378 | 3360 | } |
| 3379 | − | |
| 3361 | + | |
| 3380 | 3362 | if (voxelServerCount) { |
| 3381 | 3363 | pingVoxel = totalPingVoxel/voxelServerCount; |
| 3382 | 3364 | } |
| @@ -3524,20 +3506,6 @@ void Application::displayStats() { · 141 unmodified lines | ||
| 3524 | 3506 | } |
| 3525 | 3507 | statsVerticalOffset += PELS_PER_LINE; |
| 3526 | 3508 | drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str()); |
| 3527 | − | |
| 3528 | − if (_perfStatsOn) { | |
| 3529 | − // Get the PerfStats group details. We need to allocate and array of char* long enough to hold 1+groups | |
| 3530 | − char** perfStatLinesArray = new char*[PerfStat::getGroupCount()+1]; | |
| 3531 | − int lines = PerfStat::DumpStats(perfStatLinesArray); | |
| 3532 | − | |
| 3533 | − for (int line=0; line < lines; line++) { | |
| 3534 | − statsVerticalOffset += PELS_PER_LINE; | |
| 3535 | − drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, perfStatLinesArray[line]); | |
| 3536 | − delete perfStatLinesArray[line]; // we're responsible for cleanup | |
| 3537 | − perfStatLinesArray[line]=NULL; | |
| 3538 | − } | |
| 3539 | − delete []perfStatLinesArray; // we're responsible for cleanup | |
| 3540 | − } | |
| 3541 | 3509 | } |
| 3542 | 3510 | |
| 3543 | 3511 | void Application::renderThrustAtVoxel(const glm::vec3& thrust) { |
| @@ -3552,20 +3520,6 @@ void Application::renderThrustAtVoxel(const glm::vec3& thrust) { · 8 unmodified lines | ||
| 3552 | 3520 | } |
| 3553 | 3521 | } |
| 3554 | 3522 | |
| 3555 | −void Application::renderLineToTouchedVoxel() { | |
| 3556 | − // Draw a teal line to the voxel I am currently dragging on | |
| 3557 | − if (_mousePressed) { | |
| 3558 | − glColor3f(0, 1, 1); | |
| 3559 | − glLineWidth(2.0f); | |
| 3560 | − glBegin(GL_LINES); | |
| 3561 | − glm::vec3 voxelTouched = getMouseVoxelWorldCoordinates(_mouseVoxelDragging); | |
| 3562 | − glVertex3f(voxelTouched.x, voxelTouched.y, voxelTouched.z); | |
| 3563 | − glm::vec3 headPosition = _myAvatar.getHeadJointPosition(); | |
| 3564 | − glVertex3fv(&headPosition.x); | |
| 3565 | − glEnd(); | |
| 3566 | − } | |
| 3567 | −} | |
| 3568 | − | |
| 3569 | 3523 | |
| 3570 | 3524 | glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { |
| 3571 | 3525 | float horizontalScale = _glWidget->width() / 2.0f; |
| @@ -3712,10 +3666,10 @@ void Application::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { · 140 unmodified lines | ||
| 3712 | 3666 | if (!selfAvatarOnly) { |
| 3713 | 3667 | // Render avatars of other nodes |
| 3714 | 3668 | NodeList* nodeList = NodeList::getInstance(); |
| 3715 | − | |
| 3669 | + | |
| 3716 | 3670 | foreach (const SharedNodePointer& node, nodeList->getNodeHash()) { |
| 3717 | 3671 | QMutexLocker(&node->getMutex()); |
| 3718 | − | |
| 3672 | + | |
| 3719 | 3673 | if (node->getLinkedData() != NULL && node->getType() == NODE_TYPE_AGENT) { |
| 3720 | 3674 | Avatar *avatar = (Avatar *)node->getLinkedData(); |
| 3721 | 3675 | if (!avatar->isInitialized()) { |
| @@ -3972,7 +3926,6 @@ void Application::resetSensors() { · 250 unmodified lines | ||
| 3972 | 3926 | _headMouseX = _mouseX = _glWidget->width() / 2; |
| 3973 | 3927 | _headMouseY = _mouseY = _glWidget->height() / 2; |
| 3974 | 3928 | |
| 3975 | − _webcam.reset(); | |
| 3976 | 3929 | _faceshift.reset(); |
| 3977 | 3930 | |
| 3978 | 3931 | if (OculusManager::isConnected()) { |
| @@ -4063,7 +4016,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 84 unmodified lines | ||
| 4063 | 4016 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { |
| 4064 | 4017 | VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE); |
| 4065 | 4018 | fade.voxelDetails = rootDetails; |
| 4066 | − const float slightly_smaller = 0.99; | |
| 4019 | + const float slightly_smaller = 0.99f; | |
| 4067 | 4020 | fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller; |
| 4068 | 4021 | _voxelFades.push_back(fade); |
| 4069 | 4022 | } |
| @@ -4094,7 +4047,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines | ||
| 4094 | 4047 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { |
| 4095 | 4048 | VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE); |
| 4096 | 4049 | fade.voxelDetails = rootDetails; |
| 4097 | − const float slightly_smaller = 0.99; | |
| 4050 | + const float slightly_smaller = 0.99f; | |
| 4098 | 4051 | fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller; |
| 4099 | 4052 | _voxelFades.push_back(fade); |
| 4100 | 4053 | } |
| @@ -4184,7 +4137,7 @@ int Application::parseOctreeStats(unsigned char* messageData, ssize_t messageLen · 83 unmodified lines | ||
| 4184 | 4137 | if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { |
| 4185 | 4138 | VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE); |
| 4186 | 4139 | fade.voxelDetails = rootDetails; |
| 4187 | − const float slightly_smaller = 0.99; | |
| 4140 | + const float slightly_smaller = 0.99f; | |
| 4188 | 4141 | fade.voxelDetails.s = fade.voxelDetails.s * slightly_smaller; |
| 4189 | 4142 | _voxelFades.push_back(fade); |
| 4190 | 4143 | } |
| @@ -4213,28 +4166,28 @@ void Application::processDatagrams() { · 22 unmodified lines | ||
| 4213 | 4166 | MAX_PACKET_SIZE, |
| 4214 | 4167 | senderSockAddr.getAddressPointer(), |
| 4215 | 4168 | senderSockAddr.getPortPointer()))) { |
| 4216 | − | |
| 4169 | + | |
| 4217 | 4170 | _packetCount++; |
| 4218 | 4171 | _bytesCount += bytesReceived; |
| 4219 | − | |
| 4172 | + | |
| 4220 | 4173 | if (packetVersionMatch(_incomingPacket)) { |
| 4221 | 4174 | // only process this packet if we have a match on the packet version |
| 4222 | 4175 | switch (_incomingPacket[0]) { |
| 4223 | 4176 | case PACKET_TYPE_TRANSMITTER_DATA_V2: |
| 4224 | 4177 | // V2 = IOS transmitter app |
| 4225 | 4178 | _myTransmitter.processIncomingData(_incomingPacket, bytesReceived); |
| 4226 | − | |
| 4179 | + | |
| 4227 | 4180 | break; |
| 4228 | 4181 | case PACKET_TYPE_MIXED_AUDIO: |
| 4229 | 4182 | QMetaObject::invokeMethod(&_audio, "addReceivedAudioToBuffer", Qt::QueuedConnection, |
| 4230 | 4183 | Q_ARG(QByteArray, QByteArray((char*) _incomingPacket, bytesReceived))); |
| 4231 | 4184 | break; |
| 4232 | − | |
| 4185 | + | |
| 4233 | 4186 | case PACKET_TYPE_PARTICLE_ADD_RESPONSE: |
| 4234 | 4187 | // look up our ParticleEditHanders.... |
| 4235 | 4188 | ParticleEditHandle::handleAddResponse(_incomingPacket, bytesReceived); |
| 4236 | 4189 | break; |
| 4237 | − | |
| 4190 | + | |
| 4238 | 4191 | case PACKET_TYPE_PARTICLE_DATA: |
| 4239 | 4192 | case PACKET_TYPE_VOXEL_DATA: |
| 4240 | 4193 | case PACKET_TYPE_VOXEL_ERASE: |
| @@ -4242,7 +4195,7 @@ void Application::processDatagrams() { · 1 unmodified line | ||
| 4242 | 4195 | case PACKET_TYPE_ENVIRONMENT_DATA: { |
| 4243 | 4196 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 4244 | 4197 | "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()"); |
| 4245 | − | |
| 4198 | + | |
| 4246 | 4199 | bool wantExtraDebugging = getLogger()->extraDebugging(); |
| 4247 | 4200 | if (wantExtraDebugging && _incomingPacket[0] == PACKET_TYPE_VOXEL_DATA) { |
| 4248 | 4201 | int numBytesPacketHeader = numBytesForPacketHeader(_incomingPacket); |
| @@ -4254,10 +4207,10 @@ void Application::processDatagrams() { · 5 unmodified lines | ||
| 4254 | 4207 | dataAt += sizeof(VOXEL_PACKET_SENT_TIME); |
| 4255 | 4208 | VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); |
| 4256 | 4209 | int flightTime = arrivedAt - sentAt; |
| 4257 | − | |
| 4210 | + | |
| 4258 | 4211 | printf("got PACKET_TYPE_VOXEL_DATA, sequence:%d flightTime:%d\n", sequence, flightTime); |
| 4259 | 4212 | } |
| 4260 | − | |
| 4213 | + | |
| 4261 | 4214 | // add this packet to our list of voxel packets and process them on the voxel processing |
| 4262 | 4215 | _voxelProcessor.queueReceivedPacket(senderSockAddr, _incomingPacket, bytesReceived); |
| 4263 | 4216 | break; |
| @@ -4275,9 +4228,6 @@ void Application::processDatagrams() { · 11 unmodified lines | ||
| 4275 | 4228 | case PACKET_TYPE_AVATAR_URLS: |
| 4276 | 4229 | processAvatarURLsMessage(_incomingPacket, bytesReceived); |
| 4277 | 4230 | break; |
| 4278 | − case PACKET_TYPE_AVATAR_FACE_VIDEO: | |
| 4279 | − processAvatarFaceVideoMessage(_incomingPacket, bytesReceived); | |
| 4280 | − break; | |
| 4281 | 4231 | case PACKET_TYPE_DATA_SERVER_GET: |
| 4282 | 4232 | case PACKET_TYPE_DATA_SERVER_PUT: |
| 4283 | 4233 | case PACKET_TYPE_DATA_SERVER_SEND: |
| @@ -4394,15 +4344,19 @@ void Application::updateLocalOctreeCache(bool firstTime) { · 110 unmodified lines | ||
| 4394 | 4344 | |
| 4395 | 4345 | if (_persistThread) { |
| 4396 | 4346 | _persistThread->terminate(); |
| 4347 | + _persistThread->deleteLater(); | |
| 4397 | 4348 | _persistThread = NULL; |
| 4398 | 4349 | } |
| 4399 | 4350 | |
| 4400 | 4351 | QString localVoxelCacheFileName = getLocalVoxelCacheFileName(); |
| 4401 | 4352 | const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds |
| 4402 | − _persistThread = new OctreePersistThread(_voxels.getTree(), | |
| 4403 | − localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL); | |
| 4404 | 4353 | |
| 4405 | − qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName; | |
| 4354 | + if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableLocalVoxelCache)) { | |
| 4355 | + _persistThread = new OctreePersistThread(_voxels.getTree(), | |
| 4356 | + localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL); | |
| 4357 | + | |
| 4358 | + qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName; | |
| 4359 | + } | |
| 4406 | 4360 | |
| 4407 | 4361 | if (_persistThread) { |
| 4408 | 4362 | _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates |