mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 19:04:27 +02:00
Merge branch 'timers-from-thread' into atp
This commit is contained in:
commit
04d23f6cc2
25 changed files with 694 additions and 92 deletions
582
examples/controllers/breakdanceToy.js
Normal file
582
examples/controllers/breakdanceToy.js
Normal file
|
@ -0,0 +1,582 @@
|
||||||
|
//
|
||||||
|
// breakdanceToy.js
|
||||||
|
// examples
|
||||||
|
//
|
||||||
|
// Created by Brad Hefta-Gaub on August 24, 2015
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
// Computes the penetration between a point and a sphere (centered at the origin)
|
||||||
|
// if point is inside sphere: returns true and stores the result in 'penetration'
|
||||||
|
// (the vector that would move the point outside the sphere)
|
||||||
|
// otherwise returns false
|
||||||
|
function findSphereHit(point, sphereRadius) {
|
||||||
|
var EPSILON = 0.000001; //smallish positive number - used as margin of error for some computations
|
||||||
|
var vectorLength = Vec3.length(point);
|
||||||
|
if (vectorLength < EPSILON) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var distance = vectorLength - sphereRadius;
|
||||||
|
if (distance < 0.0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function findSpherePointHit(sphereCenter, sphereRadius, point) {
|
||||||
|
return findSphereHit(Vec3.subtract(point,sphereCenter), sphereRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
function findSphereSphereHit(firstCenter, firstRadius, secondCenter, secondRadius) {
|
||||||
|
return findSpherePointHit(firstCenter, firstRadius + secondRadius, secondCenter);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getPositionPuppet() {
|
||||||
|
var DISTANCE_IN_FRONT = 2;
|
||||||
|
var DISTANCE_UP = 0.4;
|
||||||
|
var DISTANCE_TO_SIDE = 0.0;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
var left = Vec3.multiply(right, -1);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var leftOffset = Vec3.multiply(left, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function getPositionLeftFront() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.6;
|
||||||
|
var DISTANCE_UP = 0.4;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
var left = Vec3.multiply(right, -1);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var leftOffset = Vec3.multiply(left, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionLeftSide() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.0;
|
||||||
|
var DISTANCE_UP = 0.5;
|
||||||
|
var DISTANCE_TO_SIDE = 0.9;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
var left = Vec3.multiply(right, -1);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var leftOffset = Vec3.multiply(left, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionLeftOverhead() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.2;
|
||||||
|
var DISTANCE_UP = 1;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
var left = Vec3.multiply(right, -1);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var leftOffset = Vec3.multiply(left, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionLeftLowered() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.2;
|
||||||
|
var DISTANCE_DOWN = 0.1;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
var left = Vec3.multiply(right, -1);
|
||||||
|
|
||||||
|
var downOffset = Vec3.multiply(up, DISTANCE_DOWN);
|
||||||
|
var leftOffset = Vec3.multiply(left, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), downOffset );
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionLeftOnBase() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.2;
|
||||||
|
var DISTANCE_DOWN = -0.4;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
var left = Vec3.multiply(right, -1);
|
||||||
|
|
||||||
|
var downOffset = Vec3.multiply(up, DISTANCE_DOWN);
|
||||||
|
var leftOffset = Vec3.multiply(left, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(leftOffset, frontOffset), downOffset );
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionRightFront() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.6;
|
||||||
|
var DISTANCE_UP = 0.4;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var rightOffset = Vec3.multiply(right, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(rightOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionRightSide() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.0;
|
||||||
|
var DISTANCE_UP = 0.5;
|
||||||
|
var DISTANCE_TO_SIDE = 0.9;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var rightOffset = Vec3.multiply(right, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(rightOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionRightOverhead() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.2;
|
||||||
|
var DISTANCE_UP = 1;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
|
||||||
|
var upOffset = Vec3.multiply(up, DISTANCE_UP);
|
||||||
|
var rightOffset = Vec3.multiply(right, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(rightOffset, frontOffset), upOffset);
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionRightLowered() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.2;
|
||||||
|
var DISTANCE_DOWN = 0.1;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
|
||||||
|
var downOffset = Vec3.multiply(up, DISTANCE_DOWN);
|
||||||
|
var rightOffset = Vec3.multiply(right, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(rightOffset, frontOffset), downOffset );
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPositionRightOnBase() {
|
||||||
|
var DISTANCE_IN_FRONT = 0.2;
|
||||||
|
var DISTANCE_DOWN = -0.4;
|
||||||
|
var DISTANCE_TO_SIDE = 0.3;
|
||||||
|
|
||||||
|
var up = Quat.getUp(MyAvatar.orientation);
|
||||||
|
var front = Quat.getFront(MyAvatar.orientation);
|
||||||
|
var right = Quat.getRight(MyAvatar.orientation);
|
||||||
|
|
||||||
|
var downOffset = Vec3.multiply(up, DISTANCE_DOWN);
|
||||||
|
var rightOffset = Vec3.multiply(right, DISTANCE_TO_SIDE);
|
||||||
|
var frontOffset = Vec3.multiply(front, DISTANCE_IN_FRONT);
|
||||||
|
|
||||||
|
var offset = Vec3.sum(Vec3.sum(rightOffset, frontOffset), downOffset );
|
||||||
|
var position = Vec3.sum(MyAvatar.position, offset);
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// We will also demonstrate some 3D overlays. We will create a couple of cubes, spheres, and lines
|
||||||
|
// our 3D cube that moves around...
|
||||||
|
var handSize = 0.25;
|
||||||
|
var leftCubePosition = MyAvatar.getLeftPalmPosition();
|
||||||
|
var rightCubePosition = MyAvatar.getRightPalmPosition();
|
||||||
|
|
||||||
|
var text = Overlays.addOverlay("text", {
|
||||||
|
x: 100,
|
||||||
|
y: 300,
|
||||||
|
width: 900,
|
||||||
|
height: 50,
|
||||||
|
backgroundColor: { red: 0, green: 0, blue: 0},
|
||||||
|
color: { red: 255, green: 255, blue: 255},
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "POSE...",
|
||||||
|
alpha: 1,
|
||||||
|
backgroundAlpha: 0.5
|
||||||
|
});
|
||||||
|
|
||||||
|
var leftHand= Overlays.addOverlay("cube", {
|
||||||
|
position: leftCubePosition,
|
||||||
|
size: handSize,
|
||||||
|
color: { red: 0, green: 0, blue: 255},
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var rightHand= Overlays.addOverlay("cube", {
|
||||||
|
position: rightCubePosition,
|
||||||
|
size: handSize,
|
||||||
|
color: { red: 255, green: 0, blue: 0},
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var targetSize = 0.3;
|
||||||
|
var targetColor = { red: 128, green: 128, blue: 128};
|
||||||
|
var targetColorHit = { red: 0, green: 255, blue: 0};
|
||||||
|
var moveCycleColor = { red: 255, green: 255, blue: 0};
|
||||||
|
|
||||||
|
var TEMPORARY_LIFETIME = 60;
|
||||||
|
|
||||||
|
var animationSettings = JSON.stringify({
|
||||||
|
fps: 30,
|
||||||
|
running: true,
|
||||||
|
loop: true,
|
||||||
|
firstFrame: 1,
|
||||||
|
lastFrame: 10000
|
||||||
|
});
|
||||||
|
|
||||||
|
var naturalDimensions = { x: 1.63, y: 1.67, z: 0.31 };
|
||||||
|
var dimensions = Vec3.multiply(naturalDimensions, 0.3);
|
||||||
|
|
||||||
|
var puppetEntityID = Entities.addEntity({
|
||||||
|
type: "Model",
|
||||||
|
modelURL: "https://hifi-public.s3.amazonaws.com/models/Bboys/bboy1/bboy1.fbx",
|
||||||
|
animationURL: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx",
|
||||||
|
animationSettings: animationSettings,
|
||||||
|
position: getPositionPuppet(),
|
||||||
|
ignoreForCollisions: true,
|
||||||
|
dimensions: dimensions,
|
||||||
|
lifetime: TEMPORARY_LIFETIME
|
||||||
|
});
|
||||||
|
|
||||||
|
var leftOnBase = Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionLeftOnBase(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var leftLowered = Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionLeftLowered(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var leftOverhead = Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionLeftOverhead(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var leftSide= Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionLeftSide(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var leftFront= Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionLeftFront(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var rightOnBase = Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionRightOnBase(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var rightLowered = Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionRightLowered(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var rightOverhead = Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionRightOverhead(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var rightSide= Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionRightSide(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var rightFront= Overlays.addOverlay("cube", {
|
||||||
|
position: getPositionRightFront(),
|
||||||
|
size: targetSize,
|
||||||
|
color: targetColor,
|
||||||
|
alpha: 1,
|
||||||
|
solid: false
|
||||||
|
});
|
||||||
|
|
||||||
|
var startDate = new Date();
|
||||||
|
var lastTime = startDate.getTime();
|
||||||
|
|
||||||
|
var NO_POSE = 0;
|
||||||
|
var LEFT_ON_BASE = 1;
|
||||||
|
var LEFT_OVERHEAD = 2;
|
||||||
|
var LEFT_LOWERED = 4;
|
||||||
|
var LEFT_SIDE = 8;
|
||||||
|
var LEFT_FRONT = 16;
|
||||||
|
var RIGHT_ON_BASE = 32;
|
||||||
|
var RIGHT_OVERHEAD = 64;
|
||||||
|
var RIGHT_LOWERED = 128;
|
||||||
|
var RIGHT_SIDE = 256;
|
||||||
|
var RIGHT_FRONT = 512;
|
||||||
|
|
||||||
|
var lastPoseValue = NO_POSE;
|
||||||
|
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/bboy_pose_to_idle.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/bboy_uprock.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/bboy_uprock_start.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_1.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_2.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_3.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_to_freeze.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_to_idle.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_1.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_2.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_3.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_4.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freezes.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_swipes.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_1.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_1_end.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_1_start.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_2.fbx
|
||||||
|
//http://s3.amazonaws.com/hifi-public/animations/Breakdancing/flair.fbx
|
||||||
|
|
||||||
|
|
||||||
|
var poses = Array();
|
||||||
|
/*
|
||||||
|
poses[0 ] = { name: "no pose", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_OVERHEAD ] = { name: "Left Overhead" , animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_LOWERED ] = { name: "Left Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_SIDE ] = { name: "Left Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_FRONT ] = { name: "Left Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[RIGHT_OVERHEAD ] = { name: "Right Overhead", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[RIGHT_LOWERED ] = { name: "Right Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[RIGHT_SIDE ] = { name: "Right Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[RIGHT_FRONT ] = { name: "Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
*/
|
||||||
|
|
||||||
|
poses[LEFT_ON_BASE + RIGHT_ON_BASE ] = { name: "Left On Base + Right On Base", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
|
||||||
|
poses[LEFT_OVERHEAD + RIGHT_ON_BASE ] = { name: "Left Overhead + Right On Base", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_LOWERED + RIGHT_ON_BASE ] = { name: "Left Lowered + Right On Base", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_SIDE + RIGHT_ON_BASE ] = { name: "Left Side + Right On Base", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_FRONT + RIGHT_ON_BASE ] = { name: "Left Front + Right On Base", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
|
||||||
|
poses[LEFT_ON_BASE + RIGHT_OVERHEAD ] = { name: "Left On Base + Right Overhead", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_ON_BASE + RIGHT_LOWERED ] = { name: "Left On Base + Right Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_ON_BASE + RIGHT_SIDE ] = { name: "Left On Base + Right Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
poses[LEFT_ON_BASE + RIGHT_FRONT ] = { name: "Left On Base + Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx" };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
poses[LEFT_OVERHEAD + RIGHT_OVERHEAD ] = { name: "Left Overhead + Right Overhead", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/bboy_uprock.fbx" };
|
||||||
|
poses[LEFT_LOWERED + RIGHT_OVERHEAD ] = { name: "Left Lowered + Right Overhead", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_1.fbx" };
|
||||||
|
poses[LEFT_SIDE + RIGHT_OVERHEAD ] = { name: "Left Side + Right Overhead", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_2.fbx" };
|
||||||
|
poses[LEFT_FRONT + RIGHT_OVERHEAD ] = { name: "Left Front + Right Overhead", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_3.fbx" };
|
||||||
|
|
||||||
|
poses[LEFT_OVERHEAD + RIGHT_LOWERED ] = { name: "Left Overhead + Right Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_to_freeze.fbx" };
|
||||||
|
poses[LEFT_LOWERED + RIGHT_LOWERED ] = { name: "Left Lowered + Right Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_footwork_to_idle.fbx" };
|
||||||
|
poses[LEFT_SIDE + RIGHT_LOWERED ] = { name: "Left Side + Right Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_1.fbx" };
|
||||||
|
poses[LEFT_FRONT + RIGHT_LOWERED ] = { name: "Left Front + Right Lowered", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_2.fbx" };
|
||||||
|
|
||||||
|
poses[LEFT_OVERHEAD + RIGHT_SIDE ] = { name: "Left Overhead + Right Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_3.fbx" };
|
||||||
|
poses[LEFT_LOWERED + RIGHT_SIDE ] = { name: "Left Lowered + Right Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freeze_var_4.fbx" };
|
||||||
|
poses[LEFT_SIDE + RIGHT_SIDE ] = { name: "Left Side + Right Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_freezes.fbx" };
|
||||||
|
poses[LEFT_FRONT + RIGHT_SIDE ] = { name: "Left Front + Right Side", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_swipes.fbx" };
|
||||||
|
|
||||||
|
poses[LEFT_OVERHEAD + RIGHT_FRONT ] = { name: "Left Overhead + Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock.fbx" };
|
||||||
|
poses[LEFT_LOWERED + RIGHT_FRONT ] = { name: "Left Lowered + Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_1.fbx" };
|
||||||
|
poses[LEFT_SIDE + RIGHT_FRONT ] = { name: "Left Side + Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_2.fbx" };
|
||||||
|
poses[LEFT_FRONT + RIGHT_FRONT ] = { name: "Left Front + Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_1_end.fbx" };
|
||||||
|
|
||||||
|
|
||||||
|
Script.update.connect(function(deltaTime) {
|
||||||
|
var date= new Date();
|
||||||
|
var now= date.getTime();
|
||||||
|
var elapsed = now - lastTime;
|
||||||
|
var inMoveCycle = false;
|
||||||
|
|
||||||
|
var leftHandPos = MyAvatar.getLeftPalmPosition();
|
||||||
|
var rightHandPos = MyAvatar.getRightPalmPosition();
|
||||||
|
|
||||||
|
Overlays.editOverlay(leftHand, { position: leftHandPos } );
|
||||||
|
Overlays.editOverlay(rightHand, { position: rightHandPos } );
|
||||||
|
|
||||||
|
var hitTargetLeftOnBase = findSphereSphereHit(leftHandPos, handSize/2, getPositionLeftOnBase(), targetSize/2);
|
||||||
|
var hitTargetLeftOverhead = findSphereSphereHit(leftHandPos, handSize/2, getPositionLeftOverhead(), targetSize/2);
|
||||||
|
var hitTargetLeftLowered = findSphereSphereHit(leftHandPos, handSize/2, getPositionLeftLowered(), targetSize/2);
|
||||||
|
var hitTargetLeftSide = findSphereSphereHit(leftHandPos, handSize/2, getPositionLeftSide(), targetSize/2);
|
||||||
|
var hitTargetLeftFront = findSphereSphereHit(leftHandPos, handSize/2, getPositionLeftFront(), targetSize/2);
|
||||||
|
|
||||||
|
var hitTargetRightOnBase = findSphereSphereHit(rightHandPos, handSize/2, getPositionRightOnBase(), targetSize/2);
|
||||||
|
var hitTargetRightOverhead = findSphereSphereHit(rightHandPos, handSize/2, getPositionRightOverhead(), targetSize/2);
|
||||||
|
var hitTargetRightLowered = findSphereSphereHit(rightHandPos, handSize/2, getPositionRightLowered(), targetSize/2);
|
||||||
|
var hitTargetRightSide = findSphereSphereHit(rightHandPos, handSize/2, getPositionRightSide(), targetSize/2);
|
||||||
|
var hitTargetRightFront = findSphereSphereHit(rightHandPos, handSize/2, getPositionRightFront(), targetSize/2);
|
||||||
|
|
||||||
|
|
||||||
|
// determine target colors
|
||||||
|
var targetColorLeftOnBase = hitTargetLeftOnBase ? targetColorHit : targetColor;
|
||||||
|
var targetColorLeftOverhead = hitTargetLeftOverhead ? targetColorHit : targetColor;
|
||||||
|
var targetColorLeftLowered = hitTargetLeftLowered ? targetColorHit : targetColor;
|
||||||
|
var targetColorLeftSide = hitTargetLeftSide ? targetColorHit : targetColor;
|
||||||
|
var targetColorLeftFront = hitTargetLeftFront ? targetColorHit : targetColor;
|
||||||
|
|
||||||
|
var targetColorRightOnBase = hitTargetRightOnBase ? targetColorHit : targetColor;
|
||||||
|
var targetColorRightOverhead = hitTargetRightOverhead ? targetColorHit : targetColor;
|
||||||
|
var targetColorRightLowered = hitTargetRightLowered ? targetColorHit : targetColor;
|
||||||
|
var targetColorRightSide = hitTargetRightSide ? targetColorHit : targetColor;
|
||||||
|
var targetColorRightFront = hitTargetRightFront ? targetColorHit : targetColor;
|
||||||
|
|
||||||
|
// calculate a combined arm pose based on left and right hits
|
||||||
|
var poseValue = NO_POSE;
|
||||||
|
poseValue += hitTargetLeftOnBase ? LEFT_ON_BASE : 0;
|
||||||
|
poseValue += hitTargetLeftOverhead ? LEFT_OVERHEAD : 0;
|
||||||
|
poseValue += hitTargetLeftLowered ? LEFT_LOWERED : 0;
|
||||||
|
poseValue += hitTargetLeftSide ? LEFT_SIDE : 0;
|
||||||
|
poseValue += hitTargetLeftFront ? LEFT_FRONT : 0;
|
||||||
|
poseValue += hitTargetRightOnBase ? RIGHT_ON_BASE : 0;
|
||||||
|
poseValue += hitTargetRightOverhead ? RIGHT_OVERHEAD : 0;
|
||||||
|
poseValue += hitTargetRightLowered ? RIGHT_LOWERED : 0;
|
||||||
|
poseValue += hitTargetRightSide ? RIGHT_SIDE : 0;
|
||||||
|
poseValue += hitTargetRightFront ? RIGHT_FRONT : 0;
|
||||||
|
|
||||||
|
if (poses[poseValue] == undefined) {
|
||||||
|
Overlays.editOverlay(text, { text: "no pose -- value:" + poseValue });
|
||||||
|
} else {
|
||||||
|
Overlays.editOverlay(text, { text: "pose:" + poses[poseValue].name + "\n" + "animation:" + poses[poseValue].animation });
|
||||||
|
var props = Entities.getEntityProperties(puppetEntityID);
|
||||||
|
Entities.editEntity(puppetEntityID, {
|
||||||
|
animationURL: poses[poseValue].animation,
|
||||||
|
lifetime: TEMPORARY_LIFETIME + props.age // renew lifetime
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
lastPoseValue = poseValue;
|
||||||
|
|
||||||
|
Overlays.editOverlay(leftOnBase, { position: getPositionLeftOnBase(), color: targetColorLeftOnBase } );
|
||||||
|
Overlays.editOverlay(leftOverhead, { position: getPositionLeftOverhead(), color: targetColorLeftOverhead } );
|
||||||
|
Overlays.editOverlay(leftLowered, { position: getPositionLeftLowered(), color: targetColorLeftLowered } );
|
||||||
|
Overlays.editOverlay(leftSide, { position: getPositionLeftSide() , color: targetColorLeftSide } );
|
||||||
|
Overlays.editOverlay(leftFront, { position: getPositionLeftFront() , color: targetColorLeftFront } );
|
||||||
|
|
||||||
|
Overlays.editOverlay(rightOnBase, { position: getPositionRightOnBase(), color: targetColorRightOnBase } );
|
||||||
|
Overlays.editOverlay(rightOverhead, { position: getPositionRightOverhead(), color: targetColorRightOverhead } );
|
||||||
|
Overlays.editOverlay(rightLowered, { position: getPositionRightLowered(), color: targetColorRightLowered } );
|
||||||
|
Overlays.editOverlay(rightSide, { position: getPositionRightSide() , color: targetColorRightSide } );
|
||||||
|
Overlays.editOverlay(rightFront, { position: getPositionRightFront() , color: targetColorRightFront } );
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function() {
|
||||||
|
Overlays.deleteOverlay(leftHand);
|
||||||
|
Overlays.deleteOverlay(rightHand);
|
||||||
|
|
||||||
|
Overlays.deleteOverlay(text);
|
||||||
|
Overlays.deleteOverlay(leftOnBase);
|
||||||
|
Overlays.deleteOverlay(leftOverhead);
|
||||||
|
Overlays.deleteOverlay(leftLowered);
|
||||||
|
Overlays.deleteOverlay(leftSide);
|
||||||
|
Overlays.deleteOverlay(leftFront);
|
||||||
|
Overlays.deleteOverlay(rightOnBase);
|
||||||
|
Overlays.deleteOverlay(rightOverhead);
|
||||||
|
Overlays.deleteOverlay(rightLowered);
|
||||||
|
Overlays.deleteOverlay(rightSide);
|
||||||
|
Overlays.deleteOverlay(rightFront);
|
||||||
|
|
||||||
|
print("puppetEntityID:"+puppetEntityID);
|
||||||
|
Entities.deleteEntity(puppetEntityID);
|
||||||
|
});
|
|
@ -83,5 +83,11 @@ EntityListTool = function(opts) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
webView.visibilityChanged.connect(function (visible) {
|
||||||
|
if (visible) {
|
||||||
|
that.sendUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
};
|
};
|
||||||
|
|
|
@ -66,6 +66,9 @@ void IceServer::processPacket(std::unique_ptr<udt::Packet> packet) {
|
||||||
|
|
||||||
auto nlPacket = NLPacket::fromBase(std::move(packet));
|
auto nlPacket = NLPacket::fromBase(std::move(packet));
|
||||||
|
|
||||||
|
// make sure that this packet at least looks like something we can read
|
||||||
|
if (nlPacket->getPayloadSize() >= NLPacket::localHeaderSize(PacketType::ICEServerHeartbeat)) {
|
||||||
|
|
||||||
if (nlPacket->getType() == PacketType::ICEServerHeartbeat) {
|
if (nlPacket->getType() == PacketType::ICEServerHeartbeat) {
|
||||||
SharedNetworkPeer peer = addOrUpdateHeartbeatingPeer(*nlPacket);
|
SharedNetworkPeer peer = addOrUpdateHeartbeatingPeer(*nlPacket);
|
||||||
|
|
||||||
|
@ -105,6 +108,7 @@ void IceServer::processPacket(std::unique_ptr<udt::Packet> packet) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SharedNetworkPeer IceServer::addOrUpdateHeartbeatingPeer(NLPacket& packet) {
|
SharedNetworkPeer IceServer::addOrUpdateHeartbeatingPeer(NLPacket& packet) {
|
||||||
|
|
||||||
|
|
|
@ -457,8 +457,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
audioThread->start();
|
audioThread->start();
|
||||||
|
|
||||||
|
QThread* assetThread = new QThread;
|
||||||
QThread* assetThread = new QThread();
|
|
||||||
|
|
||||||
assetThread->setObjectName("Asset Thread");
|
assetThread->setObjectName("Asset Thread");
|
||||||
auto assetClient = DependencyManager::get<AssetClient>();
|
auto assetClient = DependencyManager::get<AssetClient>();
|
||||||
|
@ -467,7 +466,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
assetThread->start();
|
assetThread->start();
|
||||||
|
|
||||||
|
|
||||||
const DomainHandler& domainHandler = nodeList->getDomainHandler();
|
const DomainHandler& domainHandler = nodeList->getDomainHandler();
|
||||||
|
|
||||||
connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
connect(&domainHandler, SIGNAL(hostnameChanged(const QString&)), SLOT(domainChanged(const QString&)));
|
||||||
|
@ -879,6 +877,12 @@ Application::~Application() {
|
||||||
DependencyManager::destroy<ScriptCache>();
|
DependencyManager::destroy<ScriptCache>();
|
||||||
DependencyManager::destroy<SoundCache>();
|
DependencyManager::destroy<SoundCache>();
|
||||||
|
|
||||||
|
// cleanup the AssetClient thread
|
||||||
|
QThread* assetThread = DependencyManager::get<AssetClient>()->thread();
|
||||||
|
DependencyManager::destroy<AssetClient>();
|
||||||
|
assetThread->quit();
|
||||||
|
assetThread->wait();
|
||||||
|
|
||||||
QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
|
QThread* nodeThread = DependencyManager::get<NodeList>()->thread();
|
||||||
|
|
||||||
// remove the NodeList from the DependencyManager
|
// remove the NodeList from the DependencyManager
|
||||||
|
@ -5067,5 +5071,7 @@ void Application::emulateMouse(Hand* hand, float click, float shift, int index)
|
||||||
void Application::crashApplication() {
|
void Application::crashApplication() {
|
||||||
QObject* object = nullptr;
|
QObject* object = nullptr;
|
||||||
bool value = object->isWindowType();
|
bool value = object->isWindowType();
|
||||||
|
Q_UNUSED(value);
|
||||||
|
|
||||||
qCDebug(interfaceapp) << "Intentionally crashed Interface";
|
qCDebug(interfaceapp) << "Intentionally crashed Interface";
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ Menu::Menu() {
|
||||||
addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0,
|
addActionToQMenuAndActionHash(toolsMenu, MenuOption::PackageModel, 0,
|
||||||
qApp, SLOT(packageModel()));
|
qApp, SLOT(packageModel()));
|
||||||
|
|
||||||
MenuWrapper* displayMenu = addMenu(DisplayPlugin::MENU_PATH());
|
addMenu(DisplayPlugin::MENU_PATH());
|
||||||
{
|
{
|
||||||
MenuWrapper* displayModeMenu = addMenu(MenuOption::OutputMenu);
|
MenuWrapper* displayModeMenu = addMenu(MenuOption::OutputMenu);
|
||||||
QActionGroup* displayModeGroup = new QActionGroup(displayModeMenu);
|
QActionGroup* displayModeGroup = new QActionGroup(displayModeMenu);
|
||||||
|
|
|
@ -844,7 +844,6 @@ void MyAvatar::sendKillAvatar() {
|
||||||
DependencyManager::get<NodeList>()->broadcastToNodes(std::move(killPacket), NodeSet() << NodeType::AvatarMixer);
|
DependencyManager::get<NodeList>()->broadcastToNodes(std::move(killPacket), NodeSet() << NodeType::AvatarMixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int counter = 0;
|
|
||||||
void MyAvatar::updateLookAtTargetAvatar() {
|
void MyAvatar::updateLookAtTargetAvatar() {
|
||||||
//
|
//
|
||||||
// Look at the avatar whose eyes are closest to the ray in direction of my avatar's head
|
// Look at the avatar whose eyes are closest to the ray in direction of my avatar's head
|
||||||
|
|
|
@ -45,6 +45,7 @@ WebWindowClass::WebWindowClass(const QString& title, const QString& url, int wid
|
||||||
|
|
||||||
auto dockWidget = new QDockWidget(title, toolWindow);
|
auto dockWidget = new QDockWidget(title, toolWindow);
|
||||||
dockWidget->setFeatures(QDockWidget::DockWidgetMovable);
|
dockWidget->setFeatures(QDockWidget::DockWidgetMovable);
|
||||||
|
connect(dockWidget, &QDockWidget::visibilityChanged, this, &WebWindowClass::visibilityChanged);
|
||||||
|
|
||||||
_webView = new QWebView(dockWidget);
|
_webView = new QWebView(dockWidget);
|
||||||
addEventBridgeToWindowObject();
|
addEventBridgeToWindowObject();
|
||||||
|
|
|
@ -60,6 +60,7 @@ public slots:
|
||||||
void setTitle(const QString& title);
|
void setTitle(const QString& title);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void visibilityChanged(bool visible); // Tool window
|
||||||
void moved(glm::vec2 position);
|
void moved(glm::vec2 position);
|
||||||
void resized(QSizeF size);
|
void resized(QSizeF size);
|
||||||
void closed();
|
void closed();
|
||||||
|
|
|
@ -206,8 +206,6 @@ void ApplicationCompositor::displayOverlayTexture(RenderArgs* renderArgs) {
|
||||||
|
|
||||||
updateTooltips();
|
updateTooltips();
|
||||||
|
|
||||||
auto deviceSize = qApp->getDeviceSize();
|
|
||||||
|
|
||||||
//Handle fading and deactivation/activation of UI
|
//Handle fading and deactivation/activation of UI
|
||||||
gpu::Batch batch;
|
gpu::Batch batch;
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,10 @@ bool OpenGLDisplayPlugin::eventFilter(QObject* receiver, QEvent* event) {
|
||||||
if (QCoreApplication::sendEvent(QCoreApplication::instance(), event)) {
|
if (QCoreApplication::sendEvent(QCoreApplication::instance(), event)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,19 +52,21 @@ protected:
|
||||||
private:
|
private:
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
|
|
||||||
ovrHmd _hmd;
|
|
||||||
float _ipd{ OVR_DEFAULT_IPD };
|
|
||||||
unsigned int _frameIndex;
|
|
||||||
ovrEyeRenderDesc _eyeRenderDescs[2];
|
|
||||||
ovrPosef _eyePoses[2];
|
ovrPosef _eyePoses[2];
|
||||||
ovrVector3f _eyeOffsets[2];
|
|
||||||
ovrFovPort _eyeFovs[2];
|
|
||||||
mat4 _eyeProjections[3];
|
mat4 _eyeProjections[3];
|
||||||
mat4 _compositeEyeProjections[2];
|
mat4 _compositeEyeProjections[2];
|
||||||
uvec2 _desiredFramebufferSize;
|
uvec2 _desiredFramebufferSize;
|
||||||
ovrTrackingState _trackingState;
|
ovrTrackingState _trackingState;
|
||||||
|
|
||||||
#if (OVR_MAJOR_VERSION >= 6)
|
#if (OVR_MAJOR_VERSION >= 6)
|
||||||
|
ovrHmd _hmd;
|
||||||
|
float _ipd{ OVR_DEFAULT_IPD };
|
||||||
|
unsigned int _frameIndex;
|
||||||
|
ovrEyeRenderDesc _eyeRenderDescs[2];
|
||||||
|
ovrVector3f _eyeOffsets[2];
|
||||||
|
ovrFovPort _eyeFovs[2];
|
||||||
|
|
||||||
ovrLayerEyeFov& getSceneLayer();
|
ovrLayerEyeFov& getSceneLayer();
|
||||||
ovrHmdDesc _hmdDesc;
|
ovrHmdDesc _hmdDesc;
|
||||||
SwapFboPtr _sceneFbo;
|
SwapFboPtr _sceneFbo;
|
||||||
|
|
|
@ -34,7 +34,7 @@ const QString & OculusLegacyDisplayPlugin::getName() const {
|
||||||
return NAME;
|
return NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
OculusLegacyDisplayPlugin::OculusLegacyDisplayPlugin() : _ipd(OVR_DEFAULT_IPD) {
|
OculusLegacyDisplayPlugin::OculusLegacyDisplayPlugin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
uvec2 OculusLegacyDisplayPlugin::getRecommendedRenderSize() const {
|
uvec2 OculusLegacyDisplayPlugin::getRecommendedRenderSize() const {
|
||||||
|
|
|
@ -44,7 +44,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
static const QString NAME;
|
static const QString NAME;
|
||||||
|
|
||||||
float _ipd{ OVR_DEFAULT_IPD };
|
|
||||||
ovrHmd _hmd;
|
ovrHmd _hmd;
|
||||||
unsigned int _frameIndex;
|
unsigned int _frameIndex;
|
||||||
ovrTrackingState _trackingState;
|
ovrTrackingState _trackingState;
|
||||||
|
|
|
@ -78,7 +78,7 @@ void StereoDisplayPlugin::activate() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void StereoDisplayPlugin::updateScreen() {
|
void StereoDisplayPlugin::updateScreen() {
|
||||||
for (int i = 0; i < _screenActions.size(); ++i) {
|
for (int i = 0; i < (int) _screenActions.size(); ++i) {
|
||||||
if (_screenActions[i]->isChecked()) {
|
if (_screenActions[i]->isChecked()) {
|
||||||
CONTAINER->setFullscreen(qApp->screens().at(i));
|
CONTAINER->setFullscreen(qApp->screens().at(i));
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,7 +41,6 @@ void GLBackend::do_setViewportTransform(Batch& batch, uint32 paramOffset) {
|
||||||
if (_stereo._pass) {
|
if (_stereo._pass) {
|
||||||
vp.x += vp.z;
|
vp.x += vp.z;
|
||||||
}
|
}
|
||||||
int i = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glViewport(vp.x, vp.y, vp.z, vp.w);
|
glViewport(vp.x, vp.y, vp.z, vp.w);
|
||||||
|
|
|
@ -24,6 +24,11 @@ MessageID AssetClient::_currentID = 0;
|
||||||
|
|
||||||
|
|
||||||
AssetClient::AssetClient() {
|
AssetClient::AssetClient() {
|
||||||
|
|
||||||
|
setCustomDeleter([](Dependency* dependency){
|
||||||
|
static_cast<AssetClient*>(dependency)->deleteLater();
|
||||||
|
});
|
||||||
|
|
||||||
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
|
auto& packetReceiver = DependencyManager::get<NodeList>()->getPacketReceiver();
|
||||||
packetReceiver.registerListener(PacketType::AssetGetInfoReply, this, "handleAssetGetInfoReply");
|
packetReceiver.registerListener(PacketType::AssetGetInfoReply, this, "handleAssetGetInfoReply");
|
||||||
packetReceiver.registerMessageListener(PacketType::AssetGetReply, this, "handleAssetGetReply");
|
packetReceiver.registerMessageListener(PacketType::AssetGetReply, this, "handleAssetGetReply");
|
||||||
|
|
|
@ -55,7 +55,7 @@ std::unique_ptr<SendQueue> SendQueue::create(Socket* socket, HifiSockAddr destin
|
||||||
Q_ASSERT_X(socket, "SendQueue::create", "Must be called with a valid Socket*");
|
Q_ASSERT_X(socket, "SendQueue::create", "Must be called with a valid Socket*");
|
||||||
|
|
||||||
// Setup queue private thread
|
// Setup queue private thread
|
||||||
QThread* thread = new QThread();
|
QThread* thread = new QThread;
|
||||||
thread->setObjectName("Networking: SendQueue " + destination.objectName()); // Name thread for easier debug
|
thread->setObjectName("Networking: SendQueue " + destination.objectName()); // Name thread for easier debug
|
||||||
|
|
||||||
connect(thread, &QThread::started, queue.get(), &SendQueue::run);
|
connect(thread, &QThread::started, queue.get(), &SendQueue::run);
|
||||||
|
|
|
@ -28,7 +28,8 @@ Q_DECLARE_METATYPE(Packet*);
|
||||||
Q_DECLARE_METATYPE(PacketList*);
|
Q_DECLARE_METATYPE(PacketList*);
|
||||||
|
|
||||||
Socket::Socket(QObject* parent) :
|
Socket::Socket(QObject* parent) :
|
||||||
QObject(parent)
|
QObject(parent),
|
||||||
|
_synTimer(new QTimer(this))
|
||||||
{
|
{
|
||||||
qRegisterMetaType<Packet*>();
|
qRegisterMetaType<Packet*>();
|
||||||
qRegisterMetaType<PacketList*>();
|
qRegisterMetaType<PacketList*>();
|
||||||
|
@ -36,10 +37,10 @@ Socket::Socket(QObject* parent) :
|
||||||
connect(&_udpSocket, &QUdpSocket::readyRead, this, &Socket::readPendingDatagrams);
|
connect(&_udpSocket, &QUdpSocket::readyRead, this, &Socket::readPendingDatagrams);
|
||||||
|
|
||||||
// make sure our synchronization method is called every SYN interval
|
// make sure our synchronization method is called every SYN interval
|
||||||
connect(&_synTimer, &QTimer::timeout, this, &Socket::rateControlSync);
|
connect(_synTimer, &QTimer::timeout, this, &Socket::rateControlSync);
|
||||||
|
|
||||||
// start our timer for the synchronization time interval
|
// start our timer for the synchronization time interval
|
||||||
_synTimer.start(_synInterval);
|
_synTimer->start(_synInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Socket::rebind() {
|
void Socket::rebind() {
|
||||||
|
@ -300,10 +301,10 @@ void Socket::rateControlSync() {
|
||||||
connection.second->sync();
|
connection.second->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_synTimer.interval() != _synInterval) {
|
if (_synTimer->interval() != _synInterval) {
|
||||||
// if the _synTimer interval doesn't match the current _synInterval (changes when the CC factory is changed)
|
// if the _synTimer interval doesn't match the current _synInterval (changes when the CC factory is changed)
|
||||||
// then restart it now with the right interval
|
// then restart it now with the right interval
|
||||||
_synTimer.start(_synInterval);
|
_synTimer->start(_synInterval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ private:
|
||||||
std::unordered_map<HifiSockAddr, std::unique_ptr<Connection>> _connectionsHash;
|
std::unordered_map<HifiSockAddr, std::unique_ptr<Connection>> _connectionsHash;
|
||||||
|
|
||||||
int _synInterval = 10; // 10ms
|
int _synInterval = 10; // 10ms
|
||||||
QTimer _synTimer;
|
QTimer* _synTimer;
|
||||||
|
|
||||||
std::unique_ptr<CongestionControlVirtualFactory> _ccFactory { new CongestionControlFactory<DefaultCC>() };
|
std::unique_ptr<CongestionControlVirtualFactory> _ccFactory { new CongestionControlFactory<DefaultCC>() };
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ void compileProgram(ProgramPtr & result, const std::string& vs, const std::strin
|
||||||
Q_UNUSED(err);
|
Q_UNUSED(err);
|
||||||
qWarning() << err.Log().c_str();
|
qWarning() << err.Log().c_str();
|
||||||
Q_ASSERT_X(false, "compileProgram", "Failed to build shader program");
|
Q_ASSERT_X(false, "compileProgram", "Failed to build shader program");
|
||||||
qFatal((const char*)err.Message);
|
qFatal("%s", (const char*) err.Message);
|
||||||
result.reset();
|
result.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,16 +16,16 @@
|
||||||
#include "WebSocketClass.h"
|
#include "WebSocketClass.h"
|
||||||
|
|
||||||
WebSocketClass::WebSocketClass(QScriptEngine* engine, QString url) :
|
WebSocketClass::WebSocketClass(QScriptEngine* engine, QString url) :
|
||||||
_engine(engine),
|
_webSocket(new QWebSocket()),
|
||||||
_webSocket(new QWebSocket())
|
_engine(engine)
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
_webSocket->open(url);
|
_webSocket->open(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketClass::WebSocketClass(QScriptEngine* engine, QWebSocket* qWebSocket) :
|
WebSocketClass::WebSocketClass(QScriptEngine* engine, QWebSocket* qWebSocket) :
|
||||||
_engine(engine),
|
_webSocket(qWebSocket),
|
||||||
_webSocket(qWebSocket)
|
_engine(engine)
|
||||||
{
|
{
|
||||||
initialize();
|
initialize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include "WebSocketServerClass.h"
|
#include "WebSocketServerClass.h"
|
||||||
|
|
||||||
WebSocketServerClass::WebSocketServerClass(QScriptEngine* engine, const QString& serverName, const quint16 port) :
|
WebSocketServerClass::WebSocketServerClass(QScriptEngine* engine, const QString& serverName, const quint16 port) :
|
||||||
_engine(engine),
|
_webSocketServer(serverName, QWebSocketServer::SslMode::NonSecureMode),
|
||||||
_webSocketServer(serverName, QWebSocketServer::SslMode::NonSecureMode)
|
_engine(engine)
|
||||||
{
|
{
|
||||||
if (_webSocketServer.listen(QHostAddress::Any, port)) {
|
if (_webSocketServer.listen(QHostAddress::Any, port)) {
|
||||||
connect(&_webSocketServer, &QWebSocketServer::newConnection, this, &WebSocketServerClass::onNewConnection);
|
connect(&_webSocketServer, &QWebSocketServer::newConnection, this, &WebSocketServerClass::onNewConnection);
|
||||||
|
|
|
@ -378,8 +378,6 @@ glm::mat4 createMatFromQuatAndPos(const glm::quat& q, const glm::vec3& p) {
|
||||||
|
|
||||||
// cancel out roll and pitch
|
// cancel out roll and pitch
|
||||||
glm::quat cancelOutRollAndPitch(const glm::quat& q) {
|
glm::quat cancelOutRollAndPitch(const glm::quat& q) {
|
||||||
glm::vec3 xAxis = q * glm::vec3(1, 0, 0);
|
|
||||||
glm::vec3 yAxis = q * glm::vec3(0, 1, 0);
|
|
||||||
glm::vec3 zAxis = q * glm::vec3(0, 0, 1);
|
glm::vec3 zAxis = q * glm::vec3(0, 0, 1);
|
||||||
|
|
||||||
// cancel out the roll and pitch
|
// cancel out the roll and pitch
|
||||||
|
@ -393,8 +391,6 @@ glm::quat cancelOutRollAndPitch(const glm::quat& q) {
|
||||||
|
|
||||||
// cancel out roll and pitch
|
// cancel out roll and pitch
|
||||||
glm::mat4 cancelOutRollAndPitch(const glm::mat4& m) {
|
glm::mat4 cancelOutRollAndPitch(const glm::mat4& m) {
|
||||||
glm::vec3 xAxis = glm::vec3(m[0]);
|
|
||||||
glm::vec3 yAxis = glm::vec3(m[1]);
|
|
||||||
glm::vec3 zAxis = glm::vec3(m[2]);
|
glm::vec3 zAxis = glm::vec3(m[2]);
|
||||||
|
|
||||||
// cancel out the roll and pitch
|
// cancel out the roll and pitch
|
||||||
|
|
|
@ -19,6 +19,7 @@ GenericThread::GenericThread(QObject* parent) :
|
||||||
_stopThread(false),
|
_stopThread(false),
|
||||||
_isThreaded(false) // assume non-threaded, must call initialize()
|
_isThreaded(false) // assume non-threaded, must call initialize()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericThread::~GenericThread() {
|
GenericThread::~GenericThread() {
|
||||||
|
|
Loading…
Reference in a new issue