mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 07:19:14 +02:00
Don’t render avatar ‘sphere’ unless there is voice intensity
This commit is contained in:
parent
039f9ff1e3
commit
11e9b18a98
1 changed files with 12 additions and 7 deletions
|
@ -207,18 +207,23 @@ void Avatar::render() {
|
||||||
renderBody();
|
renderBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
// render sphere when far away
|
// render voice intensity sphere for avatars that are farther away
|
||||||
const float MAX_ANGLE = 10.f;
|
const float MAX_SPHERE_ANGLE = 10.f;
|
||||||
|
const float MIN_SPHERE_ANGLE = 1.f;
|
||||||
|
const float MIN_SPHERE_SIZE = 0.01;
|
||||||
|
const float SPHERE_LOUDNESS_SCALING = 0.0005f;
|
||||||
|
const float SPHERE_COLOR[] = { 0.5f, 0.8f, 0.8f };
|
||||||
float height = getSkeletonHeight();
|
float height = getSkeletonHeight();
|
||||||
glm::vec3 delta = height * (getHead()->getCameraOrientation() * IDENTITY_UP) / 2.f;
|
glm::vec3 delta = height * (getHead()->getCameraOrientation() * IDENTITY_UP) / 2.f;
|
||||||
float angle = abs(angleBetween(toTarget + delta, toTarget - delta));
|
float angle = abs(angleBetween(toTarget + delta, toTarget - delta));
|
||||||
|
float sphereRadius = getHead()->getAverageLoudness() * SPHERE_LOUDNESS_SCALING;
|
||||||
if (angle < MAX_ANGLE) {
|
|
||||||
glColor4f(0.5f, 0.8f, 0.8f, 1.f - angle / MAX_ANGLE);
|
if ((sphereRadius > MIN_SPHERE_SIZE) && (angle < MAX_SPHERE_ANGLE) && (angle > MIN_SPHERE_ANGLE)) {
|
||||||
|
glColor4f(SPHERE_COLOR[0], SPHERE_COLOR[1], SPHERE_COLOR[2], 1.f - angle / MAX_SPHERE_ANGLE);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
glTranslatef(_position.x, _position.y, _position.z);
|
glTranslatef(_position.x, _position.y, _position.z);
|
||||||
glScalef(height / 2.f, height / 2.f, height / 2.f);
|
glScalef(height, height, height);
|
||||||
glutSolidSphere(1.2f + getHead()->getAverageLoudness() * .0005f, 20, 20);
|
glutSolidSphere(sphereRadius, 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue