From b940dcfdb3e1d4828f0f5629fcd794b6125a4087 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Tue, 6 Jan 2015 09:27:48 -0800 Subject: [PATCH] more voxel-ectomy cleaning up some remaining references to voxels --- .../src/octree/OctreeSendThread.cpp | 4 +- interface/src/avatar/MyAvatar.cpp | 5 - interface/src/avatar/MyAvatar.h | 2 - interface/src/avatar/VoxelShapeManager.cpp | 101 ------------------ interface/src/avatar/VoxelShapeManager.h | 54 ---------- interface/src/octree/OctreeFade.cpp | 2 +- interface/src/octree/OctreeFade.h | 2 +- .../src/octree/OctreePacketProcessor.cpp | 2 +- interface/src/octree/OctreePacketProcessor.h | 2 +- .../scripting/ClipboardScriptingInterface.cpp | 1 - interface/src/ui/OctreeStatsDialog.cpp | 2 +- interface/src/ui/PreferencesDialog.cpp | 4 +- interface/ui/preferencesDialog.ui | 69 +----------- libraries/entities/src/EntityTreeElement.cpp | 3 +- libraries/environment/src/EnvironmentData.cpp | 2 +- libraries/environment/src/EnvironmentData.h | 2 +- libraries/networking/src/PacketHeaders.h | 2 +- 17 files changed, 15 insertions(+), 244 deletions(-) delete mode 100644 interface/src/avatar/VoxelShapeManager.cpp delete mode 100644 interface/src/avatar/VoxelShapeManager.h diff --git a/assignment-client/src/octree/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp index b90e7ceb8e..ae34d54198 100644 --- a/assignment-client/src/octree/OctreeSendThread.cpp +++ b/assignment-client/src/octree/OctreeSendThread.cpp @@ -279,7 +279,7 @@ int OctreeSendThread::handlePacketSend(OctreeQueryNode* nodeData, int& trueBytes return packetsSent; } -/// Version of voxel distributor that sends the deepest LOD level at once +/// Version of octree element distributor that sends the deepest LOD level at once int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrustumChanged) { OctreeServer::didPacketDistributor(this); @@ -595,7 +595,7 @@ int OctreeSendThread::packetDistributor(OctreeQueryNode* nodeData, bool viewFrus //int elapsedCompressTimeMsecs = endCompressTimeMsecs - startCompressTimeMsecs; // if after sending packets we've emptied our bag, then we want to remember that we've sent all - // the voxels from the current view frustum + // the octree elements from the current view frustum if (nodeData->elementBag.isEmpty()) { nodeData->updateLastKnownViewFrustum(); nodeData->setViewSent(true); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 6128488628..66aab141dc 100644 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -88,7 +88,6 @@ MyAvatar::MyAvatar() : _shouldRender(true), _billboardValid(false), _physicsSimulation(), - _voxelShapeManager(), _feetTouchFloor(true), _isLookingAtLeftEye(true) { @@ -97,7 +96,6 @@ MyAvatar::MyAvatar() : _driveKeys[i] = 0.0f; } _physicsSimulation.setEntity(&_skeletonModel); - _physicsSimulation.addEntity(&_voxelShapeManager); _skeletonModel.setEnableShapes(true); _skeletonModel.buildRagdoll(); @@ -1928,9 +1926,6 @@ void MyAvatar::updateMotionBehavior() { } else { _motionBehaviors &= ~AVATAR_MOTION_STAND_ON_NEARBY_FLOORS; } - if (!(_collisionGroups | COLLISION_GROUP_VOXELS)) { - _voxelShapeManager.clearShapes(); - } if (menu->isOptionChecked(MenuOption::KeyboardMotorControl)) { _motionBehaviors |= AVATAR_MOTION_KEYBOARD_MOTOR_ENABLED; } else { diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 7bf6d057da..58ee616161 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -17,7 +17,6 @@ #include #include "Avatar.h" -#include "VoxelShapeManager.h" class ModelItemID; @@ -219,7 +218,6 @@ private: QList _animationHandles; PhysicsSimulation _physicsSimulation; - VoxelShapeManager _voxelShapeManager; bool _feetTouchFloor; bool _isLookingAtLeftEye; diff --git a/interface/src/avatar/VoxelShapeManager.cpp b/interface/src/avatar/VoxelShapeManager.cpp deleted file mode 100644 index f59077eb91..0000000000 --- a/interface/src/avatar/VoxelShapeManager.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// -// VoxelShapeManager.cpp -// interface/src/avatar -// -// Created by Andrew Meadows on 2014.09.02 -// Copyright 2012 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#include -#include -#include - -#include "VoxelShapeManager.h" - -VoxelShapeManager::VoxelShapeManager() : PhysicsEntity(), _updateExpiry(0), _lastSimulationTranslation(0.0f) { -} - -VoxelShapeManager::~VoxelShapeManager() { - clearShapes(); -} - -void VoxelShapeManager::stepForward(float deltaTime) { - PhysicsSimulation* simulation = getSimulation(); - if (simulation) { - glm::vec3 simulationOrigin = simulation->getTranslation(); - if (glm::distance2(_lastSimulationTranslation, simulationOrigin) > EPSILON) { - VoxelPool::const_iterator voxelItr = _voxels.constBegin(); - while (voxelItr != _voxels.constEnd()) { - // the shape's position is stored in the simulation-frame - const VoxelInfo& voxel = voxelItr.value(); - voxel._shape->setTranslation(voxel._cube.calcCenter() - simulationOrigin); - ++voxelItr; - } - _lastSimulationTranslation = simulationOrigin; - } - } -} - -void VoxelShapeManager::buildShapes() { - // the shapes are owned by the elements of _voxels, - // so _shapes is constructed by harvesting them from _voxels - _shapes.clear(); - VoxelPool::const_iterator voxelItr = _voxels.constBegin(); - while (voxelItr != _voxels.constEnd()) { - _shapes.push_back(voxelItr.value()._shape); - ++voxelItr; - } -} - -void VoxelShapeManager::clearShapes() { - PhysicsEntity::clearShapes(); - _voxels.clear(); -} - -void VoxelShapeManager::updateVoxels(const quint64& now, CubeList& cubes) { - const quint64 VOXEL_UPDATE_PERIOD = 100000; // usec - _updateExpiry = now + VOXEL_UPDATE_PERIOD; - PhysicsSimulation* simulation = getSimulation(); - if (!simulation) { - return; - } - - int numChanges = 0; - VoxelPool::iterator voxelItr = _voxels.begin(); - while (voxelItr != _voxels.end()) { - // look for this voxel in cubes - CubeList::iterator cubeItr = cubes.find(voxelItr.key()); - if (cubeItr == cubes.end()) { - // did not find it --> remove the voxel - simulation->removeShape(voxelItr.value()._shape); - voxelItr = _voxels.erase(voxelItr); - ++numChanges; - } else { - // found it --> remove the cube - cubes.erase(cubeItr); - voxelItr++; - } - } - - // add remaining cubes to _voxels - glm::vec3 simulationOrigin = simulation->getTranslation(); - CubeList::const_iterator cubeItr = cubes.constBegin(); - while (cubeItr != cubes.constEnd()) { - AACube cube = cubeItr.value(); - AACubeShape* shape = new AACubeShape(cube.getScale(), cube.calcCenter() - simulationOrigin); - shape->setEntity(this); - VoxelInfo voxel = {cube, shape }; - _voxels.insert(cubeItr.key(), voxel); - ++numChanges; - ++cubeItr; - } - - if (numChanges > 0) { - buildShapes(); - } -} diff --git a/interface/src/avatar/VoxelShapeManager.h b/interface/src/avatar/VoxelShapeManager.h deleted file mode 100644 index fe0024b321..0000000000 --- a/interface/src/avatar/VoxelShapeManager.h +++ /dev/null @@ -1,54 +0,0 @@ -// -// VoxelShapeManager.h -// interface/src/avatar -// -// Created by Andrew Meadows on 2014.09.02 -// Copyright 2012 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_VoxelShapeManager_h -#define hifi_VoxelShapeManager_h - -#include - -#include -#include -#include - -#include "VoxelShapeManager.h" - -class AACubeShape; - -class VoxelInfo{ -public: - AACube _cube; - AACubeShape* _shape; -}; - -typedef QHash VoxelPool; - -class VoxelShapeManager : public PhysicsEntity { -public: - VoxelShapeManager(); - ~VoxelShapeManager(); - - void stepForward(float deltaTime); - void buildShapes(); - void clearShapes(); - - bool needsUpdate(const quint64& now) const { return _updateExpiry < now; } - - /// \param cubes list of AACubes representing all of the voxels that should be in this VoxelShapeManager - void updateVoxels(const quint64& now, CubeList& cubes); - - -private: - quint64 _updateExpiry; - glm::vec3 _lastSimulationTranslation; - VoxelPool _voxels; -}; - -#endif // hifi_VoxelShapeManager_h diff --git a/interface/src/octree/OctreeFade.cpp b/interface/src/octree/OctreeFade.cpp index fa33d46491..2e2e45eb90 100644 --- a/interface/src/octree/OctreeFade.cpp +++ b/interface/src/octree/OctreeFade.cpp @@ -1,6 +1,6 @@ // // OctreeFade.cpp -// interface/src/voxels +// interface/src/octree // // Created by Brad Hefta-Gaub on 8/6/13. // Copyright 2013 High Fidelity, Inc. diff --git a/interface/src/octree/OctreeFade.h b/interface/src/octree/OctreeFade.h index bb305d8769..daae9be66f 100644 --- a/interface/src/octree/OctreeFade.h +++ b/interface/src/octree/OctreeFade.h @@ -1,6 +1,6 @@ // // OctreeFade.h -// interface/src/voxels +// interface/src/octree // // Created by Brad Hefta-Gaub on 8/6/13. // Copyright 2013 High Fidelity, Inc. diff --git a/interface/src/octree/OctreePacketProcessor.cpp b/interface/src/octree/OctreePacketProcessor.cpp index cae38834f7..da1f4a98bc 100644 --- a/interface/src/octree/OctreePacketProcessor.cpp +++ b/interface/src/octree/OctreePacketProcessor.cpp @@ -1,6 +1,6 @@ // // OctreePacketProcessor.cpp -// interface/src/voxels +// interface/src/octree // // Created by Brad Hefta-Gaub on 8/12/13. // Copyright 2013 High Fidelity, Inc. diff --git a/interface/src/octree/OctreePacketProcessor.h b/interface/src/octree/OctreePacketProcessor.h index bdf25806f3..abdf271cfb 100644 --- a/interface/src/octree/OctreePacketProcessor.h +++ b/interface/src/octree/OctreePacketProcessor.h @@ -1,6 +1,6 @@ // // OctreePacketProcessor.h -// interface/src/voxels +// interface/src/octree // // Created by Brad Hefta-Gaub on 8/12/13. // Copyright 2013 High Fidelity, Inc. diff --git a/interface/src/scripting/ClipboardScriptingInterface.cpp b/interface/src/scripting/ClipboardScriptingInterface.cpp index 30cd3ba44d..2411cc08eb 100644 --- a/interface/src/scripting/ClipboardScriptingInterface.cpp +++ b/interface/src/scripting/ClipboardScriptingInterface.cpp @@ -12,7 +12,6 @@ #include "ClipboardScriptingInterface.h" ClipboardScriptingInterface::ClipboardScriptingInterface() { - connect(this, SIGNAL(readyToImport()), Application::getInstance(), SLOT(importVoxels())); } bool ClipboardScriptingInterface::exportEntities(const QString& filename, float x, float y, float z, float s) { diff --git a/interface/src/ui/OctreeStatsDialog.cpp b/interface/src/ui/OctreeStatsDialog.cpp index 9209faeaf4..7cdd9f0828 100644 --- a/interface/src/ui/OctreeStatsDialog.cpp +++ b/interface/src/ui/OctreeStatsDialog.cpp @@ -148,7 +148,7 @@ void OctreeStatsDialog::paintEvent(QPaintEvent* event) { "Leaves: " << qPrintable(localLeavesString) << ""; label->setText(statsValue.str().c_str()); - // iterate all the current voxel stats, and list their sending modes, total their voxels, etc... + // iterate all the current octree stats, and list their sending modes, total their octree elements, etc... std::stringstream sendingMode(""); int serverCount = 0; diff --git a/interface/src/ui/PreferencesDialog.cpp b/interface/src/ui/PreferencesDialog.cpp index 21787c56e3..1eff05531a 100644 --- a/interface/src/ui/PreferencesDialog.cpp +++ b/interface/src/ui/PreferencesDialog.cpp @@ -144,7 +144,7 @@ void PreferencesDialog::loadPreferences() { ui.avatarScaleSpin->setValue(myAvatar->getScale()); - ui.maxVoxelsPPSSpin->setValue(menuInstance->getMaxOctreePacketsPerSecond()); + ui.maxOctreePPSSpin->setValue(menuInstance->getMaxOctreePacketsPerSecond()); ui.oculusUIAngularSizeSpin->setValue(menuInstance->getOculusUIAngularSize()); @@ -225,7 +225,7 @@ void PreferencesDialog::savePreferences() { Menu::getInstance()->setFaceshiftHostname(ui.faceshiftHostnameEdit->text()); - Menu::getInstance()->setMaxOctreePacketsPerSecond(ui.maxVoxelsPPSSpin->value()); + Menu::getInstance()->setMaxOctreePacketsPerSecond(ui.maxOctreePPSSpin->value()); Menu::getInstance()->setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value()); diff --git a/interface/ui/preferencesDialog.ui b/interface/ui/preferencesDialog.ui index 0108437c1f..720a3f77d5 100644 --- a/interface/ui/preferencesDialog.ui +++ b/interface/ui/preferencesDialog.ui @@ -1837,65 +1837,6 @@ 7 - - - - - Arial - - - - Maximum voxels - - - 0 - - - maxVoxelsSpin - - - - - - - - Arial - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - - Arial - - - - 5000000 - - - 50000 - - - - - @@ -1924,7 +1865,7 @@ 0 - maxVoxelsPPSSpin + maxOctreePPSSpin @@ -1947,7 +1888,7 @@ - + 100 @@ -2032,9 +1973,6 @@ 0 - - maxVoxelsSpin - @@ -2174,9 +2112,6 @@ 0 - - maxVoxelsSpin - diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index 1c8b62de16..5f072164a0 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -32,8 +32,7 @@ EntityTreeElement::~EntityTreeElement() { // This will be called primarily on addChildAt(), which means we're adding a child of our // own type to our own tree. This means we should initialize that child with any tree and type -// specific settings that our children must have. One example is out VoxelSystem, which -// we know must match ours. +// specific settings that our children must have. OctreeElement* EntityTreeElement::createNewElement(unsigned char* octalCode) { EntityTreeElement* newChild = new EntityTreeElement(octalCode); newChild->setTree(_myTree); diff --git a/libraries/environment/src/EnvironmentData.cpp b/libraries/environment/src/EnvironmentData.cpp index 17c66ce66a..913841fe31 100644 --- a/libraries/environment/src/EnvironmentData.cpp +++ b/libraries/environment/src/EnvironmentData.cpp @@ -1,6 +1,6 @@ // // EnvironmentData.cpp -// libraries/voxels/src +// libraries/environment/src // // Created by Andrzej Kapolka on 5/6/13. // Copyright 2013 High Fidelity, Inc. diff --git a/libraries/environment/src/EnvironmentData.h b/libraries/environment/src/EnvironmentData.h index 3eac4048c2..52297682fd 100644 --- a/libraries/environment/src/EnvironmentData.h +++ b/libraries/environment/src/EnvironmentData.h @@ -1,6 +1,6 @@ // // EnvironmentData.h -// libraries/voxels/src +// libraries/environment/src // // Created by Andrzej Kapolka on 5/6/13. // Copyright 2013 High Fidelity, Inc. diff --git a/libraries/networking/src/PacketHeaders.h b/libraries/networking/src/PacketHeaders.h index a0d342459c..87d93b931f 100644 --- a/libraries/networking/src/PacketHeaders.h +++ b/libraries/networking/src/PacketHeaders.h @@ -126,6 +126,6 @@ const PacketVersion VERSION_ENTITIES_HAS_FILE_BREAKS = VERSION_ENTITIES_SUPPORT_ const PacketVersion VERSION_ENTITIES_SUPPORT_DIMENSIONS = 4; const PacketVersion VERSION_ENTITIES_MODELS_HAVE_ANIMATION_SETTINGS = 5; const PacketVersion VERSION_ENTITIES_HAVE_USER_DATA = 6; -const PacketVersion VERSION_VOXELS_HAS_FILE_BREAKS = 1; +const PacketVersion VERSION_OCTREE_HAS_FILE_BREAKS = 1; #endif // hifi_PacketHeaders_h