Showing the changes to interface/src/Application.cpp (1 of 46 files). Show all
Unified · Split
| @@ -1383,6 +1383,26 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) { · 1382 unmodified lines | ||
| 1383 | 1383 | _window->activateWindow(); |
| 1384 | 1384 | } |
| 1385 | 1385 | |
| 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 | + | |
| 1386 | 1406 | void Application::cutVoxels(const VoxelDetail& sourceVoxel) { |
| 1387 | 1407 | copyVoxels(sourceVoxel); |
| 1388 | 1408 | deleteVoxelAt(sourceVoxel); |
| @@ -1521,8 +1541,8 @@ void Application::init() { · 132 unmodified lines | ||
| 1521 | 1541 | |
| 1522 | 1542 | // Set up VoxelSystem after loading preferences so we can get the desired max voxel count |
| 1523 | 1543 | _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); | |
| 1526 | 1546 | _voxels.setDisableFastVoxelPipeline(false); |
| 1527 | 1547 | _voxels.init(); |
| 1528 | 1548 | |
| @@ -1918,7 +1938,7 @@ void Application::updateMyAvatar(float deltaTime) { · 389 unmodified lines | ||
| 1918 | 1938 | // actually need to calculate the view frustum planes to send these details |
| 1919 | 1939 | // to the server. |
| 1920 | 1940 | loadViewFrustum(_myCamera, _viewFrustum); |
| 1921 | − | |
| 1941 | + | |
| 1922 | 1942 | // Update my voxel servers with my current voxel query... |
| 1923 | 1943 | queryOctree(NodeType::VoxelServer, PacketTypeVoxelQuery, _voxelServerJurisdictions); |
| 1924 | 1944 | queryOctree(NodeType::ParticleServer, PacketTypeParticleQuery, _particleServerJurisdictions); |
| @@ -1931,26 +1951,28 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 6 unmodified lines | ||
| 1931 | 1951 | return; |
| 1932 | 1952 | } |
| 1933 | 1953 | |
| 1954 | + //qDebug() << ">>> inside... queryOctree()... _viewFrustum.getFieldOfView()=" << _viewFrustum.getFieldOfView(); | |
| 1955 | + | |
| 1934 | 1956 | bool wantExtraDebugging = getLogger()->extraDebugging(); |
| 1935 | 1957 | |
| 1936 | 1958 | // 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]; | |
| 1954 | 1976 | |
| 1955 | 1977 | // Iterate all of the nodes, and get a count of how many voxel servers we have... |
| 1956 | 1978 | int totalServers = 0; |
| @@ -1990,7 +2012,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 33 unmodified lines | ||
| 1990 | 2012 | } |
| 1991 | 2013 | } |
| 1992 | 2014 | |
| 1993 | − if (wantExtraDebugging && unknownJurisdictionServers > 0) { | |
| 2015 | + if (wantExtraDebugging) { | |
| 1994 | 2016 | qDebug("Servers: total %d, in view %d, unknown jurisdiction %d", |
| 1995 | 2017 | totalServers, inViewServers, unknownJurisdictionServers); |
| 1996 | 2018 | } |
| @@ -2011,7 +2033,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 14 unmodified lines | ||
| 2011 | 2033 | } |
| 2012 | 2034 | } |
| 2013 | 2035 | |
| 2014 | − if (wantExtraDebugging && unknownJurisdictionServers > 0) { | |
| 2036 | + if (wantExtraDebugging) { | |
| 2015 | 2037 | qDebug("perServerPPS: %d perUnknownServer: %d", perServerPPS, perUnknownServer); |
| 2016 | 2038 | } |
| 2017 | 2039 | |
| @@ -2060,7 +2082,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 42 unmodified lines | ||
| 2060 | 2082 | } |
| 2061 | 2083 | |
| 2062 | 2084 | if (inView) { |
| 2063 | − _voxelQuery.setMaxOctreePacketsPerSecond(perServerPPS); | |
| 2085 | + _octreeQuery.setMaxOctreePacketsPerSecond(perServerPPS); | |
| 2064 | 2086 | } else if (unknownView) { |
| 2065 | 2087 | if (wantExtraDebugging) { |
| 2066 | 2088 | 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 | ||
| 2071 | 2093 | // If there's only one server, then don't do this, and just let the normal voxel query pass through |
| 2072 | 2094 | // as expected... this way, we will actually get a valid scene if there is one to be seen |
| 2073 | 2095 | 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)); | |
| 2075 | 2097 | 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); | |
| 2079 | 2101 | if (wantExtraDebugging) { |
| 2080 | 2102 | qDebug() << "Using 'minimal' camera position for node" << *node; |
| 2081 | 2103 | } |
| @@ -2084,23 +2106,23 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node · 2 unmodified lines | ||
| 2084 | 2106 | qDebug() << "Using regular camera position for node" << *node; |
| 2085 | 2107 | } |
| 2086 | 2108 | } |
| 2087 | − _voxelQuery.setMaxOctreePacketsPerSecond(perUnknownServer); | |
| 2109 | + _octreeQuery.setMaxOctreePacketsPerSecond(perUnknownServer); | |
| 2088 | 2110 | } else { |
| 2089 | − _voxelQuery.setMaxOctreePacketsPerSecond(0); | |
| 2111 | + _octreeQuery.setMaxOctreePacketsPerSecond(0); | |
| 2090 | 2112 | } |
| 2091 | 2113 | // set up the packet for sending... |
| 2092 | − unsigned char* endOfVoxelQueryPacket = voxelQueryPacket; | |
| 2114 | + unsigned char* endOfQueryPacket = queryPacket; | |
| 2093 | 2115 | |
| 2094 | 2116 | // insert packet type/version and node UUID |
| 2095 | − endOfVoxelQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfVoxelQueryPacket), packetType); | |
| 2117 | + endOfQueryPacket += populatePacketHeader(reinterpret_cast<char*>(endOfQueryPacket), packetType); | |
| 2096 | 2118 | |
| 2097 | 2119 | // encode the query data... |
| 2098 | − endOfVoxelQueryPacket += _voxelQuery.getBroadcastData(endOfVoxelQueryPacket); | |
| 2120 | + endOfQueryPacket += _octreeQuery.getBroadcastData(endOfQueryPacket); | |
| 2099 | 2121 | |
| 2100 | − int packetLength = endOfVoxelQueryPacket - voxelQueryPacket; | |
| 2122 | + int packetLength = endOfQueryPacket - queryPacket; | |
| 2101 | 2123 | |
| 2102 | 2124 | // 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); | |
| 2104 | 2126 | |
| 2105 | 2127 | // Feed number of bytes to corresponding channel of the bandwidth meter |
| 2106 | 2128 | _bandwidthMeter.outputStream(BandwidthMeter::VOXELS).updateValue(packetLength); |
| @@ -2342,14 +2364,13 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { · 235 unmodified lines | ||
| 2342 | 2364 | if (Menu::getInstance()->isOptionChecked(MenuOption::Voxels)) { |
| 2343 | 2365 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| 2344 | 2366 | "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); | |
| 2353 | 2374 | } |
| 2354 | 2375 | } |
| 2355 | 2376 | |
| @@ -3407,7 +3428,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 1051 unmodified lines | ||
| 3407 | 3428 | } |
| 3408 | 3429 | |
| 3409 | 3430 | // 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)); | |
| 3411 | 3432 | } |
| 3412 | 3433 | |
| 3413 | 3434 | // also clean up scene stats for that server |
| @@ -3438,7 +3459,7 @@ void Application::nodeKilled(SharedNodePointer node) { · 24 unmodified lines | ||
| 3438 | 3459 | } |
| 3439 | 3460 | |
| 3440 | 3461 | // 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)); | |
| 3442 | 3463 | } |
| 3443 | 3464 | |
| 3444 | 3465 | // also clean up scene stats for that server |