gobj: add F_rg, F_rg16, F_rg32, F_rgb32 to TexturePeeker

This commit is contained in:
rdb 2018-12-19 20:26:51 +01:00
parent 92539a3107
commit 5cafe8552b
2 changed files with 20 additions and 0 deletions

View File

@ -140,6 +140,12 @@ TexturePeeker(Texture *tex, Texture::CData *cdata) {
_get_texel = get_texel_la;
break;
case Texture::F_rg16:
case Texture::F_rg32:
case Texture::F_rg:
_get_texel = get_texel_rg;
break;
case Texture::F_rgb:
case Texture::F_rgb5:
case Texture::F_rgb8:
@ -148,6 +154,7 @@ TexturePeeker(Texture *tex, Texture::CData *cdata) {
case Texture::F_rgb332:
case Texture::F_r11_g11_b10:
case Texture::F_rgb9_e5:
case Texture::F_rgb32:
_get_texel = get_texel_rgb;
break;
@ -582,6 +589,18 @@ get_texel_la(LColor &color, const unsigned char *&p, GetComponentFunc *get_compo
color[3] = (*get_component)(p);
}
/**
* Gets the color of the texel at byte p, given that the texture is in format
* F_rg or similar.
*/
void TexturePeeker::
get_texel_rg(LColor &color, const unsigned char *&p, GetComponentFunc *get_component) {
color[0] = (*get_component)(p);
color[1] = (*get_component)(p);
color[2] = 0.0f;
color[3] = 1.0f;
}
/**
* Gets the color of the texel at byte p, given that the texture is in format
* F_rgb or similar.

View File

@ -77,6 +77,7 @@ private:
static void get_texel_a(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);
static void get_texel_l(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);
static void get_texel_la(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);
static void get_texel_rg(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);
static void get_texel_rgb(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);
static void get_texel_rgba(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);
static void get_texel_srgb(LColor &color, const unsigned char *&p, GetComponentFunc *get_component);