mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 13:33:27 +02:00
Merge branch 'master' of https://github.com/worklist/hifi
This commit is contained in:
commit
6c435569c2
6 changed files with 52 additions and 50 deletions
|
@ -130,7 +130,7 @@ int audioCallback (const void *inputBuffer,
|
||||||
|
|
||||||
loudness /= BUFFER_LENGTH_SAMPLES;
|
loudness /= BUFFER_LENGTH_SAMPLES;
|
||||||
data->lastInputLoudness = loudness;
|
data->lastInputLoudness = loudness;
|
||||||
data->averagedInputLoudness = 0.66*data->averagedInputLoudness + 0.33*loudness;
|
|
||||||
//
|
//
|
||||||
// If scope is turned on, copy input buffer to scope
|
// If scope is turned on, copy input buffer to scope
|
||||||
//
|
//
|
||||||
|
@ -510,9 +510,8 @@ error:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Audio::getInputLoudness(float * lastLoudness, float * averageLoudness) {
|
float Audio::getInputLoudness() const {
|
||||||
*lastLoudness = audioData->lastInputLoudness;
|
return audioData->lastInputLoudness;
|
||||||
*averageLoudness = audioData->averagedInputLoudness;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Audio::render(int screenWidth, int screenHeight)
|
void Audio::render(int screenWidth, int screenHeight)
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
bool getMixerLoopbackFlag();
|
bool getMixerLoopbackFlag();
|
||||||
void setMixerLoopbackFlag(bool newMixerLoopbackFlag);
|
void setMixerLoopbackFlag(bool newMixerLoopbackFlag);
|
||||||
|
|
||||||
void getInputLoudness(float * lastLoudness, float * averageLoudness);
|
float getInputLoudness() const;
|
||||||
void updateMixerParams(in_addr_t mixerAddress, in_port_t mixerPort);
|
void updateMixerParams(in_addr_t mixerAddress, in_port_t mixerPort);
|
||||||
|
|
||||||
void setWalkingState(bool newWalkState);
|
void setWalkingState(bool newWalkState);
|
||||||
|
|
|
@ -36,7 +36,6 @@ class AudioData {
|
||||||
int wasStarved;
|
int wasStarved;
|
||||||
|
|
||||||
float lastInputLoudness;
|
float lastInputLoudness;
|
||||||
float averagedInputLoudness;
|
|
||||||
|
|
||||||
bool mixerLoopbackFlag;
|
bool mixerLoopbackFlag;
|
||||||
bool playWalkSound;
|
bool playWalkSound;
|
||||||
|
|
|
@ -566,6 +566,11 @@ void Head::simulate(float deltaTime) {
|
||||||
_head.eyebrowRoll [1] *=-1;
|
_head.eyebrowRoll [1] *=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update audio trailing average for rendering facial animations
|
||||||
|
const float AUDIO_AVERAGING_SECS = 0.05;
|
||||||
|
_head.averageLoudness = (1.f - deltaTime / AUDIO_AVERAGING_SECS) * _head.averageLoudness +
|
||||||
|
(deltaTime / AUDIO_AVERAGING_SECS) * _audioLoudness;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -740,16 +745,20 @@ void Head::renderHead(bool lookingInMirror) {
|
||||||
}
|
}
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
// _eyebrows
|
|
||||||
_head.audioAttack = 0.9 * _head.audioAttack + 0.1 * fabs(_audioLoudness - _head.lastLoudness);
|
// Update audio attack data for facial animation (eyebrows and mouth)
|
||||||
|
_head.audioAttack = 0.9 * _head.audioAttack + 0.1 * fabs(_audioLoudness - _head.lastLoudness);
|
||||||
_head.lastLoudness = _audioLoudness;
|
_head.lastLoudness = _audioLoudness;
|
||||||
|
|
||||||
|
|
||||||
const float BROW_LIFT_THRESHOLD = 100;
|
const float BROW_LIFT_THRESHOLD = 100;
|
||||||
if (_head.audioAttack > BROW_LIFT_THRESHOLD)
|
if (_head.audioAttack > BROW_LIFT_THRESHOLD)
|
||||||
_head.browAudioLift += sqrt(_head.audioAttack) / 1000.0;
|
_head.browAudioLift += sqrt(_head.audioAttack) / 1000.0;
|
||||||
|
|
||||||
_head.browAudioLift *= .90;
|
_head.browAudioLift *= .90;
|
||||||
|
|
||||||
|
|
||||||
|
// Render Eyebrows
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(-_head.interBrowDistance / 2.0,0.4,0.45);
|
glTranslatef(-_head.interBrowDistance / 2.0,0.4,0.45);
|
||||||
for(side = 0; side < 2; side++) {
|
for(side = 0; side < 2; side++) {
|
||||||
|
@ -1128,7 +1137,9 @@ void Head::updateHandMovement( float deltaTime ) {
|
||||||
|
|
||||||
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
|
_bone[ AVATAR_BONE_RIGHT_HAND ].position += transformedHandMovement;
|
||||||
|
|
||||||
setHandState(_mousePressed);
|
if (_isMine) {
|
||||||
|
_handState = _mousePressed;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
// if holding hands with another avatar, add a force to the hand...
|
// if holding hands with another avatar, add a force to the hand...
|
||||||
|
@ -1263,7 +1274,7 @@ void Head::renderBody() {
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
// if the hand is grasping, show it...
|
// if the hand is grasping, show it...
|
||||||
//---------------------------------------------------------
|
//---------------------------------------------------------
|
||||||
if (( _usingBodySprings ) && ( getHandState() == 1 )) {
|
if (( _usingBodySprings ) && ( _handState == 1 )) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef
|
glTranslatef
|
||||||
(
|
(
|
||||||
|
|
|
@ -160,8 +160,10 @@ bool perfStatsOn = false; // Do we want to display perfStats?
|
||||||
int noiseOn = 0; // Whether to add random noise
|
int noiseOn = 0; // Whether to add random noise
|
||||||
float noise = 1.0; // Overall magnitude scaling for random noise levels
|
float noise = 1.0; // Overall magnitude scaling for random noise levels
|
||||||
|
|
||||||
|
bool gyroLook = false; // Whether to allow the gyro data from head to move your view
|
||||||
|
|
||||||
int displayLevels = 0;
|
int displayLevels = 0;
|
||||||
bool lookingInMirror = 0; // Are we currently rendering one's own head as if in mirror?
|
bool lookingInMirror = 0; // Are we currently rendering one's own head as if in mirror?
|
||||||
int displayField = 0;
|
int displayField = 0;
|
||||||
|
|
||||||
int displayHeadMouse = 1; // Display sample mouse pointer controlled by head movement
|
int displayHeadMouse = 1; // Display sample mouse pointer controlled by head movement
|
||||||
|
@ -476,31 +478,16 @@ void updateAvatar(float frametime)
|
||||||
headMouseY = min(headMouseY, HEIGHT);
|
headMouseY = min(headMouseY, HEIGHT);
|
||||||
|
|
||||||
// Update render direction (pitch/yaw) based on measured gyro rates
|
// Update render direction (pitch/yaw) based on measured gyro rates
|
||||||
const int MIN_YAW_RATE = 100;
|
const float MIN_YAW_RATE = 5;
|
||||||
const int MIN_PITCH_RATE = 100;
|
const float YAW_SENSITIVITY = 1.0;
|
||||||
const float YAW_SENSITIVITY = 0.02;
|
|
||||||
const float PITCH_SENSITIVITY = 0.05;
|
|
||||||
|
|
||||||
// Update render pitch and yaw rates based on keyPositions
|
// If enabled, Update render pitch and yaw based on gyro data
|
||||||
const float KEY_YAW_SENSITIVITY = 2.0;
|
if (::gyroLook) {
|
||||||
if (myAvatar.getDriveKeys(ROT_LEFT)) renderYawRate -= KEY_YAW_SENSITIVITY*frametime;
|
if (fabs(gyroYawRate) > MIN_YAW_RATE) {
|
||||||
if (myAvatar.getDriveKeys(ROT_RIGHT)) renderYawRate += KEY_YAW_SENSITIVITY*frametime;
|
myAvatar.addBodyYaw(-gyroYawRate * YAW_SENSITIVITY * frametime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fabs(gyroYawRate) > MIN_YAW_RATE)
|
|
||||||
{
|
|
||||||
if (gyroYawRate > 0)
|
|
||||||
renderYawRate += (gyroYawRate - MIN_YAW_RATE) * YAW_SENSITIVITY * frametime;
|
|
||||||
else
|
|
||||||
renderYawRate += (gyroYawRate + MIN_YAW_RATE) * YAW_SENSITIVITY * frametime;
|
|
||||||
}
|
|
||||||
if (fabs(gyroPitchRate) > MIN_PITCH_RATE)
|
|
||||||
{
|
|
||||||
if (gyroPitchRate > 0)
|
|
||||||
renderPitchRate += (gyroPitchRate - MIN_PITCH_RATE) * PITCH_SENSITIVITY * frametime;
|
|
||||||
else
|
|
||||||
renderPitchRate += (gyroPitchRate + MIN_PITCH_RATE) * PITCH_SENSITIVITY * frametime;
|
|
||||||
}
|
|
||||||
|
|
||||||
float renderPitch = myAvatar.getRenderPitch();
|
float renderPitch = myAvatar.getRenderPitch();
|
||||||
// Decay renderPitch toward zero because we never look constantly up/down
|
// Decay renderPitch toward zero because we never look constantly up/down
|
||||||
renderPitch *= (1.f - 2.0*frametime);
|
renderPitch *= (1.f - 2.0*frametime);
|
||||||
|
@ -514,11 +501,8 @@ void updateAvatar(float frametime)
|
||||||
myAvatar.setRenderPitch(renderPitch + renderPitchRate);
|
myAvatar.setRenderPitch(renderPitch + renderPitchRate);
|
||||||
|
|
||||||
// Get audio loudness data from audio input device
|
// Get audio loudness data from audio input device
|
||||||
float loudness, averageLoudness;
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
audio.getInputLoudness(&loudness, &averageLoudness);
|
myAvatar.setLoudness(audio.getInputLoudness());
|
||||||
myAvatar.setLoudness(loudness);
|
|
||||||
myAvatar.setAverageLoudness(averageLoudness);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Update Avatar with latest camera and view frustum data...
|
// Update Avatar with latest camera and view frustum data...
|
||||||
|
@ -1072,6 +1056,11 @@ int setNoise(int state) {
|
||||||
return iRet;
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setGyroLook(int state) {
|
||||||
|
int iRet = setValue(state, &::gyroLook);
|
||||||
|
return iRet;
|
||||||
|
}
|
||||||
|
|
||||||
int setVoxels(int state) {
|
int setVoxels(int state) {
|
||||||
return setValue(state, &::showingVoxels);
|
return setValue(state, &::showingVoxels);
|
||||||
}
|
}
|
||||||
|
@ -1190,16 +1179,20 @@ const char* getFrustumRenderModeName(int state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void initMenu() {
|
void initMenu() {
|
||||||
MenuColumn *menuColumnOptions, *menuColumnTools, *menuColumnDebug, *menuColumnFrustum;
|
MenuColumn *menuColumnOptions, *menuColumnRender, *menuColumnTools, *menuColumnDebug, *menuColumnFrustum;
|
||||||
// Options
|
// Options
|
||||||
menuColumnOptions = menu.addColumn("Options");
|
menuColumnOptions = menu.addColumn("Options");
|
||||||
menuColumnOptions->addRow("Mirror (h)", setHead);
|
menuColumnOptions->addRow("Mirror (h)", setHead);
|
||||||
menuColumnOptions->addRow("Field (f)", setField);
|
menuColumnOptions->addRow("Noise (n)", setNoise);
|
||||||
menuColumnOptions->addRow("(N)oise", setNoise);
|
menuColumnOptions->addRow("Gyro Look", setGyroLook);
|
||||||
menuColumnOptions->addRow("(V)oxels", setVoxels);
|
menuColumnOptions->addRow("Quit (q)", quitApp);
|
||||||
menuColumnOptions->addRow("Stars (*)", setStars);
|
|
||||||
menuColumnOptions->addRow("(Q)uit", quitApp);
|
|
||||||
|
|
||||||
|
// Render
|
||||||
|
menuColumnRender = menu.addColumn("Render");
|
||||||
|
menuColumnRender->addRow("Voxels (V)", setVoxels);
|
||||||
|
menuColumnRender->addRow("Stars (*)", setStars);
|
||||||
|
menuColumnRender->addRow("Field (f)", setField);
|
||||||
|
|
||||||
// Tools
|
// Tools
|
||||||
menuColumnTools = menu.addColumn("Tools");
|
menuColumnTools = menu.addColumn("Tools");
|
||||||
menuColumnTools->addRow("Stats (/)", setStats);
|
menuColumnTools->addRow("Stats (/)", setStats);
|
||||||
|
|
|
@ -39,20 +39,20 @@ public:
|
||||||
void setHeadPitch(float p) {_headPitch = p; }
|
void setHeadPitch(float p) {_headPitch = p; }
|
||||||
void setHeadYaw(float y) {_headYaw = y; }
|
void setHeadYaw(float y) {_headYaw = y; }
|
||||||
void setHeadRoll(float r) {_headRoll = r; };
|
void setHeadRoll(float r) {_headRoll = r; };
|
||||||
const float getHeadPitch() const { return _headPitch; };
|
float getHeadPitch() const { return _headPitch; };
|
||||||
const float getHeadYaw() const { return _headYaw; };
|
float getHeadYaw() const { return _headYaw; };
|
||||||
const float getHeadRoll() const { return _headRoll; };
|
float getHeadRoll() const { return _headRoll; };
|
||||||
void addHeadPitch(float p) {_headPitch -= p; }
|
void addHeadPitch(float p) {_headPitch -= p; }
|
||||||
void addHeadYaw(float y){_headYaw -= y; }
|
void addHeadYaw(float y){_headYaw -= y; }
|
||||||
void addHeadRoll(float r){_headRoll += r; }
|
void addHeadRoll(float r){_headRoll += r; }
|
||||||
|
|
||||||
// Hand State
|
// Hand State
|
||||||
void setHandState(char s) { _handState = s; };
|
void setHandState(char s) { _handState = s; };
|
||||||
const float getHandState() const {return _handState; }; //@Philip - shouldn't this be an int or a char?
|
char getHandState() const {return _handState; };
|
||||||
|
|
||||||
// Instantaneous audio loudness to drive mouth/facial animation
|
// Instantaneous audio loudness to drive mouth/facial animation
|
||||||
void setLoudness(float l) { _audioLoudness = l; };
|
void setLoudness(float l) { _audioLoudness = l; };
|
||||||
const float getLoudness() const {return _audioLoudness; };
|
float getLoudness() const {return _audioLoudness; };
|
||||||
|
|
||||||
// getters for camera details
|
// getters for camera details
|
||||||
const glm::vec3& getCameraPosition() const { return _cameraPosition; };
|
const glm::vec3& getCameraPosition() const { return _cameraPosition; };
|
||||||
|
|
Loading…
Reference in a new issue