mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Add a new aligned mode to alphatabs by defining numalphatabs to be a power of two minus one.
This provides fractionally better correspondence between 0-255 alpha values and blend table IDs. git-svn-id: https://svn.eduke32.com/eduke32@5890 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
9906b71023
commit
5381e729f8
2 changed files with 6 additions and 4 deletions
|
@ -3504,11 +3504,12 @@ static int32_t defsparser(scriptfile *script)
|
||||||
|
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case 0: /*case 1:*/ case 2: case 4: case 8: case 16: case 32: case 64: case 128:
|
case 1: case 3: case 7: case 15: case 31: case 63: case 127:
|
||||||
|
case 2: case 4: case 8: case 16: case 32: case 64: case 128:
|
||||||
#ifdef USE_OPENGL
|
#ifdef USE_OPENGL
|
||||||
for (int32_t a = 1, value2 = value*2; a <= value; ++a)
|
for (int32_t a = 1, value2 = value*2 + (value&1); a <= value; ++a)
|
||||||
{
|
{
|
||||||
float finv2value = 0.5f/(float)value;
|
float finv2value = 1.f/(float)value2;
|
||||||
|
|
||||||
glblend_t * const glb = glblend + a;
|
glblend_t * const glb = glblend + a;
|
||||||
*glb = defaultglblend;
|
*glb = defaultglblend;
|
||||||
|
@ -3516,6 +3517,7 @@ static int32_t defsparser(scriptfile *script)
|
||||||
glb->def[1].alpha = (float)a * finv2value;
|
glb->def[1].alpha = (float)a * finv2value;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
case 0:
|
||||||
numalphatabs = value;
|
numalphatabs = value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -4725,7 +4725,7 @@ static size_t falpha_to_blend(float alpha, int32_t *cstatptr, uint8_t *blendptr,
|
||||||
{
|
{
|
||||||
int32_t cstat = *cstatptr | transbit1;
|
int32_t cstat = *cstatptr | transbit1;
|
||||||
|
|
||||||
int32_t const twonumalphatabs = 2*numalphatabs;
|
int32_t const twonumalphatabs = 2*numalphatabs + (numalphatabs&1);
|
||||||
int32_t blendidx = Blrintf(alpha * twonumalphatabs);
|
int32_t blendidx = Blrintf(alpha * twonumalphatabs);
|
||||||
if (blendidx > numalphatabs)
|
if (blendidx > numalphatabs)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue