From 141e23195873d0f7be08e7ed91050a2e43410211 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 30 Dec 2014 18:41:56 -0800 Subject: [PATCH] more work on voxelEctomy --- assignment-client/src/Agent.cpp | 1 - .../octree/OctreeInboundPacketProcessor.cpp | 6 +- .../src/octree/OctreeInboundPacketProcessor.h | 6 +- .../src/octree/OctreeSendThread.cpp | 6 +- .../src/octree/OctreeSendThread.h | 4 +- assignment-client/src/octree/OctreeServer.cpp | 6 +- assignment-client/src/octree/OctreeServer.h | 2 +- .../src/octree/OctreeServerConsts.h | 2 +- interface/src/Application.cpp | 10 +-- interface/src/Menu.cpp | 68 ++++++++----------- interface/src/Menu.h | 22 ++---- interface/src/avatar/Avatar.cpp | 3 - interface/src/avatar/MyAvatar.cpp | 6 +- interface/src/ui/LodToolsDialog.cpp | 6 +- interface/src/ui/PreferencesDialog.cpp | 6 +- interface/src/ui/overlays/Overlays.cpp | 4 +- libraries/entities/src/EntityTreeElement.cpp | 4 +- libraries/octree/src/OctreeElement.cpp | 2 +- libraries/octree/src/OctreeElement.h | 6 +- 19 files changed, 71 insertions(+), 99 deletions(-) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 36166b7ac4..adde541504 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -25,7 +25,6 @@ #include #include #include -//#include #include // TODO: consider moving to scriptengine.h diff --git a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp index e880615b71..a2ea44152b 100644 --- a/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp +++ b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp @@ -148,7 +148,7 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin qDebug() << " --- inside while loop ---"; qDebug() << " maxSize=" << maxSize; qDebug("OctreeInboundPacketProcessor::processPacket() %c " - "packetData=%p packetLength=%d voxelData=%p atByte=%d maxSize=%d", + "packetData=%p packetLength=%d editData=%p atByte=%d maxSize=%d", packetType, packetData, packet.size(), editData, atByte, maxSize); } @@ -174,7 +174,7 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin processTime += thisProcessTime; lockWaitTime += thisLockWaitTime; - // skip to next voxel edit record in the packet + // skip to next edit record in the packet editData += editDataBytesRead; atByte += editDataBytesRead; @@ -188,7 +188,7 @@ void OctreeInboundPacketProcessor::processPacket(const SharedNodePointer& sendin if (debugProcessPacket) { qDebug("OctreeInboundPacketProcessor::processPacket() DONE LOOPING FOR %c " - "packetData=%p packetLength=%d voxelData=%p atByte=%d", + "packetData=%p packetLength=%d editData=%p atByte=%d", packetType, packetData, packet.size(), editData, atByte); } diff --git a/assignment-client/src/octree/OctreeInboundPacketProcessor.h b/assignment-client/src/octree/OctreeInboundPacketProcessor.h index 2fb83123c4..8f07f9d566 100644 --- a/assignment-client/src/octree/OctreeInboundPacketProcessor.h +++ b/assignment-client/src/octree/OctreeInboundPacketProcessor.h @@ -5,7 +5,7 @@ // Created by Brad Hefta-Gaub on 8/21/13. // Copyright 2013 High Fidelity, Inc. // -// Threaded or non-threaded network packet processor for the voxel-server +// Threaded or non-threaded network packet processor for octree servers // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -53,7 +53,7 @@ typedef QHash::iterator NodeToSenderStatsMapIterator; typedef QHash::const_iterator NodeToSenderStatsMapConstIterator; -/// Handles processing of incoming network packets for the voxel-server. As with other ReceivedPacketProcessor classes +/// Handles processing of incoming network packets for the octee servers. As with other ReceivedPacketProcessor classes /// the user is responsible for reading inbound packets and adding them to the processing queue by calling queueReceivedPacket() class OctreeInboundPacketProcessor : public ReceivedPacketProcessor { Q_OBJECT @@ -89,7 +89,7 @@ private: private: void trackInboundPacket(const QUuid& nodeUUID, unsigned short int sequence, quint64 transitTime, - int voxelsInPacket, quint64 processTime, quint64 lockWaitTime); + int elementsInPacket, quint64 processTime, quint64 lockWaitTime); OctreeServer* _myServer; int _receivedPacketCount; diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index 46ea49e9a7..1a6e54b9f5 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -147,10 +147,10 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes int statsMessageLength = nodeData->stats.getStatsMessageLength(); int piggyBackSize = nodeData->getPacketLength() + statsMessageLength; - // If the size of the stats message and the voxel message will fit in a packet, then piggyback them + // If the size of the stats message and the octree message will fit in a packet, then piggyback them if (piggyBackSize < MAX_PACKET_SIZE) { - // copy voxel message to back of stats message + // copy octree message to back of stats message memcpy(statsMessage + statsMessageLength, nodeData->getPacket(), nodeData->getPacketLength()); statsMessageLength += nodeData->getPacketLength(); @@ -240,7 +240,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes } else { // If there's actually a packet waiting, then send it. if (nodeData->isPacketWaiting() && !nodeData->isShuttingDown()) { - // just send the voxel packet + // just send the octree packet OctreeServer::didCallWriteDatagram(this); NodeList::getInstance()->writeDatagram((char*)nodeData->getPacket(), nodeData->getPacketLength(), _node); packetSent = true; diff --git a/assignment-client/src/octree/OctreeSendThread.h b/assignment-client/src/octree/OctreeSendThread.h index d8eed27802..d0507fc83d 100644 --- a/assignment-client/src/octree/OctreeSendThread.h +++ b/assignment-client/src/octree/OctreeSendThread.h @@ -5,7 +5,7 @@ // Created by Brad Hefta-Gaub on 8/21/13. // Copyright 2013 High Fidelity, Inc. // -// Threaded or non-threaded object for sending voxels to a client +// Threaded or non-threaded object for sending octree data packets to a client // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -22,7 +22,7 @@ class OctreeServer; -/// Threaded processor for sending voxel packets to a single client +/// Threaded processor for sending octree packets to a single client class OctreeSendThread : public GenericThread { Q_OBJECT public: diff --git a/assignment-client/src/octree/OctreeServer.cpp b/assignment-client/src/octree/OctreeServer.cpp index 4be2c9873f..cb206f626e 100644 --- a/assignment-client/src/octree/OctreeServer.cpp +++ b/assignment-client/src/octree/OctreeServer.cpp @@ -358,7 +358,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url statsString += "Uptime: " + getUptime(); statsString += "\r\n\r\n"; - // display voxel file load time + // display octree file load time if (isInitialLoadComplete()) { if (isPersistEnabled()) { statsString += QString("%1 File Persist Enabled...\r\n").arg(getMyServerName()); @@ -373,7 +373,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url statsString += "\r\n"; } else { - statsString += "Voxels not yet loaded...\r\n"; + statsString += "Octree file not yet loaded...\r\n"; } statsString += "\r\n\r\n"; @@ -712,7 +712,7 @@ bool OctreeServer::handleHTTPRequest(HTTPConnection* connection, const QUrl& url } statsString += QString().sprintf("Element Node Memory Usage: %8.2f %s\r\n", - OctreeElement::getVoxelMemoryUsage() / memoryScale, memoryScaleLabel); + OctreeElement::getOctreeMemoryUsage() / memoryScale, memoryScaleLabel); statsString += QString().sprintf("Octcode Memory Usage: %8.2f %s\r\n", OctreeElement::getOctcodeMemoryUsage() / memoryScale, memoryScaleLabel); statsString += QString().sprintf("External Children Memory Usage: %8.2f %s\r\n", diff --git a/assignment-client/src/octree/OctreeServer.h b/assignment-client/src/octree/OctreeServer.h index 4999594a98..a467a8a650 100644 --- a/assignment-client/src/octree/OctreeServer.h +++ b/assignment-client/src/octree/OctreeServer.h @@ -121,7 +121,7 @@ public: void forceNodeShutdown(SharedNodePointer node); public slots: - /// runs the voxel server assignment + /// runs the octree server assignment void run(); void nodeAdded(SharedNodePointer node); void nodeKilled(SharedNodePointer node); diff --git a/assignment-client/src/octree/OctreeServerConsts.h b/assignment-client/src/octree/OctreeServerConsts.h index a10c81494c..02f59f3802 100644 --- a/assignment-client/src/octree/OctreeServerConsts.h +++ b/assignment-client/src/octree/OctreeServerConsts.h @@ -19,6 +19,6 @@ const int MAX_FILENAME_LENGTH = 1024; const int INTERVALS_PER_SECOND = 60; const int OCTREE_SEND_INTERVAL_USECS = (1000 * 1000)/INTERVALS_PER_SECOND; -const int SENDING_TIME_TO_SPARE = 5 * 1000; // usec of sending interval to spare for calculating voxels +const int SENDING_TIME_TO_SPARE = 5 * 1000; // usec of sending interval to spare for sending octree elements #endif // hifi_OctreeServerConsts_h diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 40b6c4003a..89fcbeceb7 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2268,7 +2268,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node _octreeQuery.setCameraNearClip(_viewFrustum.getNearClip()); _octreeQuery.setCameraFarClip(_viewFrustum.getFarClip()); _octreeQuery.setCameraEyeOffsetPosition(_viewFrustum.getEyeOffsetPosition()); - _octreeQuery.setOctreeSizeScale(Menu::getInstance()->getVoxelSizeScale()); + _octreeQuery.setOctreeSizeScale(Menu::getInstance()->getOctreeSizeScale()); _octreeQuery.setBoundaryLevelAdjust(Menu::getInstance()->getBoundaryLevelAdjust()); unsigned char queryPacket[MAX_PACKET_SIZE]; @@ -2321,7 +2321,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node int perServerPPS = 0; const int SMALL_BUDGET = 10; int perUnknownServer = SMALL_BUDGET; - int totalPPS = Menu::getInstance()->getMaxVoxelPacketsPerSecond(); + int totalPPS = Menu::getInstance()->getMaxOctreePacketsPerSecond(); // determine PPS based on number of servers if (inViewServers >= 1) { @@ -2669,7 +2669,7 @@ bool Application::shouldRenderMesh(float largestDimension, float distanceToCamer } float Application::getSizeScale() const { - return Menu::getInstance()->getVoxelSizeScale(); + return Menu::getInstance()->getOctreeSizeScale(); } int Application::getBoundaryLevelAdjust() const { @@ -3457,7 +3457,7 @@ void Application::nodeKilled(SharedNodePointer node) { rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); // Add the jurisditionDetails object to the list of "fade outs" - if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { + if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnOctreeServerChanges)) { VoxelFade fade(VoxelFade::FADE_OUT, NODE_KILLED_RED, NODE_KILLED_GREEN, NODE_KILLED_BLUE); fade.voxelDetails = rootDetails; const float slightly_smaller = 0.99f; @@ -3543,7 +3543,7 @@ int Application::parseOctreeStats(const QByteArray& packet, const SharedNodePoin qPrintable(serverType), rootDetails.x, rootDetails.y, rootDetails.z, rootDetails.s); // Add the jurisditionDetails object to the list of "fade outs" - if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnVoxelServerChanges)) { + if (!Menu::getInstance()->isOptionChecked(MenuOption::DontFadeOnOctreeServerChanges)) { VoxelFade fade(VoxelFade::FADE_OUT, NODE_ADDED_RED, NODE_ADDED_GREEN, NODE_ADDED_BLUE); fade.voxelDetails = rootDetails; const float slightly_smaller = 0.99f; diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index f7e8df90e4..fa447a2d30 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -108,8 +108,7 @@ Menu::Menu() : #if defined(Q_OS_MAC) || defined(Q_OS_WIN) _speechRecognizer(), #endif - _maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM), - _voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE), + _octreeSizeScale(DEFAULT_OCTREE_SIZE_SCALE), _oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE), _sixenseReticleMoveSpeed(DEFAULT_SIXENSE_RETICLE_MOVE_SPEED), _invertSixenseButtons(DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS), @@ -118,7 +117,7 @@ Menu::Menu() : _avatarLODIncreaseFPS(ADJUST_LOD_UP_FPS), _avatarLODDistanceMultiplier(DEFAULT_AVATAR_LOD_DISTANCE_MULTIPLIER), _boundaryLevelAdjust(0), - _maxVoxelPacketsPerSecond(DEFAULT_MAX_VOXEL_PPS), + _maxOctreePacketsPerSecond(DEFAULT_MAX_VOXEL_PPS), _lastAdjust(usecTimestampNow()), _lastAvatarDetailDrop(usecTimestampNow()), _fpsAverage(FIVE_SECONDS_OF_FRAMES), @@ -315,8 +314,6 @@ Menu::Menu() : avatar, SLOT(onToggleRagdoll())); addCheckableActionToQMenuAndActionHash(collisionsMenu, MenuOption::CollideWithAvatars, 0, true, avatar, SLOT(updateCollisionGroups())); - addCheckableActionToQMenuAndActionHash(collisionsMenu, MenuOption::CollideWithVoxels, - 0, false, avatar, SLOT(updateCollisionGroups())); addCheckableActionToQMenuAndActionHash(collisionsMenu, MenuOption::CollideWithEnvironment, 0, false, avatar, SLOT(updateCollisionGroups())); @@ -390,6 +387,9 @@ Menu::Menu() : addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Avatars, 0, true); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Metavoxels, 0, true); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Entities, 0, true); + addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::AmbientOcclusion); + addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DontFadeOnOctreeServerChanges); + addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::DisableAutoAdjustLOD); QMenu* shadowMenu = renderOptionsMenu->addMenu("Shadows"); QActionGroup* shadowGroup = new QActionGroup(shadowMenu); @@ -424,12 +424,6 @@ Menu::Menu() : resolutionGroup->addAction(addCheckableActionToQMenuAndActionHash(resolutionMenu, MenuOption::RenderResolutionQuarter, 0, false)); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::Stars, Qt::Key_Asterisk, true); - addCheckableActionToQMenuAndActionHash(renderOptionsMenu, - MenuOption::Voxels, - Qt::SHIFT | Qt::Key_V, - true, - appInstance, - SLOT(setRenderVoxels(bool))); addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableGlowEffect, 0, true, DependencyManager::get().data(), SLOT(toggleGlowEffect(bool))); @@ -456,12 +450,6 @@ Menu::Menu() : addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderLookAtVectors, 0, false); addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::RenderFocusIndicator, 0, false); - QMenu* voxelOptionsMenu = developerMenu->addMenu("Voxels"); - addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::VoxelTextures); - addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::AmbientOcclusion); - addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DontFadeOnVoxelServerChanges); - addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DisableAutoAdjustLOD); - QMenu* metavoxelOptionsMenu = developerMenu->addMenu("Metavoxels"); addCheckableActionToQMenuAndActionHash(metavoxelOptionsMenu, MenuOption::DisplayHermiteData, 0, false, Application::getInstance()->getMetavoxels(), SLOT(refreshVoxelData())); @@ -671,9 +659,8 @@ void Menu::loadSettings(QSettings* settings) { _realWorldFieldOfView = loadSetting(settings, "realWorldFieldOfView", DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES); _faceshiftEyeDeflection = loadSetting(settings, "faceshiftEyeDeflection", DEFAULT_FACESHIFT_EYE_DEFLECTION); _faceshiftHostname = settings->value("faceshiftHostname", DEFAULT_FACESHIFT_HOSTNAME).toString(); - _maxVoxels = loadSetting(settings, "maxVoxels", DEFAULT_MAX_VOXELS_PER_SYSTEM); - _maxVoxelPacketsPerSecond = loadSetting(settings, "maxVoxelsPPS", DEFAULT_MAX_VOXEL_PPS); - _voxelSizeScale = loadSetting(settings, "voxelSizeScale", DEFAULT_OCTREE_SIZE_SCALE); + _maxOctreePacketsPerSecond = loadSetting(settings, "maxOctreePPS", DEFAULT_MAX_OCTREE_PPS); + _octreeSizeScale = loadSetting(settings, "octreeSizeScale", DEFAULT_OCTREE_SIZE_SCALE); _automaticAvatarLOD = settings->value("automaticAvatarLOD", true).toBool(); _avatarLODDecreaseFPS = loadSetting(settings, "avatarLODDecreaseFPS", DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS); _avatarLODIncreaseFPS = loadSetting(settings, "avatarLODIncreaseFPS", ADJUST_LOD_UP_FPS); @@ -738,9 +725,8 @@ void Menu::saveSettings(QSettings* settings) { settings->setValue("fieldOfView", _fieldOfView); settings->setValue("faceshiftEyeDeflection", _faceshiftEyeDeflection); settings->setValue("faceshiftHostname", _faceshiftHostname); - settings->setValue("maxVoxels", _maxVoxels); - settings->setValue("maxVoxelsPPS", _maxVoxelPacketsPerSecond); - settings->setValue("voxelSizeScale", _voxelSizeScale); + settings->setValue("maxOctreePPS", _maxOctreePacketsPerSecond); + settings->setValue("octreeSizeScale", _octreeSizeScale); settings->setValue("automaticAvatarLOD", _automaticAvatarLOD); settings->setValue("avatarLODDecreaseFPS", _avatarLODDecreaseFPS); settings->setValue("avatarLODIncreaseFPS", _avatarLODIncreaseFPS); @@ -1423,8 +1409,8 @@ QString Menu::getLODFeedbackText() { } // distance feedback - float voxelSizeScale = getVoxelSizeScale(); - float relativeToDefault = voxelSizeScale / DEFAULT_OCTREE_SIZE_SCALE; + float octreeSizeScale = getOctreeSizeScale(); + float relativeToDefault = octreeSizeScale / DEFAULT_OCTREE_SIZE_SCALE; QString result; if (relativeToDefault > 1.01) { result = QString("%1 further %2").arg(relativeToDefault,8,'f',2).arg(granularityFeedback); @@ -1475,29 +1461,29 @@ void Menu::autoAdjustLOD(float currentFPS) { quint64 elapsed = now - _lastAdjust; if (elapsed > ADJUST_LOD_DOWN_DELAY && _fpsAverage.getAverage() < ADJUST_LOD_DOWN_FPS - && _voxelSizeScale > ADJUST_LOD_MIN_SIZE_SCALE) { + && _octreeSizeScale > ADJUST_LOD_MIN_SIZE_SCALE) { - _voxelSizeScale *= ADJUST_LOD_DOWN_BY; + _octreeSizeScale *= ADJUST_LOD_DOWN_BY; - if (_voxelSizeScale < ADJUST_LOD_MIN_SIZE_SCALE) { - _voxelSizeScale = ADJUST_LOD_MIN_SIZE_SCALE; + if (_octreeSizeScale < ADJUST_LOD_MIN_SIZE_SCALE) { + _octreeSizeScale = ADJUST_LOD_MIN_SIZE_SCALE; } changed = true; _lastAdjust = now; qDebug() << "adjusting LOD down... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage() - << "_voxelSizeScale=" << _voxelSizeScale; + << "_octreeSizeScale=" << _octreeSizeScale; } if (elapsed > ADJUST_LOD_UP_DELAY && _fpsAverage.getAverage() > ADJUST_LOD_UP_FPS - && _voxelSizeScale < ADJUST_LOD_MAX_SIZE_SCALE) { - _voxelSizeScale *= ADJUST_LOD_UP_BY; - if (_voxelSizeScale > ADJUST_LOD_MAX_SIZE_SCALE) { - _voxelSizeScale = ADJUST_LOD_MAX_SIZE_SCALE; + && _octreeSizeScale < ADJUST_LOD_MAX_SIZE_SCALE) { + _octreeSizeScale *= ADJUST_LOD_UP_BY; + if (_octreeSizeScale > ADJUST_LOD_MAX_SIZE_SCALE) { + _octreeSizeScale = ADJUST_LOD_MAX_SIZE_SCALE; } changed = true; _lastAdjust = now; qDebug() << "adjusting LOD up... average fps for last approximately 5 seconds=" << _fpsAverage.getAverage() - << "_voxelSizeScale=" << _voxelSizeScale; + << "_octreeSizeScale=" << _octreeSizeScale; } if (changed) { @@ -1514,8 +1500,8 @@ void Menu::resetLODAdjust() { _lastAvatarDetailDrop = _lastAdjust = usecTimestampNow(); } -void Menu::setVoxelSizeScale(float sizeScale) { - _voxelSizeScale = sizeScale; +void Menu::setOctreeSizeScale(float sizeScale) { + _octreeSizeScale = sizeScale; _shouldRenderTableNeedsRebuilding = true; bumpSettings(); } @@ -1526,14 +1512,14 @@ void Menu::setBoundaryLevelAdjust(int boundaryLevelAdjust) { bumpSettings(); } -// TODO: This is essentially the same logic used to render voxels, but since models are more detailed then voxels +// TODO: This is essentially the same logic used to render octree cells, but since models are more detailed then octree cells // I've added a voxelToModelRatio that adjusts how much closer to a model you have to be to see it. bool Menu::shouldRenderMesh(float largestDimension, float distanceToCamera) { - const float voxelToMeshRatio = 4.0f; // must be this many times closer to a mesh than a voxel to see it. - float voxelSizeScale = getVoxelSizeScale(); + const float octreeToMeshRatio = 4.0f; // must be this many times closer to a mesh than a voxel to see it. + float octreeSizeScale = getOctreeSizeScale(); int boundaryLevelAdjust = getBoundaryLevelAdjust(); float maxScale = (float)TREE_SCALE; - float visibleDistanceAtMaxScale = boundaryDistanceForRenderLevel(boundaryLevelAdjust, voxelSizeScale) / voxelToMeshRatio; + float visibleDistanceAtMaxScale = boundaryDistanceForRenderLevel(boundaryLevelAdjust, octreeSizeScale) / octreeToMeshRatio; if (_shouldRenderTableNeedsRebuilding) { _shouldRenderTable.clear(); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 3fa3d7372d..3655735c14 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -122,7 +122,6 @@ public: OctreeStatsDialog* getOctreeStatsDialog() const { return _octreeStatsDialog; } LodToolsDialog* getLodToolsDialog() const { return _lodToolsDialog; } HMDToolsDialog* getHMDToolsDialog() const { return _hmdToolsDialog; } - int getMaxVoxels() const { return _maxVoxels; } bool getShadowsEnabled() const; @@ -132,8 +131,8 @@ public: QString getLODFeedbackText(); void autoAdjustLOD(float currentFPS); void resetLODAdjust(); - void setVoxelSizeScale(float sizeScale); - float getVoxelSizeScale() const { return _voxelSizeScale; } + void setOctreeSizeScale(float sizeScale); + float getOctreeSizeScale() const { return _octreeSizeScale; } void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; bumpSettings(); } bool getAutomaticAvatarLOD() const { return _automaticAvatarLOD; } void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; bumpSettings(); } @@ -152,8 +151,8 @@ public: #endif // User Tweakable PPS from Voxel Server - int getMaxVoxelPacketsPerSecond() const { return _maxVoxelPacketsPerSecond; } - void setMaxVoxelPacketsPerSecond(int maxVoxelPacketsPerSecond) { _maxVoxelPacketsPerSecond = maxVoxelPacketsPerSecond; bumpSettings(); } + int getMaxOctreePacketsPerSecond() const { return _maxOctreePacketsPerSecond; } + void setMaxOctreePacketsPerSecond(int value) { _maxOctreePacketsPerSecond = value; bumpSettings(); } QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu, const QString& actionName, @@ -292,8 +291,7 @@ private: #if defined(Q_OS_MAC) || defined(Q_OS_WIN) SpeechRecognizer _speechRecognizer; #endif - int _maxVoxels; - float _voxelSizeScale; + float _octreeSizeScale; float _oculusUIAngularSize; float _sixenseReticleMoveSpeed; bool _invertSixenseButtons; @@ -302,7 +300,7 @@ private: float _avatarLODIncreaseFPS; float _avatarLODDistanceMultiplier; int _boundaryLevelAdjust; - int _maxVoxelPacketsPerSecond; + int _maxOctreePacketsPerSecond; QString replaceLastOccurrence(QChar search, QChar replace, QString string); quint64 _lastAdjust; quint64 _lastAvatarDetailDrop; @@ -356,14 +354,12 @@ namespace MenuOption { const QString CollideAsRagdoll = "Collide With Self (Ragdoll)"; const QString CollideWithAvatars = "Collide With Other Avatars"; const QString CollideWithEnvironment = "Collide With World Boundaries"; - const QString CollideWithVoxels = "Collide With Voxels"; const QString Collisions = "Collisions"; const QString Console = "Console..."; const QString ControlWithSpeech = "Control With Speech"; const QString DontRenderEntitiesAsScene = "Don't Render Entities as Scene"; const QString DontDoPrecisionPicking = "Don't Do Precision Picking"; const QString DecreaseAvatarSize = "Decrease Avatar Size"; - const QString DecreaseVoxelSize = "Decrease Voxel Size"; const QString DisableActivityLogger = "Disable Activity Logger"; const QString DisableAutoAdjustLOD = "Disable Automatically Adjusting LOD"; const QString DisableLightEntities = "Disable Light Entities"; @@ -377,7 +373,7 @@ namespace MenuOption { const QString DisplayModelElementChildProxies = "Display Model Element Children"; const QString DisplayModelElementProxy = "Display Model Element Bounds"; const QString DisplayTimingDetails = "Display Timing Details"; - const QString DontFadeOnVoxelServerChanges = "Don't Fade In/Out on Voxel Server Changes"; + const QString DontFadeOnOctreeServerChanges = "Don't Fade In/Out on Octree Server Changes"; const QString EchoLocalAudio = "Echo Local Audio"; const QString EchoServerAudio = "Echo Server Audio"; const QString EditEntitiesHelp = "Edit Entities Help..."; @@ -403,7 +399,6 @@ namespace MenuOption { const QString HeadMouse = "Head Mouse"; const QString HMDTools = "HMD Tools"; const QString IncreaseAvatarSize = "Increase Avatar Size"; - const QString IncreaseVoxelSize = "Increase Voxel Size"; const QString KeyboardMotorControl = "Enable Keyboard Motor Control"; const QString LeapMotionOnHMD = "Leap Motion on HMD"; const QString LoadScript = "Open and Run Script File..."; @@ -484,9 +479,6 @@ namespace MenuOption { const QString UploadSkeleton = "Upload Skeleton Model"; const QString UserInterface = "User Interface"; const QString Visage = "Visage"; - const QString VoxelMode = "Cycle Voxel Mode"; - const QString Voxels = "Voxels"; - const QString VoxelTextures = "Voxel Textures"; const QString WalletPrivateKey = "Wallet Private Key..."; const QString Wireframe = "Wireframe"; } diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 6a659abf93..0b5dd47152 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -1043,9 +1043,6 @@ void Avatar::updateCollisionGroups() { if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithAvatars)) { _collisionGroups |= COLLISION_GROUP_AVATARS; } - if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithVoxels)) { - _collisionGroups |= COLLISION_GROUP_VOXELS; - } } void Avatar::setScale(float scale) { diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index f34f5f2c67..6128488628 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -1924,8 +1924,7 @@ void MyAvatar::updateMotionBehavior() { if (menu->isOptionChecked(MenuOption::StandOnNearbyFloors)) { _motionBehaviors |= AVATAR_MOTION_STAND_ON_NEARBY_FLOORS; // standing on floors requires collision with voxels - _collisionGroups |= COLLISION_GROUP_VOXELS; - menu->setIsOptionChecked(MenuOption::CollideWithVoxels, true); + // TODO: determine what to do with this now that voxels are gone } else { _motionBehaviors &= ~AVATAR_MOTION_STAND_ON_NEARBY_FLOORS; } @@ -1978,7 +1977,8 @@ void MyAvatar::setCollisionGroups(quint32 collisionGroups) { Menu* menu = Menu::getInstance(); menu->setIsOptionChecked(MenuOption::CollideWithEnvironment, (bool)(_collisionGroups & COLLISION_GROUP_ENVIRONMENT)); menu->setIsOptionChecked(MenuOption::CollideWithAvatars, (bool)(_collisionGroups & COLLISION_GROUP_AVATARS)); - menu->setIsOptionChecked(MenuOption::CollideWithVoxels, (bool)(_collisionGroups & COLLISION_GROUP_VOXELS)); + + // TODO: what to do about this now that voxels are gone if (! (_collisionGroups & COLLISION_GROUP_VOXELS)) { // no collision with voxels --> disable standing on floors _motionBehaviors &= ~AVATAR_MOTION_STAND_ON_NEARBY_FLOORS; diff --git a/interface/src/ui/LodToolsDialog.cpp b/interface/src/ui/LodToolsDialog.cpp index 6df5121104..388d360dc2 100644 --- a/interface/src/ui/LodToolsDialog.cpp +++ b/interface/src/ui/LodToolsDialog.cpp @@ -47,7 +47,7 @@ LodToolsDialog::LodToolsDialog(QWidget* parent) : _lodSize->setTickPosition(QSlider::TicksBelow); _lodSize->setFixedWidth(SLIDER_WIDTH); _lodSize->setPageStep(PAGE_STEP_LOD_SIZE); - int sliderValue = Menu::getInstance()->getVoxelSizeScale() / TREE_SCALE; + int sliderValue = Menu::getInstance()->getOctreeSizeScale() / TREE_SCALE; _lodSize->setValue(sliderValue); form->addRow("LOD Size Scale:", _lodSize); connect(_lodSize,SIGNAL(valueChanged(int)),this,SLOT(sizeScaleValueChanged(int))); @@ -116,7 +116,7 @@ LodToolsDialog::~LodToolsDialog() { } void LodToolsDialog::reloadSliders() { - _lodSize->setValue(Menu::getInstance()->getVoxelSizeScale() / TREE_SCALE); + _lodSize->setValue(Menu::getInstance()->getOctreeSizeScale() / TREE_SCALE); _boundaryLevelAdjust->setValue(Menu::getInstance()->getBoundaryLevelAdjust()); _feedback->setText(Menu::getInstance()->getLODFeedbackText()); } @@ -156,7 +156,7 @@ void LodToolsDialog::updateAvatarLODValues() { void LodToolsDialog::sizeScaleValueChanged(int value) { float realValue = value * TREE_SCALE; - Menu::getInstance()->setVoxelSizeScale(realValue); + Menu::getInstance()->setOctreeSizeScale(realValue); _feedback->setText(Menu::getInstance()->getLODFeedbackText()); } diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index b00d697a1c..21787c56e3 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -144,9 +144,7 @@ void PreferencesDialog::loadPreferences() { ui.avatarScaleSpin->setValue(myAvatar->getScale()); - ui.maxVoxelsSpin->setValue(menuInstance->getMaxVoxels()); - - ui.maxVoxelsPPSSpin->setValue(menuInstance->getMaxVoxelPacketsPerSecond()); + ui.maxVoxelsPPSSpin->setValue(menuInstance->getMaxOctreePacketsPerSecond()); ui.oculusUIAngularSizeSpin->setValue(menuInstance->getOculusUIAngularSize()); @@ -227,7 +225,7 @@ void PreferencesDialog::savePreferences() { Menu::getInstance()->setFaceshiftHostname(ui.faceshiftHostnameEdit->text()); - Menu::getInstance()->setMaxVoxelPacketsPerSecond(ui.maxVoxelsPPSSpin->value()); + Menu::getInstance()->setMaxOctreePacketsPerSecond(ui.maxVoxelsPPSSpin->value()); Menu::getInstance()->setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value()); diff --git a/interface/src/ui/overlays/Overlays.cpp b/interface/src/ui/overlays/Overlays.cpp index 46be62649b..19f2bda526 100644 --- a/interface/src/ui/overlays/Overlays.cpp +++ b/interface/src/ui/overlays/Overlays.cpp @@ -85,7 +85,7 @@ void Overlays::render2D() { QReadLocker lock(&_lock); RenderArgs args = { NULL, Application::getInstance()->getViewFrustum(), - Menu::getInstance()->getVoxelSizeScale(), Menu::getInstance()->getBoundaryLevelAdjust(), + Menu::getInstance()->getOctreeSizeScale(), Menu::getInstance()->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE, RenderArgs::MONO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; foreach(Overlay* thisOverlay, _overlays2D) { @@ -107,7 +107,7 @@ void Overlays::render3D(bool drawFront, RenderArgs::RenderMode renderMode, Rende float myAvatarScale = 1.0f; RenderArgs args = { NULL, Application::getInstance()->getViewFrustum(), - Menu::getInstance()->getVoxelSizeScale(), Menu::getInstance()->getBoundaryLevelAdjust(), + Menu::getInstance()->getOctreeSizeScale(), Menu::getInstance()->getBoundaryLevelAdjust(), renderMode, renderSide, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 55693b6ff9..1c8b62de16 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -25,7 +25,7 @@ EntityTreeElement::EntityTreeElement(unsigned char* octalCode) : OctreeElement() }; EntityTreeElement::~EntityTreeElement() { - _voxelMemoryUsage -= sizeof(EntityTreeElement); + _octreeMemoryUsage -= sizeof(EntityTreeElement); delete _entityItems; _entityItems = NULL; } @@ -43,7 +43,7 @@ OctreeElement* EntityTreeElement::createNewElement(unsigned char* octalCode) { void EntityTreeElement::init(unsigned char* octalCode) { OctreeElement::init(octalCode); _entityItems = new QList; - _voxelMemoryUsage += sizeof(EntityTreeElement); + _octreeMemoryUsage += sizeof(EntityTreeElement); } EntityTreeElement* EntityTreeElement::addChildAtIndex(int index) { diff --git a/libraries/octree/src/OctreeElement.cpp b/libraries/octree/src/OctreeElement.cpp index c6938ff1f6..e74b6619bd 100644 --- a/libraries/octree/src/OctreeElement.cpp +++ b/libraries/octree/src/OctreeElement.cpp @@ -29,7 +29,7 @@ #include "Octree.h" #include "SharedUtil.h" -quint64 OctreeElement::_voxelMemoryUsage = 0; +quint64 OctreeElement::_octreeMemoryUsage = 0; quint64 OctreeElement::_octcodeMemoryUsage = 0; quint64 OctreeElement::_externalChildrenMemoryUsage = 0; quint64 OctreeElement::_voxelNodeCount = 0; diff --git a/libraries/octree/src/OctreeElement.h b/libraries/octree/src/OctreeElement.h index 3bd13a2f3c..434342372f 100644 --- a/libraries/octree/src/OctreeElement.h +++ b/libraries/octree/src/OctreeElement.h @@ -192,10 +192,10 @@ public: static unsigned long getInternalNodeCount() { return _voxelNodeCount - _voxelNodeLeafCount; } static unsigned long getLeafNodeCount() { return _voxelNodeLeafCount; } - static quint64 getVoxelMemoryUsage() { return _voxelMemoryUsage; } + static quint64 getOctreeMemoryUsage() { return _octreeMemoryUsage; } static quint64 getOctcodeMemoryUsage() { return _octcodeMemoryUsage; } static quint64 getExternalChildrenMemoryUsage() { return _externalChildrenMemoryUsage; } - static quint64 getTotalMemoryUsage() { return _voxelMemoryUsage + _octcodeMemoryUsage + _externalChildrenMemoryUsage; } + static quint64 getTotalMemoryUsage() { return _octreeMemoryUsage + _octcodeMemoryUsage + _externalChildrenMemoryUsage; } static quint64 getGetChildAtIndexTime() { return _getChildAtIndexTime; } static quint64 getGetChildAtIndexCalls() { return _getChildAtIndexCalls; } @@ -334,7 +334,7 @@ protected: static quint64 _voxelNodeCount; static quint64 _voxelNodeLeafCount; - static quint64 _voxelMemoryUsage; + static quint64 _octreeMemoryUsage; static quint64 _octcodeMemoryUsage; static quint64 _externalChildrenMemoryUsage;