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
8989 const float MIRROR_REARVIEW_DISTANCE = 0.65f;
9090 const float MIRROR_REARVIEW_BODY_DISTANCE = 2.3f;
9191
92+<<<<<<< HEAD
9293 const QString CHECK_VERSION_URL = "http://www.google.com";
9394
9495
96+=======
97+>>>>>>> a8bbe41642f5ce3152f7e7ca8b9b001c78c2fcdc
9598 void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString &message) {
9699 fprintf(stdout, "%s", message.toLocal8Bit().constData());
97100 Application::getInstance()->getLogger()->addMessage(message.toLocal8Bit().constData());
@@ -148,7 +151,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 50 unmodified lines
148151 _resetRecentMaxPacketsSoon(true),
149152 _swatch(NULL),
150153 _pasteMode(false),
151− _logger(new FileLogger())
154+ _logger(new FileLogger()),
155+ _persistThread(NULL)
152156 {
153157 _applicationStartupTime = startup_time;
154158
@@ -181,7 +185,6 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 26 unmodified lines
181185 nodeList->addHook(&_voxels);
182186 nodeList->addHook(this);
183187 nodeList->addDomainListener(this);
184− nodeList->addDomainListener(&_voxels);
185188
186189 // network receive thread and voxel parsing thread are both controlled by the --nonblocking command line
187190 _enableProcessVoxelsThread = _enableNetworkThread = !cmdOptionExists(argc, constArgv, "--nonblocking");
@@ -224,8 +227,8 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 36 unmodified lines
224227 #endif
225228
226229 // 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,
228− NODE_TYPE_PARTICLE_SERVER};
230+ const char nodeTypesOfInterest[] = {NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER, NODE_TYPE_VOXEL_SERVER,
231+ NODE_TYPE_PARTICLE_SERVER, NODE_TYPE_METAVOXEL_SERVER};
229232 nodeList->setNodeTypesOfInterest(nodeTypesOfInterest, sizeof(nodeTypesOfInterest));
230233
231234 QTimer* silentNodeTimer = new QTimer(this);
@@ -265,6 +268,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : · 33 unmodified lines
265268
266269 // Set the sixense filtering
267270 _sixenseManager.setFilter(Menu::getInstance()->isOptionChecked(MenuOption::FilterSixense));
271+
268272 }
269273
270274 Application::~Application() {
@@ -1137,7 +1141,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) { · 866 unmodified lines
11371141 return;
11381142 }
11391143 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);
11411145 return;
11421146 }
11431147 }
@@ -1297,7 +1301,7 @@ void Application::wheelEvent(QWheelEvent* event) { · 153 unmodified lines
12971301 void Application::sendPingPackets() {
12981302
12991303 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};
13011305
13021306 unsigned char pingPacket[MAX_PACKET_SIZE];
13031307 int length = NodeList::getInstance()->fillPingPacket(pingPacket);
@@ -1363,8 +1367,9 @@ void Application::timer() { · 59 unmodified lines
13631367 // ask the node list to check in with the domain server
13641368 NodeList::getInstance()->sendDomainServerCheckIn();
13651369
1366− // give the MyAvatar object position to the Profile so it can propagate to the data-server
1370+ // give the MyAvatar object position, orientation to the Profile so it can propagate to the data-server
13671371 _profile.updatePosition(_myAvatar.getPosition());
1372+ _profile.updateOrientation(_myAvatar.getOrientation());
13681373 }
13691374
13701375 static glm::vec3 getFaceVector(BoxFace face) {
@@ -1451,6 +1456,8 @@ void Application::terminate() { · 80 unmodified lines
14511456 _voxelHideShowThread.terminate();
14521457 _voxelEditSender.terminate();
14531458 _particleEditSender.terminate();
1459+ _persistThread->terminate();
1460+ _persistThread = NULL;
14541461 }
14551462
14561463 static Avatar* processAvatarMessageHeader(unsigned char*& packetData, size_t& dataBytes) {
@@ -1632,10 +1639,9 @@ void Application::makeVoxel(glm::vec3 position, · 175 unmodified lines
16321639 isDestructive);
16331640 }
16341641
1635−const glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail _mouseVoxel) {
1636− return glm::vec3((_mouseVoxel.x + _mouseVoxel.s / 2.f) * TREE_SCALE,
1637− (_mouseVoxel.y + _mouseVoxel.s / 2.f) * TREE_SCALE,
1638− (_mouseVoxel.z + _mouseVoxel.s / 2.f) * TREE_SCALE);
1642+glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel) {
1643+ return glm::vec3((mouseVoxel.x + mouseVoxel.s / 2.f) * TREE_SCALE, (mouseVoxel.y + mouseVoxel.s / 2.f) * TREE_SCALE,
1644+ (mouseVoxel.z + mouseVoxel.s / 2.f) * TREE_SCALE);
16391645 }
16401646
16411647 const float NUDGE_PRECISION_MIN = 1 / pow(2.0, 12.0);
@@ -1950,6 +1956,9 @@ void Application::init() { · 308 unmodified lines
19501956 connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
19511957 connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView()));
19521958 connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
1959+
1960+
1961+ updateLocalOctreeCache(true);
19531962 }
19541963
19551964 void Application::closeMirrorView() {
@@ -2139,9 +2148,12 @@ void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm:: · 183 unmodified lines
21392148 for (vector<Avatar*>::iterator fade = _avatarFades.begin(); fade != _avatarFades.end(); fade++) {
21402149 Avatar* avatar = *fade;
21412150 const float SHRINK_RATE = 0.9f;
2142− avatar->setNewScale(avatar->getNewScale() * SHRINK_RATE);
2143− const float MINIMUM_SCALE = 0.001f;
2144− if (avatar->getNewScale() < MINIMUM_SCALE) {
2151+
2152+ avatar->setTargetScale(avatar->getScale() * SHRINK_RATE);
2153+
2154+ const float MIN_FADE_SCALE = 0.001;
2155+
2156+ if (avatar->getTargetScale() < MIN_FADE_SCALE) {
21452157 delete avatar;
21462158 _avatarFades.erase(fade--);
21472159
@@ -2410,6 +2422,7 @@ void Application::updateThreads(float deltaTime) { · 262 unmodified lines
24102422 _voxelHideShowThread.threadRoutine();
24112423 _voxelEditSender.threadRoutine();
24122424 _particleEditSender.threadRoutine();
2425+ _persistThread->threadRoutine();
24132426 }
24142427 }
24152428
@@ -4205,6 +4218,10 @@ void Application::domainChanged(QString domain) { · 1789 unmodified lines
42054218 _voxelServerJurisdictions.clear();
42064219 _octreeServerSceneStats.clear();
42074220 _particleServerJurisdictions.clear();
4221+
4222+ // reset our persist thread
4223+ qDebug() << "domainChanged()... domain=" << domain << " swapping persist cache\n";
4224+ updateLocalOctreeCache();
42084225 }
42094226
42104227 void Application::nodeAdded(Node* node) {
@@ -4428,6 +4445,10 @@ void* Application::networkReceive(void* args) { · 217 unmodified lines
44284445 app->_voxelProcessor.queueReceivedPacket(senderSockAddr, app->_incomingPacket, bytesReceived);
44294446 break;
44304447 }
4448+ case PACKET_TYPE_METAVOXEL_DATA:
4449+ app->_metavoxels.processData(QByteArray((const char*)app->_incomingPacket, bytesReceived),
4450+ senderSockAddr);
4451+ break;
44314452 case PACKET_TYPE_BULK_AVATAR_DATA:
44324453 NodeList::getInstance()->processBulkNodeData(senderSockAddr,
44334454 app->_incomingPacket,
@@ -4541,6 +4562,49 @@ void Application::toggleLogDialog() { · 107 unmodified lines
45414562 }
45424563 }
45434564
4565+void Application::initAvatarAndViewFrustum() {
4566+ updateAvatar(0.f);
4567+}
4568+
4569+QString 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+
4584+void 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+
45444608 void Application::checkVersion() {
45454609 QUrl url("https://a-tower.below92.com/version.xml");
45464610 QNetworkAccessManager *downloadXML = new QNetworkAccessManager(this);
@@ -4606,4 +4670,4 @@ void Application::skipVersion() { · 59 unmodified lines
46064670 skipFile->seek(0);
46074671 skipFile->write(_latestVersion->toStdString().c_str());
46084672 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