Merge branch 'master' of https://github.com/worklist/hifi into 19597

This commit is contained in:
Stojce Slavkovski 2014-05-06 00:24:49 +02:00
commit a5c6d8d996
9 changed files with 40 additions and 20 deletions

View file

@ -369,7 +369,7 @@ void AudioMixer::sendStatsPacket() {
statsObject["average_mixes_per_listener"] = 0.0;
}
// ThreadedAssignment::addPacketStatsAndSendStatsPacket(statsObject);
ThreadedAssignment::addPacketStatsAndSendStatsPacket(statsObject);
_sumListeners = 0;
_sumMixes = 0;

View file

@ -53,7 +53,7 @@ var numModels = modelURLs.length;
function keyPressEvent(event) {
//print("event.text=" + event.text);
debugPrint("event.text=" + event.text);
if (event.text == "ESC") {
if (leftRecentlyDeleted) {
leftRecentlyDeleted = false;
@ -63,7 +63,7 @@ function keyPressEvent(event) {
rightRecentlyDeleted = false;
rightModelAlreadyInHand = false;
}
} else if (event.text == "DELETE") {
} else if (event.text == "DELETE" || event.text == "BACKSPACE") {
if (leftModelAlreadyInHand) {
print("want to delete leftHandModel=" + leftHandModel);
Models.deleteModel(leftHandModel);
@ -122,6 +122,7 @@ function checkControllerSide(whichSide) {
var BUTTON_FWD;
var BUTTON_3;
var palmPosition;
var palmRotation;
var modelAlreadyInHand;
var handMessage;
@ -129,12 +130,14 @@ function checkControllerSide(whichSide) {
BUTTON_FWD = LEFT_BUTTON_FWD;
BUTTON_3 = LEFT_BUTTON_3;
palmPosition = Controller.getSpatialControlPosition(LEFT_PALM);
palmRotation = Controller.getSpatialControlRawRotation(LEFT_PALM);
modelAlreadyInHand = leftModelAlreadyInHand;
handMessage = "LEFT";
} else {
BUTTON_FWD = RIGHT_BUTTON_FWD;
BUTTON_3 = RIGHT_BUTTON_3;
palmPosition = Controller.getSpatialControlPosition(RIGHT_PALM);
palmRotation = Controller.getSpatialControlRawRotation(RIGHT_PALM);
modelAlreadyInHand = rightModelAlreadyInHand;
handMessage = "RIGHT";
}
@ -149,8 +152,7 @@ function checkControllerSide(whichSide) {
if (closestModel.isKnownID) {
//debugPrint
print(handMessage + " HAND- CAUGHT SOMETHING!!");
debugPrint(handMessage + " HAND- CAUGHT SOMETHING!!");
if (whichSide == LEFT_PALM) {
leftModelAlreadyInHand = true;
@ -165,9 +167,10 @@ function checkControllerSide(whichSide) {
y: modelPosition.y,
z: modelPosition.z },
radius: modelRadius,
modelRotation: palmRotation,
};
print(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
debugPrint(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
Models.editModel(closestModel, properties);
@ -189,10 +192,11 @@ function checkControllerSide(whichSide) {
y: modelPosition.y,
z: modelPosition.z },
radius: modelRadius,
modelRotation: palmRotation,
modelURL: modelURLs[currentModelURL]
};
print("modelRadius=" +modelRadius);
debugPrint("modelRadius=" +modelRadius);
newModel = Models.addModel(properties);
if (whichSide == LEFT_PALM) {
@ -225,16 +229,16 @@ function checkControllerSide(whichSide) {
// If holding the model keep it in the palm
if (grabButtonPressed) {
//debugPrint
print(">>>>> " + handMessage + "-MODEL IN HAND, grabbing, hold and move");
debugPrint(">>>>> " + handMessage + "-MODEL IN HAND, grabbing, hold and move");
var modelPosition = getModelHoldPosition(whichSide);
var properties = { position: { x: modelPosition.x,
y: modelPosition.y,
z: modelPosition.z },
radius: modelRadius,
modelRotation: palmRotation,
};
print(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
debugPrint(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
Models.editModel(handModel, properties);
} else {

View file

@ -23,7 +23,6 @@
#include "InterfaceConfig.h"
#include "Util.h"
const int NUM_BBALLS = 200;
class BuckyBalls {
@ -42,9 +41,7 @@ private:
float _bballRadius[NUM_BBALLS];
float _bballColliding[NUM_BBALLS];
int _bballElement[NUM_BBALLS];
int _bballIsGrabbed[2];
int _bballIsGrabbed[2];
};
#endif // hifi_BuckyBalls_h

View file

@ -12,7 +12,7 @@
#include <glm/gtx/quaternion.hpp>
#include "InterfaceConfig.h"
#include "Menu.h"
#include "ModelTreeRenderer.h"
ModelTreeRenderer::ModelTreeRenderer() :
@ -118,6 +118,15 @@ void ModelTreeRenderer::renderElement(OctreeElement* element, RenderArgs* args)
}
}
float ModelTreeRenderer::getSizeScale() const {
return Menu::getInstance()->getVoxelSizeScale();
}
int ModelTreeRenderer::getBoundaryLevelAdjust() const {
return Menu::getInstance()->getBoundaryLevelAdjust();
}
void ModelTreeRenderer::processEraseMessage(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) {
static_cast<ModelTree*>(_tree)->processEraseMessage(dataByteArray, sourceNode);
}

View file

@ -36,6 +36,8 @@ public:
virtual PacketType getMyQueryMessageType() const { return PacketTypeModelQuery; }
virtual PacketType getExpectedPacketType() const { return PacketTypeModelData; }
virtual void renderElement(OctreeElement* element, RenderArgs* args);
virtual float getSizeScale() const;
virtual int getBoundaryLevelAdjust() const;
void update();

View file

@ -79,7 +79,7 @@ qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) {
statsPacketStream << statsObject.toVariantMap();
return writeDatagram(statsPacket, _domainHandler.getSockAddr(), QUuid());
return writeUnverifiedDatagram(statsPacket, _domainHandler.getSockAddr());
}
void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer& sendingNode) {

View file

@ -1208,6 +1208,7 @@ ViewFrustum::location OctreeElement::inFrustum(const ViewFrustum& viewFrustum) c
// By doing this, we don't need to test each child voxel's position vs the LOD boundary
bool OctreeElement::calculateShouldRender(const ViewFrustum* viewFrustum, float voxelScaleSize, int boundaryLevelAdjust) const {
bool shouldRender = false;
if (hasContent()) {
float furthestDistance = furthestDistanceToCamera(*viewFrustum);
float childBoundary = boundaryDistanceForRenderLevel(getLevel() + 1 + boundaryLevelAdjust, voxelScaleSize);

View file

@ -140,19 +140,22 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
bool OctreeRenderer::renderOperation(OctreeElement* element, void* extraData) {
RenderArgs* args = static_cast<RenderArgs*>(extraData);
//if (true || element->isInView(*args->_viewFrustum)) {
if (element->isInView(*args->_viewFrustum)) {
if (element->hasContent()) {
args->_renderer->renderElement(element, args);
if (element->calculateShouldRender(args->_viewFrustum, args->_sizeScale, args->_boundaryLevelAdjust)) {
args->_renderer->renderElement(element, args);
} else {
return false; // if we shouldn't render, then we also should stop recursing.
}
}
return true;
return true; // continue recursing
}
// if not in view stop recursing
return false;
}
void OctreeRenderer::render() {
RenderArgs args = { 0, this, _viewFrustum };
RenderArgs args = { 0, this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust() };
if (_tree) {
_tree->lockForRead();
_tree->recurseTreeWithOperation(renderOperation, &args);

View file

@ -31,6 +31,8 @@ public:
int _renderedItems;
OctreeRenderer* _renderer;
ViewFrustum* _viewFrustum;
float _sizeScale;
int _boundaryLevelAdjust;
};
@ -46,6 +48,8 @@ public:
virtual PacketType getMyQueryMessageType() const = 0;
virtual PacketType getExpectedPacketType() const = 0;
virtual void renderElement(OctreeElement* element, RenderArgs* args) = 0;
virtual float getSizeScale() const { return DEFAULT_OCTREE_SIZE_SCALE; }
virtual int getBoundaryLevelAdjust() const { return 0; }
virtual void setTree(Octree* newTree);