mirror of
https://github.com/lubosz/overte.git
synced 2025-04-24 14:03:17 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into rec_file_format_tweaks
This commit is contained in:
commit
d2ba1ea769
17 changed files with 367 additions and 60 deletions
|
@ -21,6 +21,7 @@ var roll = 0.0;
|
|||
var rotation = Quat.fromPitchYawRollDegrees(pitch, yaw, roll)
|
||||
|
||||
var originalProperties = {
|
||||
type: "Model",
|
||||
position: { x: MyAvatar.position.x,
|
||||
y: MyAvatar.position.y,
|
||||
z: MyAvatar.position.z },
|
||||
|
@ -37,8 +38,8 @@ var originalProperties = {
|
|||
animationIsPlaying: true,
|
||||
};
|
||||
|
||||
var modelID = Models.addModel(originalProperties);
|
||||
print("Models.addModel()... modelID.creatorTokenID = " + modelID.creatorTokenID);
|
||||
var modelID = Entities.addEntity(originalProperties);
|
||||
print("Entities.addEntity()... modelID.creatorTokenID = " + modelID.creatorTokenID);
|
||||
|
||||
var isPlaying = true;
|
||||
var playPauseEveryWhile = 360;
|
||||
|
@ -48,6 +49,7 @@ var resetFrameEveryWhile = 600;
|
|||
|
||||
function moveModel(deltaTime) {
|
||||
var somethingChanged = false;
|
||||
print("count= " + count);
|
||||
if (count % playPauseEveryWhile == 0) {
|
||||
isPlaying = !isPlaying;
|
||||
print("isPlaying=" + isPlaying);
|
||||
|
@ -56,11 +58,11 @@ function moveModel(deltaTime) {
|
|||
|
||||
if (count % adjustFPSEveryWhile == 0) {
|
||||
if (animationFPS == 30) {
|
||||
animationFPS = 30;
|
||||
} else if (animationFPS == 10) {
|
||||
animationFPS = 10;
|
||||
} else if (animationFPS == 60) {
|
||||
} else if (animationFPS == 10) {
|
||||
animationFPS = 60;
|
||||
} else if (animationFPS == 60) {
|
||||
animationFPS = 30;
|
||||
}
|
||||
print("animationFPS=" + animationFPS);
|
||||
isPlaying = true;
|
||||
|
@ -78,7 +80,7 @@ function moveModel(deltaTime) {
|
|||
// delete it...
|
||||
if (count == moveUntil) {
|
||||
print("calling Models.deleteModel()");
|
||||
Models.deleteModel(modelID);
|
||||
Entities.deleteEntity(modelID);
|
||||
}
|
||||
|
||||
// stop it...
|
||||
|
@ -107,7 +109,7 @@ function moveModel(deltaTime) {
|
|||
resetFrame = false;
|
||||
}
|
||||
|
||||
Models.editModel(modelID, newProperties);
|
||||
Entities.editEntity(modelID, newProperties);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2828,7 +2828,7 @@ function handeMenuEvent(menuItem) {
|
|||
|
||||
array.push({ label: "Lifetime:", value: properties.lifetime.toFixed(decimals) });
|
||||
|
||||
if (properties.type == "Box") {
|
||||
if (properties.type == "Box" || properties.type == "Sphere") {
|
||||
array.push({ label: "Red:", value: properties.color.red });
|
||||
array.push({ label: "Green:", value: properties.color.green });
|
||||
array.push({ label: "Blue:", value: properties.color.blue });
|
||||
|
|
241
examples/entitiesButterflyFlock.js
Normal file
241
examples/entitiesButterflyFlock.js
Normal file
|
@ -0,0 +1,241 @@
|
|||
//
|
||||
// butterflyFlockTest1.js
|
||||
//
|
||||
//
|
||||
// Created by Adrian McCarlie on August 2, 2014
|
||||
// Modified by Brad Hefta-Gaub to use Entities on Sept. 3, 2014
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// This sample script creates a swarm of butterfly entities that fly around the avatar.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
function getRandomFloat(min, max) {
|
||||
return Math.random() * (max - min) + min;
|
||||
}
|
||||
|
||||
// Multiply vector by scalar
|
||||
function vScalarMult(v, s) {
|
||||
var rval = { x: v.x * s, y: v.y * s, z: v.z * s };
|
||||
return rval;
|
||||
}
|
||||
|
||||
function printVector(v) {
|
||||
print(v.x + ", " + v.y + ", " + v.z + "\n");
|
||||
}
|
||||
// Create a random vector with individual lengths between a,b
|
||||
function randVector(a, b) {
|
||||
var rval = { x: a + Math.random() * (b - a), y: a + Math.random() * (b - a), z: a + Math.random() * (b - a) };
|
||||
return rval;
|
||||
}
|
||||
|
||||
// Returns a vector which is fraction of the way between a and b
|
||||
function vInterpolate(a, b, fraction) {
|
||||
var rval = { x: a.x + (b.x - a.x) * fraction, y: a.y + (b.y - a.y) * fraction, z: a.z + (b.z - a.z) * fraction };
|
||||
return rval;
|
||||
}
|
||||
|
||||
var startTimeInSeconds = new Date().getTime() / 1000;
|
||||
|
||||
var lifeTime = 60; // lifetime of the butterflies in seconds!
|
||||
var range = 1.0; // Over what distance in meters do you want the flock to fly around
|
||||
var frame = 0;
|
||||
|
||||
var CHANCE_OF_MOVING = 0.9;
|
||||
var BUTTERFLY_GRAVITY = 0;//-0.06;
|
||||
var BUTTERFLY_FLAP_SPEED = 1.0;
|
||||
var BUTTERFLY_VELOCITY = 0.55;
|
||||
var DISTANCE_IN_FRONT_OF_ME = 1.5;
|
||||
var DISTANCE_ABOVE_ME = 1.5;
|
||||
var flockPosition = Vec3.sum(MyAvatar.position,Vec3.sum(
|
||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_ABOVE_ME),
|
||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_IN_FRONT_OF_ME)));
|
||||
|
||||
|
||||
// set these pitch, yaw, roll to the needed values to orient the model as you want it
|
||||
var pitchInDegrees = 270.0;
|
||||
var yawInDegrees = 0.0;
|
||||
var rollInDegrees = 0.0;
|
||||
var pitchInRadians = pitchInDegrees / 180.0 * Math.PI;
|
||||
var yawInRadians = yawInDegrees / 180.0 * Math.PI;
|
||||
var rollInRadians = rollInDegrees / 180.0 * Math.PI;
|
||||
|
||||
var rotation = Quat.fromPitchYawRollDegrees(pitchInDegrees, yawInDegrees, rollInDegrees);//experimental
|
||||
|
||||
// This is our butterfly object
|
||||
function defineButterfly(entityID, targetPosition) {
|
||||
this.entityID = entityID;
|
||||
this.previousFlapOffset = 0;
|
||||
this.targetPosition = targetPosition;
|
||||
this.moving = false;
|
||||
}
|
||||
|
||||
// Array of butterflies
|
||||
var butterflies = [];
|
||||
var numButterflies = 20;
|
||||
function addButterfly() {
|
||||
// Decide the size of butterfly
|
||||
var color = { red: 100, green: 100, blue: 100 };
|
||||
var size = 0;
|
||||
|
||||
var which = Math.random();
|
||||
if (which < 0.2) {
|
||||
size = 0.08;
|
||||
} else if (which < 0.4) {
|
||||
size = 0.09;
|
||||
} else if (which < 0.6) {
|
||||
size = 0.8;
|
||||
} else if (which < 0.8) {
|
||||
size = 0.8;
|
||||
} else {
|
||||
size = 0.8;
|
||||
}
|
||||
|
||||
flockPosition = Vec3.sum(MyAvatar.position,Vec3.sum(
|
||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_ABOVE_ME),
|
||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_IN_FRONT_OF_ME)));
|
||||
|
||||
var properties = {
|
||||
type: "Model",
|
||||
lifetime: lifeTime,
|
||||
position: Vec3.sum(randVector(-range, range), flockPosition),
|
||||
velocity: { x: 0, y: 0.0, z: 0 },
|
||||
gravity: { x: 0, y: 1.0, z: 0 },
|
||||
damping: 0.1,
|
||||
radius : size,
|
||||
color: color,
|
||||
rotation: rotation,
|
||||
animationURL: "http://business.ozblog.me/objects/butterfly/newButterfly2.fbx",
|
||||
animationIsPlaying: true,
|
||||
modelURL: "http://business.ozblog.me/objects/butterfly/newButterfly2.fbx"
|
||||
};
|
||||
properties.position.z = properties.position.z+1;
|
||||
butterflies.push(new defineButterfly(Entities.addEntity(properties), properties.position));
|
||||
}
|
||||
|
||||
// Generate the butterflies
|
||||
for (var i = 0; i < numButterflies; i++) {
|
||||
addButterfly();
|
||||
}
|
||||
|
||||
// Main update function
|
||||
function updateButterflies(deltaTime) {
|
||||
// Check to see if we've been running long enough that our butterflies are dead
|
||||
var nowTimeInSeconds = new Date().getTime() / 1000;
|
||||
if ((nowTimeInSeconds - startTimeInSeconds) >= lifeTime) {
|
||||
// print("our butterflies are dying, stop our script");
|
||||
Script.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
frame++;
|
||||
// Only update every third frame
|
||||
if ((frame % 3) == 0) {
|
||||
flockPosition = Vec3.sum(MyAvatar.position,Vec3.sum(
|
||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_ABOVE_ME),
|
||||
Vec3.multiply(Quat.getFront(MyAvatar.orientation), DISTANCE_IN_FRONT_OF_ME)));
|
||||
|
||||
// Update all the butterflies
|
||||
for (var i = 0; i < numButterflies; i++) {
|
||||
entityID = butterflies[i].entityID;
|
||||
var properties = Entities.getEntityProperties(entityID);
|
||||
|
||||
if (properties.position.y > flockPosition.y + getRandomFloat(0.0,0.3)){ //0.3 //ceiling
|
||||
properties.gravity.y = - 3.0;
|
||||
properties.damping.y = 1.0;
|
||||
properties.velocity.y = 0;
|
||||
properties.velocity.x = properties.velocity.x;
|
||||
properties.velocity.z = properties.velocity.z;
|
||||
if (properties.velocity.x < 0.5){
|
||||
butterflies[i].moving = false;
|
||||
}
|
||||
if (properties.velocity.z < 0.5){
|
||||
butterflies[i].moving = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (properties.velocity.y <= -0.2) {
|
||||
properties.velocity.y = 0.22;
|
||||
properties.velocity.x = properties.velocity.x;
|
||||
properties.velocity.z = properties.velocity.z;
|
||||
}
|
||||
|
||||
if (properties.position.y < flockPosition.y - getRandomFloat(0.0,0.3)) { //-0.3 // floor
|
||||
properties.velocity.y = 0.9;
|
||||
properties.gravity.y = - 4.0;
|
||||
properties.velocity.x = properties.velocity.x;
|
||||
properties.velocity.z = properties.velocity.z;
|
||||
if (properties.velocity.x < 0.5){
|
||||
butterflies[i].moving = false;
|
||||
}
|
||||
if (properties.velocity.z < 0.5){
|
||||
butterflies[i].moving = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Begin movement by getting a target
|
||||
if (butterflies[i].moving == false) {
|
||||
if (Math.random() < CHANCE_OF_MOVING) {
|
||||
var targetPosition = Vec3.sum(randVector(-range, range), flockPosition);
|
||||
if (targetPosition.x < 0) {
|
||||
targetPosition.x = 0;
|
||||
}
|
||||
if (targetPosition.y < 0) {
|
||||
targetPosition.y = 0;
|
||||
}
|
||||
if (targetPosition.z < 0) {
|
||||
targetPosition.z = 0;
|
||||
}
|
||||
if (targetPosition.x > TREE_SCALE) {
|
||||
targetPosition.x = TREE_SCALE;
|
||||
}
|
||||
if (targetPosition.y > TREE_SCALE) {
|
||||
targetPosition.y = TREE_SCALE;
|
||||
}
|
||||
if (targetPosition.z > TREE_SCALE) {
|
||||
targetPosition.z = TREE_SCALE;
|
||||
}
|
||||
butterflies[i].targetPosition = targetPosition;
|
||||
butterflies[i].moving = true;
|
||||
}
|
||||
}
|
||||
|
||||
// If we are moving, move towards the target
|
||||
if (butterflies[i].moving) {
|
||||
|
||||
var holding = properties.velocity.y;
|
||||
|
||||
var desiredVelocity = Vec3.subtract(butterflies[i].targetPosition, properties.position);
|
||||
desiredVelocity = vScalarMult(Vec3.normalize(desiredVelocity), BUTTERFLY_VELOCITY);
|
||||
|
||||
properties.velocity = vInterpolate(properties.velocity, desiredVelocity, 0.2);
|
||||
properties.velocity.y = holding ;
|
||||
|
||||
|
||||
// If we are near the target, we should get a new target
|
||||
if (Vec3.length(Vec3.subtract(properties.position, butterflies[i].targetPosition)) < (properties.radius / 1.0)) {
|
||||
butterflies[i].moving = false;
|
||||
}
|
||||
|
||||
var yawRads = Math.atan2(properties.velocity.z, properties.velocity.x);
|
||||
yawRads = yawRads + Math.PI / 2.0;
|
||||
var newOrientation = Quat.fromPitchYawRollRadians(pitchInRadians, yawRads, rollInRadians);
|
||||
properties.rotation = newOrientation;
|
||||
}
|
||||
|
||||
// Use a cosine wave offset to make it look like its flapping.
|
||||
var offset = Math.cos(nowTimeInSeconds * BUTTERFLY_FLAP_SPEED) * (properties.radius);
|
||||
properties.position.y = properties.position.y + (offset - butterflies[i].previousFlapOffset);
|
||||
// Change position relative to previous offset.
|
||||
butterflies[i].previousFlapOffset = offset;
|
||||
Entities.editEntity(entityID, properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// register the call back so it fires before each data send
|
||||
Script.update.connect(updateButterflies);
|
|
@ -205,7 +205,7 @@ function mousePressEvent(event) {
|
|||
// Compute trajectories related values
|
||||
var pickRay = Camera.computePickRay(mouseLastX, mouseLastY);
|
||||
var voxelIntersection = Voxels.findRayIntersection(pickRay);
|
||||
var modelIntersection = Models.findRayIntersection(pickRay);
|
||||
var modelIntersection = Entities.findRayIntersection(pickRay);
|
||||
|
||||
position = Camera.getPosition();
|
||||
|
||||
|
@ -218,7 +218,7 @@ function mousePressEvent(event) {
|
|||
|
||||
if (modelIntersection.intersects && modelIntersection.accurate) {
|
||||
distance = modelIntersection.distance;
|
||||
center = modelIntersection.modelProperties.position;
|
||||
center = modelIntersection.properties.position;
|
||||
string = "Inspecting model";
|
||||
}
|
||||
|
||||
|
|
|
@ -42,16 +42,16 @@ function mouseMoveEvent(event) {
|
|||
print("voxelAt.red/green/blue=" + voxelAt.red + ", " + voxelAt.green + ", " + voxelAt.blue);
|
||||
}
|
||||
|
||||
intersection = Models.findRayIntersection(pickRay);
|
||||
intersection = Entities.findRayIntersection(pickRay);
|
||||
if (!intersection.accurate) {
|
||||
print(">>> NOTE: intersection not accurate. will try calling Models.findRayIntersectionBlocking()");
|
||||
intersection = Models.findRayIntersectionBlocking(pickRay);
|
||||
print(">>> NOTE: intersection not accurate. will try calling Entities.findRayIntersectionBlocking()");
|
||||
intersection = Entities.findRayIntersectionBlocking(pickRay);
|
||||
print(">>> AFTER BLOCKING CALL intersection.accurate=" + intersection.accurate);
|
||||
}
|
||||
|
||||
if (intersection.intersects) {
|
||||
print("intersection modelID.id=" + intersection.modelID.id);
|
||||
print("intersection modelProperties.modelURL=" + intersection.modelProperties.modelURL);
|
||||
print("intersection entityID.id=" + intersection.entityID.id);
|
||||
print("intersection properties.modelURL=" + intersection.properties.modelURL);
|
||||
print("intersection face=" + intersection.face);
|
||||
print("intersection distance=" + intersection.distance);
|
||||
print("intersection intersection.x/y/z=" + intersection.intersection.x + ", "
|
||||
|
|
25
examples/twoFallingEntities.js
Normal file
25
examples/twoFallingEntities.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// twoFallingEntities.js
|
||||
//
|
||||
// Creates a red 0.2 meter diameter ball right in front of your avatar that lives for 60 seconds
|
||||
//
|
||||
|
||||
var radius = 0.1;
|
||||
var position = Vec3.sum(MyAvatar.position, Quat.getFront(MyAvatar.orientation));
|
||||
var properties = {
|
||||
type: "Sphere",
|
||||
position: position,
|
||||
velocity: { x: 0, y: 0, z: 0},
|
||||
gravity: { x: 0, y: -0.05, z: 0},
|
||||
radius: radius,
|
||||
damping: 0.999,
|
||||
color: { red: 200, green: 0, blue: 0 },
|
||||
lifetime: 60
|
||||
};
|
||||
|
||||
var newEntity = Entities.addEntity(properties);
|
||||
position.x -= radius * 1.0;
|
||||
properties.position = position;
|
||||
var newEntityTwo = Entities.addEntity(properties);
|
||||
|
||||
Script.stop(); // no need to run anymore
|
|
@ -1315,7 +1315,7 @@ void Application::dropEvent(QDropEvent *event) {
|
|||
const QMimeData *mimeData = event->mimeData();
|
||||
foreach (QUrl url, mimeData->urls()) {
|
||||
if (url.url().toLower().endsWith(SNAPSHOT_EXTENSION)) {
|
||||
snapshotPath = url.url().remove("file://");
|
||||
snapshotPath = url.toLocalFile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3932,6 +3932,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio
|
|||
_previousScriptLocation = previousScriptLocation;
|
||||
QMutexLocker locker(&_settingsMutex);
|
||||
_settings->setValue("LastScriptLocation", _previousScriptLocation);
|
||||
bumpSettings();
|
||||
}
|
||||
|
||||
void Application::loadDialog() {
|
||||
|
|
|
@ -725,6 +725,9 @@ void Menu::loadSettings(QSettings* settings) {
|
|||
Application::getInstance()->updateWindowTitle();
|
||||
NodeList::getInstance()->loadData(settings);
|
||||
|
||||
// notify that a settings has changed
|
||||
connect(&NodeList::getInstance()->getDomainHandler(), &DomainHandler::hostnameChanged, this, &Menu::bumpSettings);
|
||||
|
||||
// MyAvatar caches some menu options, so we have to update them whenever we load settings.
|
||||
// TODO: cache more settings in MyAvatar that are checked with very high frequency.
|
||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
||||
|
@ -894,6 +897,8 @@ void Menu::handleViewFrustumOffsetKeyModifier(int key) {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bumpSettings();
|
||||
}
|
||||
|
||||
void Menu::addDisabledActionAndSeparator(QMenu* destinationMenu, const QString& actionName, int menuItemLocation) {
|
||||
|
@ -1000,7 +1005,7 @@ QAction* Menu::addCheckableActionToQMenuAndActionHash(QMenu* destinationMenu,
|
|||
QAction::NoRole, menuItemLocation);
|
||||
action->setCheckable(true);
|
||||
action->setChecked(checked);
|
||||
connect(action, SIGNAL(changed()), Application::getInstance(), SLOT(bumpSettings()));
|
||||
connect(action, SIGNAL(changed()), this, SLOT(bumpSettings()));
|
||||
|
||||
return action;
|
||||
}
|
||||
|
@ -1042,6 +1047,10 @@ void Menu::aboutApp() {
|
|||
InfoView::forcedShow();
|
||||
}
|
||||
|
||||
void Menu::bumpSettings() {
|
||||
Application::getInstance()->bumpSettings();
|
||||
}
|
||||
|
||||
void sendFakeEnterEvent() {
|
||||
QPoint lastCursorPosition = QCursor::pos();
|
||||
QGLWidget* glWidget = Application::getInstance()->getGLWidget();
|
||||
|
@ -1115,6 +1124,8 @@ void Menu::changePrivateKey() {
|
|||
// pull the private key from the dialog
|
||||
_walletPrivateKey = privateKeyDialog.textValue().toUtf8();
|
||||
}
|
||||
|
||||
bumpSettings();
|
||||
|
||||
sendFakeEnterEvent();
|
||||
}
|
||||
|
@ -1637,10 +1648,12 @@ void Menu::resetLODAdjust() {
|
|||
|
||||
void Menu::setVoxelSizeScale(float sizeScale) {
|
||||
_voxelSizeScale = sizeScale;
|
||||
bumpSettings();
|
||||
}
|
||||
|
||||
void Menu::setBoundaryLevelAdjust(int boundaryLevelAdjust) {
|
||||
_boundaryLevelAdjust = boundaryLevelAdjust;
|
||||
bumpSettings();
|
||||
}
|
||||
|
||||
void Menu::lodTools() {
|
||||
|
@ -1930,5 +1943,6 @@ QString Menu::getSnapshotsLocation() const {
|
|||
|
||||
void Menu::setScriptsLocation(const QString& scriptsLocation) {
|
||||
_scriptsLocation = scriptsLocation;
|
||||
bumpSettings();
|
||||
emit scriptLocationChanged(scriptsLocation);
|
||||
}
|
||||
|
|
|
@ -92,20 +92,20 @@ public:
|
|||
const InboundAudioStream::Settings& getReceivedAudioStreamSettings() const { return _receivedAudioStreamSettings; }
|
||||
void setReceivedAudioStreamSettings(const InboundAudioStream::Settings& receivedAudioStreamSettings) { _receivedAudioStreamSettings = receivedAudioStreamSettings; }
|
||||
float getFieldOfView() const { return _fieldOfView; }
|
||||
void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; }
|
||||
void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; bumpSettings(); }
|
||||
float getRealWorldFieldOfView() const { return _realWorldFieldOfView; }
|
||||
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; }
|
||||
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; bumpSettings(); }
|
||||
float getOculusUIAngularSize() const { return _oculusUIAngularSize; }
|
||||
void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; }
|
||||
void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; bumpSettings(); }
|
||||
float getSixenseReticleMoveSpeed() const { return _sixenseReticleMoveSpeed; }
|
||||
void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; }
|
||||
void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; bumpSettings(); }
|
||||
bool getInvertSixenseButtons() const { return _invertSixenseButtons; }
|
||||
void setInvertSixenseButtons(bool invertSixenseButtons) { _invertSixenseButtons = invertSixenseButtons; }
|
||||
void setInvertSixenseButtons(bool invertSixenseButtons) { _invertSixenseButtons = invertSixenseButtons; bumpSettings(); }
|
||||
|
||||
float getFaceshiftEyeDeflection() const { return _faceshiftEyeDeflection; }
|
||||
void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; }
|
||||
void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; bumpSettings(); }
|
||||
QString getSnapshotsLocation() const;
|
||||
void setSnapshotsLocation(QString snapshotsLocation) { _snapshotsLocation = snapshotsLocation; }
|
||||
void setSnapshotsLocation(QString snapshotsLocation) { _snapshotsLocation = snapshotsLocation; bumpSettings(); }
|
||||
|
||||
const QString& getScriptsLocation() const { return _scriptsLocation; }
|
||||
void setScriptsLocation(const QString& scriptsLocation);
|
||||
|
@ -128,13 +128,13 @@ public:
|
|||
void resetLODAdjust();
|
||||
void setVoxelSizeScale(float sizeScale);
|
||||
float getVoxelSizeScale() const { return _voxelSizeScale; }
|
||||
void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; }
|
||||
void setAutomaticAvatarLOD(bool automaticAvatarLOD) { _automaticAvatarLOD = automaticAvatarLOD; bumpSettings(); }
|
||||
bool getAutomaticAvatarLOD() const { return _automaticAvatarLOD; }
|
||||
void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; }
|
||||
void setAvatarLODDecreaseFPS(float avatarLODDecreaseFPS) { _avatarLODDecreaseFPS = avatarLODDecreaseFPS; bumpSettings(); }
|
||||
float getAvatarLODDecreaseFPS() const { return _avatarLODDecreaseFPS; }
|
||||
void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS = avatarLODIncreaseFPS; }
|
||||
void setAvatarLODIncreaseFPS(float avatarLODIncreaseFPS) { _avatarLODIncreaseFPS = avatarLODIncreaseFPS; bumpSettings(); }
|
||||
float getAvatarLODIncreaseFPS() const { return _avatarLODIncreaseFPS; }
|
||||
void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; }
|
||||
void setAvatarLODDistanceMultiplier(float multiplier) { _avatarLODDistanceMultiplier = multiplier; bumpSettings(); }
|
||||
float getAvatarLODDistanceMultiplier() const { return _avatarLODDistanceMultiplier; }
|
||||
void setBoundaryLevelAdjust(int boundaryLevelAdjust);
|
||||
int getBoundaryLevelAdjust() const { return _boundaryLevelAdjust; }
|
||||
|
@ -145,7 +145,7 @@ public:
|
|||
|
||||
// User Tweakable PPS from Voxel Server
|
||||
int getMaxVoxelPacketsPerSecond() const { return _maxVoxelPacketsPerSecond; }
|
||||
void setMaxVoxelPacketsPerSecond(int maxVoxelPacketsPerSecond) { _maxVoxelPacketsPerSecond = maxVoxelPacketsPerSecond; }
|
||||
void setMaxVoxelPacketsPerSecond(int maxVoxelPacketsPerSecond) { _maxVoxelPacketsPerSecond = maxVoxelPacketsPerSecond; bumpSettings(); }
|
||||
|
||||
QAction* addActionToQMenuAndActionHash(QMenu* destinationMenu,
|
||||
const QString& actionName,
|
||||
|
@ -206,6 +206,7 @@ public slots:
|
|||
|
||||
private slots:
|
||||
void aboutApp();
|
||||
void bumpSettings();
|
||||
void editPreferences();
|
||||
void editAttachments();
|
||||
void editAnimations();
|
||||
|
|
|
@ -759,7 +759,9 @@ void SkeletonModel::computeBoundingShape(const FBXGeometry& geometry) {
|
|||
float capsuleRadius = 0.5f * sqrtf(0.5f * (diagonal.x * diagonal.x + diagonal.z * diagonal.z));
|
||||
_boundingShape.setRadius(capsuleRadius);
|
||||
_boundingShape.setHalfHeight(0.5f * diagonal.y - capsuleRadius);
|
||||
_boundingShapeLocalOffset = 0.5f * (totalExtents.maximum + totalExtents.minimum);
|
||||
|
||||
glm::vec3 rootPosition = _jointStates[geometry.rootJointIndex].getPosition();
|
||||
_boundingShapeLocalOffset = 0.5f * (totalExtents.maximum + totalExtents.minimum) - rootPosition;
|
||||
_boundingRadius = 0.5f * glm::length(diagonal);
|
||||
}
|
||||
|
||||
|
|
|
@ -124,6 +124,10 @@ void ChatWindow::showEvent(QShowEvent* event) {
|
|||
ui->messagePlainTextEdit->setFocus();
|
||||
}
|
||||
|
||||
Application::processEvents();
|
||||
|
||||
scrollToBottom();
|
||||
|
||||
#ifdef HAVE_QXMPP
|
||||
const QXmppClient& xmppClient = XmppClient::getInstance().getXMPPClient();
|
||||
if (xmppClient.isConnected()) {
|
||||
|
|
|
@ -210,7 +210,6 @@ void PreferencesDialog::savePreferences() {
|
|||
|
||||
if (shouldDispatchIdentityPacket) {
|
||||
myAvatar->sendIdentityPacket();
|
||||
Application::getInstance()->bumpSettings();
|
||||
}
|
||||
|
||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::DisableActivityLogger)
|
||||
|
@ -263,4 +262,6 @@ void PreferencesDialog::savePreferences() {
|
|||
|
||||
Application::getInstance()->resizeGL(Application::getInstance()->getGLWidget()->width(),
|
||||
Application::getInstance()->getGLWidget()->height());
|
||||
|
||||
Application::getInstance()->bumpSettings();
|
||||
}
|
||||
|
|
|
@ -88,11 +88,13 @@ bool RearMirrorTools::mousePressEvent(int x, int y) {
|
|||
|
||||
if (_headZoomIconRect.contains(x, y)) {
|
||||
_zoomLevel = HEAD;
|
||||
Application::getInstance()->bumpSettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_bodyZoomIconRect.contains(x, y)) {
|
||||
_zoomLevel = BODY;
|
||||
Application::getInstance()->bumpSettings();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityItemI
|
|||
}
|
||||
|
||||
// use MAX_PACKET_SIZE since it's static and guaranteed to be larger than _maxPacketSize
|
||||
static unsigned char bufferOut[MAX_PACKET_SIZE];
|
||||
unsigned char bufferOut[MAX_PACKET_SIZE];
|
||||
int sizeOut = 0;
|
||||
|
||||
if (EntityItemProperties::encodeEntityEditPacket(type, modelID, properties, &bufferOut[0], _maxPacketSize, sizeOut)) {
|
||||
|
@ -45,7 +45,7 @@ void EntityEditPacketSender::queueEraseEntityMessage(const EntityItemID& entityI
|
|||
return; // bail early
|
||||
}
|
||||
// use MAX_PACKET_SIZE since it's static and guaranteed to be larger than _maxPacketSize
|
||||
static unsigned char bufferOut[MAX_PACKET_SIZE];
|
||||
unsigned char bufferOut[MAX_PACKET_SIZE];
|
||||
size_t sizeOut = 0;
|
||||
if (EntityItemProperties::encodeEraseEntityMessage(entityItemID, &bufferOut[0], _maxPacketSize, sizeOut)) {
|
||||
queueOctreeEditMessage(PacketTypeEntityErase, bufferOut, sizeOut);
|
||||
|
|
|
@ -596,8 +596,14 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
|
|||
packetData->endSubTree();
|
||||
const unsigned char* finalizedData = packetData->getFinalizedData();
|
||||
int finalizedSize = packetData->getFinalizedSize();
|
||||
memcpy(bufferOut, finalizedData, finalizedSize);
|
||||
sizeOut = finalizedSize;
|
||||
if (finalizedSize <= sizeIn) {
|
||||
memcpy(bufferOut, finalizedData, finalizedSize);
|
||||
sizeOut = finalizedSize;
|
||||
} else {
|
||||
qDebug() << "ERROR - encoded edit message doesn't fit in output buffer.";
|
||||
sizeOut = 0;
|
||||
success = false;
|
||||
}
|
||||
} else {
|
||||
packetData->discardSubTree();
|
||||
sizeOut = 0;
|
||||
|
@ -747,8 +753,13 @@ bool EntityItemProperties::encodeEraseEntityMessage(const EntityItemID& entityIt
|
|||
unsigned char* outputBuffer, size_t maxLength, size_t& outputLength) {
|
||||
|
||||
unsigned char* copyAt = outputBuffer;
|
||||
|
||||
uint16_t numberOfIds = 1; // only one entity ID in this message
|
||||
|
||||
if (maxLength < sizeof(numberOfIds) + NUM_BYTES_RFC4122_UUID) {
|
||||
qDebug() << "ERROR - encodeEraseEntityMessage() called with buffer that is too small!";
|
||||
outputLength = 0;
|
||||
return false;
|
||||
}
|
||||
memcpy(copyAt, &numberOfIds, sizeof(numberOfIds));
|
||||
copyAt += sizeof(numberOfIds);
|
||||
outputLength = sizeof(numberOfIds);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// EntityScriptingInterface.cpp
|
||||
// libraries/models/src
|
||||
// libraries/entities/src
|
||||
//
|
||||
// Created by Brad Hefta-Gaub on 12/6/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
@ -19,7 +19,6 @@ EntityScriptingInterface::EntityScriptingInterface() :
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
void EntityScriptingInterface::queueEntityMessage(PacketType packetType,
|
||||
EntityItemID entityID, const EntityItemProperties& properties) {
|
||||
getEntityPacketSender()->queueEditEntityMessage(packetType, entityID, properties);
|
||||
|
@ -35,7 +34,7 @@ EntityItemID EntityScriptingInterface::addEntity(const EntityItemProperties& pro
|
|||
// queue the packet
|
||||
queueEntityMessage(PacketTypeEntityAddOrEdit, id, properties);
|
||||
|
||||
// If we have a local model tree set, then also update it.
|
||||
// If we have a local entity tree set, then also update it.
|
||||
if (_entityTree) {
|
||||
_entityTree->lockForWrite();
|
||||
_entityTree->addEntity(id, properties);
|
||||
|
@ -93,20 +92,20 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(EntityItemID
|
|||
EntityItemID EntityScriptingInterface::editEntity(EntityItemID entityID, const EntityItemProperties& properties) {
|
||||
EntityItemID actualID = entityID;
|
||||
|
||||
// if the model is unknown, attempt to look it up
|
||||
// if the entity is unknown, attempt to look it up
|
||||
if (!entityID.isKnownID) {
|
||||
actualID = EntityItemID::getIDfromCreatorTokenID(entityID.creatorTokenID);
|
||||
}
|
||||
|
||||
// if at this point, we know the id, send the update to the model server
|
||||
// if at this point, we know the id, send the update to the entity server
|
||||
if (actualID.id != UNKNOWN_ENTITY_ID) {
|
||||
entityID.id = actualID.id;
|
||||
entityID.isKnownID = true;
|
||||
queueEntityMessage(PacketTypeEntityAddOrEdit, entityID, properties);
|
||||
}
|
||||
|
||||
// If we have a local model tree set, then also update it. We can do this even if we don't know
|
||||
// the actual id, because we can edit out local models just with creatorTokenID
|
||||
// If we have a local entity tree set, then also update it. We can do this even if we don't know
|
||||
// the actual id, because we can edit out local entities just with creatorTokenID
|
||||
if (_entityTree) {
|
||||
_entityTree->lockForWrite();
|
||||
_entityTree->updateEntity(entityID, properties);
|
||||
|
@ -119,19 +118,19 @@ void EntityScriptingInterface::deleteEntity(EntityItemID entityID) {
|
|||
|
||||
EntityItemID actualID = entityID;
|
||||
|
||||
// if the model is unknown, attempt to look it up
|
||||
// if the entity is unknown, attempt to look it up
|
||||
if (!entityID.isKnownID) {
|
||||
actualID = EntityItemID::getIDfromCreatorTokenID(entityID.creatorTokenID);
|
||||
}
|
||||
|
||||
// if at this point, we know the id, send the update to the model server
|
||||
// if at this point, we know the id, send the update to the entity server
|
||||
if (actualID.id != UNKNOWN_ENTITY_ID) {
|
||||
entityID.id = actualID.id;
|
||||
entityID.isKnownID = true;
|
||||
getEntityPacketSender()->queueEraseEntityMessage(entityID);
|
||||
}
|
||||
|
||||
// If we have a local model tree set, then also update it.
|
||||
// If we have a local entity tree set, then also update it.
|
||||
if (_entityTree) {
|
||||
_entityTree->lockForWrite();
|
||||
_entityTree->deleteEntity(entityID);
|
||||
|
@ -167,12 +166,12 @@ QVector<EntityItemID> EntityScriptingInterface::findEntities(const glm::vec3& ce
|
|||
QVector<EntityItemID> result;
|
||||
if (_entityTree) {
|
||||
_entityTree->lockForRead();
|
||||
QVector<const EntityItem*> models;
|
||||
_entityTree->findEntities(center/(float)TREE_SCALE, radius/(float)TREE_SCALE, models);
|
||||
QVector<const EntityItem*> entities;
|
||||
_entityTree->findEntities(center/(float)TREE_SCALE, radius/(float)TREE_SCALE, entities);
|
||||
_entityTree->unlock();
|
||||
|
||||
foreach (const EntityItem* model, models) {
|
||||
EntityItemID thisEntityItemID(model->getID(), UNKNOWN_ENTITY_TOKEN, true);
|
||||
foreach (const EntityItem* entity, entities) {
|
||||
EntityItemID thisEntityItemID(entity->getID(), UNKNOWN_ENTITY_TOKEN, true);
|
||||
result << thisEntityItemID;
|
||||
}
|
||||
}
|
||||
|
@ -219,11 +218,11 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c
|
|||
QScriptValue obj = engine->newObject();
|
||||
obj.setProperty("intersects", value.intersects);
|
||||
obj.setProperty("accurate", value.accurate);
|
||||
QScriptValue modelItemValue = EntityItemIDtoScriptValue(engine, value.entityID);
|
||||
obj.setProperty("entityID", modelItemValue);
|
||||
QScriptValue entityItemValue = EntityItemIDtoScriptValue(engine, value.entityID);
|
||||
obj.setProperty("entityID", entityItemValue);
|
||||
|
||||
QScriptValue modelPropertiesValue = EntityItemPropertiesToScriptValue(engine, value.properties);
|
||||
obj.setProperty("properties", modelPropertiesValue);
|
||||
QScriptValue propertiesValue = EntityItemPropertiesToScriptValue(engine, value.properties);
|
||||
obj.setProperty("properties", propertiesValue);
|
||||
|
||||
obj.setProperty("distance", value.distance);
|
||||
|
||||
|
@ -262,13 +261,13 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c
|
|||
void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, RayToEntityIntersectionResult& value) {
|
||||
value.intersects = object.property("intersects").toVariant().toBool();
|
||||
value.accurate = object.property("accurate").toVariant().toBool();
|
||||
QScriptValue modelIDValue = object.property("entityID");
|
||||
if (modelIDValue.isValid()) {
|
||||
EntityItemIDfromScriptValue(modelIDValue, value.entityID);
|
||||
QScriptValue entityIDValue = object.property("entityID");
|
||||
if (entityIDValue.isValid()) {
|
||||
EntityItemIDfromScriptValue(entityIDValue, value.entityID);
|
||||
}
|
||||
QScriptValue modelPropertiesValue = object.property("properties");
|
||||
if (modelPropertiesValue.isValid()) {
|
||||
EntityItemPropertiesFromScriptValue(modelPropertiesValue, value.properties);
|
||||
QScriptValue entityPropertiesValue = object.property("properties");
|
||||
if (entityPropertiesValue.isValid()) {
|
||||
EntityItemPropertiesFromScriptValue(entityPropertiesValue, value.properties);
|
||||
}
|
||||
value.distance = object.property("distance").toVariant().toFloat();
|
||||
|
||||
|
|
|
@ -343,6 +343,10 @@ void NodeList::sendDomainServerCheckIn() {
|
|||
PacketType domainPacketType = !_domainHandler.isConnected()
|
||||
? PacketTypeDomainConnectRequest : PacketTypeDomainListRequest;
|
||||
|
||||
if (!_domainHandler.isConnected()) {
|
||||
qDebug() << "Sending connect request to domain-server at" << _domainHandler.getHostname();
|
||||
}
|
||||
|
||||
// construct the DS check in packet
|
||||
QUuid packetUUID = _sessionUUID;
|
||||
|
||||
|
|
Loading…
Reference in a new issue