made the exhibit ui slightly more visible
[laserbrain_demo] / src / ui_exhibit.cc
index 87fea01..02ce049 100644 (file)
@@ -29,12 +29,15 @@ static unsigned int fontsdr;
 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;
@@ -64,10 +67,14 @@ bool exui_init()
                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;
@@ -92,6 +99,16 @@ void exui_setnode(const SceneNode *node)
        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;
@@ -196,7 +213,6 @@ void exui_draw()
 
        // 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();
@@ -205,6 +221,7 @@ void exui_draw()
        glMatrixMode(GL_MODELVIEW);
        glPushMatrix();
 
+       /*
        Mat4 mvmat;
        glGetFloatv(GL_MODELVIEW_MATRIX, mvmat[0]);
        if(parent) {
@@ -215,11 +232,21 @@ void exui_draw()
        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);