Don't render body if looking in mirror, don't render test sphere over and over again for everyone.

This commit is contained in:
Philip Rosedale 2013-05-22 15:45:15 -07:00
parent 803c41d636
commit 5bee5f07e3

View file

@ -729,7 +729,7 @@ void Avatar::render(bool lookingInMirror, glm::vec3 cameraPosition) {
_cameraPosition = cameraPosition; // store this for use in various parts of the code _cameraPosition = cameraPosition; // store this for use in various parts of the code
if (usingBigSphereCollisionTest) { if (_isMine && usingBigSphereCollisionTest) {
// show TEST big sphere // show TEST big sphere
glColor4f(0.5f, 0.6f, 0.8f, 0.7); glColor4f(0.5f, 0.6f, 0.8f, 0.7);
glPushMatrix(); glPushMatrix();
@ -1127,58 +1127,51 @@ void Avatar::updateArmIKAndConstraints(float deltaTime) {
void Avatar::renderBody(bool lookingInMirror) { void Avatar::renderBody(bool lookingInMirror) {
// Render joint positions as spheres // Render Head
for (int b = 0; b < NUM_AVATAR_JOINTS; b++) { if (_displayingHead) {
_head.render(lookingInMirror);
if (b == AVATAR_JOINT_HEAD_BASE) { // the head is rendered as a special case
if (_displayingHead) {
_head.render(lookingInMirror);
}
} else {
glColor3f(
skinColor[0] + _joint[b].touchForce * 0.3f,
skinColor[1] - _joint[b].touchForce * 0.2f,
skinColor[2] - _joint[b].touchForce * 0.1f
);
glPushMatrix();
glTranslatef(_joint[b].springyPosition.x, _joint[b].springyPosition.y, _joint[b].springyPosition.z);
glutSolidSphere(_joint[b].radius, 20.0f, 20.0f);
glPopMatrix();
}
} }
for (int j = 1; j < NUM_AVATAR_JOINTS; j++) { // Render reset of body if not in mirror mode
if (_joint[j].parent != AVATAR_JOINT_NULL) if (!lookingInMirror) {
if ((j != AVATAR_JOINT_HEAD_TOP ) // Render joint positions as spheres
&& (j != AVATAR_JOINT_HEAD_BASE ) for (int b = 0; b < NUM_AVATAR_JOINTS; b++) {
&& (j != AVATAR_JOINT_PELVIS )
&& (j != AVATAR_JOINT_TORSO ) if (b != AVATAR_JOINT_HEAD_BASE) {
&& (j != AVATAR_JOINT_CHEST ) glColor3f(
&& (j != AVATAR_JOINT_LEFT_COLLAR ) skinColor[0] + _joint[b].touchForce * 0.3f,
&& (j != AVATAR_JOINT_LEFT_SHOULDER ) skinColor[1] - _joint[b].touchForce * 0.2f,
&& (j != AVATAR_JOINT_RIGHT_COLLAR ) skinColor[2] - _joint[b].touchForce * 0.1f
&& (j != AVATAR_JOINT_RIGHT_SHOULDER)) { );
// Render cone sections connecting the joint positions
glColor3fv(darkSkinColor); glPushMatrix();
renderJointConnectingCone glTranslatef(_joint[b].springyPosition.x, _joint[b].springyPosition.y, _joint[b].springyPosition.z);
( glutSolidSphere(_joint[b].radius, 20.0f, 20.0f);
_joint[_joint[j].parent ].springyPosition, glPopMatrix();
_joint[j ].springyPosition, }
_joint[_joint[j].parent ].radius * 0.8, }
_joint[j ].radius * 0.8
);
/* for (int j = 1; j < NUM_AVATAR_JOINTS; j++) {
// Render lines connecting the joint positions if (_joint[j].parent != AVATAR_JOINT_NULL)
glColor3f(0.4f, 0.5f, 0.6f); if ((j != AVATAR_JOINT_HEAD_TOP )
glLineWidth(3.0); && (j != AVATAR_JOINT_HEAD_BASE )
glBegin(GL_LINE_STRIP); && (j != AVATAR_JOINT_PELVIS )
glVertex3fv(&_joint[ _joint[ b ].parent ].springyPosition.x); && (j != AVATAR_JOINT_TORSO )
glVertex3fv(&_joint[ b ].springyPosition.x); && (j != AVATAR_JOINT_CHEST )
glEnd(); && (j != AVATAR_JOINT_LEFT_COLLAR )
*/ && (j != AVATAR_JOINT_LEFT_SHOULDER )
&& (j != AVATAR_JOINT_RIGHT_COLLAR )
&& (j != AVATAR_JOINT_RIGHT_SHOULDER)) {
// Render cone sections connecting the joint positions
glColor3fv(darkSkinColor);
renderJointConnectingCone
(
_joint[_joint[j].parent ].springyPosition,
_joint[j ].springyPosition,
_joint[_joint[j].parent ].radius * 0.8,
_joint[j ].radius * 0.8
);
}
} }
} }
} }