mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-15 21:18:06 +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]);
|
||||
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!
|
||||
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(Roll, 0, 0, 1);
|
||||
|
@ -335,9 +335,9 @@ void Head::render(int faceToFace, float * myLocation)
|
|||
glutSolidSphere(PupilSize, 15, 15);
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
// Transmit data to agents requesting it
|
||||
|
|
|
@ -578,14 +578,12 @@ void display(void)
|
|||
if (!display_head && stats_on) render_world_box();
|
||||
|
||||
// Render my own head
|
||||
|
||||
if (display_head) {
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.f, 0.f, -7.f);
|
||||
myHead.render(1, &location[0]);
|
||||
glPopMatrix();
|
||||
}
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glTranslatef(0.f, 0.f, -7.f);
|
||||
myHead.render(display_head, &location[0]);
|
||||
glPopMatrix();
|
||||
|
||||
//glm::vec3 test(0.5, 0.5, 0.5);
|
||||
//render_vector(&test);
|
||||
|
||||
|
|
Loading…
Reference in a new issue