Fixes from brad's review

This commit is contained in:
Philip Rosedale 2013-04-23 11:59:43 -07:00
parent 7aea9d1e61
commit 5556686875
4 changed files with 33 additions and 33 deletions

View file

@ -487,19 +487,19 @@ void Head::simulate(float deltaTime) {
if (!_head.noise) { if (!_head.noise) {
// Decay back toward center // Decay back toward center
_headPitch *= (1.0f - DECAY*2*deltaTime); _headPitch *= (1.0f - DECAY * 2 * deltaTime);
_headYaw *= (1.0f - DECAY*2*deltaTime); _headYaw *= (1.0f - DECAY * 2 * deltaTime);
_headRoll *= (1.0f - DECAY*2*deltaTime); _headRoll *= (1.0f - DECAY * 2 * deltaTime);
} }
else { else {
// Move toward new target // Move toward new target
_headPitch += (_head.pitchTarget - _headPitch)*10*deltaTime; // (1.f - DECAY*deltaTime)*Pitch + ; _headPitch += (_head.pitchTarget - _headPitch) * 10 * deltaTime; // (1.f - DECAY*deltaTime)*Pitch + ;
_headYaw += (_head.yawTarget - _headYaw )*10*deltaTime; // (1.f - DECAY*deltaTime); _headYaw += (_head.yawTarget - _headYaw ) * 10 * deltaTime; // (1.f - DECAY*deltaTime);
_headRoll *= (1.f - DECAY*deltaTime); _headRoll *= 1.f - (DECAY * deltaTime);
} }
_head.leanForward *= (1.f - DECAY*30.f*deltaTime); _head.leanForward *= (1.f - DECAY * 30 * deltaTime);
_head.leanSideways *= (1.f - DECAY*30.f*deltaTime); _head.leanSideways *= (1.f - DECAY * 30 * deltaTime);
// Update where the avatar's eyes are // Update where the avatar's eyes are
// //
@ -509,8 +509,8 @@ void Head::simulate(float deltaTime) {
_head.eyeContact = 1; _head.eyeContact = 1;
if (!_head.eyeContact) { if (!_head.eyeContact) {
// If we just stopped making eye contact,move the eyes markedly away // If we just stopped making eye contact,move the eyes markedly away
_head.eyeballPitch[0] = _head.eyeballPitch[1] = _head.eyeballPitch[0] + 5.0 + (randFloat() - 0.5)*10; _head.eyeballPitch[0] = _head.eyeballPitch[1] = _head.eyeballPitch[0] + 5.0 + (randFloat() - 0.5) * 10;
_head.eyeballYaw [0] = _head.eyeballYaw [1] = _head.eyeballYaw [0] + 5.0 + (randFloat() - 0.5)*5; _head.eyeballYaw [0] = _head.eyeballYaw [1] = _head.eyeballYaw [0] + 5.0 + (randFloat() - 0.5) * 5;
} else { } else {
// If now making eye contact, turn head to look right at viewer // If now making eye contact, turn head to look right at viewer
SetNewHeadTarget(0,0); SetNewHeadTarget(0,0);
@ -544,32 +544,32 @@ void Head::simulate(float deltaTime) {
if (_head.noise) if (_head.noise)
{ {
_headPitch += (randFloat() - 0.5)*0.2*_head.noiseEnvelope; _headPitch += (randFloat() - 0.5) * 0.2 * _head.noiseEnvelope;
_headYaw += (randFloat() - 0.5)*0.3*_head.noiseEnvelope; _headYaw += (randFloat() - 0.5) * 0.3 *_head.noiseEnvelope;
//PupilSize += (randFloat() - 0.5)*0.001*NoiseEnvelope; //PupilSize += (randFloat() - 0.5) * 0.001*NoiseEnvelope;
if (randFloat() < 0.005) _head.mouthWidth = MouthWidthChoices[rand()%3]; if (randFloat() < 0.005) _head.mouthWidth = MouthWidthChoices[rand()%3];
if (!_head.eyeContact) { if (!_head.eyeContact) {
if (randFloat() < 0.01) _head.eyeballPitch[0] = _head.eyeballPitch[1] = (randFloat() - 0.5)*20; if (randFloat() < 0.01) _head.eyeballPitch[0] = _head.eyeballPitch[1] = (randFloat() - 0.5) * 20;
if (randFloat() < 0.01) _head.eyeballYaw[0] = _head.eyeballYaw[1] = (randFloat()- 0.5)*10; if (randFloat() < 0.01) _head.eyeballYaw[0] = _head.eyeballYaw[1] = (randFloat()- 0.5) * 10;
} }
if ((randFloat() < 0.005) && (fabs(_head.pitchTarget - _headPitch) < 1.0) && (fabs(_head.yawTarget - _headYaw) < 1.0)) { if ((randFloat() < 0.005) && (fabs(_head.pitchTarget - _headPitch) < 1.0) && (fabs(_head.yawTarget - _headYaw) < 1.0)) {
SetNewHeadTarget((randFloat()-0.5)*20.0, (randFloat()-0.5)*45.0); SetNewHeadTarget((randFloat()-0.5) * 20.0, (randFloat()-0.5) * 45.0);
} }
if (0) { if (0) {
// Pick new target // Pick new target
_head.pitchTarget = (randFloat() - 0.5)*45; _head.pitchTarget = (randFloat() - 0.5) * 45;
_head.yawTarget = (randFloat() - 0.5)*22; _head.yawTarget = (randFloat() - 0.5) * 22;
} }
if (randFloat() < 0.01) if (randFloat() < 0.01)
{ {
_head.eyebrowPitch[0] = _head.eyebrowPitch[1] = BrowPitchAngle[rand()%3]; _head.eyebrowPitch[0] = _head.eyebrowPitch[1] = BrowPitchAngle[rand()%3];
_head.eyebrowRoll [0] = _head.eyebrowRoll[1] = BrowRollAngle[rand()%5]; _head.eyebrowRoll [0] = _head.eyebrowRoll[1] = BrowRollAngle[rand()%5];
_head.eyebrowRoll [1]*=-1; _head.eyebrowRoll [1] *=-1;
} }
} }
} }
@ -619,11 +619,11 @@ void Head::updateBigSphereCollisionTest( float deltaTime ) {
} }
} }
} }
void Head::render(int lookingInMirror) { void Head::render(bool lookingInMirror) {
//--------------------------------------------------- //---------------------------------------------------
// show avatar position // show avatar position
@ -695,7 +695,7 @@ void Head::render(int lookingInMirror) {
void Head::renderHead(int lookingInMirror) { void Head::renderHead(bool lookingInMirror) {
int side = 0; int side = 0;
glEnable(GL_DEPTH_TEST); glEnable(GL_DEPTH_TEST);
@ -749,17 +749,17 @@ void Head::renderHead(int lookingInMirror) {
glPopMatrix(); glPopMatrix();
// _eyebrows // _eyebrows
_head.audioAttack = 0.9*_head.audioAttack + 0.1*fabs(_audioLoudness - _head.lastLoudness); _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;
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++) {
glColor3fv(browColor); glColor3fv(browColor);
glPushMatrix(); glPushMatrix();

View file

@ -168,9 +168,9 @@ class Head : public AvatarData {
AvatarMode getMode(); AvatarMode getMode();
void setMousePressed( bool pressed ); void setMousePressed( bool pressed );
void render(int faceToFace); void render(bool lookingInMirror);
void renderBody(); void renderBody();
void renderHead( int faceToFace); void renderHead(bool lookingInMirror);
void simulate(float); void simulate(float);
void startHandMovement(); void startHandMovement();
void stopHandMovement(); void stopHandMovement();

View file

@ -161,7 +161,7 @@ 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
int displayLevels = 0; int displayLevels = 0;
int 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

View file

@ -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; };
float getHeadPitch() { return _headPitch; }; const float getHeadPitch() const { return _headPitch; };
float getHeadYaw() { return _headYaw; }; const float getHeadYaw() const { return _headYaw; };
float getHeadRoll() { return _headRoll; }; const 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; };
float getHandState() {return _handState; }; const float 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; };
float getLoudness() {return _audioLoudness; }; const 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; };