History

Merge branch 'master' of https://github.com/highfidelity/hifi into local_voxels

Atlante45 committed 12 years ago

Commit 2ee79742 parents 11e80e0 0530a7346 files · +999 −476Browse files

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

Unified · Split

interface/src/Application.cpp+65−44
@@ -1383,6 +1383,26 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) { · 1382 unmodified lines
13831383 _window->activateWindow();
13841384 }
13851385
1386+void Application::importVoxels() {
1387+ if (!_voxelImporter) {
1388+ _voxelImporter = new VoxelImporter(_window);
1389+ _voxelImporter->loadSettings(_settings);
1390+ }
1391+
1392+ if (!_voxelImporter->exec()) {
1393+ qDebug() << "[DEBUG] Import succeeded." << endl;
1394+ } else {
1395+ qDebug() << "[DEBUG] Import failed." << endl;
1396+ if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) {
1397+ _sharedVoxelSystem.killLocalVoxels();
1398+ _sharedVoxelSystem.changeTree(&_clipboard);
1399+ }
1400+ }
1401+
1402+ // restore the main window's active state
1403+ _window->activateWindow();
1404+}
1405+
13861406 void Application::cutVoxels(const VoxelDetail& sourceVoxel) {
13871407 copyVoxels(sourceVoxel);
13881408 deleteVoxelAt(sourceVoxel);
@@ -1521,8 +1541,8 @@ void Application::init() { · 132 unmodified lines
15211541
15221542 // Set up VoxelSystem after loading preferences so we can get the desired max voxel count
15231543 _voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels());
1524− _voxels.setUseVoxelShader(Menu::getInstance()->isOptionChecked(MenuOption::UseVoxelShader));
1525− _voxels.setVoxelsAsPoints(Menu::getInstance()->isOptionChecked(MenuOption::VoxelsAsPoints));
1544+ _voxels.setUseVoxelShader(false);
1545+ _voxels.setVoxelsAsPoints(false);
15261546 _voxels.setDisableFastVoxelPipeline(false);
15271547 _voxels.init();
15281548
@@ -1918,7 +1938,7 @@ void Application::updateMyAvatar(float deltaTime) { · 389 unmodified lines
19181938 // actually need to calculate the view frustum planes to send these details
19191939 // to the server.
19201940 loadViewFrustum(_myCamera, _viewFrustum);
1921−
1941+
19221942 // Update my voxel servers with my current voxel query...
19231943 queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions);
19241944 queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions);
@@ -1931,26 +1951,28 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 6 unmodified lines
19311951 return;
19321952 }
19331953
1954+ //qDebug() << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
1955+
19341956 bool wantExtraDebugging = getLogger()->extraDebugging();
19351957
19361958 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
1937− _voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes));
1938− _voxelQuery.setWantColor(!Menu::getInstance()->isOptionChecked(MenuOption::DisableColorVoxels));
1939− _voxelQuery.setWantDelta(!Menu::getInstance()->isOptionChecked(MenuOption::DisableDeltaSending));
1940− _voxelQuery.setWantOcclusionCulling(Menu::getInstance()->isOptionChecked(MenuOption::EnableOcclusionCulling));
1941− _voxelQuery.setWantCompression(Menu::getInstance()->isOptionChecked(MenuOption::EnableVoxelPacketCompression));
1942−
1943− _voxelQuery.setCameraPosition(_viewFrustum.getPosition());
1944− _voxelQuery.setCameraOrientation(_viewFrustum.getOrientation());
1945− _voxelQuery.setCameraFov(_viewFrustum.getFieldOfView());
1946− _voxelQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio());
1947− _voxelQuery.setCameraNearClip(_viewFrustum.getNearClip());
1948− _voxelQuery.setCameraFarClip(_viewFrustum.getFarClip());
1949− _voxelQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
1950− _voxelQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale());
1951− _voxelQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust());
1952−
1953− unsigned char voxelQueryPacket[MAX_PACKET_SIZE];
1959+ _octreeQuery.setWantLowResMoving(true);
1960+ _octreeQuery.setWantColor(true);
1961+ _octreeQuery.setWantDelta(true);
1962+ _octreeQuery.setWantOcclusionCulling(false);
1963+ _octreeQuery.setWantCompression(true);
1964+
1965+ _octreeQuery.setCameraPosition(_viewFrustum.getPosition());
1966+ _octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
1967+ _octreeQuery.setCameraFov(_viewFrustum.getFieldOfView());
1968+ _octreeQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio());
1969+ _octreeQuery.setCameraNearClip(_viewFrustum.getNearClip());
1970+ _octreeQuery.setCameraFarClip(_viewFrustum.getFarClip());
1971+ _octreeQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
1972+ _octreeQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale());
1973+ _octreeQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust());
1974+
1975+ unsigned char queryPacket[MAX_PACKET_SIZE];
19541976
19551977 // Iterate all of the nodes, and get a count of how many voxel servers we have...
19561978 int totalServers = 0;
@@ -1990,7 +2012,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 33 unmodified lines
19902012 }
19912013 }
19922014
1993− if (wantExtraDebugging && unknownJurisdictionServers > 0) {
2015+ if (wantExtraDebugging) {
19942016 qDebug("Servers: total %d, in view %d, unknown jurisdiction %d",
19952017 totalServers, inViewServers, unknownJurisdictionServers);
19962018 }
@@ -2011,7 +2033,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 14 unmodified lines
20112033 }
20122034 }
20132035
2014− if (wantExtraDebugging && unknownJurisdictionServers > 0) {
2036+ if (wantExtraDebugging) {
20152037 qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer);
20162038 }
20172039
@@ -2060,7 +2082,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 42 unmodified lines
20602082 }
20612083
20622084 if (inView) {
2063− _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS);
2085+ _octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
20642086 } else if (unknownView) {
20652087 if (wantExtraDebugging) {
20662088 qDebug() << "no known jurisdiction for node " << *node << ", give it budget of "
@@ -2071,11 +2093,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 4 unmodified lines
20712093 // If there's only one server, then don't do this, and just let the normal voxel query pass through
20722094 // as expected... this way, we will actually get a valid scene if there is one to be seen
20732095 if (totalServers > 1) {
2074− _voxelQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
2096+ _octreeQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
20752097 const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0);
2076− _voxelQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
2077− _voxelQuery.setCameraNearClip(0.1f);
2078− _voxelQuery.setCameraFarClip(0.1f);
2098+ _octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
2099+ _octreeQuery.setCameraNearClip(0.1f);
2100+ _octreeQuery.setCameraFarClip(0.1f);
20792101 if (wantExtraDebugging) {
20802102 qDebug() << "Using 'minimal' camera position for node" << *node;
20812103 }
@@ -2084,23 +2106,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 2 unmodified lines
20842106 qDebug() << "Using regular camera position for node" << *node;
20852107 }
20862108 }
2087− _voxelQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
2109+ _octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
20882110 } else {
2089− _voxelQuery.setMaxOctreePacketsPerSecond(0);
2111+ _octreeQuery.setMaxOctreePacketsPerSecond(0);
20902112 }
20912113 // set up the packet for sending...
2092− unsigned char* endOfVoxelQueryPacket = voxelQueryPacket;
2114+ unsigned char* endOfQueryPacket = queryPacket;
20932115
20942116 // insert packet type/version and node UUID
2095− endOfVoxelQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfVoxelQueryPacket), packetType);
2117+ endOfQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfQueryPacket), packetType);
20962118
20972119 // encode the query data...
2098− endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket);
2120+ endOfQueryPacket += _octreeQuery.getBroadcastData(endOfQueryPacket);
20992121
2100− int packetLength = endOfVoxelQueryPacket - voxelQueryPacket;
2122+ int packetLength = endOfQueryPacket - queryPacket;
21012123
21022124 // make sure we still have an active socket
2103− nodeList->writeDatagram(reinterpret_cast<const char*>(voxelQueryPacket), packetLength, node);
2125+ nodeList->writeDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
21042126
21052127 // Feed number of bytes to corresponding channel of the bandwidth meter
21062128 _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
@@ -2342,14 +2364,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 235 unmodified lines
23422364 if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
23432365 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
23442366 "Application::displaySide() ... voxels...");
2345− if (!Menu::getInstance()->isOptionChecked(MenuOption::DontRenderVoxels)) {
2346− _voxels.render();
2347−
2348− // double check that our LOD doesn't need to be auto-adjusted
2349− // only adjust if our option is set
2350− if (Menu::getInstance()->isOptionChecked(MenuOption::AutoAdjustLOD)) {
2351− Menu::getInstance()->autoAdjustLOD(_fps);
2352− }
2367+
2368+ _voxels.render();
2369+
2370+ // double check that our LOD doesn't need to be auto-adjusted
2371+ // adjust it unless we were asked to disable this feature
2372+ if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD)) {
2373+ Menu::getInstance()->autoAdjustLOD(_fps);
23532374 }
23542375 }
23552376
@@ -3407,7 +3428,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 1051 unmodified lines
34073428 }
34083429
34093430 // If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
3410− _voxelServerJurisdictions.erase(nodeUUID);
3431+ _voxelServerJurisdictions.erase(_voxelServerJurisdictions.find(nodeUUID));
34113432 }
34123433
34133434 // also clean up scene stats for that server
@@ -3438,7 +3459,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines
34383459 }
34393460
34403461 // If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
3441− _particleServerJurisdictions.erase(nodeUUID);
3462+ _particleServerJurisdictions.erase(_particleServerJurisdictions.find(nodeUUID));
34423463 }
34433464
34443465 // also clean up scene stats for that server

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