TINYGL: Fix ARGBST scaling.
I based ARGB scaling on ST scaling without giving it enough thought. It accidentally uncovered an older bug in glopClear, which made me recheck these formulas. ST scaling maps [0.0, 1.0] to [0x01.0000, 0xff.0000], meaning the first and last texture rows and columns are never shown. Treating s and t as proportions of ST_MAX fixes this by mapping to [0x00.0000, 0xff.fffc] (last two fractional bits being off-precision, as there are only 14 bits), covering the whole available range.
This commit is contained in:
parent
8c1954359e
commit
4bcc95f217
3 changed files with 15 additions and 24 deletions
|
@ -82,10 +82,10 @@ void tglColor4f(float r, float g, float b, float a) {
|
|||
p[3].f = b;
|
||||
p[4].f = a;
|
||||
// direct convertion to integer to go faster if no shading
|
||||
p[5].ui = (unsigned int)(r * (ZB_POINT_RED_MAX - ZB_POINT_RED_MIN) + ZB_POINT_RED_MIN);
|
||||
p[6].ui = (unsigned int)(g * (ZB_POINT_GREEN_MAX - ZB_POINT_GREEN_MIN) + ZB_POINT_GREEN_MIN);
|
||||
p[7].ui = (unsigned int)(b * (ZB_POINT_BLUE_MAX - ZB_POINT_BLUE_MIN) + ZB_POINT_BLUE_MIN);
|
||||
p[8].ui = (unsigned int)(a * (ZB_POINT_ALPHA_MAX - ZB_POINT_ALPHA_MIN) + ZB_POINT_ALPHA_MIN);
|
||||
p[5].ui = (unsigned int)(r * ZB_POINT_RED_MAX);
|
||||
p[6].ui = (unsigned int)(g * ZB_POINT_GREEN_MAX);
|
||||
p[7].ui = (unsigned int)(b * ZB_POINT_BLUE_MAX);
|
||||
p[8].ui = (unsigned int)(a * ZB_POINT_ALPHA_MAX);
|
||||
gl_add_op(p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue