mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 19:50:38 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into lobby
This commit is contained in:
commit
cb7a6cb93c
30 changed files with 813 additions and 113 deletions
49
cmake/modules/FindNSIGHT.cmake
Normal file
49
cmake/modules/FindNSIGHT.cmake
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
#
|
||||||
|
# FindNSIGHT.cmake
|
||||||
|
#
|
||||||
|
# Try to find NSIGHT NvToolsExt library and include path.
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# NSIGHT_FOUND
|
||||||
|
# NSIGHT_INCLUDE_DIRS
|
||||||
|
# NSIGHT_LIBRARIES
|
||||||
|
#
|
||||||
|
# Created on 10/27/2014 by Sam Gateau
|
||||||
|
# Copyright 2014 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
|
||||||
|
#
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
|
||||||
|
find_path(NSIGHT_INCLUDE_DIRS
|
||||||
|
NAMES
|
||||||
|
nvToolsExt.h
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
PATHS
|
||||||
|
"C:/Program Files/NVIDIA Corporation/NvToolsExt")
|
||||||
|
|
||||||
|
find_library(NSIGHT_LIBRARY_RELEASE nvToolsExt32_1
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"lib/Win32" "lib"
|
||||||
|
PATHS
|
||||||
|
"C:/Program Files/NVIDIA Corporation/NvToolsExt")
|
||||||
|
find_library(NSIGHT_LIBRARY_DEBUG nvToolsExt32_1
|
||||||
|
PATH_SUFFIXES
|
||||||
|
"lib/Win32" "lib"
|
||||||
|
PATHS
|
||||||
|
"C:/Program Files/NVIDIA Corporation/NvToolsExt")
|
||||||
|
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
select_library_configurations(NSIGHT)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set(NSIGHT_LIBRARIES "${NSIGHT_LIBRARY}")
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(NSIGHT DEFAULT_MSG NSIGHT_INCLUDE_DIRS NSIGHT_LIBRARIES)
|
||||||
|
|
||||||
|
mark_as_advanced(NSIGHT_INCLUDE_DIRS NSIGHT_LIBRARIES NSIGHT_SEARCH_DIRS)
|
||||||
|
|
|
@ -17,9 +17,9 @@ function update(deltaTime) {
|
||||||
if (Math.random() < deltaTime) {
|
if (Math.random() < deltaTime) {
|
||||||
guide = AvatarList.avatarWithDisplayName(leaderName);
|
guide = AvatarList.avatarWithDisplayName(leaderName);
|
||||||
if (guide && !isGuide) {
|
if (guide && !isGuide) {
|
||||||
print("found a guide!");
|
print("Found a tour guide!");
|
||||||
isGuide = true;
|
isGuide = true;
|
||||||
} else if (!isGuide) {
|
} else if (!guide && isGuide) {
|
||||||
print("Lost My Guide");
|
print("Lost My Guide");
|
||||||
isguide = false;
|
isguide = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ var willMove = false;
|
||||||
var warpActive = false;
|
var warpActive = false;
|
||||||
var warpPosition = { x: 0, y: 0, z: 0 };
|
var warpPosition = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
|
var hipsToEyes;
|
||||||
|
|
||||||
// Overlays to show target location
|
// Overlays to show target location
|
||||||
|
|
||||||
var WARP_SPHERE_SIZE = 0.15;
|
var WARP_SPHERE_SIZE = 0.15;
|
||||||
|
@ -43,8 +45,11 @@ var movingWithHead = false;
|
||||||
var headStartPosition, headStartDeltaPitch, headStartFinalPitch, headStartRoll, headStartYaw;
|
var headStartPosition, headStartDeltaPitch, headStartFinalPitch, headStartRoll, headStartYaw;
|
||||||
var deltaYaw = 0.0;
|
var deltaYaw = 0.0;
|
||||||
var keyDownTime = 0.0;
|
var keyDownTime = 0.0;
|
||||||
|
var timeSinceLastUp = 0.0;
|
||||||
var watchAvatar = false;
|
var watchAvatar = false;
|
||||||
var oldMode;
|
var oldMode;
|
||||||
|
var lastYawTurned = 0.0;
|
||||||
|
var startPullbackPosition;
|
||||||
|
|
||||||
function saveCameraState() {
|
function saveCameraState() {
|
||||||
oldMode = Camera.getMode();
|
oldMode = Camera.getMode();
|
||||||
|
@ -65,6 +70,7 @@ function activateWarp() {
|
||||||
var TRIGGER_PULLBACK_DISTANCE = 0.04;
|
var TRIGGER_PULLBACK_DISTANCE = 0.04;
|
||||||
var WATCH_AVATAR_DISTANCE = 1.5;
|
var WATCH_AVATAR_DISTANCE = 1.5;
|
||||||
var MAX_PULLBACK_YAW = 5.0;
|
var MAX_PULLBACK_YAW = 5.0;
|
||||||
|
var MAX_PULLBACK_PITCH = 5.0;
|
||||||
|
|
||||||
var sound = new Sound("http://public.highfidelity.io/sounds/Footsteps/FootstepW2Right-12db.wav");
|
var sound = new Sound("http://public.highfidelity.io/sounds/Footsteps/FootstepW2Right-12db.wav");
|
||||||
function playSound() {
|
function playSound() {
|
||||||
|
@ -74,35 +80,44 @@ function playSound() {
|
||||||
options.volume = 1.0;
|
options.volume = 1.0;
|
||||||
Audio.playSound(sound, options);
|
Audio.playSound(sound, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
var WARP_SMOOTHING = 0.90;
|
var WARP_SMOOTHING = 0.90;
|
||||||
var WARP_START_TIME = 0.50;
|
var WARP_START_TIME = 0.50;
|
||||||
var WARP_START_DISTANCE = 1.0;
|
var WARP_START_DISTANCE = 1.5;
|
||||||
var WARP_SENSITIVITY = 0.15;
|
var WARP_SENSITIVITY = 0.15;
|
||||||
|
|
||||||
|
var fixedHeight = true;
|
||||||
|
|
||||||
function updateWarp() {
|
function updateWarp() {
|
||||||
if (!warpActive) return;
|
if (!warpActive) return;
|
||||||
|
|
||||||
var look = Quat.getFront(Camera.getOrientation());
|
var viewEulers = Quat.safeEulerAngles(Camera.getOrientation());
|
||||||
var deltaPosition = Vec3.subtract(MyAvatar.getTrackedHeadPosition(), headStartPosition);
|
var deltaPosition = Vec3.subtract(MyAvatar.getTrackedHeadPosition(), headStartPosition);
|
||||||
var deltaPitch = MyAvatar.getHeadFinalPitch() - headStartFinalPitch;
|
var deltaPitch = MyAvatar.getHeadFinalPitch() - headStartFinalPitch;
|
||||||
deltaYaw = MyAvatar.getHeadFinalYaw() - headStartYaw;
|
deltaYaw = MyAvatar.getHeadFinalYaw() - headStartYaw;
|
||||||
|
viewEulers.x -= deltaPitch;
|
||||||
|
var look = Quat.getFront(Quat.fromVec3Degrees(viewEulers));
|
||||||
|
|
||||||
willMove = (!watchAvatar && (keyDownTime > WARP_START_TIME));
|
willMove = (keyDownTime > WARP_START_TIME);
|
||||||
|
|
||||||
if (willMove) {
|
if (willMove) {
|
||||||
//var distance = Math.pow((deltaPitch - WARP_PITCH_DEAD_ZONE) * WARP_SENSITIVITY, 2.0);
|
|
||||||
var distance = Math.exp(deltaPitch * WARP_SENSITIVITY) * WARP_START_DISTANCE;
|
var distance = Math.exp(deltaPitch * WARP_SENSITIVITY) * WARP_START_DISTANCE;
|
||||||
var warpDirection = Vec3.normalize({ x: look.x, y: 0, z: look.z });
|
var warpDirection = Vec3.normalize({ x: look.x, y: (fixedHeight ? 0 : look.y), z: look.z });
|
||||||
warpPosition = Vec3.mix(Vec3.sum(MyAvatar.position, Vec3.multiply(warpDirection, distance)), warpPosition, WARP_SMOOTHING);
|
var startPosition = (watchAvatar ? Camera.getPosition(): MyAvatar.getEyePosition());
|
||||||
|
warpPosition = Vec3.mix(Vec3.sum(startPosition, Vec3.multiply(warpDirection, distance)), warpPosition, WARP_SMOOTHING);
|
||||||
}
|
}
|
||||||
|
|
||||||
var height = MyAvatar.getEyePosition().y - MyAvatar.position.y;
|
var height = MyAvatar.getEyePosition().y - MyAvatar.position.y;
|
||||||
|
var cameraPosition;
|
||||||
|
|
||||||
if (!watchAvatar && (Math.abs(deltaYaw) < MAX_PULLBACK_YAW) && (deltaPosition.z > TRIGGER_PULLBACK_DISTANCE)) {
|
if (!watchAvatar &&
|
||||||
|
(Math.abs(deltaYaw) < MAX_PULLBACK_YAW) &&
|
||||||
|
(Math.abs(deltaPitch) < MAX_PULLBACK_PITCH) &&
|
||||||
|
(Vec3.length(deltaPosition) > TRIGGER_PULLBACK_DISTANCE)) {
|
||||||
saveCameraState();
|
saveCameraState();
|
||||||
var cameraPosition = Vec3.subtract(MyAvatar.position, Vec3.multiplyQbyV(Camera.getOrientation(), { x: 0, y: -height, z: -height * WATCH_AVATAR_DISTANCE }));
|
cameraPosition = Vec3.subtract(MyAvatar.position, Vec3.multiplyQbyV(Camera.getOrientation(), { x: 0, y: -height, z: -height * WATCH_AVATAR_DISTANCE }));
|
||||||
Camera.setPosition(cameraPosition);
|
Camera.setPosition(cameraPosition);
|
||||||
|
cameraPosition = Camera.getPosition();
|
||||||
|
startPullbackPosition = cameraPosition;
|
||||||
watchAvatar = true;
|
watchAvatar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,13 +143,14 @@ function finishWarp() {
|
||||||
visible: false,
|
visible: false,
|
||||||
});
|
});
|
||||||
if (willMove) {
|
if (willMove) {
|
||||||
|
warpPosition.y -= hipsToEyes;
|
||||||
MyAvatar.position = warpPosition;
|
MyAvatar.position = warpPosition;
|
||||||
playSound();
|
playSound();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update(deltaTime) {
|
function update(deltaTime) {
|
||||||
|
timeSinceLastUp += deltaTime;
|
||||||
if (movingWithHead) {
|
if (movingWithHead) {
|
||||||
keyDownTime += deltaTime;
|
keyDownTime += deltaTime;
|
||||||
updateWarp();
|
updateWarp();
|
||||||
|
@ -145,6 +161,7 @@ Controller.keyPressEvent.connect(function(event) {
|
||||||
if (event.text == "SPACE" && !event.isAutoRepeat && !movingWithHead) {
|
if (event.text == "SPACE" && !event.isAutoRepeat && !movingWithHead) {
|
||||||
keyDownTime = 0.0;
|
keyDownTime = 0.0;
|
||||||
movingWithHead = true;
|
movingWithHead = true;
|
||||||
|
hipsToEyes = MyAvatar.getEyePosition().y - MyAvatar.position.y;
|
||||||
headStartPosition = MyAvatar.getTrackedHeadPosition();
|
headStartPosition = MyAvatar.getTrackedHeadPosition();
|
||||||
headStartDeltaPitch = MyAvatar.getHeadDeltaPitch();
|
headStartDeltaPitch = MyAvatar.getHeadDeltaPitch();
|
||||||
headStartFinalPitch = MyAvatar.getHeadFinalPitch();
|
headStartFinalPitch = MyAvatar.getHeadFinalPitch();
|
||||||
|
@ -152,26 +169,31 @@ Controller.keyPressEvent.connect(function(event) {
|
||||||
headStartYaw = MyAvatar.getHeadFinalYaw();
|
headStartYaw = MyAvatar.getHeadFinalYaw();
|
||||||
deltaYaw = 0.0;
|
deltaYaw = 0.0;
|
||||||
warpPosition = MyAvatar.position;
|
warpPosition = MyAvatar.position;
|
||||||
|
warpPosition.y += hipsToEyes;
|
||||||
activateWarp();
|
activateWarp();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var TIME_FOR_TURN_AROUND = 0.50;
|
|
||||||
var TIME_FOR_TURN = 0.25;
|
var TIME_FOR_TURN = 0.25;
|
||||||
|
var DOUBLE_CLICK_TIME = 0.50;
|
||||||
var TURN_AROUND = 180.0;
|
var TURN_AROUND = 180.0;
|
||||||
|
|
||||||
Controller.keyReleaseEvent.connect(function(event) {
|
Controller.keyReleaseEvent.connect(function(event) {
|
||||||
if (event.text == "SPACE" && !event.isAutoRepeat) {
|
if (event.text == "SPACE" && !event.isAutoRepeat) {
|
||||||
movingWithHead = false;
|
movingWithHead = false;
|
||||||
if (keyDownTime < TIME_FOR_TURN_AROUND) {
|
if (timeSinceLastUp < DOUBLE_CLICK_TIME) {
|
||||||
if (keyDownTime < TIME_FOR_TURN) {
|
// Turn all the way around
|
||||||
var currentYaw = MyAvatar.getHeadFinalYaw();
|
var turnRemaining = TURN_AROUND - lastYawTurned;
|
||||||
MyAvatar.orientation = Quat.multiply(Quat.fromPitchYawRollDegrees(0, currentYaw, 0), MyAvatar.orientation);
|
lastYawTurned = 0.0;
|
||||||
} else {
|
MyAvatar.orientation = Quat.multiply(Quat.fromPitchYawRollDegrees(0, TURN_AROUND, 0), MyAvatar.orientation);
|
||||||
MyAvatar.orientation = Quat.multiply(Quat.fromPitchYawRollDegrees(0, TURN_AROUND, 0), MyAvatar.orientation);
|
playSound();
|
||||||
}
|
} else if (keyDownTime < TIME_FOR_TURN) {
|
||||||
|
var currentYaw = MyAvatar.getHeadFinalYaw();
|
||||||
|
lastYawTurned = currentYaw;
|
||||||
|
MyAvatar.orientation = Quat.multiply(Quat.fromPitchYawRollDegrees(0, currentYaw, 0), MyAvatar.orientation);
|
||||||
playSound();
|
playSound();
|
||||||
}
|
}
|
||||||
|
timeSinceLastUp = 0.0;
|
||||||
finishWarp();
|
finishWarp();
|
||||||
if (watchAvatar) {
|
if (watchAvatar) {
|
||||||
restoreCameraState();
|
restoreCameraState();
|
||||||
|
|
|
@ -34,7 +34,7 @@ var EASING_MULTIPLIER = 8;
|
||||||
var INITIAL_ZOOM_DISTANCE = 2;
|
var INITIAL_ZOOM_DISTANCE = 2;
|
||||||
var INITIAL_ZOOM_DISTANCE_FIRST_PERSON = 3;
|
var INITIAL_ZOOM_DISTANCE_FIRST_PERSON = 3;
|
||||||
|
|
||||||
EntityCameraTool = function() {
|
CameraManager = function() {
|
||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
that.enabled = false;
|
that.enabled = false;
|
||||||
|
@ -85,24 +85,28 @@ EntityCameraTool = function() {
|
||||||
Camera.setMode("independent");
|
Camera.setMode("independent");
|
||||||
|
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
|
|
||||||
|
cameraTool.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.disable = function() {
|
that.disable = function(ignoreCamera) {
|
||||||
if (!that.enabled) return;
|
if (!that.enabled) return;
|
||||||
that.enabled = false;
|
that.enabled = false;
|
||||||
that.mode = MODE_INACTIVE;
|
that.mode = MODE_INACTIVE;
|
||||||
|
|
||||||
Camera.setMode(that.previousCameraMode);
|
if (!ignoreCamera) {
|
||||||
|
Camera.setMode(that.previousCameraMode);
|
||||||
|
}
|
||||||
|
cameraTool.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.focus = function(entityProperties) {
|
that.focus = function(entityProperties) {
|
||||||
var dim = entityProperties.dimensions;
|
var dim = SelectionManager.worldDimensions;
|
||||||
dim = SelectionManager.worldDimensions;
|
|
||||||
var size = Math.max(dim.x, Math.max(dim.y, dim.z));
|
var size = Math.max(dim.x, Math.max(dim.y, dim.z));
|
||||||
|
|
||||||
that.targetZoomDistance = Math.max(size * FOCUS_ZOOM_SCALE, FOCUS_MIN_ZOOM);
|
that.targetZoomDistance = Math.max(size * FOCUS_ZOOM_SCALE, FOCUS_MIN_ZOOM);
|
||||||
|
|
||||||
that.setFocalPoint(SelectionManager.worldPosition);//entityProperties.position);
|
that.setFocalPoint(SelectionManager.worldPosition);
|
||||||
|
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
}
|
}
|
||||||
|
@ -116,6 +120,42 @@ EntityCameraTool = function() {
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
that.addYaw = function(yaw) {
|
||||||
|
that.targetYaw += yaw;
|
||||||
|
that.updateCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
that.addPitch = function(pitch) {
|
||||||
|
that.targetPitch += pitch;
|
||||||
|
that.updateCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
that.addZoom = function(zoom) {
|
||||||
|
zoom *= that.targetZoomDistance * ZOOM_SCALING;
|
||||||
|
that.targetZoomDistance = Math.min(Math.max(that.targetZoomDistance + zoom, MIN_ZOOM_DISTANCE), MAX_ZOOM_DISTANCE);
|
||||||
|
that.updateCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
that.getZoomPercentage = function() {
|
||||||
|
return (that.zoomDistance - MIN_ZOOM_DISTANCE) / MAX_ZOOM_DISTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
that.setZoomPercentage = function(pct) {
|
||||||
|
that.targetZoomDistance = pct * (MAX_ZOOM_DISTANCE - MIN_ZOOM_DISTANCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
that.pan = function(offset) {
|
||||||
|
var up = Quat.getUp(Camera.getOrientation());
|
||||||
|
var right = Quat.getRight(Camera.getOrientation());
|
||||||
|
|
||||||
|
up = Vec3.multiply(up, offset.y * 0.01 * PAN_ZOOM_SCALE_RATIO * that.zoomDistance);
|
||||||
|
right = Vec3.multiply(right, offset.x * 0.01 * PAN_ZOOM_SCALE_RATIO * that.zoomDistance);
|
||||||
|
|
||||||
|
var dPosition = Vec3.sum(up, right);
|
||||||
|
|
||||||
|
that.moveFocalPoint(dPosition);
|
||||||
|
}
|
||||||
|
|
||||||
that.mouseMoveEvent = function(event) {
|
that.mouseMoveEvent = function(event) {
|
||||||
if (that.enabled && that.mode != MODE_INACTIVE) {
|
if (that.enabled && that.mode != MODE_INACTIVE) {
|
||||||
if (that.mode == MODE_ORBIT) {
|
if (that.mode == MODE_ORBIT) {
|
||||||
|
@ -168,7 +208,7 @@ EntityCameraTool = function() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return cameraTool.mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
that.mouseReleaseEvent = function(event) {
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
@ -185,13 +225,13 @@ EntityCameraTool = function() {
|
||||||
// Scale based on current zoom level
|
// Scale based on current zoom level
|
||||||
dZoom *= that.targetZoomDistance * ZOOM_SCALING;
|
dZoom *= that.targetZoomDistance * ZOOM_SCALING;
|
||||||
|
|
||||||
that.targetZoomDistance = Math.max(that.targetZoomDistance + dZoom, MIN_ZOOM_DISTANCE);
|
that.targetZoomDistance = Math.min(Math.max(that.targetZoomDistance + dZoom, MIN_ZOOM_DISTANCE), MAX_ZOOM_DISTANCE);
|
||||||
|
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
that.updateCamera = function() {
|
that.updateCamera = function() {
|
||||||
if (!that.enabled) return;
|
if (!that.enabled || Camera.getMode() != "independent") return;
|
||||||
|
|
||||||
var yRot = Quat.angleAxis(that.yaw, { x: 0, y: 1, z: 0 });
|
var yRot = Quat.angleAxis(that.yaw, { x: 0, y: 1, z: 0 });
|
||||||
var xRot = Quat.angleAxis(that.pitch, { x: 1, y: 0, z: 0 });
|
var xRot = Quat.angleAxis(that.pitch, { x: 1, y: 0, z: 0 });
|
||||||
|
@ -215,6 +255,10 @@ EntityCameraTool = function() {
|
||||||
|
|
||||||
// Ease the position and orbit of the camera
|
// Ease the position and orbit of the camera
|
||||||
that.update = function(dt) {
|
that.update = function(dt) {
|
||||||
|
if (Camera.getMode() != "independent") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var scale = Math.min(dt * EASING_MULTIPLIER, 1.0);
|
var scale = Math.min(dt * EASING_MULTIPLIER, 1.0);
|
||||||
|
|
||||||
var dYaw = that.targetYaw - that.yaw;
|
var dYaw = that.targetYaw - that.yaw;
|
||||||
|
@ -239,9 +283,336 @@ EntityCameraTool = function() {
|
||||||
that.updateCamera();
|
that.updateCamera();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Last mode that was first or third person
|
||||||
|
var lastAvatarCameraMode = "first person";
|
||||||
|
Camera.modeUpdated.connect(function(newMode) {
|
||||||
|
print("Camera mode has been updated: " + newMode);
|
||||||
|
if (newMode == "first person" || newMode == "third person") {
|
||||||
|
lastAvatarCameraMode = newMode;
|
||||||
|
that.disable(true);
|
||||||
|
} else {
|
||||||
|
that.enable();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Controller.keyReleaseEvent.connect(function (event) {
|
||||||
|
if (event.text == "ESC" && that.enabled) {
|
||||||
|
Camera.setMode(lastAvatarCameraMode);
|
||||||
|
cameraManager.disable(true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
Script.update.connect(that.update);
|
Script.update.connect(that.update);
|
||||||
|
|
||||||
Controller.wheelEvent.connect(that.wheelEvent);
|
Controller.wheelEvent.connect(that.wheelEvent);
|
||||||
|
|
||||||
|
var cameraTool = new CameraTool(that);
|
||||||
|
|
||||||
return that;
|
return that;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ZoomTool = function(opts) {
|
||||||
|
var that = {};
|
||||||
|
|
||||||
|
var position = opts.position || { x: 0, y: 0 };
|
||||||
|
var height = opts.height || 200;
|
||||||
|
var color = opts.color || { red: 255, green: 0, blue: 0 };
|
||||||
|
var arrowButtonSize = opts.buttonSize || 20;
|
||||||
|
var arrowButtonBackground = opts.arrowBackground || { red: 255, green: 255, blue: 255 };
|
||||||
|
var zoomBackground = { red: 128, green: 0, blue: 0 };
|
||||||
|
var zoomHeight = height - (arrowButtonSize * 2);
|
||||||
|
var zoomBarY = position.y + arrowButtonSize,
|
||||||
|
|
||||||
|
var onIncreasePressed = opts.onIncreasePressed;
|
||||||
|
var onDecreasePressed = opts.onDecreasePressed;
|
||||||
|
var onPercentageSet = opts.onPercentageSet;
|
||||||
|
|
||||||
|
var increaseButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x,
|
||||||
|
y: position.y,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: arrowButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "+",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var decreaseButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x,
|
||||||
|
y: position.y + arrowButtonSize + zoomHeight,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: arrowButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "-",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var zoomBar = Overlays.addOverlay("text", {
|
||||||
|
x: position.x + 5,
|
||||||
|
y: zoomBarY,
|
||||||
|
width: 10,
|
||||||
|
height: zoomHeight,
|
||||||
|
color: { red: 0, green: 255, blue: 0 },
|
||||||
|
backgroundColor: zoomBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var zoomHandle = Overlays.addOverlay("text", {
|
||||||
|
x: position.x,
|
||||||
|
y: position.y + arrowButtonSize,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: 10,
|
||||||
|
backgroundColor: { red: 0, green: 255, blue: 0 },
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
var allOverlays = [
|
||||||
|
increaseButton,
|
||||||
|
decreaseButton,
|
||||||
|
zoomBar,
|
||||||
|
zoomHandle,
|
||||||
|
];
|
||||||
|
|
||||||
|
that.destroy = function() {
|
||||||
|
for (var i = 0; i < allOverlays.length; i++) {
|
||||||
|
Overlays.deleteOverlay(allOverlays[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
that.setVisible = function(visible) {
|
||||||
|
for (var i = 0; i < allOverlays.length; i++) {
|
||||||
|
Overlays.editOverlay(allOverlays[i], { visible: visible });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
that.setZoomPercentage = function(pct) {
|
||||||
|
var yOffset = (zoomHeight - 10) * pct;
|
||||||
|
Overlays.editOverlay(zoomHandle, {
|
||||||
|
y: position.y + arrowButtonSize + yOffset,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
||||||
|
var clicked = false;
|
||||||
|
if (clickedOverlay == increaseButton) {
|
||||||
|
if (onIncreasePressed) onIncreasePressed();
|
||||||
|
clicked = true;
|
||||||
|
} else if (clickedOverlay == decreaseButton) {
|
||||||
|
if (onDecreasePressed) onDecreasePressed();
|
||||||
|
clicked = true;
|
||||||
|
} else if (clickedOverlay == zoomBar) {
|
||||||
|
if (onPercentageSet) onPercentageSet((event.y - zoomBarY) / zoomHeight);
|
||||||
|
clicked = true;
|
||||||
|
}
|
||||||
|
return clicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
||||||
|
var ArrowTool = function(opts) {
|
||||||
|
var that = {};
|
||||||
|
|
||||||
|
var position = opts.position || { x: 0, y: 0 };
|
||||||
|
var arrowButtonSize = opts.buttonSize || 20;
|
||||||
|
var color = opts.color || { red: 255, green: 0, blue: 0 };
|
||||||
|
var arrowButtonBackground = opts.arrowBackground || { red: 255, green: 255, blue: 255 };
|
||||||
|
var centerButtonBackground = opts.centerBackground || { red: 255, green: 255, blue: 255 };
|
||||||
|
var onUpPressed = opts.onUpPressed;
|
||||||
|
var onDownPressed = opts.onDownPressed;
|
||||||
|
var onLeftPressed = opts.onLeftPressed;
|
||||||
|
var onRightPressed = opts.onRightPressed;
|
||||||
|
var onCenterPressed = opts.onCenterPressed;
|
||||||
|
|
||||||
|
var upButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x + arrowButtonSize,
|
||||||
|
y: position.y,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: arrowButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "^",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var leftButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x,
|
||||||
|
y: position.y + arrowButtonSize,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: arrowButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "<",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var rightButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x + (arrowButtonSize * 2),
|
||||||
|
y: position.y + arrowButtonSize,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: arrowButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: ">",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var downButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x + arrowButtonSize,
|
||||||
|
y: position.y + (arrowButtonSize * 2),
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: arrowButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "v",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
var centerButton = Overlays.addOverlay("text", {
|
||||||
|
x: position.x + arrowButtonSize,
|
||||||
|
y: position.y + arrowButtonSize,
|
||||||
|
width: arrowButtonSize,
|
||||||
|
height: arrowButtonSize,
|
||||||
|
color: color,
|
||||||
|
backgroundColor: centerButtonBackground,
|
||||||
|
topMargin: 4,
|
||||||
|
leftMargin: 4,
|
||||||
|
text: "",
|
||||||
|
alpha: 1.0,
|
||||||
|
visible: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
var allOverlays = [
|
||||||
|
upButton,
|
||||||
|
downButton,
|
||||||
|
leftButton,
|
||||||
|
rightButton,
|
||||||
|
centerButton,
|
||||||
|
];
|
||||||
|
|
||||||
|
that.destroy = function() {
|
||||||
|
for (var i = 0; i < allOverlays.length; i++) {
|
||||||
|
Overlays.deleteOverlay(allOverlays[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
that.setVisible = function(visible) {
|
||||||
|
for (var i = 0; i < allOverlays.length; i++) {
|
||||||
|
Overlays.editOverlay(allOverlays[i], { visible: visible });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
that.mouseReleaseEvent = function(event) {
|
||||||
|
var clickedOverlay = Overlays.getOverlayAtPoint({x: event.x, y: event.y});
|
||||||
|
var clicked = false;
|
||||||
|
if (clickedOverlay == leftButton) {
|
||||||
|
if (onLeftPressed) onLeftPressed();
|
||||||
|
clicked = true;
|
||||||
|
} else if (clickedOverlay == rightButton) {
|
||||||
|
if (onRightPressed) onRightPressed();
|
||||||
|
clicked = true;
|
||||||
|
} else if (clickedOverlay == upButton) {
|
||||||
|
if (onUpPressed) onUpPressed();
|
||||||
|
clicked = true;
|
||||||
|
} else if (clickedOverlay == downButton) {
|
||||||
|
if (onDownPressed) onDownPressed();
|
||||||
|
clicked = true;
|
||||||
|
} else if (clickedOverlay == centerButton) {
|
||||||
|
if (onCenterPressed) onCenterPressed();
|
||||||
|
clicked = true;
|
||||||
|
}
|
||||||
|
return clicked;
|
||||||
|
}
|
||||||
|
|
||||||
|
return that;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CameraTool = function(cameraManager) {
|
||||||
|
var that = {};
|
||||||
|
|
||||||
|
var toolsPosition = { x: 20, y: 280 };
|
||||||
|
var orbitToolPosition = toolsPosition;
|
||||||
|
var panToolPosition = { x: toolsPosition.x + 80, y: toolsPosition.y };
|
||||||
|
var zoomToolPosition = { x: toolsPosition.x + 20, y: toolsPosition.y + 80 };
|
||||||
|
|
||||||
|
var orbitIncrement = 15;
|
||||||
|
orbitTool = ArrowTool({
|
||||||
|
position: orbitToolPosition,
|
||||||
|
arrowBackground: { red: 192, green: 192, blue: 192 },
|
||||||
|
centerBackground: { red: 128, green: 128, blue: 255 },
|
||||||
|
color: { red: 0, green: 0, blue: 0 },
|
||||||
|
onUpPressed: function() { cameraManager.addPitch(orbitIncrement); },
|
||||||
|
onDownPressed: function() { cameraManager.addPitch(-orbitIncrement); },
|
||||||
|
onLeftPressed: function() { cameraManager.addYaw(-orbitIncrement); },
|
||||||
|
onRightPressed: function() { cameraManager.addYaw(orbitIncrement); },
|
||||||
|
onCenterPressed: function() { cameraManager.focus(); },
|
||||||
|
});
|
||||||
|
panTool = ArrowTool({
|
||||||
|
position: panToolPosition,
|
||||||
|
arrowBackground: { red: 192, green: 192, blue: 192 },
|
||||||
|
centerBackground: { red: 128, green: 128, blue: 255 },
|
||||||
|
color: { red: 0, green: 0, blue: 0 },
|
||||||
|
onUpPressed: function() { cameraManager.pan({ x: 0, y: 15 }); },
|
||||||
|
onDownPressed: function() { cameraManager.pan({ x: 0, y: -15 }); },
|
||||||
|
onLeftPressed: function() { cameraManager.pan({ x: -15, y: 0 }); },
|
||||||
|
onRightPressed: function() { cameraManager.pan({ x: 15, y: 0 }); },
|
||||||
|
});
|
||||||
|
zoomTool = ZoomTool({
|
||||||
|
position: zoomToolPosition,
|
||||||
|
arrowBackground: { red: 192, green: 192, blue: 192 },
|
||||||
|
color: { red: 0, green: 0, blue: 0 },
|
||||||
|
onIncreasePressed: function() { cameraManager.addZoom(-10); },
|
||||||
|
onDecreasePressed: function() { cameraManager.addZoom(10); },
|
||||||
|
onPercentageSet: function(pct) { cameraManager.setZoomPercentage(pct); }
|
||||||
|
});
|
||||||
|
|
||||||
|
Script.scriptEnding.connect(function() {
|
||||||
|
orbitTool.destroy();
|
||||||
|
panTool.destroy();
|
||||||
|
zoomTool.destroy();
|
||||||
|
});
|
||||||
|
|
||||||
|
that.mousePressEvent = function(event) {
|
||||||
|
return orbitTool.mouseReleaseEvent(event)
|
||||||
|
|| panTool.mouseReleaseEvent(event)
|
||||||
|
|| zoomTool.mouseReleaseEvent(event);
|
||||||
|
};
|
||||||
|
|
||||||
|
that.setVisible = function(visible) {
|
||||||
|
orbitTool.setVisible(visible);
|
||||||
|
panTool.setVisible(visible);
|
||||||
|
zoomTool.setVisible(visible);
|
||||||
|
};
|
||||||
|
|
||||||
|
Script.update.connect(function() {
|
||||||
|
cameraManager.getZoomPercentage();
|
||||||
|
zoomTool.setZoomPercentage(cameraManager.getZoomPercentage());
|
||||||
|
});
|
||||||
|
|
||||||
|
that.setVisible(false);
|
||||||
|
|
||||||
|
return that;
|
||||||
|
};
|
||||||
|
|
|
@ -19,7 +19,6 @@ SPACE_WORLD = "world";
|
||||||
SelectionManager = (function() {
|
SelectionManager = (function() {
|
||||||
var that = {};
|
var that = {};
|
||||||
|
|
||||||
|
|
||||||
that.savedProperties = {};
|
that.savedProperties = {};
|
||||||
|
|
||||||
that.eventListener = null;
|
that.eventListener = null;
|
||||||
|
@ -927,7 +926,6 @@ SelectionDisplay = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
that.updateHandles = function() {
|
that.updateHandles = function() {
|
||||||
// print("Updating handles");
|
|
||||||
if (SelectionManager.selections.length == 0) {
|
if (SelectionManager.selections.length == 0) {
|
||||||
that.setOverlaysVisible(false);
|
that.setOverlaysVisible(false);
|
||||||
return;
|
return;
|
||||||
|
@ -1134,17 +1132,30 @@ SelectionDisplay = (function () {
|
||||||
UndoStack.pushCommand(applyEntityProperties, undoData, applyEntityProperties, redoData);
|
UndoStack.pushCommand(applyEntityProperties, undoData, applyEntityProperties, redoData);
|
||||||
}
|
}
|
||||||
|
|
||||||
var lastXZPick = null;
|
var initialXZPick = null;
|
||||||
|
var isConstrained = false;
|
||||||
|
var startPosition = null;
|
||||||
var translateXZTool = {
|
var translateXZTool = {
|
||||||
mode: 'TRANSLATE_XZ',
|
mode: 'TRANSLATE_XZ',
|
||||||
onBegin: function(event) {
|
onBegin: function(event) {
|
||||||
SelectionManager.saveProperties();
|
SelectionManager.saveProperties();
|
||||||
var position = SelectionManager.worldPosition;
|
startPosition = SelectionManager.worldPosition;
|
||||||
var dimensions = SelectionManager.worldDimensions;
|
var dimensions = SelectionManager.worldDimensions;
|
||||||
var bottom = position.y - (dimensions.y / 2)
|
|
||||||
|
|
||||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
var pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
lastXZPick = rayPlaneIntersection(pickRay, position, { x: 0, y: 1, z: 0 });
|
initialXZPick = rayPlaneIntersection(pickRay, startPosition, { x: 0, y: 1, z: 0 });
|
||||||
|
|
||||||
|
// Duplicate entities if alt is pressed. This will make a
|
||||||
|
// copy of the selected entities and move the _original_ entities, not
|
||||||
|
// the new ones.
|
||||||
|
if (event.isAlt) {
|
||||||
|
for (var otherEntityID in SelectionManager.savedProperties) {
|
||||||
|
var properties = SelectionManager.savedProperties[otherEntityID];
|
||||||
|
var entityID = Entities.addEntity(properties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isConstrained = false;
|
||||||
},
|
},
|
||||||
onEnd: function(event, reason) {
|
onEnd: function(event, reason) {
|
||||||
if (reason == 'cancel') {
|
if (reason == 'cancel') {
|
||||||
|
@ -1156,6 +1167,8 @@ SelectionDisplay = (function () {
|
||||||
} else {
|
} else {
|
||||||
pushCommandForSelections();
|
pushCommandForSelections();
|
||||||
}
|
}
|
||||||
|
Overlays.editOverlay(xRailOverlay, { visible: false });
|
||||||
|
Overlays.editOverlay(zRailOverlay, { visible: false });
|
||||||
},
|
},
|
||||||
onMove: function(event) {
|
onMove: function(event) {
|
||||||
if (!entitySelected || mode !== "TRANSLATE_XZ") {
|
if (!entitySelected || mode !== "TRANSLATE_XZ") {
|
||||||
|
@ -1170,26 +1183,47 @@ SelectionDisplay = (function () {
|
||||||
Quat.getFront(lastCameraOrientation));
|
Quat.getFront(lastCameraOrientation));
|
||||||
|
|
||||||
var vector = Vec3.subtract(newIntersection, lastPlaneIntersection);
|
var vector = Vec3.subtract(newIntersection, lastPlaneIntersection);
|
||||||
|
|
||||||
var pickRay = Camera.computePickRay(event.x, event.y);
|
|
||||||
var pick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, { x: 0, y: 1, z: 0 });
|
var pick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, { x: 0, y: 1, z: 0 });
|
||||||
vector = Vec3.subtract(pick, lastXZPick);
|
var vector = Vec3.subtract(pick, initialXZPick);
|
||||||
lastXZPick = pick;
|
// initialXZPick = pick;
|
||||||
|
|
||||||
|
// If shifted, constrain to one axis
|
||||||
|
if (event.isShifted) {
|
||||||
|
if (Math.abs(vector.x) > Math.abs(vector.z)) {
|
||||||
|
vector.z = 0;
|
||||||
|
} else {
|
||||||
|
vector.x = 0;
|
||||||
|
}
|
||||||
|
if (!isConstrained) {
|
||||||
|
Overlays.editOverlay(xRailOverlay, { visible: true });
|
||||||
|
var xStart = Vec3.sum(startPosition, { x: -10000, y: 0, z: 0 });
|
||||||
|
var xEnd = Vec3.sum(startPosition, { x: 10000, y: 0, z: 0 });
|
||||||
|
var zStart = Vec3.sum(startPosition, { x: 0, y: 0, z: -10000 });
|
||||||
|
var zEnd = Vec3.sum(startPosition, { x: 0, y: 0, z: 10000 });
|
||||||
|
Overlays.editOverlay(xRailOverlay, { start: xStart, end: xEnd, visible: true });
|
||||||
|
Overlays.editOverlay(zRailOverlay, { start: zStart, end: zEnd, visible: true });
|
||||||
|
isConstrained = true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isConstrained) {
|
||||||
|
Overlays.editOverlay(xRailOverlay, { visible: false });
|
||||||
|
Overlays.editOverlay(zRailOverlay, { visible: false });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var wantDebug = false;
|
var wantDebug = false;
|
||||||
|
|
||||||
for (var i = 0; i < SelectionManager.selections.length; i++) {
|
for (var i = 0; i < SelectionManager.selections.length; i++) {
|
||||||
var properties = Entities.getEntityProperties(SelectionManager.selections[i]);
|
var properties = SelectionManager.savedProperties[SelectionManager.selections[i].id];
|
||||||
var original = properties.position;
|
Entities.editEntity(SelectionManager.selections[i], {
|
||||||
properties.position = Vec3.sum(properties.position, vector);
|
position: Vec3.sum(properties.position, vector),
|
||||||
Entities.editEntity(SelectionManager.selections[i], properties);
|
});
|
||||||
|
|
||||||
if (wantDebug) {
|
if (wantDebug) {
|
||||||
print("translateXZ... ");
|
print("translateXZ... ");
|
||||||
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
|
Vec3.print(" lastPlaneIntersection:", lastPlaneIntersection);
|
||||||
Vec3.print(" newIntersection:", newIntersection);
|
Vec3.print(" newIntersection:", newIntersection);
|
||||||
Vec3.print(" vector:", vector);
|
Vec3.print(" vector:", vector);
|
||||||
Vec3.print(" originalPosition:", original);
|
|
||||||
Vec3.print(" newPosition:", properties.position);
|
Vec3.print(" newPosition:", properties.position);
|
||||||
Vec3.print(" newPosition:", newPosition);
|
Vec3.print(" newPosition:", newPosition);
|
||||||
}
|
}
|
||||||
|
@ -1288,7 +1322,6 @@ SelectionDisplay = (function () {
|
||||||
var rotation = null;
|
var rotation = null;
|
||||||
|
|
||||||
var onBegin = function(event) {
|
var onBegin = function(event) {
|
||||||
print("STARTING: " + stretchMode);
|
|
||||||
var properties = Entities.getEntityProperties(currentSelection);
|
var properties = Entities.getEntityProperties(currentSelection);
|
||||||
initialProperties = properties;
|
initialProperties = properties;
|
||||||
rotation = spaceMode == SPACE_LOCAL ? properties.rotation : Quat.fromPitchYawRollDegrees(0, 0, 0);
|
rotation = spaceMode == SPACE_LOCAL ? properties.rotation : Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
|
@ -1366,7 +1399,6 @@ SelectionDisplay = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var onEnd = function(event, reason) {
|
var onEnd = function(event, reason) {
|
||||||
print("ENDING: " + stretchMode);
|
|
||||||
Overlays.editOverlay(xRailOverlay, { visible: false });
|
Overlays.editOverlay(xRailOverlay, { visible: false });
|
||||||
Overlays.editOverlay(yRailOverlay, { visible: false });
|
Overlays.editOverlay(yRailOverlay, { visible: false });
|
||||||
Overlays.editOverlay(zRailOverlay, { visible: false });
|
Overlays.editOverlay(zRailOverlay, { visible: false });
|
||||||
|
@ -1415,7 +1447,6 @@ SelectionDisplay = (function () {
|
||||||
var absX = Math.abs(changeInDimensions.x);
|
var absX = Math.abs(changeInDimensions.x);
|
||||||
var absY = Math.abs(changeInDimensions.y);
|
var absY = Math.abs(changeInDimensions.y);
|
||||||
var absZ = Math.abs(changeInDimensions.z);
|
var absZ = Math.abs(changeInDimensions.z);
|
||||||
print('abs: ' + absX + ', ' + absY + ', ' + absZ);
|
|
||||||
var pctChange = 0;
|
var pctChange = 0;
|
||||||
if (absX > absY && absX > absZ) {
|
if (absX > absY && absX > absZ) {
|
||||||
pctChange = changeInDimensions.x / initialProperties.dimensions.x;
|
pctChange = changeInDimensions.x / initialProperties.dimensions.x;
|
||||||
|
@ -1427,7 +1458,6 @@ SelectionDisplay = (function () {
|
||||||
pctChange = changeInDimensions.z / initialProperties.dimensions.z;
|
pctChange = changeInDimensions.z / initialProperties.dimensions.z;
|
||||||
pctChange = changeInDimensions.z / initialDimensions.z;
|
pctChange = changeInDimensions.z / initialDimensions.z;
|
||||||
}
|
}
|
||||||
print('change: ' + pctChange);
|
|
||||||
pctChange += 1.0;
|
pctChange += 1.0;
|
||||||
newDimensions = Vec3.multiply(pctChange, initialDimensions);
|
newDimensions = Vec3.multiply(pctChange, initialDimensions);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1881,7 +1911,6 @@ SelectionDisplay = (function () {
|
||||||
|
|
||||||
var tool = grabberTools[result.overlayID];
|
var tool = grabberTools[result.overlayID];
|
||||||
if (tool) {
|
if (tool) {
|
||||||
print("FOUND TOOL! " + tool.mode);
|
|
||||||
activeTool = tool;
|
activeTool = tool;
|
||||||
mode = tool.mode;
|
mode = tool.mode;
|
||||||
somethingClicked = true;
|
somethingClicked = true;
|
||||||
|
@ -1981,7 +2010,6 @@ SelectionDisplay = (function () {
|
||||||
if (result.intersects) {
|
if (result.intersects) {
|
||||||
var tool = grabberTools[result.overlayID];
|
var tool = grabberTools[result.overlayID];
|
||||||
if (tool) {
|
if (tool) {
|
||||||
print("FOUND TOOL! " + tool.mode);
|
|
||||||
activeTool = tool;
|
activeTool = tool;
|
||||||
mode = tool.mode;
|
mode = tool.mode;
|
||||||
somethingClicked = true;
|
somethingClicked = true;
|
||||||
|
|
|
@ -33,7 +33,7 @@ Script.include("libraries/entityPropertyDialogBox.js");
|
||||||
var entityPropertyDialogBox = EntityPropertyDialogBox;
|
var entityPropertyDialogBox = EntityPropertyDialogBox;
|
||||||
|
|
||||||
Script.include("libraries/entityCameraTool.js");
|
Script.include("libraries/entityCameraTool.js");
|
||||||
var entityCameraTool = new EntityCameraTool();
|
var cameraManager = new CameraManager();
|
||||||
|
|
||||||
selectionManager.setEventListener(selectionDisplay.updateHandles);
|
selectionManager.setEventListener(selectionDisplay.updateHandles);
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ var toolBar = (function () {
|
||||||
position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
|
position = Vec3.sum(MyAvatar.position, Vec3.multiply(Quat.getFront(MyAvatar.orientation), SPAWN_DISTANCE));
|
||||||
|
|
||||||
if (position.x > 0 && position.y > 0 && position.z > 0) {
|
if (position.x > 0 && position.y > 0 && position.z > 0) {
|
||||||
Entities.addEntity({
|
var entityId = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
position: position,
|
position: position,
|
||||||
dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION },
|
dimensions: { x: DEFAULT_DIMENSION, y: DEFAULT_DIMENSION, z: DEFAULT_DIMENSION },
|
||||||
|
@ -247,9 +247,9 @@ var toolBar = (function () {
|
||||||
isActive = !isActive;
|
isActive = !isActive;
|
||||||
if (!isActive) {
|
if (!isActive) {
|
||||||
selectionDisplay.unselectAll();
|
selectionDisplay.unselectAll();
|
||||||
entityCameraTool.disable();
|
cameraManager.disable();
|
||||||
} else {
|
} else {
|
||||||
entityCameraTool.enable();
|
cameraManager.enable();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ function mousePressEvent(event) {
|
||||||
var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
var clickedOverlay = Overlays.getOverlayAtPoint({ x: event.x, y: event.y });
|
||||||
|
|
||||||
if (toolBar.mousePressEvent(event) || progressDialog.mousePressEvent(event)
|
if (toolBar.mousePressEvent(event) || progressDialog.mousePressEvent(event)
|
||||||
|| entityCameraTool.mousePressEvent(event) || selectionDisplay.mousePressEvent(event)) {
|
|| cameraManager.mousePressEvent(event) || selectionDisplay.mousePressEvent(event)) {
|
||||||
// Event handled; do nothing.
|
// Event handled; do nothing.
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -482,8 +482,8 @@ function mouseMoveEvent(event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// allow the selectionDisplay and entityCameraTool to handle the event first, if it doesn't handle it, then do our own thing
|
// allow the selectionDisplay and cameraManager to handle the event first, if it doesn't handle it, then do our own thing
|
||||||
if (selectionDisplay.mouseMoveEvent(event) || entityCameraTool.mouseMoveEvent(event)) {
|
if (selectionDisplay.mouseMoveEvent(event) || cameraManager.mouseMoveEvent(event)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ function mouseReleaseEvent(event) {
|
||||||
if (entitySelected) {
|
if (entitySelected) {
|
||||||
tooltip.show(false);
|
tooltip.show(false);
|
||||||
}
|
}
|
||||||
entityCameraTool.mouseReleaseEvent(event);
|
cameraManager.mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
Controller.mousePressEvent.connect(mousePressEvent);
|
Controller.mousePressEvent.connect(mousePressEvent);
|
||||||
|
@ -652,7 +652,6 @@ Menu.menuItemEvent.connect(handeMenuEvent);
|
||||||
|
|
||||||
Controller.keyReleaseEvent.connect(function (event) {
|
Controller.keyReleaseEvent.connect(function (event) {
|
||||||
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
|
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
|
||||||
print(event.text);
|
|
||||||
if (event.text == "`") {
|
if (event.text == "`") {
|
||||||
handeMenuEvent("Edit Properties...");
|
handeMenuEvent("Edit Properties...");
|
||||||
}
|
}
|
||||||
|
@ -666,7 +665,11 @@ Controller.keyReleaseEvent.connect(function (event) {
|
||||||
if (entitySelected) {
|
if (entitySelected) {
|
||||||
// Get latest properties
|
// Get latest properties
|
||||||
var properties = Entities.getEntityProperties(selectedEntityID);
|
var properties = Entities.getEntityProperties(selectedEntityID);
|
||||||
entityCameraTool.focus(properties);
|
cameraManager.focus(properties);
|
||||||
|
}
|
||||||
|
} else if (event.text == '[') {
|
||||||
|
if (isActive) {
|
||||||
|
cameraManager.enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -226,7 +226,16 @@ else (APPLE)
|
||||||
# we're using static GLEW, so define GLEW_STATIC
|
# we're using static GLEW, so define GLEW_STATIC
|
||||||
add_definitions(-DGLEW_STATIC)
|
add_definitions(-DGLEW_STATIC)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}" wsock32.lib opengl32.lib)
|
target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}" "${NSIGHT_LIBRARIES}" wsock32.lib opengl32.lib)
|
||||||
|
|
||||||
|
# try to find the Nsight package and add it to the build if we find it
|
||||||
|
find_package(NSIGHT)
|
||||||
|
if (NSIGHT_FOUND)
|
||||||
|
include_directories(${NSIGHT_INCLUDE_DIRS})
|
||||||
|
add_definitions(-DNSIGHT_FOUND)
|
||||||
|
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif (APPLE)
|
endif (APPLE)
|
||||||
|
|
||||||
|
|
|
@ -418,6 +418,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
||||||
midiManagerInstance.openDefaultPort();
|
midiManagerInstance.openDefaultPort();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
this->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
@ -844,6 +846,19 @@ bool Application::event(QEvent* event) {
|
||||||
return QApplication::event(event);
|
return QApplication::event(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||||
|
|
||||||
|
if (event->type() == QEvent::ShortcutOverride) {
|
||||||
|
// Filter out captured keys before they're used for shortcut actions.
|
||||||
|
if (_controllerScriptingInterface.isKeyCaptured(static_cast<QKeyEvent*>(event))) {
|
||||||
|
event->accept();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Application::keyPressEvent(QKeyEvent* event) {
|
void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
|
|
||||||
_keysPressed.insert(event->key());
|
_keysPressed.insert(event->key());
|
||||||
|
@ -1539,9 +1554,12 @@ void Application::setEnableVRMode(bool enableVRMode) {
|
||||||
OculusManager::disconnect();
|
OculusManager::disconnect();
|
||||||
OculusManager::connect();
|
OculusManager::connect();
|
||||||
}
|
}
|
||||||
|
int oculusMaxFPS = Menu::getInstance()->getOculusUIMaxFPS();
|
||||||
|
setRenderTargetFramerate(oculusMaxFPS);
|
||||||
OculusManager::recalibrate();
|
OculusManager::recalibrate();
|
||||||
} else {
|
} else {
|
||||||
OculusManager::abandonCalibration();
|
OculusManager::abandonCalibration();
|
||||||
|
setRenderTargetFramerate(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
||||||
|
|
|
@ -172,6 +172,7 @@ public:
|
||||||
void dropEvent(QDropEvent *event);
|
void dropEvent(QDropEvent *event);
|
||||||
|
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
bool eventFilter(QObject* object, QEvent* event);
|
||||||
|
|
||||||
void makeVoxel(glm::vec3 position,
|
void makeVoxel(glm::vec3 position,
|
||||||
float scale,
|
float scale,
|
||||||
|
|
|
@ -21,6 +21,32 @@
|
||||||
#include "devices/OculusManager.h"
|
#include "devices/OculusManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
CameraMode stringToMode(const QString& mode) {
|
||||||
|
if (mode == "third person") {
|
||||||
|
return CAMERA_MODE_THIRD_PERSON;
|
||||||
|
} else if (mode == "first person") {
|
||||||
|
return CAMERA_MODE_FIRST_PERSON;
|
||||||
|
} else if (mode == "mirror") {
|
||||||
|
return CAMERA_MODE_MIRROR;
|
||||||
|
} else if (mode == "independent") {
|
||||||
|
return CAMERA_MODE_INDEPENDENT;
|
||||||
|
}
|
||||||
|
return CAMERA_MODE_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString modeToString(CameraMode mode) {
|
||||||
|
if (mode == CAMERA_MODE_THIRD_PERSON) {
|
||||||
|
return "third person";
|
||||||
|
} else if (mode == CAMERA_MODE_FIRST_PERSON) {
|
||||||
|
return "first person";
|
||||||
|
} else if (mode == CAMERA_MODE_MIRROR) {
|
||||||
|
return "mirror";
|
||||||
|
} else if (mode == CAMERA_MODE_INDEPENDENT) {
|
||||||
|
return "independent";
|
||||||
|
}
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
Camera::Camera() :
|
Camera::Camera() :
|
||||||
_mode(CAMERA_MODE_THIRD_PERSON),
|
_mode(CAMERA_MODE_THIRD_PERSON),
|
||||||
_position(0.0f, 0.0f, 0.0f),
|
_position(0.0f, 0.0f, 0.0f),
|
||||||
|
@ -48,6 +74,7 @@ float Camera::getFarClip() const {
|
||||||
|
|
||||||
void Camera::setMode(CameraMode m) {
|
void Camera::setMode(CameraMode m) {
|
||||||
_mode = m;
|
_mode = m;
|
||||||
|
emit modeUpdated(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -70,6 +97,7 @@ void Camera::setFarClip(float f) {
|
||||||
CameraScriptableObject::CameraScriptableObject(Camera* camera, ViewFrustum* viewFrustum) :
|
CameraScriptableObject::CameraScriptableObject(Camera* camera, ViewFrustum* viewFrustum) :
|
||||||
_camera(camera), _viewFrustum(viewFrustum)
|
_camera(camera), _viewFrustum(viewFrustum)
|
||||||
{
|
{
|
||||||
|
connect(_camera, &Camera::modeUpdated, this, &CameraScriptableObject::onModeUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
PickRay CameraScriptableObject::computePickRay(float x, float y) {
|
PickRay CameraScriptableObject::computePickRay(float x, float y) {
|
||||||
|
@ -86,24 +114,7 @@ PickRay CameraScriptableObject::computePickRay(float x, float y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CameraScriptableObject::getMode() const {
|
QString CameraScriptableObject::getMode() const {
|
||||||
QString mode("unknown");
|
return modeToString(_camera->getMode());
|
||||||
switch(_camera->getMode()) {
|
|
||||||
case CAMERA_MODE_THIRD_PERSON:
|
|
||||||
mode = "third person";
|
|
||||||
break;
|
|
||||||
case CAMERA_MODE_FIRST_PERSON:
|
|
||||||
mode = "first person";
|
|
||||||
break;
|
|
||||||
case CAMERA_MODE_MIRROR:
|
|
||||||
mode = "mirror";
|
|
||||||
break;
|
|
||||||
case CAMERA_MODE_INDEPENDENT:
|
|
||||||
mode = "independent";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return mode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CameraScriptableObject::setMode(const QString& mode) {
|
void CameraScriptableObject::setMode(const QString& mode) {
|
||||||
|
@ -131,5 +142,9 @@ void CameraScriptableObject::setMode(const QString& mode) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CameraScriptableObject::onModeUpdated(CameraMode m) {
|
||||||
|
emit modeUpdated(modeToString(m));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,11 @@ enum CameraMode
|
||||||
NUM_CAMERA_MODES
|
NUM_CAMERA_MODES
|
||||||
};
|
};
|
||||||
|
|
||||||
class Camera {
|
Q_DECLARE_METATYPE(CameraMode);
|
||||||
|
static int cameraModeId = qRegisterMetaType<CameraMode>();
|
||||||
|
|
||||||
|
class Camera : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Camera();
|
Camera();
|
||||||
|
|
||||||
|
@ -64,6 +67,9 @@ public:
|
||||||
const glm::quat& getEyeOffsetOrientation() const { return _eyeOffsetOrientation; }
|
const glm::quat& getEyeOffsetOrientation() const { return _eyeOffsetOrientation; }
|
||||||
float getScale() const { return _scale; }
|
float getScale() const { return _scale; }
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void modeUpdated(CameraMode newMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
CameraMode _mode;
|
CameraMode _mode;
|
||||||
|
@ -100,6 +106,12 @@ public slots:
|
||||||
|
|
||||||
PickRay computePickRay(float x, float y);
|
PickRay computePickRay(float x, float y);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void modeUpdated(const QString& newMode);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onModeUpdated(CameraMode m);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Camera* _camera;
|
Camera* _camera;
|
||||||
ViewFrustum* _viewFrustum;
|
ViewFrustum* _viewFrustum;
|
||||||
|
|
|
@ -105,6 +105,7 @@ Menu::Menu() :
|
||||||
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
|
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
|
||||||
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
||||||
_oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE),
|
_oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE),
|
||||||
|
_oculusUIMaxFPS(DEFAULT_OCULUS_UI_MAX_FPS),
|
||||||
_sixenseReticleMoveSpeed(DEFAULT_SIXENSE_RETICLE_MOVE_SPEED),
|
_sixenseReticleMoveSpeed(DEFAULT_SIXENSE_RETICLE_MOVE_SPEED),
|
||||||
_invertSixenseButtons(DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS),
|
_invertSixenseButtons(DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS),
|
||||||
_automaticAvatarLOD(true),
|
_automaticAvatarLOD(true),
|
||||||
|
@ -783,6 +784,8 @@ void Menu::loadSettings(QSettings* settings) {
|
||||||
|
|
||||||
_walletPrivateKey = settings->value("privateKey").toByteArray();
|
_walletPrivateKey = settings->value("privateKey").toByteArray();
|
||||||
|
|
||||||
|
_oculusUIMaxFPS = loadSetting(settings, "oculusUIMaxFPS", 0.0f);
|
||||||
|
|
||||||
scanMenuBar(&loadAction, settings);
|
scanMenuBar(&loadAction, settings);
|
||||||
Application::getInstance()->getAvatar()->loadData(settings);
|
Application::getInstance()->getAvatar()->loadData(settings);
|
||||||
Application::getInstance()->updateWindowTitle();
|
Application::getInstance()->updateWindowTitle();
|
||||||
|
@ -844,6 +847,9 @@ void Menu::saveSettings(QSettings* settings) {
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
settings->setValue("privateKey", _walletPrivateKey);
|
settings->setValue("privateKey", _walletPrivateKey);
|
||||||
|
|
||||||
|
// Oculus Rift settings
|
||||||
|
settings->setValue("oculusUIMaxFPS", _oculusUIMaxFPS);
|
||||||
|
|
||||||
scanMenuBar(&saveAction, settings);
|
scanMenuBar(&saveAction, settings);
|
||||||
Application::getInstance()->getAvatar()->saveData(settings);
|
Application::getInstance()->getAvatar()->saveData(settings);
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,8 @@ public:
|
||||||
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; bumpSettings(); }
|
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; bumpSettings(); }
|
||||||
float getOculusUIAngularSize() const { return _oculusUIAngularSize; }
|
float getOculusUIAngularSize() const { return _oculusUIAngularSize; }
|
||||||
void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; bumpSettings(); }
|
void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; bumpSettings(); }
|
||||||
|
int getOculusUIMaxFPS() const { return _oculusUIMaxFPS; }
|
||||||
|
void setOculusUIMaxFPS(int oculusUIMaxFPS) { _oculusUIMaxFPS = oculusUIMaxFPS; bumpSettings(); }
|
||||||
float getSixenseReticleMoveSpeed() const { return _sixenseReticleMoveSpeed; }
|
float getSixenseReticleMoveSpeed() const { return _sixenseReticleMoveSpeed; }
|
||||||
void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; bumpSettings(); }
|
void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; bumpSettings(); }
|
||||||
bool getInvertSixenseButtons() const { return _invertSixenseButtons; }
|
bool getInvertSixenseButtons() const { return _invertSixenseButtons; }
|
||||||
|
@ -292,6 +294,7 @@ private:
|
||||||
int _maxVoxels;
|
int _maxVoxels;
|
||||||
float _voxelSizeScale;
|
float _voxelSizeScale;
|
||||||
float _oculusUIAngularSize;
|
float _oculusUIAngularSize;
|
||||||
|
int _oculusUIMaxFPS;
|
||||||
float _sixenseReticleMoveSpeed;
|
float _sixenseReticleMoveSpeed;
|
||||||
bool _invertSixenseButtons;
|
bool _invertSixenseButtons;
|
||||||
bool _automaticAvatarLOD;
|
bool _automaticAvatarLOD;
|
||||||
|
|
|
@ -48,6 +48,13 @@ MetavoxelSystem::NetworkSimulation::NetworkSimulation(float dropRate, float repe
|
||||||
bandwidthLimit(bandwidthLimit) {
|
bandwidthLimit(bandwidthLimit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetavoxelSystem::~MetavoxelSystem() {
|
||||||
|
// kill the updater before we delete our network simulation objects
|
||||||
|
_updater->thread()->quit();
|
||||||
|
_updater->thread()->wait();
|
||||||
|
_updater = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void MetavoxelSystem::init() {
|
void MetavoxelSystem::init() {
|
||||||
MetavoxelClientManager::init();
|
MetavoxelClientManager::init();
|
||||||
DefaultMetavoxelRendererImplementation::init();
|
DefaultMetavoxelRendererImplementation::init();
|
||||||
|
|
|
@ -43,6 +43,8 @@ public:
|
||||||
int maximumDelay = 0, int bandwidthLimit = 0);
|
int maximumDelay = 0, int bandwidthLimit = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtual ~MetavoxelSystem();
|
||||||
|
|
||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
virtual MetavoxelLOD getLOD();
|
virtual MetavoxelLOD getLOD();
|
||||||
|
|
|
@ -52,6 +52,7 @@ const float DISPLAYNAME_BACKGROUND_ALPHA = 0.4f;
|
||||||
Avatar::Avatar() :
|
Avatar::Avatar() :
|
||||||
AvatarData(),
|
AvatarData(),
|
||||||
_skeletonModel(this),
|
_skeletonModel(this),
|
||||||
|
_skeletonOffset(0.0f),
|
||||||
_bodyYawDelta(0.0f),
|
_bodyYawDelta(0.0f),
|
||||||
_velocity(0.0f),
|
_velocity(0.0f),
|
||||||
_positionDeltaAccumulator(0.0f),
|
_positionDeltaAccumulator(0.0f),
|
||||||
|
@ -763,6 +764,20 @@ bool Avatar::findCollisions(const QVector<const Shape*>& shapes, CollisionList&
|
||||||
return collided;
|
return collided;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Avatar::setSkeletonOffset(const glm::vec3& offset) {
|
||||||
|
const float MAX_OFFSET_LENGTH = _scale * 0.5f;
|
||||||
|
float offsetLength = glm::length(offset);
|
||||||
|
if (offsetLength > MAX_OFFSET_LENGTH) {
|
||||||
|
_skeletonOffset = (MAX_OFFSET_LENGTH / offsetLength) * offset;
|
||||||
|
} else {
|
||||||
|
_skeletonOffset = offset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
glm::vec3 Avatar::getSkeletonPosition() const {
|
||||||
|
return _position + _skeletonOffset;
|
||||||
|
}
|
||||||
|
|
||||||
QVector<glm::quat> Avatar::getJointRotations() const {
|
QVector<glm::quat> Avatar::getJointRotations() const {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
return AvatarData::getJointRotations();
|
return AvatarData::getJointRotations();
|
||||||
|
|
|
@ -69,6 +69,7 @@ class Texture;
|
||||||
class Avatar : public AvatarData {
|
class Avatar : public AvatarData {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(quint32 collisionGroups READ getCollisionGroups WRITE setCollisionGroups)
|
Q_PROPERTY(quint32 collisionGroups READ getCollisionGroups WRITE setCollisionGroups)
|
||||||
|
Q_PROPERTY(glm::vec3 skeletonOffset READ getSkeletonOffset WRITE setSkeletonOffset)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Avatar();
|
Avatar();
|
||||||
|
@ -147,6 +148,10 @@ public:
|
||||||
quint32 getCollisionGroups() const { return _collisionGroups; }
|
quint32 getCollisionGroups() const { return _collisionGroups; }
|
||||||
virtual void setCollisionGroups(quint32 collisionGroups) { _collisionGroups = (collisionGroups & VALID_COLLISION_GROUPS); }
|
virtual void setCollisionGroups(quint32 collisionGroups) { _collisionGroups = (collisionGroups & VALID_COLLISION_GROUPS); }
|
||||||
|
|
||||||
|
Q_INVOKABLE void setSkeletonOffset(const glm::vec3& offset);
|
||||||
|
Q_INVOKABLE glm::vec3 getSkeletonOffset() { return _skeletonOffset; }
|
||||||
|
virtual glm::vec3 getSkeletonPosition() const;
|
||||||
|
|
||||||
Q_INVOKABLE glm::vec3 getJointPosition(int index) const;
|
Q_INVOKABLE glm::vec3 getJointPosition(int index) const;
|
||||||
Q_INVOKABLE glm::vec3 getJointPosition(const QString& name) const;
|
Q_INVOKABLE glm::vec3 getJointPosition(const QString& name) const;
|
||||||
Q_INVOKABLE glm::quat getJointCombinedRotation(int index) const;
|
Q_INVOKABLE glm::quat getJointCombinedRotation(int index) const;
|
||||||
|
@ -184,6 +189,7 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
Hair _hair;
|
Hair _hair;
|
||||||
SkeletonModel _skeletonModel;
|
SkeletonModel _skeletonModel;
|
||||||
|
glm::vec3 _skeletonOffset;
|
||||||
QVector<Model*> _attachmentModels;
|
QVector<Model*> _attachmentModels;
|
||||||
float _bodyYawDelta;
|
float _bodyYawDelta;
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,20 @@ MyAvatar::~MyAvatar() {
|
||||||
_lookAtTargetAvatar.clear();
|
_lookAtTargetAvatar.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray MyAvatar::toByteArray() {
|
||||||
|
CameraMode mode = Application::getInstance()->getCamera()->getMode();
|
||||||
|
if (mode == CAMERA_MODE_THIRD_PERSON || mode == CAMERA_MODE_INDEPENDENT) {
|
||||||
|
// fake the avatar position that is sent up to the AvatarMixer
|
||||||
|
glm::vec3 oldPosition = _position;
|
||||||
|
_position += _skeletonOffset;
|
||||||
|
QByteArray array = AvatarData::toByteArray();
|
||||||
|
// copy the correct position back
|
||||||
|
_position = oldPosition;
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
return AvatarData::toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
void MyAvatar::reset() {
|
void MyAvatar::reset() {
|
||||||
_skeletonModel.reset();
|
_skeletonModel.reset();
|
||||||
getHead()->reset();
|
getHead()->reset();
|
||||||
|
@ -1054,6 +1068,14 @@ void MyAvatar::setAttachmentData(const QVector<AttachmentData>& attachmentData)
|
||||||
_billboardValid = false;
|
_billboardValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 MyAvatar::getSkeletonPosition() const {
|
||||||
|
CameraMode mode = Application::getInstance()->getCamera()->getMode();
|
||||||
|
if (mode == CAMERA_MODE_THIRD_PERSON || mode == CAMERA_MODE_INDEPENDENT) {
|
||||||
|
return Avatar::getSkeletonPosition();
|
||||||
|
}
|
||||||
|
return Avatar::getPosition();
|
||||||
|
}
|
||||||
|
|
||||||
QString MyAvatar::getScriptedMotorFrame() const {
|
QString MyAvatar::getScriptedMotorFrame() const {
|
||||||
QString frame = "avatar";
|
QString frame = "avatar";
|
||||||
if (_scriptedMotorFrame == SCRIPTED_MOTOR_CAMERA_FRAME) {
|
if (_scriptedMotorFrame == SCRIPTED_MOTOR_CAMERA_FRAME) {
|
||||||
|
|
|
@ -42,6 +42,7 @@ public:
|
||||||
MyAvatar();
|
MyAvatar();
|
||||||
~MyAvatar();
|
~MyAvatar();
|
||||||
|
|
||||||
|
QByteArray toByteArray();
|
||||||
void reset();
|
void reset();
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
void simulate(float deltaTime);
|
void simulate(float deltaTime);
|
||||||
|
@ -135,6 +136,8 @@ public:
|
||||||
virtual void setSkeletonModelURL(const QUrl& skeletonModelURL);
|
virtual void setSkeletonModelURL(const QUrl& skeletonModelURL);
|
||||||
virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData);
|
virtual void setAttachmentData(const QVector<AttachmentData>& attachmentData);
|
||||||
|
|
||||||
|
virtual glm::vec3 getSkeletonPosition() const;
|
||||||
|
|
||||||
void clearJointAnimationPriorities();
|
void clearJointAnimationPriorities();
|
||||||
|
|
||||||
glm::vec3 getScriptedMotorVelocity() const { return _scriptedMotorVelocity; }
|
glm::vec3 getScriptedMotorVelocity() const { return _scriptedMotorVelocity; }
|
||||||
|
|
|
@ -77,7 +77,7 @@ const float PALM_PRIORITY = DEFAULT_PRIORITY;
|
||||||
const float LEAN_PRIORITY = DEFAULT_PRIORITY;
|
const float LEAN_PRIORITY = DEFAULT_PRIORITY;
|
||||||
|
|
||||||
void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
void SkeletonModel::simulate(float deltaTime, bool fullUpdate) {
|
||||||
setTranslation(_owningAvatar->getPosition());
|
setTranslation(_owningAvatar->getSkeletonPosition());
|
||||||
static const glm::quat refOrientation = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
static const glm::quat refOrientation = glm::angleAxis(PI, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
setRotation(_owningAvatar->getOrientation() * refOrientation);
|
setRotation(_owningAvatar->getOrientation() * refOrientation);
|
||||||
setScale(glm::vec3(1.0f, 1.0f, 1.0f) * _owningAvatar->getScale() * MODEL_SCALE);
|
setScale(glm::vec3(1.0f, 1.0f, 1.0f) * _owningAvatar->getScale() * MODEL_SCALE);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "ui/overlays/Text3DOverlay.h"
|
#include "ui/overlays/Text3DOverlay.h"
|
||||||
|
|
||||||
const float DEFAULT_OCULUS_UI_ANGULAR_SIZE = 72.0f;
|
const float DEFAULT_OCULUS_UI_ANGULAR_SIZE = 72.0f;
|
||||||
|
const int DEFAULT_OCULUS_UI_MAX_FPS = 75;
|
||||||
|
|
||||||
class Camera;
|
class Camera;
|
||||||
class PalmData;
|
class PalmData;
|
||||||
|
|
|
@ -16,6 +16,23 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#if defined(NSIGHT_FOUND)
|
||||||
|
#include "nvToolsExt.h"
|
||||||
|
class ProfileRange {
|
||||||
|
public:
|
||||||
|
ProfileRange(const char *name) {
|
||||||
|
nvtxRangePush(name);
|
||||||
|
}
|
||||||
|
~ProfileRange() {
|
||||||
|
nvtxRangePop();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||||
|
#else
|
||||||
|
#define PROFILE_RANGE(name)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace gpu {
|
namespace gpu {
|
||||||
|
|
||||||
class Batch;
|
class Batch;
|
||||||
|
|
|
@ -395,6 +395,7 @@ void Model::setJointStates(QVector<JointState> states) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::render(float alpha, RenderMode mode, RenderArgs* args) {
|
bool Model::render(float alpha, RenderMode mode, RenderArgs* args) {
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
// render the attachments
|
// render the attachments
|
||||||
foreach (Model* attachment, _attachments) {
|
foreach (Model* attachment, _attachments) {
|
||||||
attachment->render(alpha, mode);
|
attachment->render(alpha, mode);
|
||||||
|
@ -560,8 +561,11 @@ bool Model::render(float alpha, RenderMode mode, RenderArgs* args) {
|
||||||
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
GLBATCH(glBindTexture)(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
// Render!
|
// Render!
|
||||||
::gpu::backend::renderBatch(batch);
|
{
|
||||||
batch.clear();
|
PROFILE_RANGE("render Batch");
|
||||||
|
::gpu::backend::renderBatch(batch);
|
||||||
|
batch.clear();
|
||||||
|
}
|
||||||
|
|
||||||
// restore all the default material settings
|
// restore all the default material settings
|
||||||
Application::getInstance()->setupWorldLight();
|
Application::getInstance()->setupWorldLight();
|
||||||
|
@ -1551,6 +1555,7 @@ void Model::segregateMeshGroups() {
|
||||||
int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, float alphaThreshold,
|
int Model::renderMeshes(gpu::Batch& batch, RenderMode mode, bool translucent, float alphaThreshold,
|
||||||
bool hasTangents, bool hasSpecular, bool isSkinned, RenderArgs* args) {
|
bool hasTangents, bool hasSpecular, bool isSkinned, RenderArgs* args) {
|
||||||
|
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
bool dontCullOutOfViewMeshParts = Menu::getInstance()->isOptionChecked(MenuOption::DontCullOutOfViewMeshParts);
|
bool dontCullOutOfViewMeshParts = Menu::getInstance()->isOptionChecked(MenuOption::DontCullOutOfViewMeshParts);
|
||||||
bool cullTooSmallMeshParts = !Menu::getInstance()->isOptionChecked(MenuOption::DontCullTooSmallMeshParts);
|
bool cullTooSmallMeshParts = !Menu::getInstance()->isOptionChecked(MenuOption::DontCullTooSmallMeshParts);
|
||||||
bool dontReduceMaterialSwitches = Menu::getInstance()->isOptionChecked(MenuOption::DontReduceMaterialSwitches);
|
bool dontReduceMaterialSwitches = Menu::getInstance()->isOptionChecked(MenuOption::DontReduceMaterialSwitches);
|
||||||
|
|
|
@ -228,10 +228,7 @@ bool ControllerScriptingInterface::isKeyCaptured(QKeyEvent* event) const {
|
||||||
|
|
||||||
bool ControllerScriptingInterface::isKeyCaptured(const KeyEvent& event) const {
|
bool ControllerScriptingInterface::isKeyCaptured(const KeyEvent& event) const {
|
||||||
// if we've captured some combination of this key it will be in the map
|
// if we've captured some combination of this key it will be in the map
|
||||||
if (_capturedKeys.contains(event.key, event)) {
|
return _capturedKeys.contains(event.key, event);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerScriptingInterface::captureKeyEvents(const KeyEvent& event) {
|
void ControllerScriptingInterface::captureKeyEvents(const KeyEvent& event) {
|
||||||
|
|
|
@ -148,6 +148,8 @@ void PreferencesDialog::loadPreferences() {
|
||||||
|
|
||||||
ui.oculusUIAngularSizeSpin->setValue(menuInstance->getOculusUIAngularSize());
|
ui.oculusUIAngularSizeSpin->setValue(menuInstance->getOculusUIAngularSize());
|
||||||
|
|
||||||
|
ui.oculusUIMaxFPSSpin->setValue(menuInstance->getOculusUIMaxFPS());
|
||||||
|
|
||||||
ui.sixenseReticleMoveSpeedSpin->setValue(menuInstance->getSixenseReticleMoveSpeed());
|
ui.sixenseReticleMoveSpeedSpin->setValue(menuInstance->getSixenseReticleMoveSpeed());
|
||||||
|
|
||||||
ui.invertSixenseButtonsCheckBox->setChecked(menuInstance->getInvertSixenseButtons());
|
ui.invertSixenseButtonsCheckBox->setChecked(menuInstance->getInvertSixenseButtons());
|
||||||
|
@ -230,6 +232,8 @@ void PreferencesDialog::savePreferences() {
|
||||||
|
|
||||||
Menu::getInstance()->setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value());
|
Menu::getInstance()->setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value());
|
||||||
|
|
||||||
|
Menu::getInstance()->setOculusUIMaxFPS(ui.oculusUIMaxFPSSpin->value());
|
||||||
|
|
||||||
Menu::getInstance()->setSixenseReticleMoveSpeed(ui.sixenseReticleMoveSpeedSpin->value());
|
Menu::getInstance()->setSixenseReticleMoveSpeed(ui.sixenseReticleMoveSpeedSpin->value());
|
||||||
|
|
||||||
Menu::getInstance()->setInvertSixenseButtons(ui.invertSixenseButtonsCheckBox->isChecked());
|
Menu::getInstance()->setInvertSixenseButtons(ui.invertSixenseButtonsCheckBox->isChecked());
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>500</width>
|
<width>500</width>
|
||||||
<height>1386</height>
|
<height>1459</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -1772,21 +1772,21 @@
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLineEdit" name="faceshiftHostnameEdit">
|
<widget class="QLineEdit" name="faceshiftHostnameEdit">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<family>Arial</family>
|
<family>Arial</family>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="layoutDirection">
|
<property name="layoutDirection">
|
||||||
<enum>Qt::LeftToRight</enum>
|
<enum>Qt::LeftToRight</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true"/>
|
<string notr="true"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="placeholderText">
|
<property name="placeholderText">
|
||||||
<string>localhost</string>
|
<string>localhost</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
@ -2084,6 +2084,85 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>7</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>7</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Oculus Rift FPS</string>
|
||||||
|
</property>
|
||||||
|
<property name="indent">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>maxVoxelsSpin</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_18">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="oculusUIMaxFPSSpin">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>95</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>75</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="sixenseControllersTitleLabel">
|
<widget class="QLabel" name="sixenseControllersTitleLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
|
@ -67,7 +67,7 @@ AvatarData::~AvatarData() {
|
||||||
delete _referential;
|
delete _referential;
|
||||||
}
|
}
|
||||||
|
|
||||||
const glm::vec3& AvatarData::getPosition() {
|
const glm::vec3& AvatarData::getPosition() const {
|
||||||
if (_referential) {
|
if (_referential) {
|
||||||
_referential->update();
|
_referential->update();
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,15 +138,15 @@ public:
|
||||||
AvatarData();
|
AvatarData();
|
||||||
virtual ~AvatarData();
|
virtual ~AvatarData();
|
||||||
|
|
||||||
const QUuid& getSessionUUID() { return _sessionUUID; }
|
const QUuid& getSessionUUID() const { return _sessionUUID; }
|
||||||
|
|
||||||
const glm::vec3& getPosition();
|
const glm::vec3& getPosition() const;
|
||||||
virtual void setPosition(const glm::vec3 position, bool overideReferential = false);
|
virtual void setPosition(const glm::vec3 position, bool overideReferential = false);
|
||||||
|
|
||||||
glm::vec3 getHandPosition() const;
|
glm::vec3 getHandPosition() const;
|
||||||
void setHandPosition(const glm::vec3& handPosition);
|
void setHandPosition(const glm::vec3& handPosition);
|
||||||
|
|
||||||
QByteArray toByteArray();
|
virtual QByteArray toByteArray();
|
||||||
|
|
||||||
/// \return true if an error should be logged
|
/// \return true if an error should be logged
|
||||||
bool shouldLogError(const quint64& now);
|
bool shouldLogError(const quint64& now);
|
||||||
|
|
|
@ -27,8 +27,10 @@ MetavoxelClientManager::MetavoxelClientManager() :
|
||||||
}
|
}
|
||||||
|
|
||||||
MetavoxelClientManager::~MetavoxelClientManager() {
|
MetavoxelClientManager::~MetavoxelClientManager() {
|
||||||
_updater->thread()->quit();
|
if (_updater) {
|
||||||
_updater->thread()->wait();
|
_updater->thread()->quit();
|
||||||
|
_updater->thread()->wait();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetavoxelClientManager::init() {
|
void MetavoxelClientManager::init() {
|
||||||
|
|
|
@ -1040,6 +1040,9 @@ MetavoxelNode* MetavoxelNode::readSubdivision(MetavoxelStreamState& state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetavoxelNode::writeSubdivision(MetavoxelStreamState& state) const {
|
void MetavoxelNode::writeSubdivision(MetavoxelStreamState& state) const {
|
||||||
|
if (!state.shouldSubdivide()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
bool leaf = isLeaf();
|
bool leaf = isLeaf();
|
||||||
if (!state.shouldSubdivideReference()) {
|
if (!state.shouldSubdivideReference()) {
|
||||||
state.base.stream << leaf;
|
state.base.stream << leaf;
|
||||||
|
|
Loading…
Reference in a new issue