mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 09:23:03 -04:00
gobj: support T_unsigned_int_24_8 in TexturePeeker
This commit is contained in:
parent
71e18eb960
commit
1a6d329fde
@ -2342,6 +2342,24 @@ get_unsigned_int(const unsigned char *&p) {
|
||||
return (double)v.ui / 4294967295.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used by store() to retrieve the next consecutive component value
|
||||
* from the indicated element of the array, which is taken to be an array of
|
||||
* unsigned ints with the value packed in the 24 least significant bits.
|
||||
*/
|
||||
INLINE double Texture::
|
||||
get_unsigned_int_24(const unsigned char *&p) {
|
||||
union {
|
||||
uint32_t ui;
|
||||
uint8_t uc[4];
|
||||
} v;
|
||||
v.uc[0] = (*p++);
|
||||
v.uc[1] = (*p++);
|
||||
v.uc[2] = (*p++);
|
||||
v.uc[3] = (*p++);
|
||||
return (double)(v.ui & 0xffffff) / (double)0xffffff;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is used by store() to retrieve the next consecutive component value
|
||||
* from the indicated element of the array, which is taken to be an array of
|
||||
|
@ -858,6 +858,7 @@ private:
|
||||
INLINE static double get_unsigned_byte(const unsigned char *&p);
|
||||
INLINE static double get_unsigned_short(const unsigned char *&p);
|
||||
INLINE static double get_unsigned_int(const unsigned char *&p);
|
||||
INLINE static double get_unsigned_int_24(const unsigned char *&p);
|
||||
INLINE static double get_float(const unsigned char *&p);
|
||||
INLINE static double get_half_float(const unsigned char *&p);
|
||||
|
||||
|
@ -94,6 +94,10 @@ TexturePeeker(Texture *tex, Texture::CData *cdata) {
|
||||
_get_component = Texture::get_half_float;
|
||||
break;
|
||||
|
||||
case Texture::T_unsigned_int_24_8:
|
||||
_get_component = Texture::get_unsigned_int_24;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Not supported.
|
||||
_image.clear();
|
||||
|
Loading…
x
Reference in New Issue
Block a user