# HG changeset patch # User reimar # Date 1371063263 0 # Node ID 15de38d9f7265a048b52bb7f42c9a4bc8abcd355 # Parent b9aec2e77319e7d863bd700dd53bc9bc54cc458b Merge the 3 different drawing steps. diff -r b9aec2e77319 -r 15de38d9f726 libvo/matrixview.c --- a/libvo/matrixview.c Wed Jun 12 18:54:22 2013 +0000 +++ b/libvo/matrixview.c Wed Jun 12 18:54:23 2013 +0000 @@ -51,41 +51,29 @@ static float *bump_pic; -static void draw_char(int num, float light, float x, float y, float z) +static void draw_flare(float x, float y, float z); + +static void draw_char(int num, int light, int illuminated, float x, float y, float z) { + int light2 = 0; float tx, ty; int num2, num3; num %= 55; + if (light < 10) light = 0; //light = light / 255; //light=7-light;num+=(light*60); light *= matrix_brightness; + if (illuminated) { + draw_flare(x, y, z); + light += 128; + if (light > 255) light = 255; + light2 = 128; + } num2 = num / 10; num3 = num - (num2 * 10); ty = (float)num2 / 6; tx = (float)num3 / 10; - mpglColor4ub(0, light, 0, 255); // Basic polygon color - - mpglTexCoord2f(tx, ty); - mpglVertex3f(x, y, z); - mpglTexCoord2f(tx + 0.1, ty); - mpglVertex3f(x + 1, y, z); - mpglTexCoord2f(tx + 0.1, ty + 0.166); - mpglVertex3f(x + 1, y - 1, z); - mpglTexCoord2f(tx, ty + 0.166); - mpglVertex3f(x, y - 1, z); -} - -static void draw_illuminatedchar(int num, float x, float y, float z) -{ - float tx, ty; - int num2, num3; - - num %= 55; - num2 = num / 10; - num3 = num - (num2 * 10); - ty = (float)num2 / 6; - tx = (float)num3 / 10; - mpglColor4ub(128, 128, 128, 255); // Basic polygon color + mpglColor4ub(light2, light, light2, 255); // Basic polygon color mpglTexCoord2f(tx, ty); mpglVertex3f(x, y, z); @@ -117,6 +105,7 @@ int p = 0; int c, c_pic; int pic_fade = 255; + int illuminated; for (y = _text_y; y > -_text_y; y--) { for (x = -_text_x; x < _text_x; x++) { @@ -144,32 +133,14 @@ bump_pic[p] = Z_Depth; } - if (c > 10) - draw_char(text[p], c, x, y, bump_pic[p]); - - if (text_light[p] > 128 && text_light[p + text_x] < 10) - draw_illuminatedchar(text[p], x, y, - bump_pic[p]); + illuminated = text_light[p] > 128 && text_light[p + text_x] < 10; + draw_char(text[p], c, illuminated, x, y, bump_pic[p]); p++; } } } -static void draw_flares(void) -{ - float x, y; - int p = 0; - - for (y = _text_y; y > -_text_y; y--) { - for (x = -_text_x; x < _text_x; x++) { - if (text_light[p] > 128 && text_light[p + text_x] < 10) - draw_flare(x, y, bump_pic[p]); - p++; - } - } -} - static void scroll(double dCurrentTime) { int a, s, polovina; @@ -284,7 +255,6 @@ // OK, let's start drawing our planer quads. mpglBegin(GL_QUADS); draw_text(data); - draw_flares(); mpglEnd(); make_change(currentTime);