Merge remote-tracking branch 'upstream/master' into plugins

Conflicts:
	interface/src/Application.cpp
	interface/src/Application.h
This commit is contained in:
Brad Davis 2015-06-01 22:59:10 -07:00
commit f22682fe39
21 changed files with 794 additions and 161 deletions

View file

@ -75,21 +75,6 @@ To prevent these problems, install OpenSSL yourself. Download the following bina
Install OpenSSL into the Windows system directory, to make sure that Qt uses the version that you've just installed, and not some other version.
###vhacd
Download it directly from https://github.com/virneo/v-hacd
To build it run the following commands
1. cd src\
2. mkdir build
3. cd build
4. cmake ..
Build using visual studio 2013. Build ALL_BUILD and INSTALL targets both in Release and Debug.
This will create an output folder with include and lib directory inside it.
Either copy the contents of output folder to ENV %HIFI_LIB_DIR%/vhacd or create an environment variable VHACD_ROOT_DIR to this output directory.
###Build High Fidelity using Visual Studio
Follow the same build steps from the CMake section of [BUILD.md](BUILD.md), but pass a different generator to CMake.

View file

@ -3,8 +3,8 @@ set(EXTERNAL_NAME polyvox)
include(ExternalProject)
ExternalProject_Add(
${EXTERNAL_NAME}
URL http://hifi-public.s3.amazonaws.com/dependencies/polyvox-master-2015-5-27.zip
URL_MD5 e3dd09a24df4db29ba370e3bea753388
URL http://hifi-public.s3.amazonaws.com/dependencies/polyvox.zip
URL_MD5 904b840328278c9b36fa7a14be730c34
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
BINARY_DIR ${EXTERNAL_PROJECT_PREFIX}/build
LOG_DOWNLOAD 1
@ -45,7 +45,7 @@ else ()
endif ()
if (WIN32)
if (WIN32)
set(${EXTERNAL_NAME_UPPER}_CORE_LIBRARY ${INSTALL_DIR}/PolyVoxCore/lib/PolyVoxCore.lib CACHE FILEPATH "polyvox core library")
# set(${EXTERNAL_NAME_UPPER}_UTIL_LIBRARY ${INSTALL_DIR}/PolyVoxUtil/lib/PolyVoxUtil.lib CACHE FILEPATH "polyvox util library")
elseif (APPLE)

View file

@ -0,0 +1,247 @@
var HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
var SOUND_PATH = HIFI_PUBLIC_BUCKET + "sounds/Collisions-hitsandslaps/";
var soundURLS = ["67LCollision01.wav", "67LCollision02.wav", "airhockey_hit1.wav"];
var FLOOR_SIZE = 10;
var center = Vec3.sum(MyAvatar.position, Vec3.multiply(FLOOR_SIZE * 1.5, Quat.getFront(Camera.getOrientation())));
var WALL_WIDTH = .1;
var FLOOR_HEIGHT_OFFSET = -2;
var WALL_HEIGHT = FLOOR_SIZE / 4;
var BALL_DROP_HEIGHT = center.y + WALL_HEIGHT;
var NUM_BALLS = 50;
var BALL_RADIUS = 1;
var BROWNIAN_INTERVAL_TIME = 16;
var BROWNIAN_FORCE_RANGE = 5;
var SPAWN_TIME = 50;
var spawnCount = 0;
var brownianMotionActivated = false;
var buttonOffColor = {
red: 250,
green: 10,
blue: 10
};
var buttonOnColor = {
red: 10,
green: 200,
blue: 100
};
var bounds = {
xMin: center.x - FLOOR_SIZE / 2,
xMax: center.x + FLOOR_SIZE / 2,
zMin: center.z - FLOOR_SIZE / 2,
zMax: center.z + FLOOR_SIZE / 2
};
var balls = [];
var screenSize = Controller.getViewportDimensions();
var BUTTON_SIZE = 32;
var PADDING = 3;
var brownianButton = Overlays.addOverlay("image", {
x: screenSize.x / 2 - BUTTON_SIZE,
y: screenSize.y - (BUTTON_SIZE + PADDING),
width: BUTTON_SIZE,
height: BUTTON_SIZE,
imageURL: HIFI_PUBLIC_BUCKET + "images/blocks.png",
color: buttonOffColor,
alpha: 1
});
var floor = Entities.addEntity({
type: 'Box',
position: Vec3.sum(center, {
x: 0,
y: FLOOR_HEIGHT_OFFSET,
z: 0
}),
dimensions: {
x: FLOOR_SIZE,
y: WALL_WIDTH,
z: FLOOR_SIZE
},
color: {
red: 100,
green: 100,
blue: 100
}
});
var rightWall = Entities.addEntity({
type: 'Box',
position: Vec3.sum(center, {
x: FLOOR_SIZE / 2,
y: FLOOR_HEIGHT_OFFSET / 2,
z: 0
}),
dimensions: {
x: WALL_WIDTH,
y: WALL_HEIGHT,
z: FLOOR_SIZE
},
color: {
red: 120,
green: 100,
blue: 120
}
});
var leftWall = Entities.addEntity({
type: 'Box',
position: Vec3.sum(center, {
x: -FLOOR_SIZE / 2,
y: FLOOR_HEIGHT_OFFSET / 2,
z: 0
}),
dimensions: {
x: WALL_WIDTH,
y: WALL_HEIGHT,
z: FLOOR_SIZE
},
color: {
red: 120,
green: 100,
blue: 120
}
});
var backWall = Entities.addEntity({
type: 'Box',
position: Vec3.sum(center, {
x: 0,
y: FLOOR_HEIGHT_OFFSET / 2,
z: -FLOOR_SIZE / 2,
}),
dimensions: {
x: FLOOR_SIZE,
y: WALL_HEIGHT,
z: WALL_WIDTH
},
color: {
red: 120,
green: 100,
blue: 120
}
});
var frontWall = Entities.addEntity({
type: 'Box',
position: Vec3.sum(center, {
x: 0,
y: FLOOR_HEIGHT_OFFSET / 2,
z: FLOOR_SIZE / 2,
}),
dimensions: {
x: FLOOR_SIZE,
y: WALL_HEIGHT,
z: WALL_WIDTH
},
color: {
red: 120,
green: 100,
blue: 120
}
});
var spawnInterval = Script.setInterval(spawnBalls, SPAWN_TIME);
function spawnBalls() {
balls.push(Entities.addEntity({
type: "Sphere",
shapeType: "sphere",
position: {
x: randFloat(bounds.xMin, bounds.xMax),
y: BALL_DROP_HEIGHT,
z: randFloat(bounds.zMin, bounds.zMax)
},
dimensions: {
x: BALL_RADIUS,
y: BALL_RADIUS,
z: BALL_RADIUS
},
color: {
red: randFloat(100, 150),
green: randFloat(20, 80),
blue: randFloat(10, 180)
},
ignoreCollisions: false,
collisionsWillMove: true,
gravity: {
x: 0,
y: -9.9,
z: 0
},
velocity: {
x: 0,
y: -.25,
z: 0
},
collisionSoundURL: SOUND_PATH + soundURLS[randInt(0, soundURLS.length - 1)]
}));
spawnCount++;
if (spawnCount === NUM_BALLS) {
Script.clearInterval(spawnInterval);
}
}
function mousePressEvent(event) {
var clickedOverlay = Overlays.getOverlayAtPoint({
x: event.x,
y: event.y
});
if (clickedOverlay == brownianButton) {
brownianMotionActivated = !brownianMotionActivated;
if (brownianMotionActivated) {
brownianInterval = Script.setInterval(bumpBalls, BROWNIAN_INTERVAL_TIME);
Overlays.editOverlay(brownianButton, {
color: buttonOnColor
})
} else {
Script.clearInterval(brownianInterval);
Overlays.editOverlay(brownianButton, {
color: buttonOffColor
})
}
}
}
function bumpBalls() {
balls.forEach(function(ball) {
var props = Entities.getEntityProperties(ball);
var newVelocity = Vec3.sum(props.velocity, {
x: (Math.random() - 0.5) * BROWNIAN_FORCE_RANGE,
y: 0,
z: (Math.random() - 0.5) * BROWNIAN_FORCE_RANGE
});
Entities.editEntity(ball, {
velocity: newVelocity
});
});
}
function cleanup() {
Entities.deleteEntity(floor);
Entities.deleteEntity(rightWall);
Entities.deleteEntity(leftWall);
Entities.deleteEntity(backWall);
Entities.deleteEntity(frontWall);
balls.forEach(function(ball) {
Entities.deleteEntity(ball);
});
Overlays.deleteOverlay(brownianButton);
}
function randFloat(low, high) {
return Math.floor(low + Math.random() * (high - low));
}
function randInt(low, high) {
return Math.floor(randFloat(low, high));
}
Script.scriptEnding.connect(cleanup);
Script.scriptEnding.connect(cleanup);
Controller.mousePressEvent.connect(mousePressEvent);

View file

@ -36,8 +36,6 @@ var angularVelocity = {
z: 0
};
var grabSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/eric/sounds/CloseClamp.wav");
var releaseSound = SoundCache.getSound("https://hifi-public.s3.amazonaws.com/eric/sounds/ReleaseClamp.wav");
var DROP_DISTANCE = 5.0;
var DROP_COLOR = {
@ -90,10 +88,6 @@ function mousePressEvent(event) {
gravity: {x: 0, y: 0, z: 0}
});
Audio.playSound(grabSound, {
position: props.position,
volume: 0.4
});
}
}
@ -135,11 +129,6 @@ function mouseReleaseEvent() {
});
targetPosition = null;
Audio.playSound(grabSound, {
position: entityProps.position,
volume: 0.25
});
}
}

View file

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="pomodoro"
x="0px"
y="0px"
width="100"
height="100"
viewBox="-7.125 -7.328 100 100"
enable-background="new -7.125 -7.328 100 91.57"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="address-bar-error-close.svg"><metadata
id="metadata4143"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
id="defs4141" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1840"
inkscape:window-height="1057"
id="namedview4139"
showgrid="false"
inkscape:zoom="4.8487496"
inkscape:cx="50"
inkscape:cy="37.53545"
inkscape:window-x="72"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="pomodoro" /><path
d="m 42.8705,-2.3280001 c -24.8688,0 -44.9955,20.1618001 -44.9955,45.0045001 0,24.8733 20.1267,44.9955 44.9955,44.9955 24.8427,0 45.0045,-20.1222 45.0045,-44.9955 0,-24.8427 -20.1618,-45.0045001 -45.0045,-45.0045001 z M 67.1066,57.126 57.329,66.9036 42.6293,52.221 27.9422,66.9036 18.1511,57.126 32.8247,42.4443 18.1511,27.7482 27.9422,17.9796 42.6284,32.6487 57.3281,17.9796 67.1057,27.7482 52.424,42.4434 67.1066,57.126 Z"
id="path4137"
inkscape:connector-curvature="0" /><path
style="fill:#787878;fill-opacity:1;stroke:none;stroke-opacity:1"
d="M 38.400102,87.62655 C 28.705316,86.39839 21.084707,83.18102 13.982682,77.31765 5.5185024,70.329714 -0.09877759,60.244376 -1.7904936,48.998291 -2.1921426,46.328239 -2.2434696,39.677941 -1.8825126,37.07572 0.23131941,21.836625 9.4778634,8.9272213 23.005945,2.3281243 c 9.805646,-4.783264 20.444414,-5.902737 30.964952,-3.25830896 7.357662,1.849413 14.403738,5.75570696 19.976698,11.07495366 7.36697,7.031569 12.03213,16.084669 13.58981,26.37208 0.45133,2.980701 0.44981,9.518147 -0.003,12.481442 -0.72914,4.772737 -2.08456,9.199896 -4.04575,13.214497 -2.40852,4.930297 -4.94684,8.502038 -8.75077,12.313422 -6.78153,6.79482 -14.822805,10.95587 -24.504932,12.68035 -1.787127,0.3183 -3.134188,0.40875 -6.708441,0.45045 -2.459762,0.0287 -4.765789,0.0149 -5.124505,-0.0304 z m -3.02899,-27.869116 7.314939,-7.311007 7.360877,7.35692 7.360872,7.356917 4.983865,-4.982378 4.98386,-4.982378 -7.359111,-7.358686 -7.359105,-7.358687 7.359105,-7.358687 7.359111,-7.358686 -4.98387,-4.982383 -4.983864,-4.982384 -7.407456,7.393329 -7.407456,7.393328 -7.360652,-7.342464 -7.36065,-7.342467 -4.922357,4.916384 -4.922356,4.916381 7.300528,7.417269 7.300528,7.417267 -7.362706,7.362244 -7.362709,7.362244 4.890918,4.889465 c 2.690008,2.689205 4.974582,4.889463 5.076835,4.889463 0.102254,0 3.477639,-3.289951 7.500854,-7.311004 z"
id="path4145"
inkscape:connector-curvature="0" /></svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View file

@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<path fill="#000000" d="M50.291,0.07c-18.706,0-33.871,15.165-33.871,33.87c0,0.401,0.013,0.81,0.03,1.221 c0.127,3.558,0.798,6.976,1.939,10.173c7.226,23.752,31.901,54.736,31.901,54.736s24.674-30.982,31.901-54.734 c1.143-3.197,1.812-6.617,1.939-10.175c0.02-0.411,0.031-0.819,0.031-1.221C84.162,15.235,68.998,0.07,50.291,0.07z M51.013,58.386 c-2.479,0-4.664-2.126-4.664-4.664c0-2.479,2.184-4.723,4.664-4.723s4.724,2.243,4.724,4.723 C55.736,56.26,53.551,58.386,51.013,58.386z M50.481,45.811c-1.062-6.376-2.479-12.634-3.601-19.01 c-0.236-1.357-0.295-2.302-0.295-3.66c0-2.716,1.299-5.667,4.428-5.667c3.483,0,4.428,3.011,4.428,6.021 c0,1.181-0.059,2.538-0.295,3.66c-1.181,6.199-2.302,12.457-3.483,18.655H50.481z"/>
</svg>

After

Width:  |  Height:  |  Size: 954 B

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49 49" enable-background="new 0 0 49 49" xml:space="preserve">
<g>
<g>
<path fill="#333" d="M49,46c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h43c1.7,0,3,1.3,3,3V46z"/>
</g>
<g>
<g id="Your_Icon_11_">
<g>
<polygon fill="#E7EEEE" points="23.6,19.9 15.1,19.9 15.1,27.8 23.6,27.8 23.6,33.8 33,23.9 23.6,14 "/>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 759 B

View file

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 49 49" enable-background="new 0 0 49 49" xml:space="preserve">
<g>
<g>
<path fill="#0E7077" d="M49,46c0,1.7-1.3,3-3,3H3c-1.7,0-3-1.3-3-3V3c0-1.7,1.3-3,3-3h43c1.7,0,3,1.3,3,3V46z"/>
</g>
<g>
<g id="Your_Icon_11_">
<g>
<polygon fill="#E7EEEE" points="23.6,19.9 15.1,19.9 15.1,27.8 23.6,27.8 23.6,33.8 33,23.9 23.6,14 "/>
</g>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 762 B

View file

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="1440"
height="200"
data-icon="map-marker"
data-container-transform="translate(24)"
viewBox="0 0 1440 200"
id="svg4136"
inkscape:version="0.91 r13725"
sodipodi:docname="address-bar.svg">
<metadata
id="metadata4144">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4142" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1840"
inkscape:window-height="1057"
id="namedview4140"
showgrid="false"
inkscape:zoom="0.8671875"
inkscape:cx="707.02439"
inkscape:cy="52.468468"
inkscape:window-x="72"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg4136" />
<rect
style="fill:#ededed;fill-opacity:1;stroke:none;stroke-linejoin:round;stroke-opacity:1"
id="rect4141"
width="1280"
height="140"
x="160"
y="30"
rx="16.025024"
ry="17.019567" />
<circle
style="fill:#b8b8b8;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path4146"
cx="100"
cy="100"
r="100" />
<path
d="m 100,36.000005 c -22.1,0 -40,17.9 -40,39.999995 0,30 40,88 40,88 0,0 40,-58 40,-88 0,-22.099995 -17.9,-39.999995 -40,-39.999995 z m 0,22 c 9.9,0 18,8.099995 18,17.999995 0,9.9 -8.1,18 -18,18 -9.9,0 -18,-8.1 -18,-18 0,-9.9 8.1,-17.999995 18,-17.999995 z"
id="path4138"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -1,91 +1,145 @@
//
// AddressBarDialog.qml
//
// Created by Austin Davis on 2015/04/14
// 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
//
import Hifi 1.0
import QtQuick 2.3
import QtQuick.Controls 1.2
import "controls"
import "styles"
Dialog {
Item {
id: root
HifiConstants { id: hifi }
title: "Go to..."
objectName: "AddressBarDialog"
contentImplicitWidth: addressBarDialog.implicitWidth
contentImplicitHeight: addressBarDialog.implicitHeight
destroyOnCloseButton: false
property int animationDuration: hifi.effects.fadeInDuration
property bool destroyOnInvisible: false
onVisibleChanged: {
if (!visible) {
reset();
}
implicitWidth: addressBarDialog.implicitWidth
implicitHeight: addressBarDialog.implicitHeight
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
property int maximumX: parent ? parent.width - width : 0
property int maximumY: parent ? parent.height - height : 0
AddressBarDialog {
id: addressBarDialog
implicitWidth: backgroundImage.width
implicitHeight: backgroundImage.height
Image {
id: backgroundImage
source: "../images/address-bar.svg"
width: 576
height: 80
property int inputAreaHeight: 56 // Height of the background's input area
property int inputAreaStep: (height - inputAreaHeight) / 2
TextInput {
id: addressLine
anchors {
fill: parent
leftMargin: parent.height + hifi.layout.spacing * 2
rightMargin: hifi.layout.spacing * 2
topMargin: parent.inputAreaStep + hifi.layout.spacing
bottomMargin: parent.inputAreaStep + hifi.layout.spacing
}
font.pointSize: 15
helperText: "Go to: place, @user, /path, network address"
onAccepted: {
event.accepted = true // Generates erroneous error in program log, "ReferenceError: event is not defined".
addressBarDialog.loadAddress(addressLine.text)
}
}
MouseArea {
// Drag the icon
width: parent.height
height: parent.height
x: 0
y: 0
drag {
target: root
minimumX: -parent.inputAreaStep
minimumY: -parent.inputAreaStep
maximumX: root.parent ? root.maximumX : 0
maximumY: root.parent ? root.maximumY + parent.inputAreaStep : 0
}
}
MouseArea {
// Drag the input rectangle
width: parent.width - parent.height
height: parent.inputAreaHeight
x: parent.height
y: parent.inputAreaStep
drag {
target: root
minimumX: -parent.inputAreaStep
minimumY: -parent.inputAreaStep
maximumX: root.parent ? root.maximumX : 0
maximumY: root.parent ? root.maximumY + parent.inputAreaStep : 0
}
}
}
}
// The UI enables an object, rather than manipulating its visibility, so that we can do animations in both directions.
// Because visibility and enabled are booleans, they cannot be animated. So when enabled is changed, we modify a property
// that can be animated, like scale or opacity, and then when the target animation value is reached, we can modify the
// visibility.
enabled: false
opacity: 0.0
onEnabledChanged: {
opacity = enabled ? 1.0 : 0.0
if (enabled) {
addressLine.forceActiveFocus();
}
}
onParentChanged: {
if (enabled && visible) {
addressLine.forceActiveFocus();
Behavior on opacity {
// Animate opacity.
NumberAnimation {
duration: animationDuration
easing.type: Easing.OutCubic
}
}
onOpacityChanged: {
// Once we're transparent, disable the dialog's visibility.
visible = (opacity != 0.0)
}
onVisibleChanged: {
if (!visible) {
reset()
// Some dialogs should be destroyed when they become invisible.
if (destroyOnInvisible) {
destroy()
}
}
}
function reset() {
addressLine.text = ""
goButton.source = "../images/address-bar-submit.svg"
}
AddressBarDialog {
id: addressBarDialog
// The client area
x: root.clientX
y: root.clientY
implicitWidth: 512
implicitHeight: border.height + hifi.layout.spacing * 4
Border {
id: border
height: 64
anchors.left: parent.left
anchors.leftMargin: hifi.layout.spacing * 2
anchors.right: goButton.left
anchors.rightMargin: hifi.layout.spacing
anchors.verticalCenter: parent.verticalCenter
TextInput {
id: addressLine
anchors.fill: parent
helperText: "domain, location, @user, /x,y,z"
anchors.margins: hifi.layout.spacing
onAccepted: {
event.accepted
addressBarDialog.loadAddress(addressLine.text)
}
}
}
Image {
id: goButton
width: 32
height: 32
anchors.right: parent.right
anchors.rightMargin: hifi.layout.spacing * 2
source: "../images/address-bar-submit.svg"
anchors.verticalCenter: parent.verticalCenter
MouseArea {
anchors.fill: parent
onClicked: {
parent.source = "../images/address-bar-submit-active.svg"
addressBarDialog.loadAddress(addressLine.text)
}
}
}
}
Keys.onEscapePressed: {
enabled = false;
}
function toggleOrGo() {
@ -95,8 +149,22 @@ Dialog {
addressBarDialog.loadAddress(addressLine.text)
}
}
Keys.onEscapePressed: {
enabled = false
}
Keys.onPressed: {
switch(event.key) {
case Qt.Key_W:
if (event.modifiers == Qt.ControlModifier) {
event.accepted = true
enabled = false
}
break
}
}
Keys.onReturnPressed: toggleOrGo()
Keys.onEnterPressed: toggleOrGo()
}

View file

@ -0,0 +1,152 @@
//
// ErrorDialog.qml
//
// Created by David Rowe on 30 May 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
//
import Hifi 1.0 as Hifi
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import "controls"
import "styles"
Item {
id: root
HifiConstants { id: hifi }
property int animationDuration: hifi.effects.fadeInDuration
property bool destroyOnInvisible: true
Component.onCompleted: {
enabled = true
}
onParentChanged: {
if (visible && enabled) {
forceActiveFocus();
}
}
implicitWidth: content.implicitWidth
implicitHeight: content.implicitHeight
x: parent ? parent.width / 2 - width / 2 : 0
y: parent ? parent.height / 2 - height / 2 : 0
Hifi.ErrorDialog {
id: content
implicitWidth: box.width
implicitHeight: icon.height + hifi.layout.spacing * 2
Border {
id: box
width: 512
color: "#ebebeb"
radius: 2
border.width: 1
border.color: "#000000"
Image {
id: icon
source: "../images/address-bar-error-icon.svg"
width: 40
height: 40
anchors {
left: parent.left
leftMargin: hifi.layout.spacing
verticalCenter: parent.verticalCenter
}
}
Text {
id: messageText
font.pointSize: 10
font.weight: Font.Bold
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
text: content.text
}
Image {
source: "../images/address-bar-error-close.svg"
width: 20
height: 20
anchors {
right: parent.right
rightMargin: hifi.layout.spacing * 2
verticalCenter: parent.verticalCenter
}
MouseArea {
anchors.fill: parent
onClicked: {
content.accept();
}
}
}
}
}
// The UI enables an object, rather than manipulating its visibility, so that we can do animations in both directions.
// Because visibility and enabled are booleans, they cannot be animated. So when enabled is changed, we modify a property
// that can be animated, like scale or opacity, and then when the target animation value is reached, we can modify the
// visibility.
enabled: false
opacity: 0.0
onEnabledChanged: {
opacity = enabled ? 1.0 : 0.0
}
Behavior on opacity {
// Animate opacity.
NumberAnimation {
duration: animationDuration
easing.type: Easing.OutCubic
}
}
onOpacityChanged: {
// Once we're transparent, disable the dialog's visibility.
visible = (opacity != 0.0)
}
onVisibleChanged: {
if (!visible) {
// Some dialogs should be destroyed when they become invisible.
if (destroyOnInvisible) {
destroy()
}
}
}
Keys.onPressed: {
if (event.modifiers === Qt.ControlModifier)
switch (event.key) {
case Qt.Key_W:
event.accepted = true
content.accept()
break
} else switch (event.key) {
case Qt.Key_Escape:
case Qt.Key_Back:
case Qt.Key_Enter:
case Qt.Key_Return:
event.accepted = true
content.accept()
break
}
}
}

View file

@ -31,7 +31,7 @@ DialogBase {
* Support for animating the dialog in and out.
*/
enabled: false
scale: 0.0
opacity: 1.0
// The offscreen UI will enable an object, rather than manipulating it's
// visibility, so that we can do animations in both directions. Because
@ -40,20 +40,20 @@ DialogBase {
// opacity, and then when the target animation value is reached, we can
// modify the visibility
onEnabledChanged: {
scale = enabled ? 1.0 : 0.0
opacity = enabled ? 1.0 : 0.0
}
// The actual animator
Behavior on scale {
Behavior on opacity {
NumberAnimation {
duration: root.animationDuration
easing.type: Easing.InOutBounce
duration: animationDuration
easing.type: Easing.OutCubic
}
}
// Once we're scaled to 0, disable the dialog's visibility
onScaleChanged: {
visible = (scale != 0.0);
// Once we're transparent, disable the dialog's visibility
onOpacityChanged: {
visible = (opacity != 0.0);
}
// Some dialogs should be destroyed when they become invisible,

View file

@ -56,6 +56,6 @@ Item {
QtObject {
id: effects
readonly property int fadeInDuration: 400
readonly property int fadeInDuration: 300
}
}

View file

@ -55,40 +55,41 @@
#include <QMessageBox>
#include <QJsonDocument>
#include <AddressManager.h>
#include <AccountManager.h>
#include <AddressManager.h>
#include <AmbientOcclusionEffect.h>
#include <AudioInjector.h>
#include <DeferredLightingEffect.h>
#include <DependencyManager.h>
#include <EntityScriptingInterface.h>
#include <ErrorDialog.h>
#include <GlowEffect.h>
#include <HFActionEvent.h>
#include <HFBackEvent.h>
#include <VrMenu.h>
#include <InfoView.h>
#include <LogHandler.h>
#include <MainWindow.h>
#include <MessageDialog.h>
#include <ModelEntityItem.h>
#include <NetworkAccessManager.h>
#include <NetworkingConstants.h>
#include <ObjectMotionState.h>
#include <OctalCode.h>
#include <OctreeSceneStats.h>
#include <ObjectMotionState.h>
#include <PacketHeaders.h>
#include <PathUtils.h>
#include <PerfStat.h>
#include <PhysicsEngine.h>
#include <ProgramObject.h>
#include <ResourceCache.h>
#include <SceneScriptingInterface.h>
#include <ScriptCache.h>
#include <SettingHandle.h>
#include <SoundCache.h>
#include <TextRenderer.h>
#include <UserActivityLogger.h>
#include <UUID.h>
#include <MessageDialog.h>
#include <InfoView.h>
#include <SceneScriptingInterface.h>
#include <VrMenu.h>
#include "Application.h"
#include "AudioClient.h"
@ -794,6 +795,7 @@ void Application::initializeGL() {
void Application::initializeUi() {
AddressBarDialog::registerType();
ErrorDialog::registerType();
LoginDialog::registerType();
MessageDialog::registerType();
VrMenu::registerType();
@ -3012,10 +3014,16 @@ PickRay Application::computePickRay(float x, float y) const {
QImage Application::renderAvatarBillboard() {
auto primaryFramebuffer = DependencyManager::get<TextureCache>()->getPrimaryFramebuffer();
glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(primaryFramebuffer));
// clear the alpha channel so the background is transparent
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
// the "glow" here causes an alpha of one
Glower glower;
const int BILLBOARD_SIZE = 64;
#if 0
renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE,
@ -3025,9 +3033,10 @@ QImage Application::renderAvatarBillboard() {
QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
return image;
}
@ -3275,7 +3284,8 @@ void Application::displaySide(const Camera& theCamera, bool selfAvatarOnly) {
false, selfAvatarOnly);
}
{
if (true) {
//if (!billboard) {
DependencyManager::get<DeferredLightingEffect>()->setAmbientLightMode(getRenderAmbientLight());
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
DependencyManager::get<DeferredLightingEffect>()->setGlobalLight(skyStage->getSunLight()->getDirection(), skyStage->getSunLight()->getColor(), skyStage->getSunLight()->getIntensity(), skyStage->getSunLight()->getAmbientIntensity());

View file

@ -281,7 +281,6 @@ public:
QImage renderAvatarBillboard();
void displaySide(const Camera& camera, bool selfAvatarOnly = false);
void getModelViewMatrix(glm::dmat4* modelViewMatrix);
void getProjectionMatrix(glm::dmat4* projectionMatrix);

View file

@ -36,12 +36,10 @@ void AddressBarDialog::loadAddress(const QString& address) {
}
void AddressBarDialog::displayAddressOfflineMessage() {
OffscreenUi::information("Address offline",
"That user or place is currently offline.");
OffscreenUi::error("That user or place is currently offline");
}
void AddressBarDialog::displayAddressNotFoundMessage() {
OffscreenUi::information("Address not found",
"There is no address information for that user or place.");
OffscreenUi::error("There is no address information for that user or place");
}

View file

@ -1133,7 +1133,7 @@ void EntityTreeRenderer::playEntityCollisionSound(const QUuid& myNodeID, EntityT
const float energy = mass * linearVelocity * linearVelocity / 2.0f;
const glm::vec3 position = collision.contactPoint;
const float COLLISION_ENERGY_AT_FULL_VOLUME = 0.5f;
const float COLLISION_MINIMUM_VOLUME = 0.001f;
const float COLLISION_MINIMUM_VOLUME = 0.005f;
const float energyFactorOfFull = fmin(1.0f, energy / COLLISION_ENERGY_AT_FULL_VOLUME);
if (energyFactorOfFull < COLLISION_MINIMUM_VOLUME) {
return;
@ -1149,7 +1149,7 @@ void EntityTreeRenderer::playEntityCollisionSound(const QUuid& myNodeID, EntityT
}
// This is a hack. Quiet sound aren't really heard at all, so we compress everything to the range [1-c, 1], if we play it all.
const float COLLISION_SOUND_COMPRESSION_RANGE = 0.7f;
const float COLLISION_SOUND_COMPRESSION_RANGE = 1.0f; // This section could be removed when the value is 1, but let's see how it goes.
float volume = energyFactorOfFull;
volume = (volume * COLLISION_SOUND_COMPRESSION_RANGE) + (1.0f - COLLISION_SOUND_COMPRESSION_RANGE);
@ -1180,7 +1180,7 @@ void EntityTreeRenderer::entityCollisionWithEntity(const EntityItemID& idA, cons
return;
}
// Don't respond to small continuous contacts.
const float COLLISION_MINUMUM_PENETRATION = 0.005f;
const float COLLISION_MINUMUM_PENETRATION = 0.002f;
if ((collision.type != CONTACT_EVENT_TYPE_START) && (glm::length(collision.penetration) < COLLISION_MINUMUM_PENETRATION)) {
return;
}

View file

@ -0,0 +1,38 @@
//
// ErrorDialog.cpp
//
// Created by David Rowe on 30 May 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
//
#include "ErrorDialog.h"
HIFI_QML_DEF(ErrorDialog)
ErrorDialog::ErrorDialog(QQuickItem* parent) : OffscreenQmlDialog(parent) {
}
ErrorDialog::~ErrorDialog() {
}
QString ErrorDialog::text() const {
return _text;
}
void ErrorDialog::setVisible(bool v) {
OffscreenQmlDialog::setVisible(v);
}
void ErrorDialog::setText(const QString& arg) {
if (arg != _text) {
_text = arg;
emit textChanged();
}
}
void ErrorDialog::accept() {
OffscreenQmlDialog::accept();
}

View file

@ -0,0 +1,46 @@
//
// ErrorDialog.h
//
// Created by David Rowe on 30 May 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
//
#pragma once
#ifndef hifi_ErrorDialog_h
#define hifi_ErrorDialog_h
#include "OffscreenQmlDialog.h"
class ErrorDialog : public OffscreenQmlDialog
{
Q_OBJECT
HIFI_QML_DECL
private:
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
public:
ErrorDialog(QQuickItem* parent = 0);
virtual ~ErrorDialog();
QString text() const;
public slots:
virtual void setVisible(bool v);
void setText(const QString& arg);
signals:
void textChanged();
protected slots:
virtual void accept();
private:
QString _text;
};
#endif // hifi_ErrorDialog_h

View file

@ -13,6 +13,7 @@
#include <QOpenGLDebugLogger>
#include <QGLWidget>
#include <QtQml>
#include "ErrorDialog.h"
#include "MessageDialog.h"
@ -130,6 +131,15 @@ void OffscreenUi::critical(const QString& title, const QString& text,
static_cast<QMessageBox::Icon>(MessageDialog::Critical), buttons);
}
void OffscreenUi::error(const QString& text) {
ErrorDialog* pDialog{ nullptr };
ErrorDialog::show([&](QQmlContext* ctx, QObject* item) {
pDialog = item->findChild<ErrorDialog*>();
pDialog->setText(text);
});
pDialog->setEnabled(true);
}
OffscreenUi::ButtonCallback OffscreenUi::NO_OP_CALLBACK = [](QMessageBox::StandardButton) {};

View file

@ -115,6 +115,8 @@ public:
static void critical(const QString& title, const QString& text,
ButtonCallback callback = NO_OP_CALLBACK,
QMessageBox::StandardButtons buttons = QMessageBox::Ok);
static void error(const QString& text); // Interim dialog in new style
};
#endif