From 6e7dc65d5f1d6cde20d1c21321aa8a86e20b8e82 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 7 Aug 2013 22:38:01 -0700 Subject: [PATCH 01/19] hacking on not dumping voxels --- voxel-server/src/main.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index c6a8a61ca1..7b60c6354e 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -66,6 +66,7 @@ bool shouldShowAnimationDebug = false; bool displayVoxelStats = false; bool debugVoxelReceiving = false; bool sendEnvironments = true; +bool dontDumpOnMove = false; // by default we dump on move EnvironmentData environmentData[3]; @@ -236,7 +237,10 @@ void deepestLevelVoxelDistributor(NodeList* nodeList, // if our view has changed, we need to reset these things... if (viewFrustumChanged) { - nodeData->nodeBag.deleteAll(); + if (!::dontDumpOnMove) { + printf("dumping nodeBag on move!\n"); + nodeData->nodeBag.deleteAll(); + } nodeData->map.erase(); } @@ -252,12 +256,18 @@ void deepestLevelVoxelDistributor(NodeList* nodeList, nodeData->stats.printDebugDetails(); } - // This is the start of "resending" the scene. - nodeData->nodeBag.insert(serverTree.rootNode); - // start tracking our stats bool isFullScene = (!viewFrustumChanged || !nodeData->getWantDelta()) && nodeData->getViewFrustumJustStoppedChanging(); + + // If we're starting a full scene, then definitely we want to empty the nodeBag + if (isFullScene) { + printf(">>> dumping nodeBag before fullscene!\n"); + nodeData->nodeBag.deleteAll(); + } nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, ::serverTree.rootNode, ::jurisdiction); + + // This is the start of "resending" the scene. + nodeData->nodeBag.insert(serverTree.rootNode); } // If we have something in our nodeBag, then turn them into packets and send them out... @@ -475,6 +485,15 @@ int main(int argc, const char * argv[]) { jurisdiction = new JurisdictionMap(jurisdictionRoot, jurisdictionEndNodes); } } + + // should we dump the voxels from the node bag on move? default to FALSE, we do dump + const char* DONT_DUMP_ON_MOVE = "--dontDumpOnMove"; + ::dontDumpOnMove = cmdOptionExists(argc, argv, DONT_DUMP_ON_MOVE); + if (::dontDumpOnMove) { + printf("dontDumpOnMove=TRUE we will not empty the node bag when clients move\n"); + } else { + printf("dontDumpOnMove=FALSE [default!] we will empty the node bag when clients move\n"); + } // should we send environments? Default is yes, but this command line suppresses sending const char* DONT_SEND_ENVIRONMENTS = "--dontSendEnvironments"; From 48e35ec6cb2010f388ed553125ec470b65cfbd1f Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 14:29:58 -0700 Subject: [PATCH 02/19] fix delete local voxels in case of last voxel server going away --- interface/src/VoxelSystem.cpp | 22 +++++++++++++++++----- interface/src/VoxelSystem.h | 2 ++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index bc9502b0ee..1e3c47b8ba 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -63,6 +63,7 @@ VoxelSystem::VoxelSystem(float treeScale, int maxVoxels) : _abandonedVBOSlots = 0; _falseColorizeBySource = false; _dataSourceID = UNKNOWN_NODE_ID; + _voxelServerCount = 0; } void VoxelSystem::nodeDeleted(VoxelNode* node) { @@ -1538,6 +1539,7 @@ void VoxelSystem::nodeAdded(Node* node) { if (node->getType() == NODE_TYPE_VOXEL_SERVER) { uint16_t nodeID = node->getNodeID(); printf("VoxelSystem... voxel server %u added...\n", nodeID); + _voxelServerCount++; } } @@ -1545,8 +1547,11 @@ bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { uint16_t killedNodeID = *(uint16_t*)extraData; for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { VoxelNode* childNode = node->getChildAtIndex(i); - if (childNode && childNode->getSourceID()== killedNodeID) { - node->safeDeepDeleteChildAtIndex(i); + if (childNode) { + uint16_t childNodeID = childNodeID = childNode->getSourceID(); + if (childNodeID == killedNodeID) { + node->safeDeepDeleteChildAtIndex(i); + } } } return true; @@ -1554,12 +1559,19 @@ bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { void VoxelSystem::nodeKilled(Node* node) { if (node->getType() == NODE_TYPE_VOXEL_SERVER) { + _voxelServerCount--; uint16_t nodeID = node->getNodeID(); printf("VoxelSystem... voxel server %u removed...\n", nodeID); - // Kill any voxels from the local tree - _tree->recurseTreeWithOperation(killSourceVoxelsOperation, &nodeID); - _tree->setDirtyBit(); + if (_voxelServerCount > 0) { + // Kill any voxels from the local tree that match this nodeID + _tree->recurseTreeWithOperation(killSourceVoxelsOperation, &nodeID); + _tree->setDirtyBit(); + } else { + // Last server, take the easy way and kill all the local voxels! + _tree->eraseAllVoxels(); + _voxelsInWriteArrays = _voxelsInReadArrays = 0; // better way to do this?? + } setupNewVoxelsForDrawing(); } } diff --git a/interface/src/VoxelSystem.h b/interface/src/VoxelSystem.h index 60396adcb0..94e2d42e5e 100644 --- a/interface/src/VoxelSystem.h +++ b/interface/src/VoxelSystem.h @@ -206,6 +206,8 @@ private: bool _falseColorizeBySource; int _dataSourceID; + + int _voxelServerCount; }; #endif From 6d4ebda1ffe43f3fa633c53dcbe0861ba697fdba Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 14:30:46 -0700 Subject: [PATCH 03/19] fix delete local voxels in case of last voxel server going away --- interface/src/VoxelSystem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 1e3c47b8ba..2197b1b1bb 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -1548,7 +1548,7 @@ bool VoxelSystem::killSourceVoxelsOperation(VoxelNode* node, void* extraData) { for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { VoxelNode* childNode = node->getChildAtIndex(i); if (childNode) { - uint16_t childNodeID = childNodeID = childNode->getSourceID(); + uint16_t childNodeID = childNode->getSourceID(); if (childNodeID == killedNodeID) { node->safeDeepDeleteChildAtIndex(i); } From 1bb7d75794ea8166321c060687390ab84cd1d7af Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 14:36:42 -0700 Subject: [PATCH 04/19] added tool for splitting SVOs on jurisdiction boundaries --- libraries/voxels/src/JurisdictionMap.h | 4 +- voxel-edit/src/main.cpp | 94 ++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/libraries/voxels/src/JurisdictionMap.h b/libraries/voxels/src/JurisdictionMap.h index 59e08e85e9..cf6dba677b 100644 --- a/libraries/voxels/src/JurisdictionMap.h +++ b/libraries/voxels/src/JurisdictionMap.h @@ -31,7 +31,9 @@ public: bool writeToFile(const char* filename); bool readFromFile(const char* filename); - unsigned char* getRootOctalCode() const { return _rootOctalCode; } + unsigned char* getRootOctalCode() const { return _rootOctalCode; } + unsigned char* getEndNodeOctalCode(int index) const { return _endNodes[index]; } + int getEndNodeCount() const { return _endNodes.size(); } private: void clear(); diff --git a/voxel-edit/src/main.cpp b/voxel-edit/src/main.cpp index 9571e4adf5..da92505aed 100644 --- a/voxel-edit/src/main.cpp +++ b/voxel-edit/src/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include VoxelTree myTree; @@ -56,10 +57,103 @@ void voxelTutorial(VoxelTree * tree) { int main(int argc, const char * argv[]) { + qInstallMessageHandler(sharedMessageHandler); + const char* SAY_HELLO = "--sayHello"; if (cmdOptionExists(argc, argv, SAY_HELLO)) { printf("I'm just saying hello...\n"); } + + + // Handles taking and SVO and splitting it into multiple SVOs based on + // jurisdiction details + const char* SPLIT_SVO = "--splitSVO"; + const char* splitSVOFile = getCmdOption(argc, argv, SPLIT_SVO); + const char* SPLIT_JURISDICTION_ROOT = "--splitJurisdictionRoot"; + const char* SPLIT_JURISDICTION_ENDNODES = "--splitJurisdictionEndNodes"; + const char* splitJurisdictionRoot = getCmdOption(argc, argv, SPLIT_JURISDICTION_ROOT); + const char* splitJurisdictionEndNodes = getCmdOption(argc, argv, SPLIT_JURISDICTION_ENDNODES); + if (splitSVOFile && splitJurisdictionRoot && splitJurisdictionEndNodes) { + char outputFileName[512]; + + printf("splitSVOFile: %s Jurisdictions Root: %s EndNodes: %s\n", + splitSVOFile, splitJurisdictionRoot, splitJurisdictionEndNodes); + + VoxelTree rootSVO; + + rootSVO.readFromSVOFile(splitSVOFile); + JurisdictionMap jurisdiction(splitJurisdictionRoot, splitJurisdictionEndNodes); + + printf("Jurisdiction Root Octcode: "); + printOctalCode(jurisdiction.getRootOctalCode()); + + printf("Jurisdiction End Nodes: %d \n", jurisdiction.getEndNodeCount()); + for (int i = 0; i < jurisdiction.getEndNodeCount(); i++) { + unsigned char* endNodeCode = jurisdiction.getEndNodeOctalCode(i); + printf("End Node: %d ", i); + printOctalCode(endNodeCode); + + // get the endNode details + VoxelPositionSize endNodeDetails; + voxelDetailsForCode(endNodeCode, endNodeDetails); + + // Now, create a split SVO for the EndNode. + // copy the EndNode into a temporary tree + VoxelTree endNodeTree; + + // create a small voxels at corners of the endNode Tree, this will is a hack + // to work around a bug in voxel server that will send Voxel not exists + // for regions that don't contain anything even if they're not in the + // jurisdiction of the server + // This hack assumes the end nodes for demo dinner since it only guarantees + // nodes in the 8 child voxels of the main root voxel + endNodeTree.createVoxel(0.0, 0.0, 0.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 0.0, 0.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(0.0, 1.0, 0.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(0.0, 0.0, 1.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 1.0, 1.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 1.0, 0.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(0.0, 1.0, 1.0, 0.015625, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 0.0, 1.0, 0.015625, 1, 1, 1, true); + + // Delete the voxel for the EndNode from the temporary tree, so we can + // import our endNode content into it... + endNodeTree.deleteVoxelCodeFromTree(endNodeCode, COLLAPSE_EMPTY_TREE); + + VoxelNode* endNode = rootSVO.getVoxelAt(endNodeDetails.x, + endNodeDetails.y, + endNodeDetails.z, + endNodeDetails.s); + + rootSVO.copySubTreeIntoNewTree(endNode, &endNodeTree, false); + + sprintf(outputFileName, "splitENDNODE%d%s", i, splitSVOFile); + printf("outputFile: %s\n", outputFileName); + endNodeTree.writeToSVOFile(outputFileName); + + // Delete the voxel for the EndNode from the root tree... + rootSVO.deleteVoxelCodeFromTree(endNodeCode, COLLAPSE_EMPTY_TREE); + + // create a small voxel in center of each EndNode, this will is a hack + // to work around a bug in voxel server that will send Voxel not exists + // for regions that don't contain anything even if they're not in the + // jurisdiction of the server + float x = endNodeDetails.x + endNodeDetails.s * 0.5; + float y = endNodeDetails.y + endNodeDetails.s * 0.5; + float z = endNodeDetails.z + endNodeDetails.s * 0.5; + float s = endNodeDetails.s * 0.015625; + + rootSVO.createVoxel(x, y, z, s, 1, 1, 1, true); + + } + + sprintf(outputFileName, "splitROOT%s", splitSVOFile); + printf("outputFile: %s\n", outputFileName); + rootSVO.writeToSVOFile(outputFileName); + + printf("exiting now\n"); + return 0; + } const char* DONT_CREATE_FILE = "--dontCreateSceneFile"; bool dontCreateFile = cmdOptionExists(argc, argv, DONT_CREATE_FILE); From 205ba7c642f5f841efe475355e6fb1880cd4db72 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 14:45:35 -0700 Subject: [PATCH 05/19] drop default Packets per second --- voxel-server/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index f5b0eca825..84304fa127 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -47,7 +47,7 @@ const float DEATH_STAR_RADIUS = 4.0; const float MAX_CUBE = 0.05f; const int VOXEL_SEND_INTERVAL_USECS = 17 * 1000; // approximately 60fps -int PACKETS_PER_CLIENT_PER_INTERVAL = 20; +int PACKETS_PER_CLIENT_PER_INTERVAL = 10; const int SENDING_TIME_TO_SPARE = 5 * 1000; // usec of sending interval to spare for calculating voxels const int INTERVALS_PER_SECOND = 1000 * 1000 / VOXEL_SEND_INTERVAL_USECS; From 1eff6e94cee420b291838423cf376c100149191f Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 8 Aug 2013 14:46:56 -0700 Subject: [PATCH 06/19] tone down voxel server sending --- voxel-server/src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index f5b0eca825..84304fa127 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -47,7 +47,7 @@ const float DEATH_STAR_RADIUS = 4.0; const float MAX_CUBE = 0.05f; const int VOXEL_SEND_INTERVAL_USECS = 17 * 1000; // approximately 60fps -int PACKETS_PER_CLIENT_PER_INTERVAL = 20; +int PACKETS_PER_CLIENT_PER_INTERVAL = 10; const int SENDING_TIME_TO_SPARE = 5 * 1000; // usec of sending interval to spare for calculating voxels const int INTERVALS_PER_SECOND = 1000 * 1000 / VOXEL_SEND_INTERVAL_USECS; From 25350e99a3ffe0be5e0baa51f8906e55a65e8cb3 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 14:49:16 -0700 Subject: [PATCH 07/19] fix whitespace --- voxel-edit/src/main.cpp | 82 ++++++++++++++++++++--------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/voxel-edit/src/main.cpp b/voxel-edit/src/main.cpp index da92505aed..343f0a4364 100644 --- a/voxel-edit/src/main.cpp +++ b/voxel-edit/src/main.cpp @@ -59,39 +59,39 @@ int main(int argc, const char * argv[]) { qInstallMessageHandler(sharedMessageHandler); - const char* SAY_HELLO = "--sayHello"; + const char* SAY_HELLO = "--sayHello"; if (cmdOptionExists(argc, argv, SAY_HELLO)) { - printf("I'm just saying hello...\n"); - } - - - // Handles taking and SVO and splitting it into multiple SVOs based on - // jurisdiction details - const char* SPLIT_SVO = "--splitSVO"; + printf("I'm just saying hello...\n"); + } + + + // Handles taking and SVO and splitting it into multiple SVOs based on + // jurisdiction details + const char* SPLIT_SVO = "--splitSVO"; const char* splitSVOFile = getCmdOption(argc, argv, SPLIT_SVO); - const char* SPLIT_JURISDICTION_ROOT = "--splitJurisdictionRoot"; - const char* SPLIT_JURISDICTION_ENDNODES = "--splitJurisdictionEndNodes"; + const char* SPLIT_JURISDICTION_ROOT = "--splitJurisdictionRoot"; + const char* SPLIT_JURISDICTION_ENDNODES = "--splitJurisdictionEndNodes"; const char* splitJurisdictionRoot = getCmdOption(argc, argv, SPLIT_JURISDICTION_ROOT); const char* splitJurisdictionEndNodes = getCmdOption(argc, argv, SPLIT_JURISDICTION_ENDNODES); if (splitSVOFile && splitJurisdictionRoot && splitJurisdictionEndNodes) { char outputFileName[512]; - printf("splitSVOFile: %s Jurisdictions Root: %s EndNodes: %s\n", - splitSVOFile, splitJurisdictionRoot, splitJurisdictionEndNodes); + printf("splitSVOFile: %s Jurisdictions Root: %s EndNodes: %s\n", + splitSVOFile, splitJurisdictionRoot, splitJurisdictionEndNodes); VoxelTree rootSVO; rootSVO.readFromSVOFile(splitSVOFile); - JurisdictionMap jurisdiction(splitJurisdictionRoot, splitJurisdictionEndNodes); - - printf("Jurisdiction Root Octcode: "); - printOctalCode(jurisdiction.getRootOctalCode()); + JurisdictionMap jurisdiction(splitJurisdictionRoot, splitJurisdictionEndNodes); + + printf("Jurisdiction Root Octcode: "); + printOctalCode(jurisdiction.getRootOctalCode()); - printf("Jurisdiction End Nodes: %d \n", jurisdiction.getEndNodeCount()); - for (int i = 0; i < jurisdiction.getEndNodeCount(); i++) { - unsigned char* endNodeCode = jurisdiction.getEndNodeOctalCode(i); - printf("End Node: %d ", i); - printOctalCode(endNodeCode); + printf("Jurisdiction End Nodes: %d \n", jurisdiction.getEndNodeCount()); + for (int i = 0; i < jurisdiction.getEndNodeCount(); i++) { + unsigned char* endNodeCode = jurisdiction.getEndNodeOctalCode(i); + printf("End Node: %d ", i); + printOctalCode(endNodeCode); // get the endNode details VoxelPositionSize endNodeDetails; @@ -116,8 +116,8 @@ int main(int argc, const char * argv[]) endNodeTree.createVoxel(0.0, 1.0, 1.0, 0.015625, 1, 1, 1, true); endNodeTree.createVoxel(1.0, 0.0, 1.0, 0.015625, 1, 1, 1, true); - // Delete the voxel for the EndNode from the temporary tree, so we can - // import our endNode content into it... + // Delete the voxel for the EndNode from the temporary tree, so we can + // import our endNode content into it... endNodeTree.deleteVoxelCodeFromTree(endNodeCode, COLLAPSE_EMPTY_TREE); VoxelNode* endNode = rootSVO.getVoxelAt(endNodeDetails.x, @@ -130,10 +130,10 @@ int main(int argc, const char * argv[]) sprintf(outputFileName, "splitENDNODE%d%s", i, splitSVOFile); printf("outputFile: %s\n", outputFileName); endNodeTree.writeToSVOFile(outputFileName); - - // Delete the voxel for the EndNode from the root tree... + + // Delete the voxel for the EndNode from the root tree... rootSVO.deleteVoxelCodeFromTree(endNodeCode, COLLAPSE_EMPTY_TREE); - + // create a small voxel in center of each EndNode, this will is a hack // to work around a bug in voxel server that will send Voxel not exists // for regions that don't contain anything even if they're not in the @@ -142,27 +142,27 @@ int main(int argc, const char * argv[]) float y = endNodeDetails.y + endNodeDetails.s * 0.5; float z = endNodeDetails.z + endNodeDetails.s * 0.5; float s = endNodeDetails.s * 0.015625; - + rootSVO.createVoxel(x, y, z, s, 1, 1, 1, true); - - } + + } sprintf(outputFileName, "splitROOT%s", splitSVOFile); - printf("outputFile: %s\n", outputFileName); + printf("outputFile: %s\n", outputFileName); rootSVO.writeToSVOFile(outputFileName); - - printf("exiting now\n"); - return 0; - } - - const char* DONT_CREATE_FILE = "--dontCreateSceneFile"; - bool dontCreateFile = cmdOptionExists(argc, argv, DONT_CREATE_FILE); + printf("exiting now\n"); + return 0; + } + + const char* DONT_CREATE_FILE = "--dontCreateSceneFile"; + bool dontCreateFile = cmdOptionExists(argc, argv, DONT_CREATE_FILE); + if (dontCreateFile) { - printf("You asked us not to create a scene file, so we will not.\n"); - } else { - printf("Creating Scene File...\n"); - + printf("You asked us not to create a scene file, so we will not.\n"); + } else { + printf("Creating Scene File...\n"); + const char* RUN_TUTORIAL = "--runTutorial"; if (cmdOptionExists(argc, argv, RUN_TUTORIAL)) { voxelTutorial(&myTree); From 3a2b6684244eed9fbf18ba5d023e7b2e66dd5263 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 15:04:23 -0700 Subject: [PATCH 08/19] make dontdumponmove default --- voxel-server/src/main.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index 7b60c6354e..55f407872b 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -66,7 +66,6 @@ bool shouldShowAnimationDebug = false; bool displayVoxelStats = false; bool debugVoxelReceiving = false; bool sendEnvironments = true; -bool dontDumpOnMove = false; // by default we dump on move EnvironmentData environmentData[3]; @@ -237,10 +236,6 @@ void deepestLevelVoxelDistributor(NodeList* nodeList, // if our view has changed, we need to reset these things... if (viewFrustumChanged) { - if (!::dontDumpOnMove) { - printf("dumping nodeBag on move!\n"); - nodeData->nodeBag.deleteAll(); - } nodeData->map.erase(); } @@ -261,7 +256,6 @@ void deepestLevelVoxelDistributor(NodeList* nodeList, // If we're starting a full scene, then definitely we want to empty the nodeBag if (isFullScene) { - printf(">>> dumping nodeBag before fullscene!\n"); nodeData->nodeBag.deleteAll(); } nodeData->stats.sceneStarted(isFullScene, viewFrustumChanged, ::serverTree.rootNode, ::jurisdiction); @@ -486,15 +480,6 @@ int main(int argc, const char * argv[]) { } } - // should we dump the voxels from the node bag on move? default to FALSE, we do dump - const char* DONT_DUMP_ON_MOVE = "--dontDumpOnMove"; - ::dontDumpOnMove = cmdOptionExists(argc, argv, DONT_DUMP_ON_MOVE); - if (::dontDumpOnMove) { - printf("dontDumpOnMove=TRUE we will not empty the node bag when clients move\n"); - } else { - printf("dontDumpOnMove=FALSE [default!] we will empty the node bag when clients move\n"); - } - // should we send environments? Default is yes, but this command line suppresses sending const char* DONT_SEND_ENVIRONMENTS = "--dontSendEnvironments"; bool dontSendEnvironments = cmdOptionExists(argc, argv, DONT_SEND_ENVIRONMENTS); From a661d9f2f44727cc1a08cd7b425fdf170e5f4e6a Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Thu, 8 Aug 2013 15:19:48 -0700 Subject: [PATCH 09/19] repair header byte calculations in assignment server --- assignment-server/src/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/assignment-server/src/main.cpp b/assignment-server/src/main.cpp index 374009b917..be902ed5b0 100644 --- a/assignment-server/src/main.cpp +++ b/assignment-server/src/main.cpp @@ -32,9 +32,8 @@ int main(int argc, const char* argv[]) { UDPSocket serverSocket(ASSIGNMENT_SERVER_PORT); - int numHeaderBytes = numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_SEND_ASSIGNMENT); unsigned char assignmentPacket[MAX_PACKET_SIZE_BYTES]; - populateTypeAndVersion(assignmentPacket, PACKET_TYPE_SEND_ASSIGNMENT); + int numSendHeaderBytes = populateTypeAndVersion(assignmentPacket, PACKET_TYPE_SEND_ASSIGNMENT); while (true) { if (serverSocket.receive((sockaddr*) &senderSocket, &senderData, &receivedBytes)) { @@ -53,7 +52,7 @@ int main(int argc, const char* argv[]) { qDebug() << "Sending assignment with URL" << scriptURL << "\n"; int scriptURLBytes = scriptURL.size(); - memcpy(assignmentPacket + numHeaderBytes, scriptURL.toLocal8Bit().constData(), scriptURLBytes); + memcpy(assignmentPacket + numSendHeaderBytes, scriptURL.toLocal8Bit().constData(), scriptURLBytes); // send the assignment serverSocket.send((sockaddr*) &senderSocket, assignmentPacket, numHeaderBytes + scriptURLBytes); From 299696e7a4eeaf75d636560dae1041d4e4655d4d Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 15:20:08 -0700 Subject: [PATCH 10/19] add parameter for Dump Voxels on Move --- voxel-server/src/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/voxel-server/src/main.cpp b/voxel-server/src/main.cpp index 678387b1a3..c7e266e430 100644 --- a/voxel-server/src/main.cpp +++ b/voxel-server/src/main.cpp @@ -67,6 +67,7 @@ bool displayVoxelStats = false; bool debugVoxelReceiving = false; bool sendEnvironments = true; bool sendMinimalEnvironment = false; +bool dumpVoxelsOnMove = false; EnvironmentData environmentData[3]; @@ -237,6 +238,9 @@ void deepestLevelVoxelDistributor(NodeList* nodeList, // if our view has changed, we need to reset these things... if (viewFrustumChanged) { + if (::dumpVoxelsOnMove) { + nodeData->nodeBag.deleteAll(); + } nodeData->map.erase(); } @@ -482,6 +486,12 @@ int main(int argc, const char * argv[]) { } } + + // should we send environments? Default is yes, but this command line suppresses sending + const char* DUMP_VOXELS_ON_MOVE = "--dumpVoxelsOnMove"; + ::dumpVoxelsOnMove = cmdOptionExists(argc, argv, DUMP_VOXELS_ON_MOVE); + printf("dumpVoxelsOnMove=%s\n", debug::valueOf(::dumpVoxelsOnMove)); + // should we send environments? Default is yes, but this command line suppresses sending const char* DONT_SEND_ENVIRONMENTS = "--dontSendEnvironments"; bool dontSendEnvironments = cmdOptionExists(argc, argv, DONT_SEND_ENVIRONMENTS); From b1e975e96b8929c368c4f61e717ebab1336bf642 Mon Sep 17 00:00:00 2001 From: atlante45 Date: Thu, 8 Aug 2013 15:48:33 -0700 Subject: [PATCH 11/19] Don't show pie menu when on voxel --- interface/src/Application.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index b9ac953767..0998011e11 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -943,7 +943,7 @@ void Application::mousePressEvent(QMouseEvent* event) { maybeEditVoxelUnderCursor(); - if (!_palette.isActive()) { + if (!_palette.isActive() && (!_isHoverVoxel || _isLookingAtOtherAvatar)) { _pieMenu.mousePressEvent(_mouseX, _mouseY); } From f5fe965093b1ee25f5724d2619505f02682da97d Mon Sep 17 00:00:00 2001 From: atlante45 Date: Thu, 8 Aug 2013 15:49:35 -0700 Subject: [PATCH 12/19] Position based follow mode whith head movement --- interface/src/avatar/Avatar.cpp | 49 +++++++++++++++++++++------------ interface/src/avatar/Head.h | 5 ++-- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index ead86085a0..ddc7b9926d 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -297,7 +297,6 @@ void Avatar::reset() { // Update avatar head rotation with sensor data void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, float pitchFromTouch) { - _head.setMousePitch(pitchFromTouch); SerialInterface* gyros = Application::getInstance()->getSerialHeadSensor(); Webcam* webcam = Application::getInstance()->getWebcam(); glm::vec3 estimatedPosition, estimatedRotation; @@ -307,11 +306,17 @@ void Avatar::updateFromGyrosAndOrWebcam(bool gyroLook, } else if (webcam->isActive()) { estimatedRotation = webcam->getEstimatedRotation(); + } else if (_leadingAvatar) { + _head.getFace().clearFrame(); + return; } else { + _head.setMousePitch(pitchFromTouch); _head.setPitch(pitchFromTouch); _head.getFace().clearFrame(); return; } + _head.setMousePitch(pitchFromTouch); + if (webcam->isActive()) { estimatedPosition = webcam->getEstimatedPosition(); @@ -426,33 +431,43 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { _shouldJump = false; } + // Add thrusts from leading avatar + const float FOLLOWING_RATE = .02f; + if (_leadingAvatar != NULL) { glm::vec3 toTarget = _leadingAvatar->getPosition() - _position; - if (.5f < up.x * toTarget.x + up.y * toTarget.y + up.z * toTarget.z) { - _thrust += _scale * THRUST_MAG_UP * deltaTime * up; - } else if (up.x * toTarget.x + up.y * toTarget.y + up.z * toTarget.z < -.5f) { - _thrust -= _scale * THRUST_MAG_UP * deltaTime * up; - } - if (glm::length(_position - _leadingAvatar->getPosition()) > _scale * _stringLength) { - _thrust += _scale * THRUST_MAG_FWD * deltaTime * front; + _position += toTarget * FOLLOWING_RATE; } else { - toTarget = _leadingAvatar->getHead().getLookAtPosition() - _position; - getHead().setLookAtPosition(_leadingAvatar->getHead().getLookAtPosition()); + toTarget = _leadingAvatar->getHead().getLookAtPosition() - _head.getPosition(); } + toTarget = glm::vec3(glm::dot(right, toTarget), + glm::dot(up , toTarget), + glm::dot(front, toTarget)); - float yawAngle = angleBetween(front, glm::vec3(toTarget.x, 0.f, toTarget.z)); - if (yawAngle < -10.f || 10.f < yawAngle){ - if (right.x * toTarget.x + right.y * toTarget.y + right.z * toTarget.z > 0) { - _bodyYawDelta -= YAW_MAG * deltaTime; + float yawAngle = angleBetween(-IDENTITY_FRONT, glm::vec3(toTarget.x, 0.f, toTarget.z)); + if (5.f < glm::abs(yawAngle)){ + if (IDENTITY_RIGHT.x * toTarget.x + IDENTITY_RIGHT.y * toTarget.y + IDENTITY_RIGHT.z * toTarget.z > 0) { + _bodyYawDelta -= yawAngle; } else { - _bodyYawDelta += YAW_MAG * deltaTime; + _bodyYawDelta += yawAngle; } } + + float pitchAngle = glm::abs(90.f - angleBetween(IDENTITY_UP, toTarget)); + if (1.f < glm::abs(pitchAngle) && yawAngle < 30.f){ + if (IDENTITY_UP.x * toTarget.x + IDENTITY_UP.y * toTarget.y + IDENTITY_UP.z * toTarget.z > 0) { + _head.setMousePitch(_head.getMousePitch() + .10f * pitchAngle); + } else { + _head.setMousePitch(_head.getMousePitch() - .10f * pitchAngle); + } + _head.setPitch(_head.getMousePitch()); + } } - + + // Add thrusts from Transmitter if (transmitter) { transmitter->checkForLostTransmitter(); @@ -533,7 +548,7 @@ void Avatar::simulate(float deltaTime, Transmitter* transmitter, float gyroCamer follow(NULL); } - // Ajust, scale, thrust and lookAt position when following an other avatar + // Ajust, scale, position and lookAt position when following an other avatar if (isMyAvatar() && _leadingAvatar && _newScale != _leadingAvatar->getScale()) { _newScale = _leadingAvatar->getScale(); } diff --git a/interface/src/avatar/Head.h b/interface/src/avatar/Head.h index 60fc2864ed..31efc21d48 100644 --- a/interface/src/avatar/Head.h +++ b/interface/src/avatar/Head.h @@ -57,8 +57,9 @@ public: void setCameraFollowsHead(bool cameraFollowsHead) { _cameraFollowsHead = cameraFollowsHead; } - void setMousePitch(float mousePitch) { _mousePitch = mousePitch; } - + float getMousePitch() { return _mousePitch; } + void setMousePitch(float mousePitch) { _mousePitch = mousePitch; } + glm::quat getOrientation() const; glm::quat getCameraOrientation () const; From 45961b2b64ad1d761a11dff6326876ae67b7a1f1 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 8 Aug 2013 16:00:50 -0700 Subject: [PATCH 13/19] Collision and click sounds improved --- interface/src/Application.cpp | 10 +++++++++- interface/src/Audio.cpp | 11 +++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 6d272b757c..4265f330c4 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -952,7 +952,15 @@ void Application::mousePressEvent(QMouseEvent* event) { _hoverVoxelOriginalColor[1] = _hoverVoxel.green; _hoverVoxelOriginalColor[2] = _hoverVoxel.blue; _hoverVoxelOriginalColor[3] = 1; - _audio.startCollisionSound(1.0, HOVER_VOXEL_FREQUENCY * _hoverVoxel.s * TREE_SCALE, 0.0, HOVER_VOXEL_DECAY); + const float RED_CLICK_FREQUENCY = 1000.f; + const float GREEN_CLICK_FREQUENCY = 1250.f; + const float BLUE_CLICK_FREQUENCY = 1330.f; + const float MIDDLE_A_FREQUENCY = 440.f; + float frequency = MIDDLE_A_FREQUENCY + ((float)_hoverVoxel.red / 255.f * RED_CLICK_FREQUENCY + + (float)_hoverVoxel.green / 255.f * GREEN_CLICK_FREQUENCY + + (float)_hoverVoxel.blue / 255.f * BLUE_CLICK_FREQUENCY) / 3.f; + + _audio.startCollisionSound(1.0, frequency, 0.0, HOVER_VOXEL_DECAY); _isHoverVoxelSounding = true; } diff --git a/interface/src/Audio.cpp b/interface/src/Audio.cpp index 3e011f5e05..add56df80c 100644 --- a/interface/src/Audio.cpp +++ b/interface/src/Audio.cpp @@ -704,7 +704,7 @@ void Audio::addProceduralSounds(int16_t* inputBuffer, float speed = glm::length(_lastVelocity); float volume = VOLUME_BASELINE * (1.f - speed / MAX_AUDIBLE_VELOCITY); - int sample; + float sample; // // Travelling noise @@ -724,13 +724,16 @@ void Audio::addProceduralSounds(int16_t* inputBuffer, if (_collisionSoundMagnitude > COLLISION_SOUND_CUTOFF_LEVEL) { for (int i = 0; i < numSamples; i++) { t = (float) _proceduralEffectSample + (float) i; + sample = sinf(t * _collisionSoundFrequency) + sinf(t * _collisionSoundFrequency / DOWN_TWO_OCTAVES) + sinf(t * _collisionSoundFrequency / DOWN_FOUR_OCTAVES * UP_MAJOR_FIFTH); sample *= _collisionSoundMagnitude * COLLISION_SOUND_MAX_VOLUME; - inputBuffer[i] += sample; - outputLeft[i] += sample; - outputRight[i] += sample; + + + inputBuffer[i] += (int) sample; + outputLeft[i] += (int) sample; + outputRight[i] += (int) sample; _collisionSoundMagnitude *= _collisionSoundDuration; } } From 0e9e4c8c07700f270160edb6c175857750e8b8cb Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 16:05:30 -0700 Subject: [PATCH 14/19] cr feedback --- voxel-edit/src/main.cpp | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/voxel-edit/src/main.cpp b/voxel-edit/src/main.cpp index 343f0a4364..36913a2d6c 100644 --- a/voxel-edit/src/main.cpp +++ b/voxel-edit/src/main.cpp @@ -59,12 +59,6 @@ int main(int argc, const char * argv[]) { qInstallMessageHandler(sharedMessageHandler); - const char* SAY_HELLO = "--sayHello"; - if (cmdOptionExists(argc, argv, SAY_HELLO)) { - printf("I'm just saying hello...\n"); - } - - // Handles taking and SVO and splitting it into multiple SVOs based on // jurisdiction details const char* SPLIT_SVO = "--splitSVO"; @@ -107,14 +101,15 @@ int main(int argc, const char * argv[]) // jurisdiction of the server // This hack assumes the end nodes for demo dinner since it only guarantees // nodes in the 8 child voxels of the main root voxel - endNodeTree.createVoxel(0.0, 0.0, 0.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(1.0, 0.0, 0.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(0.0, 1.0, 0.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(0.0, 0.0, 1.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(1.0, 1.0, 1.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(1.0, 1.0, 0.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(0.0, 1.0, 1.0, 0.015625, 1, 1, 1, true); - endNodeTree.createVoxel(1.0, 0.0, 1.0, 0.015625, 1, 1, 1, true); + const float verySmall = verySmall; + endNodeTree.createVoxel(0.0, 0.0, 0.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 0.0, 0.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(0.0, 1.0, 0.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(0.0, 0.0, 1.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 1.0, 1.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 1.0, 0.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(0.0, 1.0, 1.0, verySmall, 1, 1, 1, true); + endNodeTree.createVoxel(1.0, 0.0, 1.0, verySmall, 1, 1, 1, true); // Delete the voxel for the EndNode from the temporary tree, so we can // import our endNode content into it... @@ -141,7 +136,7 @@ int main(int argc, const char * argv[]) float x = endNodeDetails.x + endNodeDetails.s * 0.5; float y = endNodeDetails.y + endNodeDetails.s * 0.5; float z = endNodeDetails.z + endNodeDetails.s * 0.5; - float s = endNodeDetails.s * 0.015625; + float s = endNodeDetails.s * verySmall; rootSVO.createVoxel(x, y, z, s, 1, 1, 1, true); From 2c96296936685ffe583d7575763612fc667b16d8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 16:08:06 -0700 Subject: [PATCH 15/19] fixed LOD disappear on backing up --- interface/src/VoxelSystem.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index 2197b1b1bb..5351f129be 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -390,14 +390,29 @@ int VoxelSystem::newTreeToArrays(VoxelNode* node) { bool shouldRender = false; // assume we don't need to render it // if it's colored, we might need to render it! shouldRender = node->calculateShouldRender(Application::getInstance()->getViewFrustum()); + node->setShouldRender(shouldRender); // let children figure out their renderness if (!node->isLeaf()) { + + // As we check our children, see if any of them went from shouldRender to NOT shouldRender + // then we probably dropped LOD and if we don't have color, we want to average our children + // for a new color. + int childrenGotHiddenCount = 0; for (int i = 0; i < NUMBER_OF_CHILDREN; i++) { - if (node->getChildAtIndex(i)) { - voxelsUpdated += newTreeToArrays(node->getChildAtIndex(i)); + VoxelNode* childNode = node->getChildAtIndex(i); + if (childNode) { + bool wasShouldRender = childNode->getShouldRender(); + voxelsUpdated += newTreeToArrays(childNode); + bool isShouldRender = childNode->getShouldRender(); + if (wasShouldRender && !isShouldRender) { + childrenGotHiddenCount++; + } } } + if (childrenGotHiddenCount > 0) { + node->setColorFromAverageOfChildren(); + } } if (_writeRenderFullVBO) { voxelsUpdated += updateNodeInArraysAsFullVBO(node); From d5a0b2ff93f2f34a18023e73acdbdaed889f4b58 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 8 Aug 2013 16:10:07 -0700 Subject: [PATCH 16/19] Fixes per review --- interface/src/Application.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 7527c0ec54..4776f4a189 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -956,9 +956,10 @@ void Application::mousePressEvent(QMouseEvent* event) { const float GREEN_CLICK_FREQUENCY = 1250.f; const float BLUE_CLICK_FREQUENCY = 1330.f; const float MIDDLE_A_FREQUENCY = 440.f; - float frequency = MIDDLE_A_FREQUENCY + ((float)_hoverVoxel.red / 255.f * RED_CLICK_FREQUENCY + - (float)_hoverVoxel.green / 255.f * GREEN_CLICK_FREQUENCY + - (float)_hoverVoxel.blue / 255.f * BLUE_CLICK_FREQUENCY) / 3.f; + float frequency = MIDDLE_A_FREQUENCY + + (_hoverVoxel.red / 255.f * RED_CLICK_FREQUENCY + + _hoverVoxel.green / 255.f * GREEN_CLICK_FREQUENCY + + _hoverVoxel.blue / 255.f * BLUE_CLICK_FREQUENCY) / 3.f; _audio.startCollisionSound(1.0, frequency, 0.0, HOVER_VOXEL_DECAY); _isHoverVoxelSounding = true; From 0e1149a8ef057603a9cbae14ae9ac75ce502b969 Mon Sep 17 00:00:00 2001 From: Philip Rosedale Date: Thu, 8 Aug 2013 16:11:51 -0700 Subject: [PATCH 17/19] Fixes per review --- interface/src/Application.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 4776f4a189..dab8d3353d 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -956,10 +956,10 @@ void Application::mousePressEvent(QMouseEvent* event) { const float GREEN_CLICK_FREQUENCY = 1250.f; const float BLUE_CLICK_FREQUENCY = 1330.f; const float MIDDLE_A_FREQUENCY = 440.f; - float frequency = MIDDLE_A_FREQUENCY - + (_hoverVoxel.red / 255.f * RED_CLICK_FREQUENCY + - _hoverVoxel.green / 255.f * GREEN_CLICK_FREQUENCY + - _hoverVoxel.blue / 255.f * BLUE_CLICK_FREQUENCY) / 3.f; + float frequency = MIDDLE_A_FREQUENCY + + (_hoverVoxel.red / 255.f * RED_CLICK_FREQUENCY + + _hoverVoxel.green / 255.f * GREEN_CLICK_FREQUENCY + + _hoverVoxel.blue / 255.f * BLUE_CLICK_FREQUENCY) / 3.f; _audio.startCollisionSound(1.0, frequency, 0.0, HOVER_VOXEL_DECAY); _isHoverVoxelSounding = true; From 521eb196255cefc848d194e2aabcd9a47d1d5a52 Mon Sep 17 00:00:00 2001 From: atlante45 Date: Thu, 8 Aug 2013 16:22:26 -0700 Subject: [PATCH 18/19] PR comments + Changed MIN and MAX scale --- interface/src/avatar/Avatar.cpp | 16 ++++++++++------ interface/src/avatar/Avatar.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/interface/src/avatar/Avatar.cpp b/interface/src/avatar/Avatar.cpp index ddc7b9926d..e561720eaf 100755 --- a/interface/src/avatar/Avatar.cpp +++ b/interface/src/avatar/Avatar.cpp @@ -433,7 +433,11 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { // Add thrusts from leading avatar - const float FOLLOWING_RATE = .02f; + const float FOLLOWING_RATE = 0.02f; + const float MIN_YAW = 5.0f; + const float MIN_PITCH = 1.0f; + const float PITCH_RATE = 0.1f; + const float MIN_YAW_BEFORE_PITCH = 30.0f; if (_leadingAvatar != NULL) { glm::vec3 toTarget = _leadingAvatar->getPosition() - _position; @@ -448,7 +452,7 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { glm::dot(front, toTarget)); float yawAngle = angleBetween(-IDENTITY_FRONT, glm::vec3(toTarget.x, 0.f, toTarget.z)); - if (5.f < glm::abs(yawAngle)){ + if (glm::abs(yawAngle) > MIN_YAW){ if (IDENTITY_RIGHT.x * toTarget.x + IDENTITY_RIGHT.y * toTarget.y + IDENTITY_RIGHT.z * toTarget.z > 0) { _bodyYawDelta -= yawAngle; } else { @@ -456,12 +460,12 @@ void Avatar::updateThrust(float deltaTime, Transmitter * transmitter) { } } - float pitchAngle = glm::abs(90.f - angleBetween(IDENTITY_UP, toTarget)); - if (1.f < glm::abs(pitchAngle) && yawAngle < 30.f){ + float pitchAngle = glm::abs(90.0f - angleBetween(IDENTITY_UP, toTarget)); + if (glm::abs(pitchAngle) > MIN_PITCH && yawAngle < MIN_YAW_BEFORE_PITCH){ if (IDENTITY_UP.x * toTarget.x + IDENTITY_UP.y * toTarget.y + IDENTITY_UP.z * toTarget.z > 0) { - _head.setMousePitch(_head.getMousePitch() + .10f * pitchAngle); + _head.setMousePitch(_head.getMousePitch() + PITCH_RATE * pitchAngle); } else { - _head.setMousePitch(_head.getMousePitch() - .10f * pitchAngle); + _head.setMousePitch(_head.getMousePitch() - PITCH_RATE * pitchAngle); } _head.setPitch(_head.getMousePitch()); } diff --git a/interface/src/avatar/Avatar.h b/interface/src/avatar/Avatar.h index 155028c43f..29a79047ed 100755 --- a/interface/src/avatar/Avatar.h +++ b/interface/src/avatar/Avatar.h @@ -27,8 +27,8 @@ #include "world.h" -static const float MAX_SCALE = 10.f; -static const float MIN_SCALE = .5f; +static const float MAX_SCALE = 1000.f; +static const float MIN_SCALE = .005f; static const float SCALING_RATIO = .05f; static const float SMOOTHING_RATIO = .05f; // 0 < ratio < 1 static const float RESCALING_TOLERANCE = .02f; From 11212ca8d030d916343d990267d4cd63fd81a628 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Thu, 8 Aug 2013 17:48:45 -0700 Subject: [PATCH 19/19] change path of flying bug --- animation-server/src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/animation-server/src/main.cpp b/animation-server/src/main.cpp index dec8f2ea5d..b20ebad37f 100644 --- a/animation-server/src/main.cpp +++ b/animation-server/src/main.cpp @@ -86,8 +86,8 @@ const float BUG_VOXEL_SIZE = 0.0625f / TREE_SCALE; glm::vec3 bugPosition = glm::vec3(BUG_VOXEL_SIZE * 20.0, BUG_VOXEL_SIZE * 30.0, BUG_VOXEL_SIZE * 20.0); glm::vec3 bugDirection = glm::vec3(0, 0, 1); const int VOXELS_PER_BUG = 18; -glm::vec3 bugPathCenter = glm::vec3(BUG_VOXEL_SIZE * 150.0, BUG_VOXEL_SIZE * 30.0, BUG_VOXEL_SIZE * 150.0); -float bugPathRadius = BUG_VOXEL_SIZE * 140.0; +glm::vec3 bugPathCenter = glm::vec3(0.25f,0.15f,0.25f); // glm::vec3(BUG_VOXEL_SIZE * 150.0, BUG_VOXEL_SIZE * 30.0, BUG_VOXEL_SIZE * 150.0); +float bugPathRadius = 0.2f; //BUG_VOXEL_SIZE * 140.0; float bugPathTheta = 0.0 * PI_OVER_180; float bugRotation = 0.0 * PI_OVER_180; float bugAngleDelta = 0.2 * PI_OVER_180;