mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
color nodes by audio level
This commit is contained in:
parent
42b2b2154e
commit
e67675ac36
1 changed files with 11 additions and 4 deletions
|
@ -58,8 +58,13 @@ ExtendedOverlay.prototype.editOverlay = function (properties) { // change displa
|
||||||
Overlays.editOverlay(this.activeOverlay, properties);
|
Overlays.editOverlay(this.activeOverlay, properties);
|
||||||
};
|
};
|
||||||
|
|
||||||
function color(selected) {
|
function color(selected, level) {
|
||||||
return selected ? SELECTED_COLOR : UNSELECTED_COLOR;
|
var base = selected ? SELECTED_COLOR : UNSELECTED_COLOR;
|
||||||
|
function scale(component) {
|
||||||
|
var delta = 0xFF - component;
|
||||||
|
return component + (delta * level);
|
||||||
|
}
|
||||||
|
return {red: scale(base.red), green: scale(base.green), blue: scale(base.blue)};
|
||||||
}
|
}
|
||||||
|
|
||||||
function textures(selected) {
|
function textures(selected) {
|
||||||
|
@ -71,7 +76,7 @@ ExtendedOverlay.prototype.select = function (selected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.editOverlay({color: color(selected)});
|
this.editOverlay({color: color(selected, this.audioLevel)});
|
||||||
if (this.model) {
|
if (this.model) {
|
||||||
this.model.editOverlay({textures: textures(selected)});
|
this.model.editOverlay({textures: textures(selected)});
|
||||||
}
|
}
|
||||||
|
@ -204,7 +209,7 @@ function addAvatarNode(id) {
|
||||||
drawInFront: true,
|
drawInFront: true,
|
||||||
solid: true,
|
solid: true,
|
||||||
alpha: 0.8,
|
alpha: 0.8,
|
||||||
color: color(selected),
|
color: color(selected, 0.0),
|
||||||
ignoreRayIntersection: false}, selected, true);
|
ignoreRayIntersection: false}, selected, true);
|
||||||
}
|
}
|
||||||
function populateUserList() {
|
function populateUserList() {
|
||||||
|
@ -288,6 +293,7 @@ function updateOverlays() {
|
||||||
|
|
||||||
overlay.ping = pingPong;
|
overlay.ping = pingPong;
|
||||||
overlay.editOverlay({
|
overlay.editOverlay({
|
||||||
|
color: color(ExtendedOverlay.isSelected(id), overlay.audioLevel),
|
||||||
position: target,
|
position: target,
|
||||||
dimensions: 0.032 * distance
|
dimensions: 0.032 * distance
|
||||||
});
|
});
|
||||||
|
@ -451,6 +457,7 @@ function getAudioLevel(id) {
|
||||||
if (audioLevel > 1.0) {
|
if (audioLevel > 1.0) {
|
||||||
audioLevel = 1;
|
audioLevel = 1;
|
||||||
}
|
}
|
||||||
|
data.audioLevel = audioLevel;
|
||||||
return audioLevel;
|
return audioLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue