mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
fix bug handling colors in stdfloat_double build
This commit is contained in:
parent
800c0ceeb5
commit
fd3a43b751
@ -324,7 +324,7 @@ operator << (ostream &out, const GeomVertexColumn &obj) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts an integer (typically a uint8) value to a
|
||||
// floating-point value. If the contents value
|
||||
@ -332,7 +332,7 @@ operator << (ostream &out, const GeomVertexColumn &obj) {
|
||||
// range 0..1 per convention; otherwise leaves it alone.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float GeomVertexColumn::Packer::
|
||||
maybe_scale_color(unsigned int value) {
|
||||
maybe_scale_color_f(unsigned int value) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
return (float)value / 255.0f;
|
||||
} else {
|
||||
@ -341,13 +341,13 @@ maybe_scale_color(unsigned int value) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts a pair of integers into the _v2 member. See
|
||||
// one-parameter maybe_scale_color() for more info.
|
||||
// one-parameter maybe_scale_color_f() for more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_scale_color(unsigned int a, unsigned int b) {
|
||||
maybe_scale_color_f(unsigned int a, unsigned int b) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_v2.set((float)a / 255.0f,
|
||||
(float)b / 255.0f);
|
||||
@ -357,13 +357,13 @@ maybe_scale_color(unsigned int a, unsigned int b) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts a pair of integers into the _v3 member. See
|
||||
// one-parameter maybe_scale_color() for more info.
|
||||
// one-parameter maybe_scale_color_f() for more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_scale_color(unsigned int a, unsigned int b, unsigned int c) {
|
||||
maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_v3.set((float)a / 255.0f,
|
||||
(float)b / 255.0f,
|
||||
@ -374,14 +374,14 @@ maybe_scale_color(unsigned int a, unsigned int b, unsigned int c) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts a pair of integers into the _v4 member. See
|
||||
// one-parameter maybe_scale_color() for more info.
|
||||
// one-parameter maybe_scale_color_f() for more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_scale_color(unsigned int a, unsigned int b, unsigned int c,
|
||||
unsigned int d) {
|
||||
maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c,
|
||||
unsigned int d) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_v4.set((float)a / 255.0f,
|
||||
(float)b / 255.0f,
|
||||
@ -394,7 +394,7 @@ maybe_scale_color(unsigned int a, unsigned int b, unsigned int c,
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts a floating-point value to a uint8 value. If
|
||||
// the contents value indicates this is a color value,
|
||||
@ -402,7 +402,7 @@ maybe_scale_color(unsigned int a, unsigned int b, unsigned int c,
|
||||
// otherwise leaves it alone.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE unsigned int GeomVertexColumn::Packer::
|
||||
maybe_unscale_color(float data) {
|
||||
maybe_unscale_color_f(float data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
return (unsigned int)(data * 255.0f);
|
||||
} else {
|
||||
@ -411,14 +411,14 @@ maybe_unscale_color(float data) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts an LVecBase2f into a pair of uint8
|
||||
// values. See one-parameter maybe_unscale_color() for
|
||||
// values. See one-parameter maybe_unscale_color_f() for
|
||||
// more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_unscale_color(const LVecBase2f &data) {
|
||||
maybe_unscale_color_f(const LVecBase2f &data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_a = (unsigned int)(data[0] * 255.0f);
|
||||
_b = (unsigned int)(data[1] * 255.0f);
|
||||
@ -429,14 +429,14 @@ maybe_unscale_color(const LVecBase2f &data) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts an LVecBase3f into a pair of uint8
|
||||
// values. See one-parameter maybe_unscale_color() for
|
||||
// values. See one-parameter maybe_unscale_color_f() for
|
||||
// more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_unscale_color(const LVecBase3f &data) {
|
||||
maybe_unscale_color_f(const LVecBase3f &data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_a = (unsigned int)(data[0] * 255.0f);
|
||||
_b = (unsigned int)(data[1] * 255.0f);
|
||||
@ -449,14 +449,14 @@ maybe_unscale_color(const LVecBase3f &data) {
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_f
|
||||
// Access: Public
|
||||
// Description: Converts an LVecBase4f into a pair of uint8
|
||||
// values. See one-parameter maybe_unscale_color() for
|
||||
// values. See one-parameter maybe_unscale_color_f() for
|
||||
// more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_unscale_color(const LVecBase4f &data) {
|
||||
maybe_unscale_color_f(const LVecBase4f &data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_a = (unsigned int)(data[0] * 255.0f);
|
||||
_b = (unsigned int)(data[1] * 255.0f);
|
||||
@ -469,3 +469,150 @@ maybe_unscale_color(const LVecBase4f &data) {
|
||||
_d = (unsigned int)data[3];
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts an integer (typically a uint8) value to a
|
||||
// floating-point value. If the contents value
|
||||
// indicates this is a color value, scales it into the
|
||||
// range 0..1 per convention; otherwise leaves it alone.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE double GeomVertexColumn::Packer::
|
||||
maybe_scale_color_d(unsigned int value) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
return (double)value / 255.0;
|
||||
} else {
|
||||
return (double)value;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts a pair of integers into the _v2d member. See
|
||||
// one-parameter maybe_scale_color_d() for more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_scale_color_d(unsigned int a, unsigned int b) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_v2d.set((double)a / 255.0,
|
||||
(double)b / 255.0);
|
||||
} else {
|
||||
_v2d.set((double)a, (double)b);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts a pair of integers into the _v3d member. See
|
||||
// one-parameter maybe_scale_color_d() for more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_v3d.set((double)a / 255.0,
|
||||
(double)b / 255.0,
|
||||
(double)c / 255.0);
|
||||
} else {
|
||||
_v3d.set((double)a, (double)b, (double)c);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_scale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts a pair of integers into the _v4d member. See
|
||||
// one-parameter maybe_scale_color_d() for more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c,
|
||||
unsigned int d) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_v4d.set((double)a / 255.0,
|
||||
(double)b / 255.0,
|
||||
(double)c / 255.0,
|
||||
(double)d / 255.0);
|
||||
} else {
|
||||
_v4d.set((double)a, (double)b, (double)c, (double)d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts a floating-point value to a uint8 value. If
|
||||
// the contents value indicates this is a color value,
|
||||
// scales it into the range 0..255 per convention;
|
||||
// otherwise leaves it alone.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE unsigned int GeomVertexColumn::Packer::
|
||||
maybe_unscale_color_d(double data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
return (unsigned int)(data * 255.0);
|
||||
} else {
|
||||
return (unsigned int)data;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts an LVecBase2d into a pair of uint8
|
||||
// values. See one-parameter maybe_unscale_color_d() for
|
||||
// more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_unscale_color_d(const LVecBase2d &data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_a = (unsigned int)(data[0] * 255.0);
|
||||
_b = (unsigned int)(data[1] * 255.0);
|
||||
} else {
|
||||
_a = (unsigned int)data[0];
|
||||
_b = (unsigned int)data[1];
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts an LVecBase3d into a pair of uint8
|
||||
// values. See one-parameter maybe_unscale_color_d() for
|
||||
// more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_unscale_color_d(const LVecBase3d &data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_a = (unsigned int)(data[0] * 255.0);
|
||||
_b = (unsigned int)(data[1] * 255.0);
|
||||
_c = (unsigned int)(data[2] * 255.0);
|
||||
} else {
|
||||
_a = (unsigned int)data[0];
|
||||
_b = (unsigned int)data[1];
|
||||
_c = (unsigned int)data[2];
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: GeomVertexColumn::Packer::maybe_unscale_color_d
|
||||
// Access: Public
|
||||
// Description: Converts an LVecBase4d into a pair of uint8
|
||||
// values. See one-parameter maybe_unscale_color_d() for
|
||||
// more info.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void GeomVertexColumn::Packer::
|
||||
maybe_unscale_color_d(const LVecBase4d &data) {
|
||||
if (_column->get_contents() == C_color) {
|
||||
_a = (unsigned int)(data[0] * 255.0);
|
||||
_b = (unsigned int)(data[1] * 255.0);
|
||||
_c = (unsigned int)(data[2] * 255.0);
|
||||
_d = (unsigned int)(data[3] * 255.0);
|
||||
} else {
|
||||
_a = (unsigned int)data[0];
|
||||
_b = (unsigned int)data[1];
|
||||
_c = (unsigned int)data[2];
|
||||
_d = (unsigned int)data[3];
|
||||
}
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ float GeomVertexColumn::Packer::
|
||||
get_data1f(const unsigned char *pointer) {
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
return maybe_scale_color(*pointer);
|
||||
return maybe_scale_color_f(*pointer);
|
||||
|
||||
case NT_uint16:
|
||||
return *(const PN_uint16 *)pointer;
|
||||
@ -364,13 +364,13 @@ get_data1f(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
return maybe_scale_color(GeomVertexData::unpack_abcd_d(dword));
|
||||
return maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword));
|
||||
}
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
return maybe_scale_color(GeomVertexData::unpack_abcd_b(dword));
|
||||
return maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword));
|
||||
}
|
||||
|
||||
case NT_float32:
|
||||
@ -400,7 +400,7 @@ get_data2f(const unsigned char *pointer) {
|
||||
} else {
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1]);
|
||||
maybe_scale_color_f(pointer[0], pointer[1]);
|
||||
return _v2;
|
||||
|
||||
case NT_uint16:
|
||||
@ -420,16 +420,16 @@ get_data2f(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
}
|
||||
return _v2;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
}
|
||||
return _v2;
|
||||
|
||||
@ -477,7 +477,7 @@ get_data3f(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2]);
|
||||
maybe_scale_color_f(pointer[0], pointer[1], pointer[2]);
|
||||
return _v3;
|
||||
|
||||
case NT_uint16:
|
||||
@ -497,18 +497,18 @@ get_data3f(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword));
|
||||
}
|
||||
return _v3;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword));
|
||||
}
|
||||
return _v3;
|
||||
|
||||
@ -563,7 +563,7 @@ get_data4f(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
maybe_scale_color_f(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
return _v4;
|
||||
|
||||
case NT_uint16:
|
||||
@ -583,20 +583,20 @@ get_data4f(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4;
|
||||
|
||||
@ -631,7 +631,7 @@ double GeomVertexColumn::Packer::
|
||||
get_data1d(const unsigned char *pointer) {
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
return maybe_scale_color(*pointer);
|
||||
return maybe_scale_color_d(*pointer);
|
||||
|
||||
case NT_uint16:
|
||||
return *(const PN_uint16 *)pointer;
|
||||
@ -642,13 +642,13 @@ get_data1d(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
return maybe_scale_color(GeomVertexData::unpack_abcd_d(dword));
|
||||
return maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword));
|
||||
}
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
return maybe_scale_color(GeomVertexData::unpack_abcd_b(dword));
|
||||
return maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword));
|
||||
}
|
||||
|
||||
case NT_float32:
|
||||
@ -678,7 +678,7 @@ get_data2d(const unsigned char *pointer) {
|
||||
} else {
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1]);
|
||||
maybe_scale_color_d(pointer[0], pointer[1]);
|
||||
return _v2d;
|
||||
|
||||
case NT_uint16:
|
||||
@ -698,16 +698,16 @@ get_data2d(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
}
|
||||
return _v2d;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword));
|
||||
}
|
||||
return _v2d;
|
||||
|
||||
@ -755,7 +755,7 @@ get_data3d(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2]);
|
||||
maybe_scale_color_d(pointer[0], pointer[1], pointer[2]);
|
||||
return _v3d;
|
||||
|
||||
case NT_uint16:
|
||||
@ -775,18 +775,18 @@ get_data3d(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword));
|
||||
}
|
||||
return _v3d;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword));
|
||||
}
|
||||
return _v3d;
|
||||
|
||||
@ -841,7 +841,7 @@ get_data4d(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
maybe_scale_color_d(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
return _v4d;
|
||||
|
||||
case NT_uint16:
|
||||
@ -861,20 +861,20 @@ get_data4d(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4d;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4d;
|
||||
|
||||
@ -1234,7 +1234,7 @@ set_data1f(unsigned char *pointer, float data) {
|
||||
case 1:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
*pointer = maybe_unscale_color(data);
|
||||
*pointer = maybe_unscale_color_f(data);
|
||||
break;
|
||||
|
||||
case NT_uint16:
|
||||
@ -1291,7 +1291,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) {
|
||||
case 2:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
break;
|
||||
@ -1367,7 +1367,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) {
|
||||
case 3:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
pointer[2] = _c;
|
||||
@ -1448,7 +1448,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
pointer[2] = _c;
|
||||
@ -1476,12 +1476,12 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) {
|
||||
break;
|
||||
|
||||
case NT_packed_dcba:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a);
|
||||
break;
|
||||
|
||||
case NT_packed_dabc:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c);
|
||||
break;
|
||||
|
||||
@ -1523,7 +1523,7 @@ set_data1d(unsigned char *pointer, double data) {
|
||||
case 1:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
*pointer = maybe_unscale_color(data);
|
||||
*pointer = maybe_unscale_color_d(data);
|
||||
break;
|
||||
|
||||
case NT_uint16:
|
||||
@ -1580,7 +1580,7 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) {
|
||||
case 2:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
break;
|
||||
@ -1656,7 +1656,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) {
|
||||
case 3:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
pointer[2] = _c;
|
||||
@ -1737,7 +1737,7 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
pointer[2] = _c;
|
||||
@ -1765,12 +1765,12 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) {
|
||||
break;
|
||||
|
||||
case NT_packed_dcba:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a);
|
||||
break;
|
||||
|
||||
case NT_packed_dabc:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c);
|
||||
break;
|
||||
|
||||
@ -2164,7 +2164,7 @@ get_data4f(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
maybe_scale_color_f(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
return _v4;
|
||||
|
||||
case NT_uint16:
|
||||
@ -2184,20 +2184,20 @@ get_data4f(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4;
|
||||
|
||||
@ -2299,7 +2299,7 @@ get_data4d(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
maybe_scale_color_d(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
return _v4d;
|
||||
|
||||
case NT_uint16:
|
||||
@ -2319,20 +2319,20 @@ get_data4d(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4d;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4d;
|
||||
|
||||
@ -2423,7 +2423,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
pointer[2] = _c;
|
||||
@ -2451,12 +2451,12 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) {
|
||||
break;
|
||||
|
||||
case NT_packed_dcba:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a);
|
||||
break;
|
||||
|
||||
case NT_packed_dabc:
|
||||
maybe_unscale_color(data);
|
||||
maybe_unscale_color_f(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c);
|
||||
break;
|
||||
|
||||
@ -2552,7 +2552,7 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
pointer[0] = _a;
|
||||
pointer[1] = _b;
|
||||
pointer[2] = _c;
|
||||
@ -2580,12 +2580,12 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) {
|
||||
break;
|
||||
|
||||
case NT_packed_dcba:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a);
|
||||
break;
|
||||
|
||||
case NT_packed_dabc:
|
||||
maybe_unscale_color(LCAST(float, data));
|
||||
maybe_unscale_color_d(data);
|
||||
*(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c);
|
||||
break;
|
||||
|
||||
@ -2645,7 +2645,7 @@ get_data4f(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
maybe_scale_color_f(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
return _v4;
|
||||
|
||||
case NT_uint16:
|
||||
@ -2665,20 +2665,20 @@ get_data4f(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4;
|
||||
|
||||
@ -2733,7 +2733,7 @@ get_data4d(const unsigned char *pointer) {
|
||||
default:
|
||||
switch (_column->get_numeric_type()) {
|
||||
case NT_uint8:
|
||||
maybe_scale_color(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
maybe_scale_color_d(pointer[0], pointer[1], pointer[2], pointer[3]);
|
||||
return _v4d;
|
||||
|
||||
case NT_uint16:
|
||||
@ -2753,20 +2753,20 @@ get_data4d(const unsigned char *pointer) {
|
||||
case NT_packed_dcba:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4d;
|
||||
|
||||
case NT_packed_dabc:
|
||||
{
|
||||
PN_uint32 dword = *(const PN_uint32 *)pointer;
|
||||
maybe_scale_color(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword),
|
||||
GeomVertexData::unpack_abcd_c(dword),
|
||||
GeomVertexData::unpack_abcd_d(dword),
|
||||
GeomVertexData::unpack_abcd_a(dword));
|
||||
}
|
||||
return _v4d;
|
||||
|
||||
|
@ -138,17 +138,29 @@ private:
|
||||
return "Packer";
|
||||
}
|
||||
|
||||
INLINE float maybe_scale_color(unsigned int value);
|
||||
INLINE void maybe_scale_color(unsigned int a, unsigned int b);
|
||||
INLINE void maybe_scale_color(unsigned int a, unsigned int b,
|
||||
unsigned int c);
|
||||
INLINE void maybe_scale_color(unsigned int a, unsigned int b,
|
||||
unsigned int c, unsigned int d);
|
||||
INLINE float maybe_scale_color_f(unsigned int value);
|
||||
INLINE void maybe_scale_color_f(unsigned int a, unsigned int b);
|
||||
INLINE void maybe_scale_color_f(unsigned int a, unsigned int b,
|
||||
unsigned int c);
|
||||
INLINE void maybe_scale_color_f(unsigned int a, unsigned int b,
|
||||
unsigned int c, unsigned int d);
|
||||
|
||||
INLINE unsigned int maybe_unscale_color(float data);
|
||||
INLINE void maybe_unscale_color(const LVecBase2f &data);
|
||||
INLINE void maybe_unscale_color(const LVecBase3f &data);
|
||||
INLINE void maybe_unscale_color(const LVecBase4f &data);
|
||||
INLINE unsigned int maybe_unscale_color_f(float data);
|
||||
INLINE void maybe_unscale_color_f(const LVecBase2f &data);
|
||||
INLINE void maybe_unscale_color_f(const LVecBase3f &data);
|
||||
INLINE void maybe_unscale_color_f(const LVecBase4f &data);
|
||||
|
||||
INLINE double maybe_scale_color_d(unsigned int value);
|
||||
INLINE void maybe_scale_color_d(unsigned int a, unsigned int b);
|
||||
INLINE void maybe_scale_color_d(unsigned int a, unsigned int b,
|
||||
unsigned int c);
|
||||
INLINE void maybe_scale_color_d(unsigned int a, unsigned int b,
|
||||
unsigned int c, unsigned int d);
|
||||
|
||||
INLINE unsigned int maybe_unscale_color_d(double data);
|
||||
INLINE void maybe_unscale_color_d(const LVecBase2d &data);
|
||||
INLINE void maybe_unscale_color_d(const LVecBase3d &data);
|
||||
INLINE void maybe_unscale_color_d(const LVecBase4d &data);
|
||||
|
||||
const GeomVertexColumn *_column;
|
||||
LVecBase2f _v2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user