X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fui_exhibit.cc;h=438a52e0dacc6d2bf8f113a1cf143432ca7f9be9;hp=87fea01d08e0f844d80c4a042e2920c16a9b880e;hb=2fd19c29d765f973a757807d4e051e09495b47b4;hpb=f25228d21d10f8df4607384ddb879251d31ee40e diff --git a/src/ui_exhibit.cc b/src/ui_exhibit.cc index 87fea01..438a52e 100644 --- a/src/ui_exhibit.cc +++ b/src/ui_exhibit.cc @@ -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 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; @@ -205,6 +222,7 @@ void exui_draw() glMatrixMode(GL_MODELVIEW); glPushMatrix(); + /* Mat4 mvmat; glGetFloatv(GL_MODELVIEW_MATRIX, mvmat[0]); if(parent) { @@ -215,11 +233,20 @@ 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); glEnable(GL_TEXTURE_2D); + glDisable(GL_CULL_FACE); glDepthMask(0); glUseProgram(0);