static float aspect;
static int ui_width, ui_height;
+static Mat4 tilt_matrix;
+
static RenderTarget *rtarg;
static const SceneNode *parent;
static Vec3 pos;
static Vec2 size;
static int text_padding;
static float text_scale = 0.65f;
+static float scale = 1.0f;
static Exhibit *ex;
static int vis_tab, num_tabs;
static std::vector<std::string> tab_names;
return false;
}
+ tilt_matrix = Mat4::identity;
+
size.x = 15;
size.y = 18;
text_padding = 6;
+ scale = 1.0f;
+
aspect = size.x / size.y;
ui_height = 512;
ui_width = ui_height * aspect;
parent = node;
}
+void exui_rotation(const Vec3 &euler)
+{
+ tilt_matrix.rotation(euler);
+}
+
+void exui_scale(float s)
+{
+ scale = s;
+}
+
void exui_change_tab(int dir)
{
vis_tab = (vis_tab + dir) % num_tabs;
// render the 2D UI in a texture
push_render_target(rtarg);
- glClearColor(0, 1, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
draw_2d_ui();
pop_render_target();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
+ /*
Mat4 mvmat;
glGetFloatv(GL_MODELVIEW_MATRIX, mvmat[0]);
if(parent) {
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]);
+ */
+ Mat4 xform;
+ if(parent) {
+ xform = parent->get_matrix();
+ }
+ xform = tilt_matrix * xform;
+ xform.pre_scale(scale, scale, scale);
+ glMultMatrixf(xform[0]);
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ glBlendColor(0, 0, 0, 0.35);
+ glBlendFunc(GL_SRC_ALPHA, GL_CONSTANT_ALPHA);
glEnable(GL_TEXTURE_2D);
+ glDisable(GL_CULL_FACE);
glDepthMask(0);
glUseProgram(0);