mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 14:08:51 +02:00
cleanup
This commit is contained in:
parent
1c126e2525
commit
7e0877e753
5 changed files with 23 additions and 122 deletions
|
@ -147,45 +147,6 @@ Avatar::Avatar(const Avatar &otherAvatar) :_head(otherAvatar._head) { //include
|
||||||
|
|
||||||
for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = otherAvatar._driveKeys[i];
|
for (int i = 0; i < MAX_DRIVE_KEYS; i++) _driveKeys[i] = otherAvatar._driveKeys[i];
|
||||||
|
|
||||||
/*
|
|
||||||
_head.pupilSize = otherAvatar._head.pupilSize;
|
|
||||||
_head.interPupilDistance = otherAvatar._head.interPupilDistance;
|
|
||||||
_head.interBrowDistance = otherAvatar._head.interBrowDistance;
|
|
||||||
_head.nominalPupilSize = otherAvatar._head.nominalPupilSize;
|
|
||||||
_head.yawRate = otherAvatar._head.yawRate;
|
|
||||||
_head.pitchRate = otherAvatar._head.pitchRate;
|
|
||||||
_head.rollRate = otherAvatar._head.rollRate;
|
|
||||||
_head.eyebrowPitch[0] = otherAvatar._head.eyebrowPitch[0];
|
|
||||||
_head.eyebrowPitch[1] = otherAvatar._head.eyebrowPitch[1];
|
|
||||||
_head.eyebrowRoll [0] = otherAvatar._head.eyebrowRoll [0];
|
|
||||||
_head.eyebrowRoll [1] = otherAvatar._head.eyebrowRoll [1];
|
|
||||||
_head.mouthPitch = otherAvatar._head.mouthPitch;
|
|
||||||
_head.mouthYaw = otherAvatar._head.mouthYaw;
|
|
||||||
_head.mouthWidth = otherAvatar._head.mouthWidth;
|
|
||||||
_head.mouthHeight = otherAvatar._head.mouthHeight;
|
|
||||||
_head.eyeballPitch[0] = otherAvatar._head.eyeballPitch[0];
|
|
||||||
_head.eyeballPitch[1] = otherAvatar._head.eyeballPitch[1];
|
|
||||||
_head.eyeballScaleX = otherAvatar._head.eyeballScaleX;
|
|
||||||
_head.eyeballScaleY = otherAvatar._head.eyeballScaleY;
|
|
||||||
_head.eyeballScaleZ = otherAvatar._head.eyeballScaleZ;
|
|
||||||
_head.eyeballYaw[0] = otherAvatar._head.eyeballYaw[0];
|
|
||||||
_head.eyeballYaw[1] = otherAvatar._head.eyeballYaw[1];
|
|
||||||
_head.pitchTarget = otherAvatar._head.pitchTarget;
|
|
||||||
_head.yawTarget = otherAvatar._head.yawTarget;
|
|
||||||
_head.noiseEnvelope = otherAvatar._head.noiseEnvelope;
|
|
||||||
_head.pupilConverge = otherAvatar._head.pupilConverge;
|
|
||||||
_head.leanForward = otherAvatar._head.leanForward;
|
|
||||||
_head.leanSideways = otherAvatar._head.leanSideways;
|
|
||||||
_head.eyeContact = otherAvatar._head.eyeContact;
|
|
||||||
_head.eyeContactTarget = otherAvatar._head.eyeContactTarget;
|
|
||||||
_head.scale = otherAvatar._head.scale;
|
|
||||||
_head.audioAttack = otherAvatar._head.audioAttack;
|
|
||||||
_head.averageLoudness = otherAvatar._head.averageLoudness;
|
|
||||||
_head.lastLoudness = otherAvatar._head.lastLoudness;
|
|
||||||
_head.browAudioLift = otherAvatar._head.browAudioLift;
|
|
||||||
_head.noise = otherAvatar._head.noise;
|
|
||||||
*/
|
|
||||||
|
|
||||||
_distanceToNearestAvatar = otherAvatar._distanceToNearestAvatar;
|
_distanceToNearestAvatar = otherAvatar._distanceToNearestAvatar;
|
||||||
|
|
||||||
initializeSkeleton();
|
initializeSkeleton();
|
||||||
|
|
|
@ -201,7 +201,7 @@ private:
|
||||||
glm::vec3 _mouseRayOrigin;
|
glm::vec3 _mouseRayOrigin;
|
||||||
glm::vec3 _mouseRayDirection;
|
glm::vec3 _mouseRayDirection;
|
||||||
glm::vec3 _cameraPosition;
|
glm::vec3 _cameraPosition;
|
||||||
Avatar * _interactingOther;
|
Avatar* _interactingOther;
|
||||||
float _cumulativeMouseYaw;
|
float _cumulativeMouseYaw;
|
||||||
bool _isMouseTurningRight;
|
bool _isMouseTurningRight;
|
||||||
|
|
||||||
|
|
|
@ -118,10 +118,10 @@ void Camera::updateFollowMode(float deltaTime) {
|
||||||
_position += (_idealPosition - _position) * t;
|
_position += (_idealPosition - _position) * t;
|
||||||
}
|
}
|
||||||
|
|
||||||
float mm = 1.0f - _modeShift;
|
float inverseModeShift = 1.0f - _modeShift;
|
||||||
_upShift = _attributes[_mode].upShift * _modeShift + _previousAttributes[_mode].upShift * mm;
|
_upShift = _attributes[_mode].upShift * _modeShift + _previousAttributes[_mode].upShift * inverseModeShift;
|
||||||
_distance = _attributes[_mode].distance * _modeShift + _previousAttributes[_mode].distance * mm;
|
_distance = _attributes[_mode].distance * _modeShift + _previousAttributes[_mode].distance * inverseModeShift;
|
||||||
_upShift = _attributes[_mode].upShift * _modeShift + _previousAttributes[_mode].upShift * mm;
|
_upShift = _attributes[_mode].upShift * _modeShift + _previousAttributes[_mode].upShift * inverseModeShift;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -154,65 +154,6 @@ void Head::initialize() {
|
||||||
_sphere = NULL;
|
_sphere = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void Head::copyFromHead(const Head &head) {
|
|
||||||
|
|
||||||
returnHeadToCenter = head.returnHeadToCenter;
|
|
||||||
audioLoudness = head.audioLoudness;
|
|
||||||
skinColor = head.skinColor;
|
|
||||||
position = head.position;
|
|
||||||
rotation = head.rotation;
|
|
||||||
lookatPosition = head.lookatPosition;
|
|
||||||
_leftEyePosition = head._leftEyePosition;
|
|
||||||
_rightEyePosition = head._rightEyePosition;
|
|
||||||
yaw = head.yaw;
|
|
||||||
pitch = head.pitch;
|
|
||||||
roll = head.roll;
|
|
||||||
pitchRate = head.pitchRate;
|
|
||||||
yawRate = head.yawRate;
|
|
||||||
rollRate = head.rollRate;
|
|
||||||
noise = head.noise;
|
|
||||||
eyeballPitch[0] = head.eyeballPitch[0];
|
|
||||||
eyeballYaw [0] = head.eyeballYaw [0];
|
|
||||||
eyebrowPitch[0] = head.eyebrowPitch[0];
|
|
||||||
eyebrowRoll [0] = head.eyebrowRoll [0];
|
|
||||||
eyeballPitch[1] = head.eyeballPitch[1];
|
|
||||||
eyeballYaw [1] = head.eyeballYaw [1];
|
|
||||||
eyebrowPitch[1] = head.eyebrowPitch[1];
|
|
||||||
eyebrowRoll [1] = head.eyebrowRoll [1];
|
|
||||||
eyeballScaleX = head.eyeballScaleX;
|
|
||||||
eyeballScaleY = head.eyeballScaleY;
|
|
||||||
eyeballScaleZ = head.eyeballScaleZ;
|
|
||||||
interPupilDistance = head.interPupilDistance;
|
|
||||||
interBrowDistance = head.interBrowDistance;
|
|
||||||
nominalPupilSize = head.nominalPupilSize;
|
|
||||||
pupilSize = head.pupilSize;
|
|
||||||
mouthPitch = head.mouthPitch;
|
|
||||||
mouthYaw = head.mouthYaw;
|
|
||||||
mouthWidth = head.mouthWidth;
|
|
||||||
mouthHeight = head.mouthHeight;
|
|
||||||
leanForward = head.leanForward;
|
|
||||||
leanSideways = head.leanSideways;
|
|
||||||
pitchTarget = head.pitchTarget;
|
|
||||||
yawTarget = head.yawTarget;
|
|
||||||
noiseEnvelope = head.noiseEnvelope;
|
|
||||||
pupilConverge = head.pupilConverge;
|
|
||||||
scale = head.scale;
|
|
||||||
eyeContact = head.eyeContact;
|
|
||||||
browAudioLift = head.browAudioLift;
|
|
||||||
eyeContactTarget = head.eyeContactTarget;
|
|
||||||
_orientation = head._orientation;
|
|
||||||
_bodyYaw = head._bodyYaw;
|
|
||||||
lastLoudness = head.lastLoudness;
|
|
||||||
averageLoudness = head.averageLoudness;
|
|
||||||
audioAttack = head.audioAttack;
|
|
||||||
_looking = head._looking;
|
|
||||||
_gravity = head._gravity;
|
|
||||||
sphere = head.sphere;
|
|
||||||
returnSpringScale = head.returnSpringScale;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
void Head::setPositionRotationAndScale(glm::vec3 p, glm::vec3 r, float s) {
|
void Head::setPositionRotationAndScale(glm::vec3 p, glm::vec3 r, float s) {
|
||||||
|
|
||||||
_position = p;
|
_position = p;
|
||||||
|
@ -355,20 +296,23 @@ void Head::updateEyePositions() {
|
||||||
float upShift = _scale * 0.38f;
|
float upShift = _scale * 0.38f;
|
||||||
float frontShift = _scale * 0.8f;
|
float frontShift = _scale * 0.8f;
|
||||||
|
|
||||||
_leftEyePosition = _position + _orientation.getRight() * rightShift
|
_leftEyePosition = _position
|
||||||
+ _orientation.getUp () * upShift
|
+ _orientation.getRight() * rightShift
|
||||||
+ _orientation.getFront() * frontShift;
|
+ _orientation.getUp () * upShift
|
||||||
_rightEyePosition = _position - _orientation.getRight() * rightShift
|
+ _orientation.getFront() * frontShift;
|
||||||
+ _orientation.getUp () * upShift
|
_rightEyePosition = _position
|
||||||
+ _orientation.getFront() * frontShift;
|
- _orientation.getRight() * rightShift
|
||||||
|
+ _orientation.getUp () * upShift
|
||||||
|
+ _orientation.getFront() * frontShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Head::setLooking(bool looking) {
|
void Head::setLooking(bool looking) {
|
||||||
|
|
||||||
_looking = looking;
|
_looking = looking;
|
||||||
|
|
||||||
glm::vec3 averagEyePosition = _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * ONE_HALF;
|
glm::vec3 averageEyePosition = _leftEyePosition + (_rightEyePosition - _leftEyePosition ) * ONE_HALF;
|
||||||
glm::vec3 targetLookatAxis = glm::normalize(_lookatPosition - averagEyePosition);
|
glm::vec3 targetLookatAxis = glm::normalize(_lookatPosition - averageEyePosition);
|
||||||
|
|
||||||
float dot = glm::dot(targetLookatAxis, _orientation.getFront());
|
float dot = glm::dot(targetLookatAxis, _orientation.getFront());
|
||||||
if (dot < MINIMUM_EYE_ROTATION) {
|
if (dot < MINIMUM_EYE_ROTATION) {
|
||||||
|
@ -376,6 +320,7 @@ void Head::setLooking(bool looking) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void Head::setLookatPosition(glm::vec3 l) {
|
void Head::setLookatPosition(glm::vec3 l) {
|
||||||
_lookatPosition = l;
|
_lookatPosition = l;
|
||||||
}
|
}
|
||||||
|
@ -383,6 +328,7 @@ void Head::setLookatPosition(glm::vec3 l) {
|
||||||
void Head::setGravity(glm::vec3 gravity) {
|
void Head::setGravity(glm::vec3 gravity) {
|
||||||
_gravity = gravity;
|
_gravity = gravity;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
glm::vec3 Head::getApproximateEyePosition() {
|
glm::vec3 Head::getApproximateEyePosition() {
|
||||||
return _leftEyePosition + (_rightEyePosition - _leftEyePosition) * ONE_HALF;
|
return _leftEyePosition + (_rightEyePosition - _leftEyePosition) * ONE_HALF;
|
||||||
|
@ -402,11 +348,11 @@ void Head::render(bool lookingInMirror) {
|
||||||
glScalef(_scale, _scale, _scale);
|
glScalef(_scale, _scale, _scale);
|
||||||
|
|
||||||
if (lookingInMirror) {
|
if (lookingInMirror) {
|
||||||
glRotatef(_bodyYaw - _yaw, 0, 1, 0);
|
glRotatef(_bodyYaw - _yaw, 0, 1, 0);
|
||||||
glRotatef(_pitch, 1, 0, 0);
|
glRotatef(_pitch, 1, 0, 0);
|
||||||
glRotatef(-_roll, 0, 0, 1);
|
glRotatef(-_roll, 0, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
glRotatef(_bodyYaw + _yaw, 0, 1, 0);
|
glRotatef(_bodyYaw + _yaw, 0, 1, 0);
|
||||||
glRotatef(_pitch, 1, 0, 0);
|
glRotatef(_pitch, 1, 0, 0);
|
||||||
glRotatef(_roll, 0, 0, 1);
|
glRotatef(_roll, 0, 0, 1);
|
||||||
}
|
}
|
||||||
|
@ -524,12 +470,7 @@ void Head::renderEyeBalls() {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glm::vec3 rotationAxis = glm::cross(targetLookatAxis, glm::vec3(0.0f, 1.0f, 0.0f));
|
glm::vec3 rotationAxis = glm::cross(targetLookatAxis, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
float angle = 180.0f - angleBetween(targetLookatAxis, glm::vec3(0.0f, 1.0f, 0.0f));
|
float angle = 180.0f - angleBetween(targetLookatAxis, glm::vec3(0.0f, 1.0f, 0.0f));
|
||||||
|
|
||||||
//glm::vec3 U_rotationAxis = glm::vec3(0.0f, 0.0f, 1.0f);
|
|
||||||
//float U_angle = angleBetween(_orientation.getFront(), glm::vec3(1.0f, 0.0f, 0.0f));
|
|
||||||
//glRotatef(U_angle, U_rotationAxis.x, U_rotationAxis.y, U_rotationAxis.z);
|
|
||||||
glRotatef(angle, rotationAxis.x, rotationAxis.y, rotationAxis.z);
|
glRotatef(angle, rotationAxis.x, rotationAxis.y, rotationAxis.z);
|
||||||
|
|
||||||
glTranslatef( 0.0f, -0.018f, 0.0f);//push the iris out a bit (otherwise - inside of eyeball!)
|
glTranslatef( 0.0f, -0.018f, 0.0f);//push the iris out a bit (otherwise - inside of eyeball!)
|
||||||
glScalef( 1.0f, 0.5f, 1.0f); // flatten the iris
|
glScalef( 1.0f, 0.5f, 1.0f); // flatten the iris
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
|
@ -32,11 +32,10 @@ public:
|
||||||
void render(bool lookingInMirror);
|
void render(bool lookingInMirror);
|
||||||
void setNewTarget(float, float);
|
void setNewTarget(float, float);
|
||||||
void setSpringScale(float s) { _returnSpringScale = s; }
|
void setSpringScale(float s) { _returnSpringScale = s; }
|
||||||
void setLookatPosition(glm::vec3 lookatPosition);
|
void setLookatPosition(glm::vec3 l ) { _lookatPosition = l; }
|
||||||
void setLooking(bool looking);
|
void setLooking(bool looking);
|
||||||
void setGravity(glm::vec3 gravity);
|
void setGravity(glm::vec3 gravity) { _gravity = gravity; }
|
||||||
void setBodyYaw(float y) { _bodyYaw = y; }
|
void setBodyYaw(float y) { _bodyYaw = y; }
|
||||||
void copyFromHead(const Head &head);
|
|
||||||
|
|
||||||
glm::vec3 getApproximateEyePosition();
|
glm::vec3 getApproximateEyePosition();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue