From 588231cebfa22cd4a9685be901568b8d391b9882 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Mon, 14 Apr 2014 15:36:20 -0700 Subject: [PATCH] reconcile old and new implmentations so that 0 fan out produces same results --- interface/src/AudioReflector.cpp | 78 +++++++++++++++++++++++++------- interface/src/AudioReflector.h | 10 ++-- 2 files changed, 67 insertions(+), 21 deletions(-) diff --git a/interface/src/AudioReflector.cpp b/interface/src/AudioReflector.cpp index 31ceaa2594..fdafa3d762 100644 --- a/interface/src/AudioReflector.cpp +++ b/interface/src/AudioReflector.cpp @@ -108,7 +108,7 @@ float AudioReflector::getBounceAttenuationCoefficient(int bounceCount) { // now we know the current attenuation for the "perfect" reflection case, but we now incorporate // our surface materials to determine how much of this ray is absorbed, reflected, and diffused SurfaceCharacteristics material = getSurfaceCharacteristics(); - return material.reflectiveRatio * bounceCount; + return powf(material.reflectiveRatio, bounceCount); } glm::vec3 AudioReflector::getFaceNormal(BoxFace face) { @@ -183,6 +183,21 @@ void AudioReflector::calculateAllReflections() { if (shouldRecalc) { qDebug() << "RECALC...... !!!!!!!!!!!!!!!!!!!!!!!!!!!!"; +if (_reflections == 0) { + qDebug() << "RECALC...... No reflections!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; +} +if (!isSimilarPosition(origin, _origin)) { + qDebug() << "RECALC...... origin changed...!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; +} +if (!isSimilarOrientation(orientation, _orientation)) { + qDebug() << "RECALC...... orientation changed...!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; +} +if (!isSimilarPosition(listenerPosition, _listenerPosition)) { + qDebug() << "RECALC...... listenerPosition changed...!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; +} +if (withDiffusion != _withDiffusion) { + qDebug() << "RECALC...... withDiffusion changed...!!!!!!!!!!!!!!!!!!!!!!!!!!!!"; +} QMutexLocker locker(&_mutex); @@ -208,6 +223,7 @@ qDebug() << "RECALC...... !!!!!!!!!!!!!!!!!!!!!!!!!!!!"; glm::vec3 backRightDown = glm::normalize(back + right + down); glm::vec3 backLeftDown = glm::normalize(back + left + down); + _rightReflections = calculateReflections(listenerPosition, _origin, right); _frontRightUpReflections = calculateReflections(listenerPosition, _origin, frontRightUp); _frontLeftUpReflections = calculateReflections(listenerPosition, _origin, frontLeftUp); _backRightUpReflections = calculateReflections(listenerPosition, _origin, backRightUp); @@ -219,7 +235,6 @@ qDebug() << "RECALC...... !!!!!!!!!!!!!!!!!!!!!!!!!!!!"; _frontReflections = calculateReflections(listenerPosition, _origin, front); _backReflections = calculateReflections(listenerPosition, _origin, back); _leftReflections = calculateReflections(listenerPosition, _origin, left); - _rightReflections = calculateReflections(listenerPosition, _origin, right); _upReflections = calculateReflections(listenerPosition, _origin, up); _downReflections = calculateReflections(listenerPosition, _origin, down); @@ -352,6 +367,14 @@ void AudioReflector::echoReflections(const glm::vec3& origin, const QVector