diff --git a/panda/src/gobj/texturePeeker.cxx b/panda/src/gobj/texturePeeker.cxx index 7bb17ab87a..ece87f36a5 100644 --- a/panda/src/gobj/texturePeeker.cxx +++ b/panda/src/gobj/texturePeeker.cxx @@ -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. diff --git a/panda/src/gobj/texturePeeker.h b/panda/src/gobj/texturePeeker.h index ffe3aba2b1..e88603bcea 100644 --- a/panda/src/gobj/texturePeeker.h +++ b/panda/src/gobj/texturePeeker.h @@ -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);