mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 00:17:25 +02:00
parent
fcd44f5817
commit
e30cf33a03
4 changed files with 10 additions and 38 deletions
|
@ -10,31 +10,18 @@
|
||||||
// in response to the audio intensity.
|
// in response to the audio intensity.
|
||||||
//
|
//
|
||||||
|
|
||||||
// add two vectors
|
|
||||||
function vPlus(a, b) {
|
|
||||||
var rval = { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
|
|
||||||
// multiply scalar with vector
|
|
||||||
function vsMult(s, v) {
|
|
||||||
var rval = { x: s * v.x, y: s * v.y, z: s * v.z };
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
||||||
var FACTOR = 0.75;
|
var FACTOR = 0.75;
|
||||||
|
|
||||||
var countParticles = 0; // the first time around we want to create the particle and thereafter to modify it.
|
var countParticles = 0; // the first time around we want to create the particle and thereafter to modify it.
|
||||||
var particleID;
|
var particleID;
|
||||||
|
|
||||||
function updateParticle()
|
function updateParticle() {
|
||||||
{
|
|
||||||
// the particle should be placed in front of the user's avatar
|
// the particle should be placed in front of the user's avatar
|
||||||
var avatarFront = Quat.getFront(MyAvatar.orientation);
|
var avatarFront = Quat.getFront(MyAvatar.orientation);
|
||||||
|
|
||||||
// move particle three units in front of the avatar
|
// move particle three units in front of the avatar
|
||||||
var particlePosition = vPlus(MyAvatar.position, vsMult (3, avatarFront));
|
var particlePosition = Vec3.sum(MyAvatar.position, Vec3.multiply(avatarFront, 3));
|
||||||
|
|
||||||
// play a sound at the location of the particle
|
// play a sound at the location of the particle
|
||||||
var options = new AudioInjectionOptions();
|
var options = new AudioInjectionOptions();
|
||||||
|
@ -42,11 +29,10 @@ function updateParticle()
|
||||||
options.volume = 0.75;
|
options.volume = 0.75;
|
||||||
Audio.playSound(sound, options);
|
Audio.playSound(sound, options);
|
||||||
|
|
||||||
var audioAverageLoudness = MyAvatar.audioAverageLoudness * FACTOR;
|
var audioAverageLoudness = MyAvatar.audioAverageLoudness * FACTOR;
|
||||||
//print ("Audio Loudness = " + MyAvatar.audioLoudness + " -- Audio Average Loudness = " + MyAvatar.audioAverageLoudness);
|
//print ("Audio Loudness = " + MyAvatar.audioLoudness + " -- Audio Average Loudness = " + MyAvatar.audioAverageLoudness);
|
||||||
|
|
||||||
if (countParticles < 1)
|
if (countParticles < 1) {
|
||||||
{
|
|
||||||
var particleProperies = {
|
var particleProperies = {
|
||||||
position: particlePosition // the particle should stay in front of the user's avatar as he moves
|
position: particlePosition // the particle should stay in front of the user's avatar as he moves
|
||||||
, color: { red: 0, green: 255, blue: 0 }
|
, color: { red: 0, green: 255, blue: 0 }
|
||||||
|
@ -59,8 +45,7 @@ function updateParticle()
|
||||||
particleID = Particles.addParticle (particleProperies);
|
particleID = Particles.addParticle (particleProperies);
|
||||||
countParticles++;
|
countParticles++;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
// animates the particles radius and color in response to the changing audio intensity
|
// animates the particles radius and color in response to the changing audio intensity
|
||||||
var newProperties = {
|
var newProperties = {
|
||||||
position: particlePosition // the particle should stay in front of the user's avatar as he moves
|
position: particlePosition // the particle should stay in front of the user's avatar as he moves
|
||||||
|
|
|
@ -10,28 +10,15 @@
|
||||||
// in response to the audio intensity.
|
// in response to the audio intensity.
|
||||||
//
|
//
|
||||||
|
|
||||||
// add two vectors
|
|
||||||
function vPlus(a, b) {
|
|
||||||
var rval = { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
|
|
||||||
// multiply scalar with vector
|
|
||||||
function vsMult(s, v) {
|
|
||||||
var rval = { x: s * v.x, y: s * v.y, z: s * v.z };
|
|
||||||
return rval;
|
|
||||||
}
|
|
||||||
|
|
||||||
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
var sound = new Sound("https://s3-us-west-1.amazonaws.com/highfidelity-public/sounds/Animals/mexicanWhipoorwill.raw");
|
||||||
var FACTOR = 0.75;
|
var FACTOR = 0.75;
|
||||||
|
|
||||||
function addParticle()
|
function addParticle() {
|
||||||
{
|
|
||||||
// the particle should be placed in front of the user's avatar
|
// the particle should be placed in front of the user's avatar
|
||||||
var avatarFront = Quat.getFront(MyAvatar.orientation);
|
var avatarFront = Quat.getFront(MyAvatar.orientation);
|
||||||
|
|
||||||
// move particle three units in front of the avatar
|
// move particle three units in front of the avatar
|
||||||
var particlePosition = vPlus(MyAvatar.position, vsMult (3, avatarFront));
|
var particlePosition = Vec3.sum(MyAvatar.position, Vec3.multiply (avatarFront, 3));
|
||||||
|
|
||||||
// play a sound at the location of the particle
|
// play a sound at the location of the particle
|
||||||
var options = new AudioInjectionOptions();
|
var options = new AudioInjectionOptions();
|
||||||
|
|
|
@ -141,7 +141,7 @@ void MyAvatar::update(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get audio loudness data from audio input device
|
// Get audio loudness data from audio input device
|
||||||
Audio *audio = Application::getInstance()->getAudio();
|
Audio* audio = Application::getInstance()->getAudio();
|
||||||
_head.setAudioLoudness(audio->getLastInputLoudness());
|
_head.setAudioLoudness(audio->getLastInputLoudness());
|
||||||
_head.setAudioAverageLoudness(audio->getAudioAverageInputLoudness());
|
_head.setAudioAverageLoudness(audio->getAudioAverageInputLoudness());
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ protected:
|
||||||
float _rightEyeBlink;
|
float _rightEyeBlink;
|
||||||
float _averageLoudness;
|
float _averageLoudness;
|
||||||
float _browAudioLift;
|
float _browAudioLift;
|
||||||
float _audioAverageLoudness;
|
float _audioAverageLoudness;
|
||||||
std::vector<float> _blendshapeCoefficients;
|
std::vector<float> _blendshapeCoefficients;
|
||||||
float _pupilDilation;
|
float _pupilDilation;
|
||||||
AvatarData* _owningAvatar;
|
AvatarData* _owningAvatar;
|
||||||
|
|
Loading…
Reference in a new issue