History

Resolving conflicts

Leonardo Murillo committed 12 years ago

Commit 24bedc92 parents 4373cc1 a8bbe4183 files · +3178 −1774Browse files

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

Unified · Split

interface/src/Application.cpp+79−15
@@ -89,9 +89,12 @@ const float MIRROR_FULLSCREEN_DISTANCE = 0.35f; · 88 unmodified lines
89const float MIRROR_REARVIEW_DISTANCE = 0.65f;89const float MIRROR_REARVIEW_DISTANCE = 0.65f;
90const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;90const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
91 91
92<<<<<<< HEAD
92const QString CHECK_VERSION_URL = "http://www.google.com";93const QString CHECK_VERSION_URL = "http://www.google.com";
93 94
94 95
96=======
97>>>>>>> a8bbe41642f5ce3152f7e7ca8b9b001c78c2fcdc
95void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {98void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
96 fprintf(stdout, "%s", message.toLocal8Bit().constData());99 fprintf(stdout, "%s", message.toLocal8Bit().constData());
97 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());100 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());
@@ -148,7 +151,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 50 unmodified lines
148 _resetRecentMaxPacketsSoon(true),151 _resetRecentMaxPacketsSoon(true),
149 _swatch(NULL),152 _swatch(NULL),
150 _pasteMode(false),153 _pasteMode(false),
151 _logger(new FileLogger())154 _logger(new FileLogger()),
155 _persistThread(NULL)
152{156{
153 _applicationStartupTime = startup_time;157 _applicationStartupTime = startup_time;
154 158
@@ -181,7 +185,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 26 unmodified lines
181 nodeList->addHook(&_voxels);185 nodeList->addHook(&_voxels);
182 nodeList->addHook(this);186 nodeList->addHook(this);
183 nodeList->addDomainListener(this);187 nodeList->addDomainListener(this);
184 nodeList->addDomainListener(&_voxels);
185 188
186 // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line189 // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line
187 _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");190 _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
@@ -224,8 +227,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 36 unmodified lines
224 #endif227 #endif
225 228
226 // tell the NodeList instance who to tell the domain server we care about229 // tell the NodeList instance who to tell the domain server we care about
227 const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER,230 const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER,
228 NODE_TYPE_PARTICLE_SERVER};231 NODE_TYPE_PARTICLE_SERVER, NODE_TYPE_METAVOXEL_SERVER};
229 nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest));232 nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
230 233
231 QTimer* silentNodeTimer = new QTimer(this);234 QTimer* silentNodeTimer = new QTimer(this);
@@ -265,6 +268,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 33 unmodified lines
265 268
266 // Set the sixense filtering269 // Set the sixense filtering
267 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));270 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
271
268}272}
269 273
270Application::~Application() {274Application::~Application() {
@@ -1137,7 +1141,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 866 unmodified lines
1137 return;1141 return;
1138 }1142 }
1139 if (_isHoverVoxel) {1143 if (_isHoverVoxel) {
1140 _myAvatar.orbit(glm::vec3(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z) * (float)TREE_SCALE, deltaX, deltaY);1144 _myAvatar.orbit(getMouseVoxelWorldCoordinates(_hoverVoxel), deltaX, deltaY);
1141 return;1145 return;
1142 }1146 }
1143 }1147 }
@@ -1297,7 +1301,7 @@ void Application::wheelEvent(QWheelEvent* event) { · 153 unmodified lines
1297void Application::sendPingPackets() {1301void Application::sendPingPackets() {
1298 1302
1299 const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_PARTICLE_SERVER,1303 const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_PARTICLE_SERVER,
1300 NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER};1304 NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_METAVOXEL_SERVER};
1301 1305
1302 unsigned char pingPacket[MAX_PACKET_SIZE];1306 unsigned char pingPacket[MAX_PACKET_SIZE];
1303 int length = NodeList::getInstance()->fillPingPacket(pingPacket);1307 int length = NodeList::getInstance()->fillPingPacket(pingPacket);
@@ -1363,8 +1367,9 @@ void Application::timer() { · 59 unmodified lines
1363 // ask the node list to check in with the domain server1367 // ask the node list to check in with the domain server
1364 NodeList::getInstance()->sendDomainServerCheckIn();1368 NodeList::getInstance()->sendDomainServerCheckIn();
1365 1369
1366 // give the MyAvatar object position to the Profile so it can propagate to the data-server1370 // give the MyAvatar object position, orientation to the Profile so it can propagate to the data-server
1367 _profile.updatePosition(_myAvatar.getPosition());1371 _profile.updatePosition(_myAvatar.getPosition());
1372 _profile.updateOrientation(_myAvatar.getOrientation());
1368}1373}
1369 1374
1370static glm::vec3 getFaceVector(BoxFace face) {1375static glm::vec3 getFaceVector(BoxFace face) {
@@ -1451,6 +1456,8 @@ void Application::terminate() { · 80 unmodified lines
1451 _voxelHideShowThread.terminate();1456 _voxelHideShowThread.terminate();
1452 _voxelEditSender.terminate();1457 _voxelEditSender.terminate();
1453 _particleEditSender.terminate();1458 _particleEditSender.terminate();
1459 _persistThread->terminate();
1460 _persistThread = NULL;
1454}1461}
1455 1462
1456static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {1463static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
@@ -1632,10 +1639,9 @@ void Application::makeVoxel(glm::vec3 position, · 175 unmodified lines
1632 isDestructive);1639 isDestructive);
1633 }1640 }
1634 1641
1635const glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail _mouseVoxel) {1642glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel) {
1636 return glm::vec3((_mouseVoxel.x + _mouseVoxel.s / 2.f) * TREE_SCALE,1643 return glm::vec3((mouseVoxel.x + mouseVoxel.s / 2.f) * TREE_SCALE, (mouseVoxel.y + mouseVoxel.s / 2.f) * TREE_SCALE,
1637 (_mouseVoxel.y + _mouseVoxel.s / 2.f) * TREE_SCALE,1644 (mouseVoxel.z + mouseVoxel.s / 2.f) * TREE_SCALE);
1638 (_mouseVoxel.z + _mouseVoxel.s / 2.f) * TREE_SCALE);
1639}1645}
1640 1646
1641const float NUDGE_PRECISION_MIN = 1 / pow(2.0, 12.0);1647const float NUDGE_PRECISION_MIN = 1 / pow(2.0, 12.0);
@@ -1950,6 +1956,9 @@ void Application::init() { · 308 unmodified lines
1950 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));1956 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
1951 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));1957 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
1952 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));1958 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1959
1960
1961 updateLocalOctreeCache(true);
1953}1962}
1954 1963
1955void Application::closeMirrorView() {1964void Application::closeMirrorView() {
@@ -2139,9 +2148,12 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 183 unmodified lines
2139 for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {2148 for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
2140 Avatar* avatar = *fade;2149 Avatar* avatar = *fade;
2141 const float SHRINK_RATE = 0.9f;2150 const float SHRINK_RATE = 0.9f;
2142 avatar->setNewScale(avatar->getNewScale() * SHRINK_RATE);2151
2143 const float MINIMUM_SCALE = 0.001f;2152 avatar->setTargetScale(avatar->getScale() * SHRINK_RATE);
2144 if (avatar->getNewScale() < MINIMUM_SCALE) {2153
2154 const float MIN_FADE_SCALE = 0.001;
2155
2156 if (avatar->getTargetScale() < MIN_FADE_SCALE) {
2145 delete avatar;2157 delete avatar;
2146 _avatarFades.erase(fade--);2158 _avatarFades.erase(fade--);
2147 2159
@@ -2410,6 +2422,7 @@ void Application::updateThreads(float deltaTime) { · 262 unmodified lines
2410 _voxelHideShowThread.threadRoutine();2422 _voxelHideShowThread.threadRoutine();
2411 _voxelEditSender.threadRoutine();2423 _voxelEditSender.threadRoutine();
2412 _particleEditSender.threadRoutine();2424 _particleEditSender.threadRoutine();
2425 _persistThread->threadRoutine();
2413 }2426 }
2414}2427}
2415 2428
@@ -4205,6 +4218,10 @@ void Application::domainChanged(QString domain) { · 1789 unmodified lines
4205 _voxelServerJurisdictions.clear();4218 _voxelServerJurisdictions.clear();
4206 _octreeServerSceneStats.clear();4219 _octreeServerSceneStats.clear();
4207 _particleServerJurisdictions.clear();4220 _particleServerJurisdictions.clear();
4221
4222 // reset our persist thread
4223 qDebug() << "domainChanged()... domain=" << domain << " swapping persist cache\n";
4224 updateLocalOctreeCache();
4208}4225}
4209 4226
4210void Application::nodeAdded(Node* node) {4227void Application::nodeAdded(Node* node) {
@@ -4428,6 +4445,10 @@ void* Application::networkReceive(void* args) { · 217 unmodified lines
4428 app->_voxelProcessor.queueReceivedPacket(senderSockAddr, app->_incomingPacket, bytesReceived);4445 app->_voxelProcessor.queueReceivedPacket(senderSockAddr, app->_incomingPacket, bytesReceived);
4429 break;4446 break;
4430 }4447 }
4448 case PACKET_TYPE_METAVOXEL_DATA:
4449 app->_metavoxels.processData(QByteArray((const char*)app->_incomingPacket, bytesReceived),
4450 senderSockAddr);
4451 break;
4431 case PACKET_TYPE_BULK_AVATAR_DATA:4452 case PACKET_TYPE_BULK_AVATAR_DATA:
4432 NodeList::getInstance()->processBulkNodeData(senderSockAddr,4453 NodeList::getInstance()->processBulkNodeData(senderSockAddr,
4433 app->_incomingPacket,4454 app->_incomingPacket,
@@ -4541,6 +4562,49 @@ void Application::toggleLogDialog() { · 107 unmodified lines
4541 }4562 }
4542}4563}
4543 4564
4565void Application::initAvatarAndViewFrustum() {
4566 updateAvatar(0.f);
4567}
4568
4569QString Application::getLocalVoxelCacheFileName() {
4570 QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
4571 QDir logDir(fileName);
4572 if (!logDir.exists(fileName)) {
4573 logDir.mkdir(fileName);
4574 }
4575
4576 fileName.append(QString("/hifi.voxelscache."));
4577 fileName.append(_profile.getLastDomain());
4578 fileName.append(QString(".svo"));
4579
4580 return fileName;
4581}
4582
4583
4584void Application::updateLocalOctreeCache(bool firstTime) {
4585 // only do this if we've already got a persistThread or we're told this is the first time
4586 if (firstTime || _persistThread) {
4587
4588 if (_persistThread) {
4589 _persistThread->terminate();
4590 _persistThread = NULL;
4591 }
4592
4593 QString localVoxelCacheFileName = getLocalVoxelCacheFileName();
4594 const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds
4595 _persistThread = new OctreePersistThread(_voxels.getTree(),
4596 localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL);
4597
4598 qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName << "\n";
4599
4600 if (_persistThread) {
4601 _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates
4602 connect(_persistThread, SIGNAL(loadCompleted()), &_voxels, SLOT(localVoxelCacheLoaded()));
4603 _persistThread->initialize(true);
4604 }
4605 }
4606}
4607
4544void Application::checkVersion() {4608void Application::checkVersion() {
4545 QUrl url("https://a-tower.below92.com/version.xml");4609 QUrl url("https://a-tower.below92.com/version.xml");
4546 QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);4610 QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);
@@ -4606,4 +4670,4 @@ void Application::skipVersion() { · 59 unmodified lines
4606 skipFile->seek(0);4670 skipFile->seek(0);
4607 skipFile->write(_latestVersion->toStdString().c_str());4671 skipFile->write(_latestVersion->toStdString().c_str());
4608 skipFile->close();4672 skipFile->close();
4609}4673}

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