From 3e08a0b48b44026424846c88e1b1692b84049b41 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Feb 2014 13:26:46 -0800 Subject: [PATCH 01/10] fix spacebar capture --- examples/spaceInvadersExample.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/spaceInvadersExample.js b/examples/spaceInvadersExample.js index 79e6837f21..c817afcdd4 100644 --- a/examples/spaceInvadersExample.js +++ b/examples/spaceInvadersExample.js @@ -275,6 +275,9 @@ function cleanupGame() { if (missileFired) { Particles.deleteParticle(myMissile); } + + Controller.releaseKeyEvents({text: " "}); + Script.stop(); } Script.scriptEnding.connect(cleanupGame); From a05e07460f919e6b7489474aa7662bff4d27df13 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 5 Feb 2014 13:54:17 -0800 Subject: [PATCH 02/10] fix windows build errors and warnings --- interface/src/Audio.cpp | 3 ++- libraries/metavoxels/src/DatagramSequencer.cpp | 2 +- libraries/shared/src/NodeList.cpp | 2 +- libraries/shared/src/PacketHeaders.cpp | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 6b6de5a51d..d7aae8e6f3 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -481,7 +481,7 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) { // copy the samples we'll resample from the ring buffer - this also // pushes the read pointer of the ring buffer forwards - int16_t ringBufferSamples[numNetworkOutputSamples]; + int16_t* ringBufferSamples= new int16_t[numNetworkOutputSamples]; _ringBuffer.readSamples(ringBufferSamples, numNetworkOutputSamples); // add the next numNetworkOutputSamples from each QByteArray @@ -502,6 +502,7 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) { Q_ARG(QByteArray, QByteArray((char*) ringBufferSamples, numNetworkOutputSamples)), Q_ARG(bool, true), Q_ARG(bool, false)); } + delete[] ringBufferSamples; } } diff --git a/libraries/metavoxels/src/DatagramSequencer.cpp b/libraries/metavoxels/src/DatagramSequencer.cpp index 83ef641b39..8daec16511 100644 --- a/libraries/metavoxels/src/DatagramSequencer.cpp +++ b/libraries/metavoxels/src/DatagramSequencer.cpp @@ -138,7 +138,7 @@ void DatagramSequencer::receivedDatagram(const QByteArray& datagram) { } // read and dispatch the high-priority messages - quint32 highPriorityMessageCount; + int highPriorityMessageCount; _incomingPacketStream >> highPriorityMessageCount; int newHighPriorityMessages = highPriorityMessageCount - _receivedHighPriorityMessages; for (int i = 0; i < highPriorityMessageCount; i++) { diff --git a/libraries/shared/src/NodeList.cpp b/libraries/shared/src/NodeList.cpp index cd9356ab15..d6b8005263 100644 --- a/libraries/shared/src/NodeList.cpp +++ b/libraries/shared/src/NodeList.cpp @@ -337,7 +337,7 @@ void NodeList::processSTUNResponse(const QByteArray& packet) { const uint32_t RFC_5389_MAGIC_COOKIE_NETWORK_ORDER = htonl(RFC_5389_MAGIC_COOKIE); - size_t attributeStartIndex = NUM_BYTES_STUN_HEADER; + int attributeStartIndex = NUM_BYTES_STUN_HEADER; if (memcmp(packet.data() + NUM_BYTES_MESSAGE_TYPE_AND_LENGTH, &RFC_5389_MAGIC_COOKIE_NETWORK_ORDER, diff --git a/libraries/shared/src/PacketHeaders.cpp b/libraries/shared/src/PacketHeaders.cpp index 67b534bc34..16e7cca1c1 100644 --- a/libraries/shared/src/PacketHeaders.cpp +++ b/libraries/shared/src/PacketHeaders.cpp @@ -37,7 +37,7 @@ int packArithmeticallyCodedValue(int value, char* destination) { return 1; } else { // pack 255 and then recursively pack on - destination[0] = 255; + ((unsigned char*)destination)[0] = 255; return 1 + packArithmeticallyCodedValue(value - 255, destination + 1); } } From b0ccedd1a6d35de490642f8f43445f6964ea82c6 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Feb 2014 13:59:17 -0800 Subject: [PATCH 03/10] fix spacing --- interface/src/Audio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index d7aae8e6f3..9fb2f6d932 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -417,7 +417,7 @@ void Audio::handleAudioInput() { Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO) .updateValue(NETWORK_BUFFER_LENGTH_BYTES_PER_CHANNEL + leadingBytes); } - delete[] inputAudioSamples; + delete[] inputAudioSamples; } } From 8cc4666f2a249478e9261ddda6bb1b390acc817d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Feb 2014 14:00:17 -0800 Subject: [PATCH 04/10] fix spacing --- interface/src/Audio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 9fb2f6d932..3689c4462e 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -502,7 +502,7 @@ void Audio::addReceivedAudioToBuffer(const QByteArray& audioByteArray) { Q_ARG(QByteArray, QByteArray((char*) ringBufferSamples, numNetworkOutputSamples)), Q_ARG(bool, true), Q_ARG(bool, false)); } - delete[] ringBufferSamples; + delete[] ringBufferSamples; } } From 5059f27067f6e2d4fa94d3190bfdfd8311ab9d1e Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Feb 2014 14:08:42 -0800 Subject: [PATCH 05/10] update README to reference build notes for Windows and Ubuntu and Qt 5.2 --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a42bbd1626..5678312f6f 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,18 @@ send your resume to hiring@highfidelity.io Building Interface & other High Fidelity Components ========= -Interface is our OS X and Linux build-able client for accessing our virtual +Interface is our Windows, OS X, and Linux build-able client for accessing our virtual world. +For detailed notes on building for Windows, please refer to the following wiki page: +https://github.com/highfidelity/hifi/wiki/Building-on-Windows + +For detailed notes on building for Ubuntu, please refer to the following wiki page: +https://github.com/highfidelity/hifi/wiki/Building-on-Ubuntu-13.04 + +Building on Mac OS X and Linux: +-------------------------------- + CMake ----- Hifi uses CMake to generate build files and project files @@ -45,9 +54,9 @@ If Cmake throws you an error related to Qt5 it likely cannot find your Qt5 cmake You can solve this by setting an environment variable, QT_CMAKE_PREFIX_PATH, to the location of the folder distributed with Qt5 that contains them. -For example, a Qt5 5.1.1 installation to /usr/local/qt5 would require that QT_CMAKE_PREFIX_PATH be set with the following command. This can either be entered directly into your shell session before you build or in your shell profile (e.g.: ~/.bash_profile, ~/.bashrc, ~/.zshrc - this depends on your shell and environment). +For example, a Qt5 5.2.0 installation to /usr/local/qt5 would require that QT_CMAKE_PREFIX_PATH be set with the following command. This can either be entered directly into your shell session before you build or in your shell profile (e.g.: ~/.bash_profile, ~/.bashrc, ~/.zshrc - this depends on your shell and environment). - export QT_CMAKE_PREFIX_PATH=/usr/local/qt/5.1.1/clang_64/lib/cmake/ + export QT_CMAKE_PREFIX_PATH=/usr/local/qt/5.2.0/clang_64/lib/cmake/ The path it needs to be set to will depend on where and how Qt5 was installed. @@ -64,7 +73,7 @@ components located in the build/target_name/Debug directories. Other dependencies & information ---- -In addition to CMake, Qt 5.1 is required to build all components. +In addition to CMake, Qt 5.2 is required to build all components. What can I build on? We have successfully built on OS X 10.8, Ubuntu and a few other modern Linux From aa3a1a9a72458c06e2ccd7a170b4c7bb350ea6b5 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 5 Feb 2014 15:35:57 -0800 Subject: [PATCH 06/10] Stop rendering our head in first person camera mode. --- interface/src/Application.cpp | 3 ++- interface/src/Camera.cpp | 13 +++++++++++++ interface/src/Camera.h | 3 +++ interface/src/avatar/Avatar.cpp | 4 +++- interface/src/avatar/AvatarManager.cpp | 3 +-- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d0d071a141..24d31b9442 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2884,7 +2884,8 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) { } } - _avatarManager.renderAvatars(whichCamera.getMode() == CAMERA_MODE_MIRROR, selfAvatarOnly); + bool renderMyHead = (whichCamera.getInterpolatedMode() != CAMERA_MODE_FIRST_PERSON); + _avatarManager.renderAvatars(renderMyHead, selfAvatarOnly); if (!selfAvatarOnly) { // Render the world box diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp index 94bc693c2b..d3a126c38a 100644 --- a/interface/src/Camera.cpp +++ b/interface/src/Camera.cpp @@ -36,6 +36,7 @@ Camera::Camera() { _modeShiftRate = 1.0f; _linearModeShift = 0.0f; _mode = CAMERA_MODE_THIRD_PERSON; + _prevMode = CAMERA_MODE_THIRD_PERSON; _tightness = 10.0f; // default _fieldOfView = DEFAULT_FIELD_OF_VIEW_DEGREES; _aspectRatio = 16.f/9.f; @@ -123,6 +124,7 @@ void Camera::setModeShiftRate ( float rate ) { void Camera::setMode(CameraMode m) { + _prevMode = _mode; _mode = m; _modeShift = 0.0; _linearModeShift = 0.0; @@ -199,6 +201,17 @@ bool Camera::getFrustumNeedsReshape() const { return _frustumNeedsReshape; } +// call this when deciding whether to render the head or not +CameraMode Camera::getInterpolatedMode() const { + const float SHIFT_THRESHOLD_INTO_FIRST_PERSON = 0.7f; + const float SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON = 0.6f; + if (_mode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_INTO_FIRST_PERSON || + _prevMode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON) { + return _prevMode; + } + return _mode; +} + // call this after reshaping the view frustum void Camera::setFrustumWasReshaped() { _frustumNeedsReshape = false; diff --git a/interface/src/Camera.h b/interface/src/Camera.h index 615135bc80..7fc9b47634 100644 --- a/interface/src/Camera.h +++ b/interface/src/Camera.h @@ -61,6 +61,8 @@ public: const glm::quat& getEyeOffsetOrientation () const { return _eyeOffsetOrientation; } float getScale () const { return _scale; } + CameraMode getInterpolatedMode() const; + bool getFrustumNeedsReshape() const; // call to find out if the view frustum needs to be reshaped void setFrustumWasReshaped(); // call this after reshaping the view frustum. @@ -68,6 +70,7 @@ private: bool _needsToInitialize; CameraMode _mode; + CameraMode _prevMode; bool _frustumNeedsReshape; glm::vec3 _position; glm::vec3 _idealPosition; diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index 4b4c189729..259bf994e0 100644 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -242,7 +242,9 @@ void Avatar::renderBody(bool forceRenderHead) { glm::vec3 pos = getPosition(); //printf("Render other at %.3f, %.2f, %.2f\n", pos.x, pos.y, pos.z); _skeletonModel.render(1.0f); - _head.render(1.0f); + if (forceRenderHead) { + _head.render(1.0f); + } _hand.render(false); } diff --git a/interface/src/avatar/AvatarManager.cpp b/interface/src/avatar/AvatarManager.cpp index d98d30cf6a..a4a85f5770 100644 --- a/interface/src/avatar/AvatarManager.cpp +++ b/interface/src/avatar/AvatarManager.cpp @@ -75,7 +75,6 @@ void AvatarManager::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { bool renderLookAtVectors = Menu::getInstance()->isOptionChecked(MenuOption::LookAtVectors); if (!selfAvatarOnly) { - // Render avatars of other nodes foreach (const AvatarSharedPointer& avatarPointer, _avatarHash) { Avatar* avatar = static_cast(avatarPointer.data()); if (!avatar->isInitialized()) { @@ -84,7 +83,7 @@ void AvatarManager::renderAvatars(bool forceRenderHead, bool selfAvatarOnly) { if (avatar == static_cast(_myAvatar.data())) { avatar->render(forceRenderHead); } else { - avatar->render(false); + avatar->render(true); } avatar->setDisplayingLookatVectors(renderLookAtVectors); } From f4fe2bb7549b414dd98d9679e13647d8f8f86b2a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 5 Feb 2014 16:04:23 -0800 Subject: [PATCH 07/10] move octree-server libs to assignment-client --- assignment-client/CMakeLists.txt | 3 -- assignment-client/src/AssignmentFactory.cpp | 6 +-- .../octree}/OctreeInboundPacketProcessor.cpp | 0 .../octree}/OctreeInboundPacketProcessor.h | 0 .../src/octree}/OctreeQueryNode.cpp | 0 .../src/octree}/OctreeQueryNode.h | 0 .../src/octree}/OctreeSendThread.cpp | 0 .../src/octree}/OctreeSendThread.h | 0 .../src/octree}/OctreeServer.cpp | 0 .../src/octree}/OctreeServer.h | 0 .../src/octree}/OctreeServerConsts.h | 0 .../src/particles}/ParticleNodeData.h | 3 +- .../src/particles}/ParticleServer.cpp | 0 .../src/particles}/ParticleServer.h | 2 +- .../src/particles}/ParticleServerConsts.h | 0 .../src/voxels}/VoxelNodeData.h | 5 ++- .../src/voxels}/VoxelServer.cpp | 0 .../src/voxels}/VoxelServer.h | 3 +- .../src/voxels}/VoxelServerConsts.h | 0 libraries/octree-server/CMakeLists.txt | 36 ------------------ libraries/particle-server/CMakeLists.txt | 37 ------------------- libraries/voxel-server/CMakeLists.txt | 37 ------------------- 22 files changed, 9 insertions(+), 123 deletions(-) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeInboundPacketProcessor.cpp (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeInboundPacketProcessor.h (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeQueryNode.cpp (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeQueryNode.h (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeSendThread.cpp (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeSendThread.h (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeServer.cpp (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeServer.h (100%) rename {libraries/octree-server/src => assignment-client/src/octree}/OctreeServerConsts.h (100%) rename {libraries/particle-server/src => assignment-client/src/particles}/ParticleNodeData.h (95%) rename {libraries/particle-server/src => assignment-client/src/particles}/ParticleServer.cpp (100%) rename {libraries/particle-server/src => assignment-client/src/particles}/ParticleServer.h (97%) rename {libraries/particle-server/src => assignment-client/src/particles}/ParticleServerConsts.h (100%) rename {libraries/voxel-server/src => assignment-client/src/voxels}/VoxelNodeData.h (79%) rename {libraries/voxel-server/src => assignment-client/src/voxels}/VoxelServer.cpp (100%) rename {libraries/voxel-server/src => assignment-client/src/voxels}/VoxelServer.h (98%) rename {libraries/voxel-server/src => assignment-client/src/voxels}/VoxelServerConsts.h (100%) delete mode 100644 libraries/octree-server/CMakeLists.txt delete mode 100644 libraries/particle-server/CMakeLists.txt delete mode 100644 libraries/voxel-server/CMakeLists.txt diff --git a/assignment-client/CMakeLists.txt b/assignment-client/CMakeLists.txt index 51a91621da..60b9d75338 100644 --- a/assignment-client/CMakeLists.txt +++ b/assignment-client/CMakeLists.txt @@ -30,9 +30,6 @@ link_hifi_library(octree ${TARGET_NAME} ${ROOT_DIR}) link_hifi_library(voxels ${TARGET_NAME} ${ROOT_DIR}) link_hifi_library(particles ${TARGET_NAME} ${ROOT_DIR}) link_hifi_library(metavoxels ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(octree-server ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(particle-server ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(voxel-server ${TARGET_NAME} ${ROOT_DIR}) link_hifi_library(script-engine ${TARGET_NAME} ${ROOT_DIR}) link_hifi_library(embedded-webserver ${TARGET_NAME} ${ROOT_DIR}) diff --git a/assignment-client/src/AssignmentFactory.cpp b/assignment-client/src/AssignmentFactory.cpp index 5bf0417f22..cde5666ab9 100644 --- a/assignment-client/src/AssignmentFactory.cpp +++ b/assignment-client/src/AssignmentFactory.cpp @@ -8,15 +8,13 @@ #include -#include - -#include - #include "Agent.h" #include "AssignmentFactory.h" #include "audio/AudioMixer.h" #include "avatars/AvatarMixer.h" #include "metavoxels/MetavoxelServer.h" +#include "particles/ParticleServer.h" +#include "voxels/VoxelServer.h" ThreadedAssignment* AssignmentFactory::unpackAssignment(const QByteArray& packet) { QDataStream packetStream(packet); diff --git a/libraries/octree-server/src/OctreeInboundPacketProcessor.cpp b/assignment-client/src/octree/OctreeInboundPacketProcessor.cpp similarity index 100% rename from libraries/octree-server/src/OctreeInboundPacketProcessor.cpp rename to assignment-client/src/octree/OctreeInboundPacketProcessor.cpp diff --git a/libraries/octree-server/src/OctreeInboundPacketProcessor.h b/assignment-client/src/octree/OctreeInboundPacketProcessor.h similarity index 100% rename from libraries/octree-server/src/OctreeInboundPacketProcessor.h rename to assignment-client/src/octree/OctreeInboundPacketProcessor.h diff --git a/libraries/octree-server/src/OctreeQueryNode.cpp b/assignment-client/src/octree/OctreeQueryNode.cpp similarity index 100% rename from libraries/octree-server/src/OctreeQueryNode.cpp rename to assignment-client/src/octree/OctreeQueryNode.cpp diff --git a/libraries/octree-server/src/OctreeQueryNode.h b/assignment-client/src/octree/OctreeQueryNode.h similarity index 100% rename from libraries/octree-server/src/OctreeQueryNode.h rename to assignment-client/src/octree/OctreeQueryNode.h diff --git a/libraries/octree-server/src/OctreeSendThread.cpp b/assignment-client/src/octree/OctreeSendThread.cpp similarity index 100% rename from libraries/octree-server/src/OctreeSendThread.cpp rename to assignment-client/src/octree/OctreeSendThread.cpp diff --git a/libraries/octree-server/src/OctreeSendThread.h b/assignment-client/src/octree/OctreeSendThread.h similarity index 100% rename from libraries/octree-server/src/OctreeSendThread.h rename to assignment-client/src/octree/OctreeSendThread.h diff --git a/libraries/octree-server/src/OctreeServer.cpp b/assignment-client/src/octree/OctreeServer.cpp similarity index 100% rename from libraries/octree-server/src/OctreeServer.cpp rename to assignment-client/src/octree/OctreeServer.cpp diff --git a/libraries/octree-server/src/OctreeServer.h b/assignment-client/src/octree/OctreeServer.h similarity index 100% rename from libraries/octree-server/src/OctreeServer.h rename to assignment-client/src/octree/OctreeServer.h diff --git a/libraries/octree-server/src/OctreeServerConsts.h b/assignment-client/src/octree/OctreeServerConsts.h similarity index 100% rename from libraries/octree-server/src/OctreeServerConsts.h rename to assignment-client/src/octree/OctreeServerConsts.h diff --git a/libraries/particle-server/src/ParticleNodeData.h b/assignment-client/src/particles/ParticleNodeData.h similarity index 95% rename from libraries/particle-server/src/ParticleNodeData.h rename to assignment-client/src/particles/ParticleNodeData.h index 4ab16cb33a..450767613e 100644 --- a/libraries/particle-server/src/ParticleNodeData.h +++ b/assignment-client/src/particles/ParticleNodeData.h @@ -10,9 +10,10 @@ #ifndef __hifi__ParticleNodeData__ #define __hifi__ParticleNodeData__ -#include #include +#include "../octree/OctreeQueryNode.h" + class ParticleNodeData : public OctreeQueryNode { public: ParticleNodeData() : diff --git a/libraries/particle-server/src/ParticleServer.cpp b/assignment-client/src/particles/ParticleServer.cpp similarity index 100% rename from libraries/particle-server/src/ParticleServer.cpp rename to assignment-client/src/particles/ParticleServer.cpp diff --git a/libraries/particle-server/src/ParticleServer.h b/assignment-client/src/particles/ParticleServer.h similarity index 97% rename from libraries/particle-server/src/ParticleServer.h rename to assignment-client/src/particles/ParticleServer.h index 1c1e3b5be9..345ebe86e3 100644 --- a/libraries/particle-server/src/ParticleServer.h +++ b/assignment-client/src/particles/ParticleServer.h @@ -10,7 +10,7 @@ #ifndef __particle_server__ParticleServer__ #define __particle_server__ParticleServer__ -#include +#include "../octree/OctreeServer.h" #include "Particle.h" #include "ParticleServerConsts.h" diff --git a/libraries/particle-server/src/ParticleServerConsts.h b/assignment-client/src/particles/ParticleServerConsts.h similarity index 100% rename from libraries/particle-server/src/ParticleServerConsts.h rename to assignment-client/src/particles/ParticleServerConsts.h diff --git a/libraries/voxel-server/src/VoxelNodeData.h b/assignment-client/src/voxels/VoxelNodeData.h similarity index 79% rename from libraries/voxel-server/src/VoxelNodeData.h rename to assignment-client/src/voxels/VoxelNodeData.h index 54ef9da5b6..c24bfad6ce 100644 --- a/libraries/voxel-server/src/VoxelNodeData.h +++ b/assignment-client/src/voxels/VoxelNodeData.h @@ -3,15 +3,16 @@ // hifi // // Created by Stephen Birarda on 3/21/13. -// +// Copyright (c) 2014 HighFidelity, Inc. All rights reserved. // #ifndef __hifi__VoxelNodeData__ #define __hifi__VoxelNodeData__ -#include #include +#include "../octree/OctreeQueryNode.h" + class VoxelNodeData : public OctreeQueryNode { public: VoxelNodeData() : OctreeQueryNode() { }; diff --git a/libraries/voxel-server/src/VoxelServer.cpp b/assignment-client/src/voxels/VoxelServer.cpp similarity index 100% rename from libraries/voxel-server/src/VoxelServer.cpp rename to assignment-client/src/voxels/VoxelServer.cpp diff --git a/libraries/voxel-server/src/VoxelServer.h b/assignment-client/src/voxels/VoxelServer.h similarity index 98% rename from libraries/voxel-server/src/VoxelServer.h rename to assignment-client/src/voxels/VoxelServer.h index 183224b2a7..526a3b2c54 100644 --- a/libraries/voxel-server/src/VoxelServer.h +++ b/assignment-client/src/voxels/VoxelServer.h @@ -17,8 +17,7 @@ #include #include -#include - +#include "../octree/OctreeServer.h" #include "VoxelServerConsts.h" diff --git a/libraries/voxel-server/src/VoxelServerConsts.h b/assignment-client/src/voxels/VoxelServerConsts.h similarity index 100% rename from libraries/voxel-server/src/VoxelServerConsts.h rename to assignment-client/src/voxels/VoxelServerConsts.h diff --git a/libraries/octree-server/CMakeLists.txt b/libraries/octree-server/CMakeLists.txt deleted file mode 100644 index 64c73a4bd4..0000000000 --- a/libraries/octree-server/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(ROOT_DIR ../..) -set(MACRO_DIR ${ROOT_DIR}/cmake/macros) - -# setup for find modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/") - -set(TARGET_NAME octree-server) - -find_package(Qt5Network REQUIRED) -find_package(Qt5Widgets REQUIRED) - -include(${MACRO_DIR}/SetupHifiLibrary.cmake) - -setup_hifi_library(${TARGET_NAME} ${OPTIONAL_SRCS}) - -qt5_use_modules(${TARGET_NAME} Network Widgets) - -include(${MACRO_DIR}/IncludeGLM.cmake) -include_glm(${TARGET_NAME} ${ROOT_DIR}) - -# link ZLIB -find_package(ZLIB) -include_directories(${ZLIB_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -# link in the shared library -include(${MACRO_DIR}/LinkHifiLibrary.cmake) -link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR}) - -# link in the hifi octree library -link_hifi_library(octree ${TARGET_NAME} ${ROOT_DIR}) - -# link the embedded webserver -link_hifi_library(embedded-webserver ${TARGET_NAME} ${ROOT_DIR}) diff --git a/libraries/particle-server/CMakeLists.txt b/libraries/particle-server/CMakeLists.txt deleted file mode 100644 index 9c63645e8d..0000000000 --- a/libraries/particle-server/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(ROOT_DIR ../..) -set(MACRO_DIR ${ROOT_DIR}/cmake/macros) - -# setup for find modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/") - -set(TARGET_NAME particle-server) - -find_package(Qt5Widgets REQUIRED) - -include(${MACRO_DIR}/SetupHifiLibrary.cmake) - -setup_hifi_library(${TARGET_NAME} ${OPTIONAL_SRCS}) - -qt5_use_modules(${TARGET_NAME} Widgets) - -# inluce GLM -include(${MACRO_DIR}/IncludeGLM.cmake) -include_glm(${TARGET_NAME} ${ROOT_DIR}) - -# link in the shared library -include(${MACRO_DIR}/LinkHifiLibrary.cmake) -link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR}) - -# link ZLIB -find_package(ZLIB) -include_directories(${ZLIB_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -link_hifi_library(octree ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(octree-server ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(particles ${TARGET_NAME} ${ROOT_DIR}) - -# link in the embedded webserver -link_hifi_library(embedded-webserver ${TARGET_NAME} ${ROOT_DIR}) \ No newline at end of file diff --git a/libraries/voxel-server/CMakeLists.txt b/libraries/voxel-server/CMakeLists.txt deleted file mode 100644 index 594d037767..0000000000 --- a/libraries/voxel-server/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -set(ROOT_DIR ../..) -set(MACRO_DIR ${ROOT_DIR}/cmake/macros) - -# setup for find modules -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/modules/") - -set(TARGET_NAME voxel-server) - -find_package(Qt5Widgets REQUIRED) - -include(${MACRO_DIR}/SetupHifiLibrary.cmake) - -setup_hifi_library(${TARGET_NAME} ${OPTIONAL_SRCS}) - -qt5_use_modules(${TARGET_NAME} Widgets) - -include(${MACRO_DIR}/IncludeGLM.cmake) -include_glm(${TARGET_NAME} ${ROOT_DIR}) - -# link ZLIB -find_package(ZLIB) -include_directories(${ZLIB_INCLUDE_DIRS}) -target_link_libraries(${TARGET_NAME} ${ZLIB_LIBRARIES}) - -# link in the shared library -include(${MACRO_DIR}/LinkHifiLibrary.cmake) -link_hifi_library(shared ${TARGET_NAME} ${ROOT_DIR}) - -# link in the embedded webserver -link_hifi_library(embedded-webserver ${TARGET_NAME} ${ROOT_DIR}) - -# link in the hifi octree library -link_hifi_library(octree ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(octree-server ${TARGET_NAME} ${ROOT_DIR}) -link_hifi_library(voxels ${TARGET_NAME} ${ROOT_DIR}) \ No newline at end of file From f657a3efe9d5478066ba652b49d92fb20d06ad10 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 5 Feb 2014 20:02:01 -0800 Subject: [PATCH 08/10] remove local cache option --- interface/src/Application.cpp | 63 ++--------------------------------- interface/src/Application.h | 5 --- interface/src/Menu.cpp | 1 - interface/src/Menu.h | 1 - 4 files changed, 2 insertions(+), 68 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index d0d071a141..b0629bf6de 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -154,8 +154,7 @@ Application::Application(int& argc, char** argv, timeval &startup_time) : _resetRecentMaxPacketsSoon(true), _swatch(NULL), _pasteMode(false), - _logger(new FileLogger(this)), - _persistThread(NULL) + _logger(new FileLogger(this)) { _myAvatar = _avatarManager.getMyAvatar(); @@ -316,12 +315,7 @@ Application::~Application() { _voxelHideShowThread.terminate(); _voxelEditSender.terminate(); _particleEditSender.terminate(); - if (_persistThread) { - _persistThread->terminate(); - _persistThread->deleteLater(); - _persistThread = NULL; - } - + storeSizeAndPosition(); saveScripts(); _sharedVoxelSystem.changeTree(new VoxelTree); @@ -1907,9 +1901,6 @@ void Application::init() { connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); connect(_rearMirrorTools, SIGNAL(shrinkView()), SLOT(shrinkMirrorView())); connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); - - - updateLocalOctreeCache(true); } void Application::closeMirrorView() { @@ -2207,9 +2198,6 @@ void Application::updateThreads(float deltaTime) { _voxelHideShowThread.threadRoutine(); _voxelEditSender.threadRoutine(); _particleEditSender.threadRoutine(); - if (_persistThread) { - _persistThread->threadRoutine(); - } } } @@ -3882,10 +3870,6 @@ void Application::domainChanged(const QString& domainHostname) { // reset the particle renderer _particles.clear(); - - // reset our persist thread - qDebug() << "Domain changed to" << domainHostname << ". Swapping persist cache."; - updateLocalOctreeCache(); } void Application::nodeKilled(SharedNodePointer node) { @@ -4155,49 +4139,6 @@ void Application::initAvatarAndViewFrustum() { updateMyAvatar(0.f); } -QString Application::getLocalVoxelCacheFileName() { - QString fileName = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - QDir logDir(fileName); - if (!logDir.exists(fileName)) { - logDir.mkdir(fileName); - } - - fileName.append(QString("/hifi.voxelscache.")); - fileName.append(_profile.getLastDomain()); - fileName.append(QString(".svo")); - - return fileName; -} - - -void Application::updateLocalOctreeCache(bool firstTime) { - // only do this if we've already got a persistThread or we're told this is the first time - if (firstTime || _persistThread) { - - if (_persistThread) { - _persistThread->terminate(); - _persistThread->deleteLater(); - _persistThread = NULL; - } - - QString localVoxelCacheFileName = getLocalVoxelCacheFileName(); - const int LOCAL_CACHE_PERSIST_INTERVAL = 1000 * 10; // every 10 seconds - - if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableLocalVoxelCache)) { - _persistThread = new OctreePersistThread(_voxels.getTree(), - localVoxelCacheFileName.toLocal8Bit().constData(),LOCAL_CACHE_PERSIST_INTERVAL); - - qDebug() << "updateLocalOctreeCache()... localVoxelCacheFileName=" << localVoxelCacheFileName; - } - - if (_persistThread) { - _voxels.beginLoadingLocalVoxelCache(); // while local voxels are importing, don't do individual node VBO updates - connect(_persistThread, SIGNAL(loadCompleted()), &_voxels, SLOT(localVoxelCacheLoaded())); - _persistThread->initialize(true); - } - } -} - void Application::checkVersion() { QNetworkRequest latestVersionRequest((QUrl(CHECK_VERSION_URL))); latestVersionRequest.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); diff --git a/interface/src/Application.h b/interface/src/Application.h index bf9981a160..e82eaf1d6c 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -484,11 +484,6 @@ private: FileLogger* _logger; - OctreePersistThread* _persistThread; - - QString getLocalVoxelCacheFileName(); - void updateLocalOctreeCache(bool firstTime = false); - void checkVersion(); void displayUpdateDialog(); bool shouldSkipVersion(QString latestVersion); diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index 67eaa8782c..709f848a2f 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -317,7 +317,6 @@ Menu::Menu() : addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::AmbientOcclusion); addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DontFadeOnVoxelServerChanges); addActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::LodTools, Qt::SHIFT | Qt::Key_L, this, SLOT(lodTools())); - addCheckableActionToQMenuAndActionHash(voxelOptionsMenu, MenuOption::DisableLocalVoxelCache); QMenu* voxelProtoOptionsMenu = voxelOptionsMenu->addMenu("Voxel Server Protocol Options"); diff --git a/interface/src/Menu.h b/interface/src/Menu.h index 5e49ca6fd1..6f7986fcc3 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -176,7 +176,6 @@ namespace MenuOption { const QString DestructiveAddVoxel = "Create Voxel is Destructive"; const QString DisableColorVoxels = "Disable Colored Voxels"; const QString DisableDeltaSending = "Disable Delta Sending"; - const QString DisableLocalVoxelCache = "Disable Local Voxel Cache"; const QString DisableLowRes = "Disable Lower Resolution While Moving"; const QString DisplayFrustum = "Display Frustum"; const QString DisplayLeapHands = "Display Leap Hands"; From 4f5a27796ff2fa3228f3b684ba8cc35f6332d3f5 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Wed, 5 Feb 2014 20:46:17 -0800 Subject: [PATCH 09/10] fix warning --- interface/src/Camera.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/src/Camera.cpp b/interface/src/Camera.cpp index d3a126c38a..7ec4f90eef 100644 --- a/interface/src/Camera.cpp +++ b/interface/src/Camera.cpp @@ -205,8 +205,8 @@ bool Camera::getFrustumNeedsReshape() const { CameraMode Camera::getInterpolatedMode() const { const float SHIFT_THRESHOLD_INTO_FIRST_PERSON = 0.7f; const float SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON = 0.6f; - if (_mode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_INTO_FIRST_PERSON || - _prevMode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON) { + if ((_mode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_INTO_FIRST_PERSON) || + (_prevMode == CAMERA_MODE_FIRST_PERSON && _linearModeShift < SHIFT_THRESHOLD_OUT_OF_FIRST_PERSON)) { return _prevMode; } return _mode; From a16b3a34e40d3157e5291d921241626f06d4a728 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Thu, 6 Feb 2014 02:18:28 -0800 Subject: [PATCH 10/10] fix stutter while spinning --- interface/src/Application.cpp | 2 +- interface/src/VoxelSystem.cpp | 135 ++++++++++++++++------------------ interface/src/VoxelSystem.h | 9 --- 3 files changed, 63 insertions(+), 83 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index ee4bf7f27c..f55332f5b6 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -2053,7 +2053,7 @@ void Application::updateHoverVoxels(float deltaTime, float& distance, BoxFace& f glm::vec4 oldVoxel(_hoverVoxel.x, _hoverVoxel.y, _hoverVoxel.z, _hoverVoxel.s); // only do this work if MAKE_SOUND_ON_VOXEL_HOVER or MAKE_SOUND_ON_VOXEL_CLICK is enabled, // and make sure the tree is not already busy... because otherwise you'll have to wait. - if (!(_voxels.treeIsBusy() || _mousePressed)) { + if (!_mousePressed) { { PerformanceWarning warn(showWarnings, "Application::updateHoverVoxels() _voxels.findRayIntersection()"); _isHoverVoxel = _voxels.findRayIntersection(_mouseRayOrigin, _mouseRayDirection, _hoverVoxel, distance, face); diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 2342aa9de1..1ffc6c3e5e 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -99,8 +99,6 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) _culledOnce = false; _inhideOutOfView = false; - _treeIsBusy = false; - } void VoxelSystem::elementDeleted(OctreeElement* element) { @@ -594,9 +592,10 @@ int VoxelSystem::parseData(const QByteArray& packet) { } if (sectionLength) { + PerformanceWarning warn(showTimingDetails, "VoxelSystem::parseData() section"); // ask the VoxelTree to read the bitstream into the tree ReadBitstreamToTreeParams args(packetIsColored ? WANT_COLOR : NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID()); - lockTree(); + _tree->lockForWrite(); VoxelPacketData packetData(packetIsCompressed); packetData.loadFinalizedContent(dataAt, sectionLength); if (Application::getInstance()->getLogger()->extraDebugging()) { @@ -608,7 +607,7 @@ int VoxelSystem::parseData(const QByteArray& packet) { packetData.getUncompressedSize()); } _tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args); - unlockTree(); + _tree->unlock(); dataBytes -= sectionLength; dataAt += sectionLength; @@ -1395,9 +1394,11 @@ void VoxelSystem::removeScaleAndReleaseProgram(bool texture) { int VoxelSystem::_nodeCount = 0; void VoxelSystem::killLocalVoxels() { - lockTree(); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::killLocalVoxels()"); + _tree->lockForWrite(); _tree->eraseAllOctreeElements(); - unlockTree(); + _tree->unlock(); clearFreeBufferIndexes(); _voxelsInReadArrays = 0; // do we need to do this? setupNewVoxelsForDrawing(); @@ -1416,10 +1417,12 @@ bool VoxelSystem::clearAllNodesBufferIndexOperation(OctreeElement* element, void } void VoxelSystem::clearAllNodesBufferIndex() { + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::clearAllNodesBufferIndex()"); _nodeCount = 0; - lockTree(); + _tree->lockForRead(); // we won't change the tree so it's ok to treat this as a read _tree->recurseTreeWithOperation(clearAllNodesBufferIndexOperation); - unlockTree(); + _tree->unlock(); if (Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings)) { qDebug("clearing buffer index of %d nodes", _nodeCount); } @@ -1481,7 +1484,8 @@ bool VoxelSystem::trueColorizeOperation(OctreeElement* element, void* extraData) } void VoxelSystem::trueColorize() { - PerformanceWarning warn(true, "trueColorize()",true); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "trueColorize()",true); _nodeCount = 0; _tree->recurseTreeWithOperation(trueColorizeOperation); qDebug("setting true color for %d nodes", _nodeCount); @@ -1951,9 +1955,13 @@ void VoxelSystem::hideOutOfView(bool forceFullFrustum) { return; } - lockTree(); - _tree->recurseTreeWithOperation(hideOutOfViewOperation,(void*)&args); - unlockTree(); + { + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::... recurseTreeWithOperation(hideOutOfViewOperation)"); + _tree->lockForRead(); + _tree->recurseTreeWithOperation(hideOutOfViewOperation,(void*)&args); + _tree->unlock(); + } _lastCulledViewFrustum = args.thisViewFrustum; // save last stable _culledOnce = true; @@ -2150,35 +2158,47 @@ bool VoxelSystem::hideOutOfViewOperation(OctreeElement* element, void* extraData bool VoxelSystem::findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, VoxelDetail& detail, float& distance, BoxFace& face) { - lockTree(); - OctreeElement* element; - if (!_tree->findRayIntersection(origin, direction, element, distance, face)) { - unlockTree(); - return false; + + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::findRayIntersection()"); + bool result = false; // assume no intersection + if (_tree->tryLockForRead()) { + OctreeElement* element; + result = _tree->findRayIntersection(origin, direction, element, distance, face); + if (result) { + VoxelTreeElement* voxel = (VoxelTreeElement*)element; + detail.x = voxel->getCorner().x; + detail.y = voxel->getCorner().y; + detail.z = voxel->getCorner().z; + detail.s = voxel->getScale(); + detail.red = voxel->getColor()[0]; + detail.green = voxel->getColor()[1]; + detail.blue = voxel->getColor()[2]; + } + _tree->unlock(); } - VoxelTreeElement* voxel = (VoxelTreeElement*)element; - detail.x = voxel->getCorner().x; - detail.y = voxel->getCorner().y; - detail.z = voxel->getCorner().z; - detail.s = voxel->getScale(); - detail.red = voxel->getColor()[0]; - detail.green = voxel->getColor()[1]; - detail.blue = voxel->getColor()[2]; - unlockTree(); - return true; + return result; } bool VoxelSystem::findSpherePenetration(const glm::vec3& center, float radius, glm::vec3& penetration) { - lockTree(); - bool result = _tree->findSpherePenetration(center, radius, penetration); - unlockTree(); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::findSpherePenetration()"); + bool result = false; // assume no penetration + if (_tree->tryLockForRead()) { + result = _tree->findSpherePenetration(center, radius, penetration); + _tree->unlock(); + } return result; } bool VoxelSystem::findCapsulePenetration(const glm::vec3& start, const glm::vec3& end, float radius, glm::vec3& penetration) { - lockTree(); - bool result = _tree->findCapsulePenetration(start, end, radius, penetration); - unlockTree(); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::findCapsulePenetration()"); + bool result = false; // assume no penetration + if (_tree->tryLockForRead()) { + result = _tree->findCapsulePenetration(start, end, radius, penetration); + _tree->unlock(); + } return result; } @@ -2354,13 +2374,14 @@ void VoxelSystem::collectStatsForTreesAndVBOs() { void VoxelSystem::deleteVoxelAt(float x, float y, float z, float s) { - lockTree(); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::deleteVoxelAt()"); + _tree->lockForWrite(); _tree->deleteVoxelAt(x, y, z, s); - unlockTree(); + _tree->unlock(); // redraw! setupNewVoxelsForDrawing(); // do we even need to do this? Or will the next network receive kick in? - }; VoxelTreeElement* VoxelSystem::getVoxelAt(float x, float y, float z, float s) const { @@ -2370,10 +2391,12 @@ VoxelTreeElement* VoxelSystem::getVoxelAt(float x, float y, float z, float s) co void VoxelSystem::createVoxel(float x, float y, float z, float s, unsigned char red, unsigned char green, unsigned char blue, bool destructive) { - //qDebug("VoxelSystem::createVoxel(%f,%f,%f,%f)\n",x,y,z,s); - lockTree(); + PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), + "VoxelSystem::createVoxel()"); + + _tree->lockForWrite(); _tree->createVoxel(x, y, z, s, red, green, blue, destructive); - unlockTree(); + _tree->unlock(); setupNewVoxelsForDrawing(); }; @@ -2744,37 +2767,3 @@ unsigned long VoxelSystem::getVoxelMemoryUsageGPU() { return (_initialMemoryUsageGPU - currentFreeMemory); } -void VoxelSystem::lockTree() { - _treeLock.lock(); - _treeIsBusy = true; -} - -void VoxelSystem::unlockTree() { - _treeIsBusy = false; - _treeLock.unlock(); -} - - -void VoxelSystem::localVoxelCacheLoaded() { - qDebug() << "localVoxelCacheLoaded()"; - - // Make sure that the application has properly set up the view frustum for our loaded state - Application::getInstance()->initAvatarAndViewFrustum(); - - _tree->setDirtyBit(); // make sure the tree thinks it's dirty - _setupNewVoxelsForDrawingLastFinished = 0; // don't allow the setupNewVoxelsForDrawing() shortcuts - _writeRenderFullVBO = true; // this will disable individual node updates, was reset by killLocalVoxels() - setupNewVoxelsForDrawing(); - _inhideOutOfView = false; // reenable hideOutOfView behavior -} - -void VoxelSystem::beginLoadingLocalVoxelCache() { - qDebug() << "beginLoadingLocalVoxelCache()"; - _writeRenderFullVBO = true; // this will disable individual node updates - _inhideOutOfView = true; // this will disable hidOutOfView which we want to do until local cache is loaded - killLocalVoxels(); - qDebug() << "DONE beginLoadingLocalVoxelCache()"; -} - - - diff --git a/interface/src/VoxelSystem.h b/interface/src/VoxelSystem.h index ca90424b70..d1404668bf 100644 --- a/interface/src/VoxelSystem.h +++ b/interface/src/VoxelSystem.h @@ -110,8 +110,6 @@ public: virtual void elementDeleted(OctreeElement* element); virtual void elementUpdated(OctreeElement* element); - bool treeIsBusy() const { return _treeIsBusy; } - VoxelTreeElement* getVoxelEnclosing(const glm::vec3& point); signals: @@ -144,9 +142,6 @@ public slots: void setUseVoxelShader(bool useVoxelShader); void setVoxelsAsPoints(bool voxelsAsPoints); - void localVoxelCacheLoaded(); - void beginLoadingLocalVoxelCache(); - protected: float _treeScale; unsigned long _maxVoxels; @@ -304,10 +299,6 @@ private: bool _useFastVoxelPipeline; bool _inhideOutOfView; - bool _treeIsBusy; // is the tree mutex locked? if so, it's busy, and if you can avoid it, don't access the tree - - void lockTree(); - void unlockTree(); }; #endif