History

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

Andrzej Kapolka committed 12 years ago

Commit 5d4ed4c2 parents 29f7954 0530a7334 files · +923 −416Browse files

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

Unified · Split

interface/src/Application.cpp+65−44
@@ -1382,6 +1382,26 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) { · 1381 unmodified lines
13821382 _window->activateWindow();
13831383 }
13841384
1385+void Application::importVoxels() {
1386+ if (!_voxelImporter) {
1387+ _voxelImporter = new VoxelImporter(_window);
1388+ _voxelImporter->loadSettings(_settings);
1389+ }
1390+
1391+ if (!_voxelImporter->exec()) {
1392+ qDebug() << "[DEBUG] Import succeeded." << endl;
1393+ } else {
1394+ qDebug() << "[DEBUG] Import failed." << endl;
1395+ if (_sharedVoxelSystem.getTree() == _voxelImporter->getVoxelTree()) {
1396+ _sharedVoxelSystem.killLocalVoxels();
1397+ _sharedVoxelSystem.changeTree(&_clipboard);
1398+ }
1399+ }
1400+
1401+ // restore the main window's active state
1402+ _window->activateWindow();
1403+}
1404+
13851405 void Application::cutVoxels(const VoxelDetail& sourceVoxel) {
13861406 copyVoxels(sourceVoxel);
13871407 deleteVoxelAt(sourceVoxel);
@@ -1520,8 +1540,8 @@ void Application::init() { · 132 unmodified lines
15201540
15211541 // Set up VoxelSystem after loading preferences so we can get the desired max voxel count
15221542 _voxels.setMaxVoxels(Menu::getInstance()->getMaxVoxels());
1523− _voxels.setUseVoxelShader(Menu::getInstance()->isOptionChecked(MenuOption::UseVoxelShader));
1524− _voxels.setVoxelsAsPoints(Menu::getInstance()->isOptionChecked(MenuOption::VoxelsAsPoints));
1543+ _voxels.setUseVoxelShader(false);
1544+ _voxels.setVoxelsAsPoints(false);
15251545 _voxels.setDisableFastVoxelPipeline(false);
15261546 _voxels.init();
15271547
@@ -1917,7 +1937,7 @@ void Application::updateMyAvatar(float deltaTime) { · 389 unmodified lines
19171937 // actually need to calculate the view frustum planes to send these details
19181938 // to the server.
19191939 loadViewFrustum(_myCamera, _viewFrustum);
1920−
1940+
19211941 // Update my voxel servers with my current voxel query...
19221942 queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions);
19231943 queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions);
@@ -1930,26 +1950,28 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 6 unmodified lines
19301950 return;
19311951 }
19321952
1953+ //qDebug() << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView();
1954+
19331955 bool wantExtraDebugging = getLogger()->extraDebugging();
19341956
19351957 // These will be the same for all servers, so we can set them up once and then reuse for each server we send to.
1936− _voxelQuery.setWantLowResMoving(!Menu::getInstance()->isOptionChecked(MenuOption::DisableLowRes));
1937− _voxelQuery.setWantColor(!Menu::getInstance()->isOptionChecked(MenuOption::DisableColorVoxels));
1938− _voxelQuery.setWantDelta(!Menu::getInstance()->isOptionChecked(MenuOption::DisableDeltaSending));
1939− _voxelQuery.setWantOcclusionCulling(Menu::getInstance()->isOptionChecked(MenuOption::EnableOcclusionCulling));
1940− _voxelQuery.setWantCompression(Menu::getInstance()->isOptionChecked(MenuOption::EnableVoxelPacketCompression));
1941−
1942− _voxelQuery.setCameraPosition(_viewFrustum.getPosition());
1943− _voxelQuery.setCameraOrientation(_viewFrustum.getOrientation());
1944− _voxelQuery.setCameraFov(_viewFrustum.getFieldOfView());
1945− _voxelQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio());
1946− _voxelQuery.setCameraNearClip(_viewFrustum.getNearClip());
1947− _voxelQuery.setCameraFarClip(_viewFrustum.getFarClip());
1948− _voxelQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
1949− _voxelQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale());
1950− _voxelQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust());
1951−
1952− unsigned char voxelQueryPacket[MAX_PACKET_SIZE];
1958+ _octreeQuery.setWantLowResMoving(true);
1959+ _octreeQuery.setWantColor(true);
1960+ _octreeQuery.setWantDelta(true);
1961+ _octreeQuery.setWantOcclusionCulling(false);
1962+ _octreeQuery.setWantCompression(true);
1963+
1964+ _octreeQuery.setCameraPosition(_viewFrustum.getPosition());
1965+ _octreeQuery.setCameraOrientation(_viewFrustum.getOrientation());
1966+ _octreeQuery.setCameraFov(_viewFrustum.getFieldOfView());
1967+ _octreeQuery.setCameraAspectRatio(_viewFrustum.getAspectRatio());
1968+ _octreeQuery.setCameraNearClip(_viewFrustum.getNearClip());
1969+ _octreeQuery.setCameraFarClip(_viewFrustum.getFarClip());
1970+ _octreeQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition());
1971+ _octreeQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale());
1972+ _octreeQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust());
1973+
1974+ unsigned char queryPacket[MAX_PACKET_SIZE];
19531975
19541976 // Iterate all of the nodes, and get a count of how many voxel servers we have...
19551977 int totalServers = 0;
@@ -1989,7 +2011,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 33 unmodified lines
19892011 }
19902012 }
19912013
1992− if (wantExtraDebugging && unknownJurisdictionServers > 0) {
2014+ if (wantExtraDebugging) {
19932015 qDebug("Servers: total %d, in view %d, unknown jurisdiction %d",
19942016 totalServers, inViewServers, unknownJurisdictionServers);
19952017 }
@@ -2010,7 +2032,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 14 unmodified lines
20102032 }
20112033 }
20122034
2013− if (wantExtraDebugging && unknownJurisdictionServers > 0) {
2035+ if (wantExtraDebugging) {
20142036 qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer);
20152037 }
20162038
@@ -2059,7 +2081,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 42 unmodified lines
20592081 }
20602082
20612083 if (inView) {
2062− _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS);
2084+ _octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS);
20632085 } else if (unknownView) {
20642086 if (wantExtraDebugging) {
20652087 qDebug() << "no known jurisdiction for node " << *node << ", give it budget of "
@@ -2070,11 +2092,11 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 4 unmodified lines
20702092 // If there's only one server, then don't do this, and just let the normal voxel query pass through
20712093 // as expected... this way, we will actually get a valid scene if there is one to be seen
20722094 if (totalServers > 1) {
2073− _voxelQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
2095+ _octreeQuery.setCameraPosition(glm::vec3(-0.1,-0.1,-0.1));
20742096 const glm::quat OFF_IN_NEGATIVE_SPACE = glm::quat(-0.5, 0, -0.5, 1.0);
2075− _voxelQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
2076− _voxelQuery.setCameraNearClip(0.1f);
2077− _voxelQuery.setCameraFarClip(0.1f);
2097+ _octreeQuery.setCameraOrientation(OFF_IN_NEGATIVE_SPACE);
2098+ _octreeQuery.setCameraNearClip(0.1f);
2099+ _octreeQuery.setCameraFarClip(0.1f);
20782100 if (wantExtraDebugging) {
20792101 qDebug() << "Using 'minimal' camera position for node" << *node;
20802102 }
@@ -2083,23 +2105,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 2 unmodified lines
20832105 qDebug() << "Using regular camera position for node" << *node;
20842106 }
20852107 }
2086− _voxelQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
2108+ _octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer);
20872109 } else {
2088− _voxelQuery.setMaxOctreePacketsPerSecond(0);
2110+ _octreeQuery.setMaxOctreePacketsPerSecond(0);
20892111 }
20902112 // set up the packet for sending...
2091− unsigned char* endOfVoxelQueryPacket = voxelQueryPacket;
2113+ unsigned char* endOfQueryPacket = queryPacket;
20922114
20932115 // insert packet type/version and node UUID
2094− endOfVoxelQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfVoxelQueryPacket), packetType);
2116+ endOfQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfQueryPacket), packetType);
20952117
20962118 // encode the query data...
2097− endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket);
2119+ endOfQueryPacket += _octreeQuery.getBroadcastData(endOfQueryPacket);
20982120
2099− int packetLength = endOfVoxelQueryPacket - voxelQueryPacket;
2121+ int packetLength = endOfQueryPacket - queryPacket;
21002122
21012123 // make sure we still have an active socket
2102− nodeList->writeDatagram(reinterpret_cast<const char*>(voxelQueryPacket), packetLength, node);
2124+ nodeList->writeDatagram(reinterpret_cast<const char*>(queryPacket), packetLength, node);
21032125
21042126 // Feed number of bytes to corresponding channel of the bandwidth meter
21052127 _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength);
@@ -2341,14 +2363,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 235 unmodified lines
23412363 if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) {
23422364 PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
23432365 "Application::displaySide() ... voxels...");
2344− if (!Menu::getInstance()->isOptionChecked(MenuOption::DontRenderVoxels)) {
2345− _voxels.render();
2346−
2347− // double check that our LOD doesn't need to be auto-adjusted
2348− // only adjust if our option is set
2349− if (Menu::getInstance()->isOptionChecked(MenuOption::AutoAdjustLOD)) {
2350− Menu::getInstance()->autoAdjustLOD(_fps);
2351− }
2366+
2367+ _voxels.render();
2368+
2369+ // double check that our LOD doesn't need to be auto-adjusted
2370+ // adjust it unless we were asked to disable this feature
2371+ if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableAutoAdjustLOD)) {
2372+ Menu::getInstance()->autoAdjustLOD(_fps);
23522373 }
23532374 }
23542375
@@ -3406,7 +3427,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 1051 unmodified lines
34063427 }
34073428
34083429 // If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
3409− _voxelServerJurisdictions.erase(nodeUUID);
3430+ _voxelServerJurisdictions.erase(_voxelServerJurisdictions.find(nodeUUID));
34103431 }
34113432
34123433 // also clean up scene stats for that server
@@ -3437,7 +3458,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines
34373458 }
34383459
34393460 // If the voxel server is going away, remove it from our jurisdiction map so we don't send voxels to a dead server
3440− _particleServerJurisdictions.erase(nodeUUID);
3461+ _particleServerJurisdictions.erase(_particleServerJurisdictions.find(nodeUUID));
34413462 }
34423463
34433464 // 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