mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-06 15:51:25 +00:00
Don't need LA for greyscale textures, switch to luminance-only.
This commit is contained in:
parent
3bfdf0aea3
commit
91bebf1bfa
2 changed files with 9 additions and 10 deletions
|
@ -42,6 +42,8 @@ typedef struct tex_s {
|
||||||
} tex_t;
|
} tex_t;
|
||||||
|
|
||||||
#define tex_palette 0
|
#define tex_palette 0
|
||||||
|
#define tex_l GL_LUMINANCE
|
||||||
|
#define tex_a GL_ALPHA
|
||||||
#define tex_la 2
|
#define tex_la 2
|
||||||
#define tex_rgb 3
|
#define tex_rgb 3
|
||||||
#define tex_rgba 4
|
#define tex_rgba 4
|
||||||
|
|
|
@ -46,6 +46,7 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
#include "QF/texture.h"
|
#include "QF/texture.h"
|
||||||
#include "QF/tga.h"
|
#include "QF/tga.h"
|
||||||
#include "QF/zone.h"
|
#include "QF/zone.h"
|
||||||
|
#include "QF/GL/defines.h"
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
@ -106,20 +107,18 @@ reverse_blit_rgba (byte *buf, int count, byte red, byte green, byte blue,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline byte *
|
static inline byte *
|
||||||
blit_la (byte *buf, int count, byte lum, byte alpha)
|
blit_l (byte *buf, int count, byte lum)
|
||||||
{
|
{
|
||||||
while (count--) {
|
while (count--) {
|
||||||
*buf++ = lum;
|
*buf++ = lum;
|
||||||
*buf++ = alpha;
|
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline byte *
|
static inline byte *
|
||||||
reverse_blit_la (byte *buf, int count, byte lum, byte alpha)
|
reverse_blit_l (byte *buf, int count, byte lum)
|
||||||
{
|
{
|
||||||
while (count--) {
|
while (count--) {
|
||||||
*buf-- = alpha;
|
|
||||||
*buf-- = lum;
|
*buf-- = lum;
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -195,18 +194,16 @@ static inline byte *
|
||||||
read_l (byte *buf, int count, byte **data, cmap_t *cmap)
|
read_l (byte *buf, int count, byte **data, cmap_t *cmap)
|
||||||
{
|
{
|
||||||
byte lum = *(*data)++;
|
byte lum = *(*data)++;
|
||||||
byte alpha = 255;
|
|
||||||
|
|
||||||
return blit_la (buf, count, lum, alpha);
|
return blit_l (buf, count, lum);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline byte *
|
static inline byte *
|
||||||
reverse_read_l (byte *buf, int count, byte **data, cmap_t *cmap)
|
reverse_read_l (byte *buf, int count, byte **data, cmap_t *cmap)
|
||||||
{
|
{
|
||||||
byte lum = *(*data)++;
|
byte lum = *(*data)++;
|
||||||
byte alpha = 255;
|
|
||||||
|
|
||||||
return reverse_blit_la (buf, count, lum, alpha);
|
return reverse_blit_l (buf, count, lum);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@ -558,7 +555,7 @@ decode_greyscale (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
||||||
|
|
||||||
if (targa->pixel_size != 8)
|
if (targa->pixel_size != 8)
|
||||||
Sys_Error ("LoadTGA: unsupported truecolor pixel size");
|
Sys_Error ("LoadTGA: unsupported truecolor pixel size");
|
||||||
tex->format = tex_la;
|
tex->format = tex_l;
|
||||||
|
|
||||||
columns = targa->width;
|
columns = targa->width;
|
||||||
rows = targa->height;
|
rows = targa->height;
|
||||||
|
@ -595,7 +592,7 @@ decode_greyscale_rle (TargaHeader *targa, tex_t *tex, byte *dataByte)
|
||||||
|
|
||||||
if (targa->pixel_size != 8)
|
if (targa->pixel_size != 8)
|
||||||
Sys_Error ("LoadTGA: unsupported truecolor pixel size");
|
Sys_Error ("LoadTGA: unsupported truecolor pixel size");
|
||||||
tex->format = tex_la;
|
tex->format = tex_l;
|
||||||
|
|
||||||
columns = targa->width;
|
columns = targa->width;
|
||||||
rows = targa->height;
|
rows = targa->height;
|
||||||
|
|
Loading…
Reference in a new issue