mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:00:13 +02:00
Merge branch 'master' of https://github.com/worklist/hifi into 19597
This commit is contained in:
commit
a5c6d8d996
9 changed files with 40 additions and 20 deletions
|
@ -369,7 +369,7 @@ void AudioMixer::sendStatsPacket() {
|
||||||
statsObject["average_mixes_per_listener"] = 0.0;
|
statsObject["average_mixes_per_listener"] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ThreadedAssignment::addPacketStatsAndSendStatsPacket(statsObject);
|
ThreadedAssignment::addPacketStatsAndSendStatsPacket(statsObject);
|
||||||
|
|
||||||
_sumListeners = 0;
|
_sumListeners = 0;
|
||||||
_sumMixes = 0;
|
_sumMixes = 0;
|
||||||
|
|
|
@ -53,7 +53,7 @@ var numModels = modelURLs.length;
|
||||||
|
|
||||||
|
|
||||||
function keyPressEvent(event) {
|
function keyPressEvent(event) {
|
||||||
//print("event.text=" + event.text);
|
debugPrint("event.text=" + event.text);
|
||||||
if (event.text == "ESC") {
|
if (event.text == "ESC") {
|
||||||
if (leftRecentlyDeleted) {
|
if (leftRecentlyDeleted) {
|
||||||
leftRecentlyDeleted = false;
|
leftRecentlyDeleted = false;
|
||||||
|
@ -63,7 +63,7 @@ function keyPressEvent(event) {
|
||||||
rightRecentlyDeleted = false;
|
rightRecentlyDeleted = false;
|
||||||
rightModelAlreadyInHand = false;
|
rightModelAlreadyInHand = false;
|
||||||
}
|
}
|
||||||
} else if (event.text == "DELETE") {
|
} else if (event.text == "DELETE" || event.text == "BACKSPACE") {
|
||||||
if (leftModelAlreadyInHand) {
|
if (leftModelAlreadyInHand) {
|
||||||
print("want to delete leftHandModel=" + leftHandModel);
|
print("want to delete leftHandModel=" + leftHandModel);
|
||||||
Models.deleteModel(leftHandModel);
|
Models.deleteModel(leftHandModel);
|
||||||
|
@ -122,6 +122,7 @@ function checkControllerSide(whichSide) {
|
||||||
var BUTTON_FWD;
|
var BUTTON_FWD;
|
||||||
var BUTTON_3;
|
var BUTTON_3;
|
||||||
var palmPosition;
|
var palmPosition;
|
||||||
|
var palmRotation;
|
||||||
var modelAlreadyInHand;
|
var modelAlreadyInHand;
|
||||||
var handMessage;
|
var handMessage;
|
||||||
|
|
||||||
|
@ -129,12 +130,14 @@ function checkControllerSide(whichSide) {
|
||||||
BUTTON_FWD = LEFT_BUTTON_FWD;
|
BUTTON_FWD = LEFT_BUTTON_FWD;
|
||||||
BUTTON_3 = LEFT_BUTTON_3;
|
BUTTON_3 = LEFT_BUTTON_3;
|
||||||
palmPosition = Controller.getSpatialControlPosition(LEFT_PALM);
|
palmPosition = Controller.getSpatialControlPosition(LEFT_PALM);
|
||||||
|
palmRotation = Controller.getSpatialControlRawRotation(LEFT_PALM);
|
||||||
modelAlreadyInHand = leftModelAlreadyInHand;
|
modelAlreadyInHand = leftModelAlreadyInHand;
|
||||||
handMessage = "LEFT";
|
handMessage = "LEFT";
|
||||||
} else {
|
} else {
|
||||||
BUTTON_FWD = RIGHT_BUTTON_FWD;
|
BUTTON_FWD = RIGHT_BUTTON_FWD;
|
||||||
BUTTON_3 = RIGHT_BUTTON_3;
|
BUTTON_3 = RIGHT_BUTTON_3;
|
||||||
palmPosition = Controller.getSpatialControlPosition(RIGHT_PALM);
|
palmPosition = Controller.getSpatialControlPosition(RIGHT_PALM);
|
||||||
|
palmRotation = Controller.getSpatialControlRawRotation(RIGHT_PALM);
|
||||||
modelAlreadyInHand = rightModelAlreadyInHand;
|
modelAlreadyInHand = rightModelAlreadyInHand;
|
||||||
handMessage = "RIGHT";
|
handMessage = "RIGHT";
|
||||||
}
|
}
|
||||||
|
@ -149,8 +152,7 @@ function checkControllerSide(whichSide) {
|
||||||
|
|
||||||
if (closestModel.isKnownID) {
|
if (closestModel.isKnownID) {
|
||||||
|
|
||||||
//debugPrint
|
debugPrint(handMessage + " HAND- CAUGHT SOMETHING!!");
|
||||||
print(handMessage + " HAND- CAUGHT SOMETHING!!");
|
|
||||||
|
|
||||||
if (whichSide == LEFT_PALM) {
|
if (whichSide == LEFT_PALM) {
|
||||||
leftModelAlreadyInHand = true;
|
leftModelAlreadyInHand = true;
|
||||||
|
@ -165,9 +167,10 @@ function checkControllerSide(whichSide) {
|
||||||
y: modelPosition.y,
|
y: modelPosition.y,
|
||||||
z: modelPosition.z },
|
z: modelPosition.z },
|
||||||
radius: modelRadius,
|
radius: modelRadius,
|
||||||
|
modelRotation: palmRotation,
|
||||||
};
|
};
|
||||||
|
|
||||||
print(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
|
debugPrint(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
|
||||||
|
|
||||||
Models.editModel(closestModel, properties);
|
Models.editModel(closestModel, properties);
|
||||||
|
|
||||||
|
@ -189,10 +192,11 @@ function checkControllerSide(whichSide) {
|
||||||
y: modelPosition.y,
|
y: modelPosition.y,
|
||||||
z: modelPosition.z },
|
z: modelPosition.z },
|
||||||
radius: modelRadius,
|
radius: modelRadius,
|
||||||
|
modelRotation: palmRotation,
|
||||||
modelURL: modelURLs[currentModelURL]
|
modelURL: modelURLs[currentModelURL]
|
||||||
};
|
};
|
||||||
|
|
||||||
print("modelRadius=" +modelRadius);
|
debugPrint("modelRadius=" +modelRadius);
|
||||||
|
|
||||||
newModel = Models.addModel(properties);
|
newModel = Models.addModel(properties);
|
||||||
if (whichSide == LEFT_PALM) {
|
if (whichSide == LEFT_PALM) {
|
||||||
|
@ -225,16 +229,16 @@ function checkControllerSide(whichSide) {
|
||||||
|
|
||||||
// If holding the model keep it in the palm
|
// If holding the model keep it in the palm
|
||||||
if (grabButtonPressed) {
|
if (grabButtonPressed) {
|
||||||
//debugPrint
|
debugPrint(">>>>> " + handMessage + "-MODEL IN HAND, grabbing, hold and move");
|
||||||
print(">>>>> " + handMessage + "-MODEL IN HAND, grabbing, hold and move");
|
|
||||||
var modelPosition = getModelHoldPosition(whichSide);
|
var modelPosition = getModelHoldPosition(whichSide);
|
||||||
var properties = { position: { x: modelPosition.x,
|
var properties = { position: { x: modelPosition.x,
|
||||||
y: modelPosition.y,
|
y: modelPosition.y,
|
||||||
z: modelPosition.z },
|
z: modelPosition.z },
|
||||||
radius: modelRadius,
|
radius: modelRadius,
|
||||||
|
modelRotation: palmRotation,
|
||||||
};
|
};
|
||||||
|
|
||||||
print(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
|
debugPrint(">>>>>>>>>>>> EDIT MODEL.... modelRadius=" +modelRadius);
|
||||||
|
|
||||||
Models.editModel(handModel, properties);
|
Models.editModel(handModel, properties);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
|
|
||||||
const int NUM_BBALLS = 200;
|
const int NUM_BBALLS = 200;
|
||||||
|
|
||||||
class BuckyBalls {
|
class BuckyBalls {
|
||||||
|
@ -42,9 +41,7 @@ private:
|
||||||
float _bballRadius[NUM_BBALLS];
|
float _bballRadius[NUM_BBALLS];
|
||||||
float _bballColliding[NUM_BBALLS];
|
float _bballColliding[NUM_BBALLS];
|
||||||
int _bballElement[NUM_BBALLS];
|
int _bballElement[NUM_BBALLS];
|
||||||
int _bballIsGrabbed[2];
|
int _bballIsGrabbed[2];
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_BuckyBalls_h
|
#endif // hifi_BuckyBalls_h
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.hpp>
|
||||||
|
|
||||||
#include "InterfaceConfig.h"
|
#include "InterfaceConfig.h"
|
||||||
|
#include "Menu.h"
|
||||||
#include "ModelTreeRenderer.h"
|
#include "ModelTreeRenderer.h"
|
||||||
|
|
||||||
ModelTreeRenderer::ModelTreeRenderer() :
|
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) {
|
void ModelTreeRenderer::processEraseMessage(const QByteArray& dataByteArray, const SharedNodePointer& sourceNode) {
|
||||||
static_cast<ModelTree*>(_tree)->processEraseMessage(dataByteArray, sourceNode);
|
static_cast<ModelTree*>(_tree)->processEraseMessage(dataByteArray, sourceNode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,8 @@ public:
|
||||||
virtual PacketType getMyQueryMessageType() const { return PacketTypeModelQuery; }
|
virtual PacketType getMyQueryMessageType() const { return PacketTypeModelQuery; }
|
||||||
virtual PacketType getExpectedPacketType() const { return PacketTypeModelData; }
|
virtual PacketType getExpectedPacketType() const { return PacketTypeModelData; }
|
||||||
virtual void renderElement(OctreeElement* element, RenderArgs* args);
|
virtual void renderElement(OctreeElement* element, RenderArgs* args);
|
||||||
|
virtual float getSizeScale() const;
|
||||||
|
virtual int getBoundaryLevelAdjust() const;
|
||||||
|
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ qint64 NodeList::sendStatsToDomainServer(const QJsonObject& statsObject) {
|
||||||
|
|
||||||
statsPacketStream << statsObject.toVariantMap();
|
statsPacketStream << statsObject.toVariantMap();
|
||||||
|
|
||||||
return writeDatagram(statsPacket, _domainHandler.getSockAddr(), QUuid());
|
return writeUnverifiedDatagram(statsPacket, _domainHandler.getSockAddr());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer& sendingNode) {
|
void NodeList::timePingReply(const QByteArray& packet, const SharedNodePointer& sendingNode) {
|
||||||
|
|
|
@ -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
|
// 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 OctreeElement::calculateShouldRender(const ViewFrustum* viewFrustum, float voxelScaleSize, int boundaryLevelAdjust) const {
|
||||||
bool shouldRender = false;
|
bool shouldRender = false;
|
||||||
|
|
||||||
if (hasContent()) {
|
if (hasContent()) {
|
||||||
float furthestDistance = furthestDistanceToCamera(*viewFrustum);
|
float furthestDistance = furthestDistanceToCamera(*viewFrustum);
|
||||||
float childBoundary = boundaryDistanceForRenderLevel(getLevel() + 1 + boundaryLevelAdjust, voxelScaleSize);
|
float childBoundary = boundaryDistanceForRenderLevel(getLevel() + 1 + boundaryLevelAdjust, voxelScaleSize);
|
||||||
|
|
|
@ -140,19 +140,22 @@ void OctreeRenderer::processDatagram(const QByteArray& dataByteArray, const Shar
|
||||||
|
|
||||||
bool OctreeRenderer::renderOperation(OctreeElement* element, void* extraData) {
|
bool OctreeRenderer::renderOperation(OctreeElement* element, void* extraData) {
|
||||||
RenderArgs* args = static_cast<RenderArgs*>(extraData);
|
RenderArgs* args = static_cast<RenderArgs*>(extraData);
|
||||||
//if (true || element->isInView(*args->_viewFrustum)) {
|
|
||||||
if (element->isInView(*args->_viewFrustum)) {
|
if (element->isInView(*args->_viewFrustum)) {
|
||||||
if (element->hasContent()) {
|
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
|
// if not in view stop recursing
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OctreeRenderer::render() {
|
void OctreeRenderer::render() {
|
||||||
RenderArgs args = { 0, this, _viewFrustum };
|
RenderArgs args = { 0, this, _viewFrustum, getSizeScale(), getBoundaryLevelAdjust() };
|
||||||
if (_tree) {
|
if (_tree) {
|
||||||
_tree->lockForRead();
|
_tree->lockForRead();
|
||||||
_tree->recurseTreeWithOperation(renderOperation, &args);
|
_tree->recurseTreeWithOperation(renderOperation, &args);
|
||||||
|
|
|
@ -31,6 +31,8 @@ public:
|
||||||
int _renderedItems;
|
int _renderedItems;
|
||||||
OctreeRenderer* _renderer;
|
OctreeRenderer* _renderer;
|
||||||
ViewFrustum* _viewFrustum;
|
ViewFrustum* _viewFrustum;
|
||||||
|
float _sizeScale;
|
||||||
|
int _boundaryLevelAdjust;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +48,8 @@ public:
|
||||||
virtual PacketType getMyQueryMessageType() const = 0;
|
virtual PacketType getMyQueryMessageType() const = 0;
|
||||||
virtual PacketType getExpectedPacketType() const = 0;
|
virtual PacketType getExpectedPacketType() const = 0;
|
||||||
virtual void renderElement(OctreeElement* element, RenderArgs* args) = 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);
|
virtual void setTree(Octree* newTree);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue