mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:49:05 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi
This commit is contained in:
commit
e1266ef74d
7 changed files with 71 additions and 44 deletions
|
@ -35,16 +35,26 @@ var chords = new Array();
|
||||||
chords[1] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw");
|
chords[1] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+A.raw");
|
||||||
chords[2] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+B.raw");
|
chords[2] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+B.raw");
|
||||||
chords[3] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+E.raw");
|
chords[3] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+E.raw");
|
||||||
|
chords[4] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Nylon+G.raw");
|
||||||
|
|
||||||
// Electric guitar
|
// Electric guitar
|
||||||
chords[4] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+A+short.raw");
|
chords[5] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+A+short.raw");
|
||||||
chords[5] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+B+short.raw");
|
chords[6] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+B+short.raw");
|
||||||
chords[6] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+E+short.raw");
|
chords[7] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+E+short.raw");
|
||||||
|
chords[8] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Metal+G+short.raw");
|
||||||
|
|
||||||
var guitarSelector = 3;
|
// Steel Guitar
|
||||||
|
chords[9] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+A.raw");
|
||||||
|
chords[10] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+B.raw");
|
||||||
|
chords[11] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+E.raw");
|
||||||
|
chords[12] = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Guitars/Guitar+-+Steel+G.raw");
|
||||||
|
|
||||||
var whichChord = chords[guitarSelector + 1];
|
var NUM_CHORDS = 4;
|
||||||
|
var NUM_GUITARS = 3;
|
||||||
|
var guitarSelector = NUM_CHORDS;
|
||||||
|
var whichChord = 1;
|
||||||
|
|
||||||
var leftHanded = false;
|
var leftHanded = true;
|
||||||
if (leftHanded) {
|
if (leftHanded) {
|
||||||
var strumHand = 0;
|
var strumHand = 0;
|
||||||
var chordHand = 1;
|
var chordHand = 1;
|
||||||
|
@ -59,20 +69,23 @@ var lastPosition = { x: 0.0,
|
||||||
|
|
||||||
var soundPlaying = false;
|
var soundPlaying = false;
|
||||||
var selectorPressed = false;
|
var selectorPressed = false;
|
||||||
|
var position;
|
||||||
|
|
||||||
MyAvatar.attach(guitarModel, "Hips", {x: -0.0, y: -0.0, z: 0.0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.0);
|
MyAvatar.attach(guitarModel, "Hips", {x: -0.0, y: -0.0, z: 0.0}, Quat.fromPitchYawRollDegrees(0, 0, 0), 1.0);
|
||||||
|
|
||||||
function checkHands(deltaTime) {
|
function checkHands(deltaTime) {
|
||||||
for (var palm = 0; palm < 2; palm++) {
|
for (var palm = 0; palm < 2; palm++) {
|
||||||
var palmVelocity = Controller.getSpatialControlVelocity(palm * 2 + 1);
|
var palmVelocity = Controller.getSpatialControlVelocity(palm * 2 + 1);
|
||||||
var speed = length(palmVelocity) / 4.0;
|
var volume = length(palmVelocity) / 5.0;
|
||||||
var position = Controller.getSpatialControlPosition(palm * 2 + 1);
|
var position = Controller.getSpatialControlPosition(palm * 2 + 1);
|
||||||
var myPelvis = MyAvatar.position;
|
var myPelvis = MyAvatar.position;
|
||||||
var trigger = Controller.getTriggerValue(strumHand);
|
var trigger = Controller.getTriggerValue(strumHand);
|
||||||
var chord = Controller.getTriggerValue(chordHand);
|
var chord = Controller.getTriggerValue(chordHand);
|
||||||
|
|
||||||
|
if (volume > 1.0) volume = 1.0;
|
||||||
if ((chord > 0.1) && Audio.isInjectorPlaying(soundPlaying)) {
|
if ((chord > 0.1) && Audio.isInjectorPlaying(soundPlaying)) {
|
||||||
// If chord finger trigger pulled, stop current chord
|
// If chord finger trigger pulled, stop current chord
|
||||||
|
print("stopped sound");
|
||||||
Audio.stopInjector(soundPlaying);
|
Audio.stopInjector(soundPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,9 +94,8 @@ function checkHands(deltaTime) {
|
||||||
// Change guitars if button FWD (5) pressed
|
// Change guitars if button FWD (5) pressed
|
||||||
if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 5)) {
|
if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 5)) {
|
||||||
if (!selectorPressed) {
|
if (!selectorPressed) {
|
||||||
if (guitarSelector == 0) {
|
guitarSelector += NUM_CHORDS;
|
||||||
guitarSelector = 3;
|
if (guitarSelector >= NUM_CHORDS * NUM_GUITARS) {
|
||||||
} else {
|
|
||||||
guitarSelector = 0;
|
guitarSelector = 0;
|
||||||
}
|
}
|
||||||
selectorPressed = true;
|
selectorPressed = true;
|
||||||
|
@ -93,38 +105,65 @@ function checkHands(deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 1)) {
|
if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 1)) {
|
||||||
whichChord = chords[guitarSelector + 1];
|
whichChord = 1;
|
||||||
} else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 2)) {
|
} else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 2)) {
|
||||||
whichChord = chords[guitarSelector + 2];
|
whichChord = 2;
|
||||||
} else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 3)) {
|
} else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 3)) {
|
||||||
whichChord = chords[guitarSelector + 3];
|
whichChord = 3;
|
||||||
|
} else if (Controller.isButtonPressed(chordHand * BUTTON_COUNT + 4)) {
|
||||||
|
whichChord = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (palm == strumHand) {
|
if (palm == strumHand) {
|
||||||
|
|
||||||
var STRUM_HEIGHT_ABOVE_PELVIS = 0.00;
|
var STRUM_HEIGHT_ABOVE_PELVIS = 0.10;
|
||||||
var strumTriggerHeight = myPelvis.y + STRUM_HEIGHT_ABOVE_PELVIS;
|
var strumTriggerHeight = myPelvis.y + STRUM_HEIGHT_ABOVE_PELVIS;
|
||||||
//printVector(position);
|
//printVector(position);
|
||||||
if ( ( ((position.y < strumTriggerHeight) && (lastPosition.y >= strumTriggerHeight)) ||
|
if ( ( ((position.y < strumTriggerHeight) && (lastPosition.y >= strumTriggerHeight)) ||
|
||||||
((position.y > strumTriggerHeight) && (lastPosition.y <= strumTriggerHeight)) ) && (trigger > 0.1) ){
|
((position.y > strumTriggerHeight) && (lastPosition.y <= strumTriggerHeight)) ) && (trigger > 0.1) ){
|
||||||
// If hand passes downward or upward through 'strings', and finger trigger pulled, play
|
// If hand passes downward or upward through 'strings', and finger trigger pulled, play
|
||||||
var options = new AudioInjectionOptions();
|
playChord(position, volume);
|
||||||
options.position = position;
|
|
||||||
if (speed > 1.0) { speed = 1.0; }
|
|
||||||
options.volume = speed;
|
|
||||||
if (Audio.isInjectorPlaying(soundPlaying)) {
|
|
||||||
Audio.stopInjector(soundPlaying);
|
|
||||||
}
|
|
||||||
soundPlaying = Audio.playSound(whichChord, options);
|
|
||||||
}
|
}
|
||||||
lastPosition = Controller.getSpatialControlPosition(palm * 2 + 1);
|
lastPosition = Controller.getSpatialControlPosition(palm * 2 + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function playChord(position, volume) {
|
||||||
|
var options = new AudioInjectionOptions();
|
||||||
|
options.position = position;
|
||||||
|
options.volume = volume;
|
||||||
|
if (Audio.isInjectorPlaying(soundPlaying)) {
|
||||||
|
print("stopped sound");
|
||||||
|
Audio.stopInjector(soundPlaying);
|
||||||
|
}
|
||||||
|
print("Played sound: " + whichChord + " at volume " + options.volume);
|
||||||
|
soundPlaying = Audio.playSound(chords[guitarSelector + whichChord], options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function keyPressEvent(event) {
|
||||||
|
// check for keypresses and use those to trigger sounds if not hydra
|
||||||
|
keyVolume = 0.4;
|
||||||
|
if (event.text == "1") {
|
||||||
|
whichChord = 1;
|
||||||
|
playChord(MyAvatar.position, keyVolume);
|
||||||
|
} else if (event.text == "2") {
|
||||||
|
whichChord = 2;
|
||||||
|
playChord(MyAvatar.position, keyVolume);
|
||||||
|
} else if (event.text == "3") {
|
||||||
|
whichChord = 3;
|
||||||
|
playChord(MyAvatar.position, keyVolume);
|
||||||
|
} else if (event.text == "4") {
|
||||||
|
whichChord = 4;
|
||||||
|
playChord(MyAvatar.position, keyVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function scriptEnding() {
|
function scriptEnding() {
|
||||||
MyAvatar.detachOne(guitarModel);
|
MyAvatar.detachOne(guitarModel);
|
||||||
}
|
}
|
||||||
// Connect a call back that happens every frame
|
// Connect a call back that happens every frame
|
||||||
Script.update.connect(checkHands);
|
Script.update.connect(checkHands);
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
|
Controller.keyPressEvent.connect(keyPressEvent);
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
|
_mirrorViewRect(QRect(MIRROR_VIEW_LEFT_PADDING, MIRROR_VIEW_TOP_PADDING, MIRROR_VIEW_WIDTH, MIRROR_VIEW_HEIGHT)),
|
||||||
_cameraPushback(0.0f),
|
_cameraPushback(0.0f),
|
||||||
_scaleMirror(1.0f),
|
_scaleMirror(1.0f),
|
||||||
|
_rotateMirror(0.0f),
|
||||||
|
_raiseMirror(0.0f),
|
||||||
_mouseX(0),
|
_mouseX(0),
|
||||||
_mouseY(0),
|
_mouseY(0),
|
||||||
_lastMouseMove(usecTimestampNow()),
|
_lastMouseMove(usecTimestampNow()),
|
||||||
|
|
|
@ -970,9 +970,7 @@ void Menu::goToUser(const QString& user) {
|
||||||
/// Open a url, shortcutting any "hifi" scheme URLs to the local application.
|
/// Open a url, shortcutting any "hifi" scheme URLs to the local application.
|
||||||
void Menu::openUrl(const QUrl& url) {
|
void Menu::openUrl(const QUrl& url) {
|
||||||
if (url.scheme() == "hifi") {
|
if (url.scheme() == "hifi") {
|
||||||
QString path = url.toString(QUrl::RemoveScheme);
|
goToURL(url.toString());
|
||||||
path = path.remove(QRegExp("^:?/*"));
|
|
||||||
goTo(path);
|
|
||||||
} else {
|
} else {
|
||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -406,7 +406,7 @@ void Avatar::renderBillboard() {
|
||||||
}
|
}
|
||||||
_billboardTexture.reset(new Texture());
|
_billboardTexture.reset(new Texture());
|
||||||
glBindTexture(GL_TEXTURE_2D, _billboardTexture->getID());
|
glBindTexture(GL_TEXTURE_2D, _billboardTexture->getID());
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 1,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0,
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE, image.constBits());
|
GL_BGRA, GL_UNSIGNED_BYTE, image.constBits());
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
||||||
|
|
|
@ -366,10 +366,10 @@ void NetworkTexture::setImage(const QImage& image, bool translucent) {
|
||||||
imageLoaded(image);
|
imageLoaded(image);
|
||||||
glBindTexture(GL_TEXTURE_2D, getID());
|
glBindTexture(GL_TEXTURE_2D, getID());
|
||||||
if (image.hasAlphaChannel()) {
|
if (image.hasAlphaChannel()) {
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 1,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.width(), image.height(), 0,
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE, image.constBits());
|
GL_BGRA, GL_UNSIGNED_BYTE, image.constBits());
|
||||||
} else {
|
} else {
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 1,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, image.width(), image.height(), 0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, image.constBits());
|
GL_RGB, GL_UNSIGNED_BYTE, image.constBits());
|
||||||
}
|
}
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
@ -404,10 +404,10 @@ QSharedPointer<Texture> DilatableNetworkTexture::getDilatedTexture(float dilatio
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texture->getID());
|
glBindTexture(GL_TEXTURE_2D, texture->getID());
|
||||||
if (dilatedImage.hasAlphaChannel()) {
|
if (dilatedImage.hasAlphaChannel()) {
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dilatedImage.width(), dilatedImage.height(), 1,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, dilatedImage.width(), dilatedImage.height(), 0,
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE, dilatedImage.constBits());
|
GL_BGRA, GL_UNSIGNED_BYTE, dilatedImage.constBits());
|
||||||
} else {
|
} else {
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dilatedImage.width(), dilatedImage.height(), 1,
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, dilatedImage.width(), dilatedImage.height(), 0,
|
||||||
GL_RGB, GL_UNSIGNED_BYTE, dilatedImage.constBits());
|
GL_RGB, GL_UNSIGNED_BYTE, dilatedImage.constBits());
|
||||||
}
|
}
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
const int NUM_MESSAGES_TO_TIME_STAMP = 20;
|
const int NUM_MESSAGES_TO_TIME_STAMP = 20;
|
||||||
|
|
||||||
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?))://\\S+)");
|
const QRegularExpression regexLinks("((?:(?:ftp)|(?:https?)|(?:hifi))://\\S+)");
|
||||||
const QRegularExpression regexHifiLinks("([#@]\\S+)");
|
const QRegularExpression regexHifiLinks("([#@]\\S+)");
|
||||||
const QString mentionSoundsPath("/sounds/mention/");
|
const QString mentionSoundsPath("/sounds/mention/");
|
||||||
const QString mentionRegex("@(\\b%1\\b)");
|
const QString mentionRegex("@(\\b%1\\b)");
|
||||||
|
|
|
@ -88,10 +88,6 @@ padding-top: 3px;</string>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Reload all</string>
|
<string>Reload all</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>../resources/images/reload.svg</normaloff>../resources/images/reload.svg</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="stopAllButton">
|
<widget class="QPushButton" name="stopAllButton">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -115,10 +111,6 @@ padding-top: 3px;</string>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Stop all</string>
|
<string>Stop all</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>../resources/images/stop.svg</normaloff>../resources/images/stop.svg</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QLabel" name="recentlyLoadedLabel">
|
<widget class="QLabel" name="recentlyLoadedLabel">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
@ -251,10 +243,6 @@ padding-top: 3px;</string>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load script</string>
|
<string>Load script</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>../resources/images/plus.svg</normaloff>../resources/images/plus.svg</iconset>
|
|
||||||
</property>
|
|
||||||
</widget>
|
</widget>
|
||||||
<zorder>widgetTitle</zorder>
|
<zorder>widgetTitle</zorder>
|
||||||
<zorder>currentlyRunningLabel</zorder>
|
<zorder>currentlyRunningLabel</zorder>
|
||||||
|
|
Loading…
Reference in a new issue