if(have_handtracking) {
update_vrhands(&avatar);
} else {
+ // TODO do this properly
// set the position of the left hand at a suitable position for the exhibit UI
- Vec3 dir = transpose(mouse_view_matrix.upper3x3()) * Vec3(0, 0, -1);
+ dir = transpose(mouse_view_matrix.upper3x3()) * Vec3(-0.47, 0, -1);
exslot_left.node.set_position(avatar.pos + dir * 30); // magic: distance in front
}
ui_width = ui_height * aspect;
rtarg = new RenderTarget;
- if(!rtarg->create(ui_width, ui_height, GL_RGB)) {
+ if(!rtarg->create(ui_width, ui_height, GL_RGBA)) {
error_log("failed to create exui render target\n");
return false;
}
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- glOrtho(0, ui_width, 0, ui_height, -1, 1);
+ glTranslatef(-1, 1, 0);
+ glScalef(2.0 / ui_width, -2.0 / ui_height, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
// place UI image into the scene
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
+
+ Mat4 mvmat;
+ glGetFloatv(GL_MODELVIEW_MATRIX, mvmat[0]);
+
+ /*
if(parent) {
glMultMatrixf(parent->get_matrix()[0]);
}
glTranslatef(pos.x, pos.y, pos.z);
+ */
+ if(parent) {
+ mvmat = parent->get_matrix() * mvmat;
+ }
+ mvmat.translate(pos.x, pos.y, pos.z);
+
+ mvmat[0][0] = mvmat[1][1] = mvmat[2][2] = 1.0f;
+ mvmat[0][1] = mvmat[0][2] = mvmat[1][0] = mvmat[2][0] = mvmat[1][2] = mvmat[2][1] = 0.0f;
+
+ glLoadMatrixf(mvmat[0]);
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);