mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 09:08:47 +02:00
Render own manipulator hand in front of camera
This commit is contained in:
parent
777a00db3e
commit
0453445b13
2 changed files with 18 additions and 20 deletions
|
@ -218,19 +218,19 @@ void Head::render(int faceToFace, float * myLocation)
|
||||||
glm::vec3 cameraHead(myLocation[0], myLocation[1], myLocation[2]);
|
glm::vec3 cameraHead(myLocation[0], myLocation[1], myLocation[2]);
|
||||||
float distanceToCamera = glm::distance(cameraHead, position);
|
float distanceToCamera = glm::distance(cameraHead, position);
|
||||||
|
|
||||||
|
// Always render own hand, but don't render head unless showing face2face
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
glPushMatrix();
|
||||||
|
|
||||||
|
glScalef(scale, scale, scale);
|
||||||
|
glTranslatef(leanSideways, 0.f, leanForward);
|
||||||
|
|
||||||
|
glRotatef(Yaw, 0, 1, 0);
|
||||||
|
|
||||||
|
hand->render();
|
||||||
|
|
||||||
// Don't render a head if it is really close to your location, because that is your own head!
|
// Don't render a head if it is really close to your location, because that is your own head!
|
||||||
if ((distanceToCamera > 1.0) || faceToFace) {
|
if ((distanceToCamera > 1.0) || faceToFace) {
|
||||||
glEnable(GL_DEPTH_TEST);
|
|
||||||
glPushMatrix();
|
|
||||||
|
|
||||||
|
|
||||||
glScalef(scale, scale, scale);
|
|
||||||
glTranslatef(leanSideways, 0.f, leanForward);
|
|
||||||
|
|
||||||
glRotatef(Yaw, 0, 1, 0);
|
|
||||||
|
|
||||||
hand->render();
|
|
||||||
|
|
||||||
glRotatef(Pitch, 1, 0, 0);
|
glRotatef(Pitch, 1, 0, 0);
|
||||||
glRotatef(Roll, 0, 0, 1);
|
glRotatef(Roll, 0, 0, 1);
|
||||||
|
@ -335,9 +335,9 @@ void Head::render(int faceToFace, float * myLocation)
|
||||||
glutSolidSphere(PupilSize, 15, 15);
|
glutSolidSphere(PupilSize, 15, 15);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
}
|
||||||
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transmit data to agents requesting it
|
// Transmit data to agents requesting it
|
||||||
|
|
|
@ -578,14 +578,12 @@ void display(void)
|
||||||
if (!display_head && stats_on) render_world_box();
|
if (!display_head && stats_on) render_world_box();
|
||||||
|
|
||||||
// Render my own head
|
// Render my own head
|
||||||
|
glPushMatrix();
|
||||||
if (display_head) {
|
glLoadIdentity();
|
||||||
glPushMatrix();
|
glTranslatef(0.f, 0.f, -7.f);
|
||||||
glLoadIdentity();
|
myHead.render(display_head, &location[0]);
|
||||||
glTranslatef(0.f, 0.f, -7.f);
|
glPopMatrix();
|
||||||
myHead.render(1, &location[0]);
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
//glm::vec3 test(0.5, 0.5, 0.5);
|
//glm::vec3 test(0.5, 0.5, 0.5);
|
||||||
//render_vector(&test);
|
//render_vector(&test);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue