25 void GeomVertexColumn::
28 _num_components = copy._num_components;
29 _numeric_type = copy._numeric_type;
30 _contents = copy._contents;
32 _column_alignment = copy._column_alignment;
33 _num_elements = copy._num_elements;
34 _element_stride = copy._element_stride;
55 _num_components = num_components;
65 _numeric_type = numeric_type;
95 _column_alignment = column_alignment;
102 void GeomVertexColumn::
103 output(std::ostream &out)
const {
138 case NT_packed_ufloat:
145 if (_num_elements > 1) {
146 out <<
"[" << _num_elements <<
"]";
154 void GeomVertexColumn::
156 nassertv(_num_components > 0 && _start >= 0);
158 _num_values = _num_components;
160 if (_numeric_type == NT_stdfloat) {
161 if (vertices_float64) {
162 _numeric_type = NT_float64;
164 _numeric_type = NT_float32;
168 switch (_numeric_type) {
171 _component_bytes = 2;
176 _component_bytes = 4;
181 _component_bytes = 1;
186 _component_bytes = 4;
191 _component_bytes = 4;
195 _component_bytes = 8;
202 case NT_packed_ufloat:
203 _component_bytes = 4;
208 if (_num_elements == 0) {
210 if (_contents == C_matrix) {
211 _num_elements = _num_components;
217 if (_column_alignment < 1) {
220 _column_alignment = max(_component_bytes, (
int)vertex_column_alignment);
224 _start = ((_start + _column_alignment - 1) / _column_alignment) * _column_alignment;
226 if (_element_stride < 1) {
227 _element_stride = _component_bytes * _num_components;
229 _total_bytes = _element_stride * _num_elements;
231 if (_packer !=
nullptr) {
235 _packer = make_packer();
236 _packer->_column =
this;
243 GeomVertexColumn::Packer *GeomVertexColumn::
244 make_packer()
const {
252 if (
sizeof(
float) ==
sizeof(PN_float32)) {
257 return new Packer_point_nativefloat_2;
259 return new Packer_point_nativefloat_3;
261 return new Packer_point_nativefloat_4;
266 return new Packer_point_float32_2;
268 return new Packer_point_float32_3;
270 return new Packer_point_float32_4;
275 if (
sizeof(
double) ==
sizeof(PN_float64)) {
280 return new Packer_point_nativedouble_2;
282 return new Packer_point_nativedouble_3;
284 return new Packer_point_nativedouble_4;
289 return new Packer_point_float64_2;
291 return new Packer_point_float64_3;
293 return new Packer_point_float64_4;
300 return new Packer_point;
306 return new Packer_rgba_uint8_4;
309 return new Packer_argb_packed;
312 if (
sizeof(
float) ==
sizeof(PN_float32)) {
315 return new Packer_rgba_nativefloat_4;
317 return new Packer_rgba_float32_4;
325 <<
"GeomVertexColumn with contents C_color must have 3 or 4 components!\n";
327 return new Packer_color;
332 <<
"GeomVertexColumn with contents C_normal must have 3 or 4 components!\n";
341 if (
sizeof(
float) ==
sizeof(PN_float32)) {
344 return new Packer_nativefloat_3;
346 return new Packer_float32_3;
356 if (
sizeof(
double) ==
sizeof(PN_float64)) {
359 return new Packer_nativedouble_3;
361 return new Packer_float64_3;
412 _name == InternalName::get_normal() && _contents == C_vector) {
413 _contents = C_normal;
428 _numeric_type = (NumericType)scan.
get_uint8();
432 _column_alignment = 1;
446 GeomVertexColumn::Packer::
453 float GeomVertexColumn::Packer::
454 get_data1f(
const unsigned char *pointer) {
455 switch (_column->get_numeric_type()) {
457 return *(
const uint8_t *)pointer;
460 return *(
const uint16_t *)pointer;
463 return *(
const uint32_t *)pointer;
467 uint32_t dword = *(
const uint32_t *)pointer;
473 uint32_t dword = *(
const uint32_t *)pointer;
478 return *(
const PN_float32 *)pointer;
481 return *(
const PN_float64 *)pointer;
484 return *(
const int8_t *)pointer;
487 return *(
const int16_t *)pointer;
490 return *(
const int32_t *)pointer;
492 case NT_packed_ufloat:
494 uint32_t dword = *(
const uint32_t *)pointer;
499 nassertr(
false, 0.0f);
508 const LVecBase2f &GeomVertexColumn::Packer::
509 get_data2f(
const unsigned char *pointer) {
510 if (_column->get_num_values() == 1) {
511 _v2.set(get_data1f(pointer), 0.0f);
515 switch (_column->get_numeric_type()) {
518 const uint8_t *pi = (
const uint8_t *)pointer;
519 _v2.set(pi[0], pi[1]);
525 const uint16_t *pi = (
const uint16_t *)pointer;
526 _v2.set(pi[0], pi[1]);
532 const uint32_t *pi = (
const uint32_t *)pointer;
533 _v2.set(pi[0], pi[1]);
539 uint32_t dword = *(
const uint32_t *)pointer;
547 uint32_t dword = *(
const uint32_t *)pointer;
555 const PN_float32 *pi = (
const PN_float32 *)pointer;
556 _v2.set(pi[0], pi[1]);
562 const PN_float64 *pi = (
const PN_float64 *)pointer;
563 _v2.set(pi[0], pi[1]);
568 nassertr(
false, _v2);
573 const int8_t *pi = (
const int8_t *)pointer;
574 _v2.set(pi[0], pi[1]);
580 const int16_t *pi = (
const int16_t *)pointer;
581 _v2.set(pi[0], pi[1]);
587 const int32_t *pi = (
const int32_t *)pointer;
588 _v2.set(pi[0], pi[1]);
592 case NT_packed_ufloat:
593 nassertr(
false, _v2);
604 const LVecBase3f &GeomVertexColumn::Packer::
605 get_data3f(
const unsigned char *pointer) {
606 switch (_column->get_num_values()) {
608 _v3.set(get_data1f(pointer), 0.0f, 0.0f);
613 const LVecBase2f &v2 = get_data2f(pointer);
614 _v3.set(v2[0], v2[1], 0.0f);
619 switch (_column->get_numeric_type()) {
622 const uint8_t *pi = (
const uint8_t *)pointer;
623 _v3.set(pi[0], pi[1], pi[2]);
629 const uint16_t *pi = (
const uint16_t *)pointer;
630 _v3.set(pi[0], pi[1], pi[2]);
636 const uint32_t *pi = (
const uint32_t *)pointer;
637 _v3.set(pi[0], pi[1], pi[2]);
643 uint32_t dword = *(
const uint32_t *)pointer;
652 uint32_t dword = *(
const uint32_t *)pointer;
661 const PN_float32 *pi = (
const PN_float32 *)pointer;
662 _v3.set(pi[0], pi[1], pi[2]);
668 const PN_float64 *pi = (
const PN_float64 *)pointer;
669 _v3.set(pi[0], pi[1], pi[2]);
674 nassertr(
false, _v3);
679 const int8_t *pi = (
const int8_t *)pointer;
680 _v3.set(pi[0], pi[1], pi[2]);
686 const int16_t *pi = (
const int16_t *)pointer;
687 _v3.set(pi[0], pi[1], pi[2]);
693 const int32_t *pi = (
const int32_t *)pointer;
694 _v3.set(pi[0], pi[1], pi[2]);
698 case NT_packed_ufloat:
700 uint32_t dword = *(
const uint32_t *)pointer;
715 const LVecBase4f &GeomVertexColumn::Packer::
716 get_data4f(
const unsigned char *pointer) {
717 switch (_column->get_num_values()) {
719 _v4.set(get_data1f(pointer), 0.0f, 0.0f, 0.0f);
724 const LVecBase2f &v2 = get_data2f(pointer);
725 _v4.set(v2[0], v2[1], 0.0f, 0.0f);
731 const LVecBase3f &v3 = get_data3f(pointer);
732 _v4.set(v3[0], v3[1], v3[2], 0.0f);
737 switch (_column->get_numeric_type()) {
740 const uint8_t *pi = (
const uint8_t *)pointer;
741 _v4.set(pi[0], pi[1], pi[2], pi[3]);
747 const uint16_t *pi = (
const uint16_t *)pointer;
748 _v4.set(pi[0], pi[1], pi[2], pi[3]);
754 const uint32_t *pi = (
const uint32_t *)pointer;
755 _v4.set(pi[0], pi[1], pi[2], pi[3]);
761 uint32_t dword = *(
const uint32_t *)pointer;
771 uint32_t dword = *(
const uint32_t *)pointer;
781 const PN_float32 *pi = (
const PN_float32 *)pointer;
782 _v4.set(pi[0], pi[1], pi[2], pi[3]);
788 const PN_float64 *pi = (
const PN_float64 *)pointer;
789 _v4.set(pi[0], pi[1], pi[2], pi[3]);
794 nassertr(
false, _v4);
799 const int8_t *pi = (
const int8_t *)pointer;
800 _v4.set(pi[0], pi[1], pi[2], pi[3]);
806 const int16_t *pi = (
const int16_t *)pointer;
807 _v4.set(pi[0], pi[1], pi[2], pi[3]);
813 const int32_t *pi = (
const int32_t *)pointer;
814 _v4.set(pi[0], pi[1], pi[2], pi[3]);
818 case NT_packed_ufloat:
819 nassertr(
false, _v4);
830 double GeomVertexColumn::Packer::
831 get_data1d(
const unsigned char *pointer) {
832 switch (_column->get_numeric_type()) {
834 return *(
const uint8_t *)pointer;
837 return *(
const uint16_t *)pointer;
840 return *(
const uint32_t *)pointer;
844 uint32_t dword = *(
const uint32_t *)pointer;
850 uint32_t dword = *(
const uint32_t *)pointer;
855 return *(
const PN_float32 *)pointer;
858 return *(
const PN_float64 *)pointer;
861 nassertr(
false, 0.0);
865 return *(
const int8_t *)pointer;
868 return *(
const int16_t *)pointer;
871 return *(
const int32_t *)pointer;
873 case NT_packed_ufloat:
875 uint32_t dword = *(
const uint32_t *)pointer;
886 const LVecBase2d &GeomVertexColumn::Packer::
887 get_data2d(
const unsigned char *pointer) {
888 if (_column->get_num_values() == 1) {
889 _v2d.set(get_data1d(pointer), 0.0f);
893 switch (_column->get_numeric_type()) {
896 const uint8_t *pi = (
const uint8_t *)pointer;
897 _v2d.set(pi[0], pi[1]);
903 const uint16_t *pi = (
const uint16_t *)pointer;
904 _v2d.set(pi[0], pi[1]);
910 const uint32_t *pi = (
const uint32_t *)pointer;
911 _v2d.set(pi[0], pi[1]);
917 uint32_t dword = *(
const uint32_t *)pointer;
925 uint32_t dword = *(
const uint32_t *)pointer;
933 const PN_float32 *pi = (
const PN_float32 *)pointer;
934 _v2d.set(pi[0], pi[1]);
940 const PN_float64 *pi = (
const PN_float64 *)pointer;
941 _v2d.set(pi[0], pi[1]);
946 nassertr(
false, _v2d);
951 const int8_t *pi = (
const int8_t *)pointer;
952 _v2d.set(pi[0], pi[1]);
958 const int16_t *pi = (
const int16_t *)pointer;
959 _v2d.set(pi[0], pi[1]);
965 const int32_t *pi = (
const int32_t *)pointer;
966 _v2d.set(pi[0], pi[1]);
970 case NT_packed_ufloat:
971 nassertr(
false, _v2d);
982 const LVecBase3d &GeomVertexColumn::Packer::
983 get_data3d(
const unsigned char *pointer) {
984 switch (_column->get_num_values()) {
986 _v3d.set(get_data1d(pointer), 0.0f, 0.0f);
991 const LVecBase2d &v2 = get_data2d(pointer);
992 _v3d.set(v2[0], v2[1], 0.0f);
997 switch (_column->get_numeric_type()) {
1000 const uint8_t *pi = (
const uint8_t *)pointer;
1001 _v3d.set(pi[0], pi[1], pi[2]);
1007 const uint16_t *pi = (
const uint16_t *)pointer;
1008 _v3d.set(pi[0], pi[1], pi[2]);
1014 const uint32_t *pi = (
const uint32_t *)pointer;
1015 _v3d.set(pi[0], pi[1], pi[2]);
1019 case NT_packed_dcba:
1021 uint32_t dword = *(
const uint32_t *)pointer;
1028 case NT_packed_dabc:
1030 uint32_t dword = *(
const uint32_t *)pointer;
1039 const PN_float32 *pi = (
const PN_float32 *)pointer;
1040 _v3d.set(pi[0], pi[1], pi[2]);
1046 const PN_float64 *pi = (
const PN_float64 *)pointer;
1047 _v3d.set(pi[0], pi[1], pi[2]);
1052 nassertr(
false, _v3d);
1057 const int8_t *pi = (
const int8_t *)pointer;
1058 _v3d.set(pi[0], pi[1], pi[2]);
1064 const int16_t *pi = (
const int16_t *)pointer;
1065 _v3d.set(pi[0], pi[1], pi[2]);
1071 const int32_t *pi = (
const int32_t *)pointer;
1072 _v3d.set(pi[0], pi[1], pi[2]);
1076 case NT_packed_ufloat:
1078 uint32_t dword = *(
const uint32_t *)pointer;
1093 const LVecBase4d &GeomVertexColumn::Packer::
1094 get_data4d(
const unsigned char *pointer) {
1095 switch (_column->get_num_values()) {
1097 _v4d.set(get_data1d(pointer), 0.0f, 0.0f, 0.0f);
1102 const LVecBase2d &v2 = get_data2d(pointer);
1103 _v4d.set(v2[0], v2[1], 0.0f, 0.0f);
1109 const LVecBase3d &v3 = get_data3d(pointer);
1110 _v4d.set(v3[0], v3[1], v3[2], 0.0f);
1115 switch (_column->get_numeric_type()) {
1118 const uint8_t *pi = (
const uint8_t *)pointer;
1119 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1125 const uint16_t *pi = (
const uint16_t *)pointer;
1126 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1132 const uint32_t *pi = (
const uint32_t *)pointer;
1133 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1137 case NT_packed_dcba:
1139 uint32_t dword = *(
const uint32_t *)pointer;
1147 case NT_packed_dabc:
1149 uint32_t dword = *(
const uint32_t *)pointer;
1159 const PN_float32 *pi = (
const PN_float32 *)pointer;
1160 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1166 const PN_float64 *pi = (
const PN_float64 *)pointer;
1167 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1172 nassertr(
false, _v4d);
1177 const int8_t *pi = (
const int8_t *)pointer;
1178 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1184 const int16_t *pi = (
const int16_t *)pointer;
1185 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1191 const int32_t *pi = (
const int32_t *)pointer;
1192 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
1196 case NT_packed_ufloat:
1197 nassertr(
false, _v4d);
1208 int GeomVertexColumn::Packer::
1209 get_data1i(
const unsigned char *pointer) {
1210 switch (_column->get_numeric_type()) {
1215 return *(
const uint16_t *)pointer;
1218 return *(
const uint32_t *)pointer;
1220 case NT_packed_dcba:
1222 uint32_t dword = *(
const uint32_t *)pointer;
1226 case NT_packed_dabc:
1228 uint32_t dword = *(
const uint32_t *)pointer;
1233 return (
int)*(
const PN_float32 *)pointer;
1236 return (
int)*(
const PN_float64 *)pointer;
1243 return *(
const int8_t *)pointer;
1246 return *(
const int16_t *)pointer;
1249 return *(
const int32_t *)pointer;
1251 case NT_packed_ufloat:
1253 uint32_t dword = *(
const uint32_t *)pointer;
1264 const LVecBase2i &GeomVertexColumn::Packer::
1265 get_data2i(
const unsigned char *pointer) {
1266 switch (_column->get_num_values()) {
1268 _v2i.set(get_data1i(pointer), 0);
1272 switch (_column->get_numeric_type()) {
1274 _v2i.set(pointer[0], pointer[1]);
1279 const uint16_t *pi = (
const uint16_t *)pointer;
1280 _v2i.set(pi[0], pi[1]);
1286 const uint32_t *pi = (
const uint32_t *)pointer;
1287 _v2i.set(pi[0], pi[1]);
1291 case NT_packed_dcba:
1293 uint32_t dword = *(
const uint32_t *)pointer;
1299 case NT_packed_dabc:
1301 uint32_t dword = *(
const uint32_t *)pointer;
1309 const PN_float32 *pi = (
const PN_float32 *)pointer;
1310 _v2i.set((
int)pi[0], (
int)pi[1]);
1316 const PN_float64 *pi = (
const PN_float64 *)pointer;
1317 _v2i.set((
int)pi[0], (
int)pi[1]);
1322 nassertr(
false, _v2i);
1327 const int8_t *pi = (
const int8_t *)pointer;
1328 _v2i.set(pi[0], pi[1]);
1334 const int16_t *pi = (
const int16_t *)pointer;
1335 _v2i.set(pi[0], pi[1]);
1341 const int32_t *pi = (
const int32_t *)pointer;
1342 _v2i.set(pi[0], pi[1]);
1346 case NT_packed_ufloat:
1347 nassertr(
false, _v2i);
1358 const LVecBase3i &GeomVertexColumn::Packer::
1359 get_data3i(
const unsigned char *pointer) {
1360 switch (_column->get_num_values()) {
1362 _v3i.set(get_data1i(pointer), 0, 0);
1367 const LVecBase2i &v2 = get_data2i(pointer);
1368 _v3i.set(v2[0], v2[1], 0);
1373 switch (_column->get_numeric_type()) {
1375 _v3i.set(pointer[0], pointer[1], 0);
1380 const uint16_t *pi = (
const uint16_t *)pointer;
1381 _v3i.set(pi[0], pi[1], pi[2]);
1387 const uint32_t *pi = (
const uint32_t *)pointer;
1388 _v3i.set(pi[0], pi[1], pi[2]);
1392 case NT_packed_dcba:
1394 uint32_t dword = *(
const uint32_t *)pointer;
1401 case NT_packed_dabc:
1403 uint32_t dword = *(
const uint32_t *)pointer;
1412 const PN_float32 *pi = (
const PN_float32 *)pointer;
1413 _v3i.set((
int)pi[0], (
int)pi[1], (
int)pi[2]);
1419 const PN_float64 *pi = (
const PN_float64 *)pointer;
1420 _v3i.set((
int)pi[0], (
int)pi[1], (
int)pi[2]);
1425 nassertr(
false, _v3i);
1430 const int8_t *pi = (
const int8_t *)pointer;
1431 _v3i.set(pi[0], pi[1], pi[2]);
1437 const int16_t *pi = (
const int16_t *)pointer;
1438 _v3i.set(pi[0], pi[1], pi[2]);
1444 const int32_t *pi = (
const int32_t *)pointer;
1445 _v3i.set(pi[0], pi[1], pi[2]);
1449 case NT_packed_ufloat:
1451 uint32_t dword = *(
const uint32_t *)pointer;
1466 const LVecBase4i &GeomVertexColumn::Packer::
1467 get_data4i(
const unsigned char *pointer) {
1468 switch (_column->get_num_values()) {
1470 _v4i.set(get_data1i(pointer), 0, 0, 0);
1475 const LVecBase2i &v2 = get_data2i(pointer);
1476 _v4i.set(v2[0], v2[1], 0, 0);
1482 const LVecBase3i &v3 = get_data3i(pointer);
1483 _v4i.set(v3[0], v3[1], v3[2], 0);
1488 switch (_column->get_numeric_type()) {
1490 _v4i.set(pointer[0], pointer[1], pointer[2], pointer[3]);
1495 const uint16_t *pi = (
const uint16_t *)pointer;
1496 _v4i.set(pi[0], pi[1], pi[2], pi[3]);
1502 const uint32_t *pi = (
const uint32_t *)pointer;
1503 _v4i.set(pi[0], pi[1], pi[2], pi[3]);
1507 case NT_packed_dcba:
1509 uint32_t dword = *(
const uint32_t *)pointer;
1517 case NT_packed_dabc:
1519 uint32_t dword = *(
const uint32_t *)pointer;
1529 const PN_float32 *pi = (
const PN_float32 *)pointer;
1530 _v4i.set((
int)pi[0], (
int)pi[1], (
int)pi[2], (
int)pi[3]);
1536 const PN_float64 *pi = (
const PN_float64 *)pointer;
1537 _v4i.set((
int)pi[0], (
int)pi[1], (
int)pi[2], (
int)pi[3]);
1542 nassertr(
false, _v4i);
1547 const int8_t *pi = (
const int8_t *)pointer;
1548 _v4i.set(pi[0], pi[1], pi[2], pi[3]);
1554 const int16_t *pi = (
const int16_t *)pointer;
1555 _v4i.set(pi[0], pi[1], pi[2], pi[3]);
1561 const int32_t *pi = (
const int32_t *)pointer;
1562 _v4i.set(pi[0], pi[1], pi[2], pi[3]);
1566 case NT_packed_ufloat:
1567 nassertr(
false, _v4i);
1578 void GeomVertexColumn::Packer::
1579 set_data1f(
unsigned char *pointer,
float data) {
1580 switch (_column->get_num_values()) {
1582 switch (_column->get_numeric_type()) {
1584 *(uint8_t *)pointer = (
unsigned int)data;
1588 *(uint16_t *)pointer = (
unsigned int)data;
1592 *(uint32_t *)pointer = (
unsigned int)data;
1595 case NT_packed_dcba:
1596 case NT_packed_dabc:
1601 *(PN_float32 *)pointer = data;
1605 *(PN_float64 *)pointer = data;
1613 *(int8_t *)pointer = (
int)data;
1617 *(int16_t *)pointer = (
int)data;
1621 *(int32_t *)pointer = (
int)data;
1624 case NT_packed_ufloat:
1631 set_data2f(pointer, LVecBase2f(data, 0.0f));
1635 set_data3f(pointer, LVecBase3f(data, 0.0f, 0.0f));
1639 set_data4f(pointer, LVecBase4f(data, 0.0f, 0.0f, 0.0f));
1647 void GeomVertexColumn::Packer::
1648 set_data2f(
unsigned char *pointer,
const LVecBase2f &data) {
1649 switch (_column->get_num_values()) {
1651 set_data1f(pointer, data[0]);
1655 switch (_column->get_numeric_type()) {
1658 uint8_t *pi = (uint8_t *)pointer;
1659 pi[0] = (
unsigned int)data[0];
1660 pi[1] = (
unsigned int)data[1];
1666 uint16_t *pi = (uint16_t *)pointer;
1667 pi[0] = (
unsigned int)data[0];
1668 pi[1] = (
unsigned int)data[1];
1674 uint32_t *pi = (uint32_t *)pointer;
1675 pi[0] = (
unsigned int)data[0];
1676 pi[1] = (
unsigned int)data[1];
1680 case NT_packed_dcba:
1681 case NT_packed_dabc:
1687 PN_float32 *pi = (PN_float32 *)pointer;
1695 PN_float64 *pi = (PN_float64 *)pointer;
1707 int8_t *pi = (int8_t *)pointer;
1708 pi[0] = (int)data[0];
1709 pi[1] = (int)data[1];
1715 int16_t *pi = (int16_t *)pointer;
1716 pi[0] = (int)data[0];
1717 pi[1] = (int)data[1];
1723 int32_t *pi = (int32_t *)pointer;
1724 pi[0] = (int)data[0];
1725 pi[1] = (int)data[1];
1729 case NT_packed_ufloat:
1736 set_data3f(pointer, LVecBase3f(data[0], data[1], 0.0f));
1740 set_data4f(pointer, LVecBase4f(data[0], data[1], 0.0f, 0.0f));
1748 void GeomVertexColumn::Packer::
1749 set_data3f(
unsigned char *pointer,
const LVecBase3f &data) {
1750 switch (_column->get_num_values()) {
1752 set_data1f(pointer, data[0]);
1756 set_data2f(pointer, LVecBase2f(data[0], data[1]));
1760 switch (_column->get_numeric_type()) {
1763 uint8_t *pi = (uint8_t *)pointer;
1764 pi[0] = (
unsigned int)data[0];
1765 pi[1] = (
unsigned int)data[1];
1766 pi[2] = (
unsigned int)data[2];
1772 uint16_t *pi = (uint16_t *)pointer;
1773 pi[0] = (
unsigned int)data[0];
1774 pi[1] = (
unsigned int)data[1];
1775 pi[2] = (
unsigned int)data[2];
1781 uint32_t *pi = (uint32_t *)pointer;
1782 pi[0] = (
unsigned int)data[0];
1783 pi[1] = (
unsigned int)data[1];
1784 pi[2] = (
unsigned int)data[2];
1788 case NT_packed_dcba:
1789 case NT_packed_dabc:
1795 PN_float32 *pi = (PN_float32 *)pointer;
1804 PN_float64 *pi = (PN_float64 *)pointer;
1817 int8_t *pi = (int8_t *)pointer;
1818 pi[0] = (int)data[0];
1819 pi[1] = (int)data[1];
1820 pi[2] = (int)data[2];
1826 int16_t *pi = (int16_t *)pointer;
1827 pi[0] = (int)data[0];
1828 pi[1] = (int)data[1];
1829 pi[2] = (int)data[2];
1835 int32_t *pi = (int32_t *)pointer;
1836 pi[0] = (int)data[0];
1837 pi[1] = (int)data[1];
1838 pi[2] = (int)data[2];
1842 case NT_packed_ufloat:
1849 set_data4f(pointer, LVecBase4f(data[0], data[1], data[2], 0.0f));
1857 void GeomVertexColumn::Packer::
1858 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
1859 switch (_column->get_num_values()) {
1861 set_data1f(pointer, data[0]);
1865 set_data2f(pointer, LVecBase2f(data[0], data[1]));
1869 set_data3f(pointer, LVecBase3f(data[0], data[1], data[2]));
1873 switch (_column->get_numeric_type()) {
1876 uint8_t *pi = (uint8_t *)pointer;
1877 pi[0] = (
unsigned int)data[0];
1878 pi[1] = (
unsigned int)data[1];
1879 pi[2] = (
unsigned int)data[2];
1880 pi[3] = (
unsigned int)data[3];
1886 uint16_t *pi = (uint16_t *)pointer;
1887 pi[0] = (
unsigned int)data[0];
1888 pi[1] = (
unsigned int)data[1];
1889 pi[2] = (
unsigned int)data[2];
1890 pi[3] = (
unsigned int)data[3];
1896 uint32_t *pi = (uint32_t *)pointer;
1897 pi[0] = (
unsigned int)data[0];
1898 pi[1] = (
unsigned int)data[1];
1899 pi[2] = (
unsigned int)data[2];
1900 pi[3] = (
unsigned int)data[3];
1904 case NT_packed_dcba:
1908 case NT_packed_dabc:
1914 PN_float32 *pi = (PN_float32 *)pointer;
1924 PN_float64 *pi = (PN_float64 *)pointer;
1938 int8_t *pi = (int8_t *)pointer;
1939 pi[0] = (int)data[0];
1940 pi[1] = (int)data[1];
1941 pi[2] = (int)data[2];
1942 pi[3] = (int)data[3];
1948 int16_t *pi = (int16_t *)pointer;
1949 pi[0] = (int)data[0];
1950 pi[1] = (int)data[1];
1951 pi[2] = (int)data[2];
1952 pi[3] = (int)data[3];
1958 int32_t *pi = (int32_t *)pointer;
1959 pi[0] = (int)data[0];
1960 pi[1] = (int)data[1];
1961 pi[2] = (int)data[2];
1962 pi[3] = (int)data[3];
1966 case NT_packed_ufloat:
1977 void GeomVertexColumn::Packer::
1978 set_data1d(
unsigned char *pointer,
double data) {
1979 switch (_column->get_num_values()) {
1981 switch (_column->get_numeric_type()) {
1983 *(uint8_t *)pointer = (
unsigned int)data;
1987 *(uint16_t *)pointer = (
unsigned int)data;
1991 *(uint32_t *)pointer = (
unsigned int)data;
1994 case NT_packed_dcba:
1995 case NT_packed_dabc:
2000 *(PN_float32 *)pointer = data;
2004 *(PN_float64 *)pointer = data;
2012 *(int8_t *)pointer = (
int)data;
2016 *(int16_t *)pointer = (
int)data;
2020 *(int32_t *)pointer = (
int)data;
2023 case NT_packed_ufloat:
2030 set_data2d(pointer, LVecBase2d(data, 0.0f));
2034 set_data3d(pointer, LVecBase3d(data, 0.0f, 0.0f));
2038 set_data4d(pointer, LVecBase4d(data, 0.0f, 0.0f, 0.0f));
2046 void GeomVertexColumn::Packer::
2047 set_data2d(
unsigned char *pointer,
const LVecBase2d &data) {
2048 switch (_column->get_num_values()) {
2050 set_data1d(pointer, data[0]);
2053 switch (_column->get_numeric_type()) {
2056 uint8_t *pi = (uint8_t *)pointer;
2057 pi[0] = (
unsigned int)data[0];
2058 pi[1] = (
unsigned int)data[1];
2064 uint16_t *pi = (uint16_t *)pointer;
2065 pi[0] = (
unsigned int)data[0];
2066 pi[1] = (
unsigned int)data[1];
2072 uint32_t *pi = (uint32_t *)pointer;
2073 pi[0] = (
unsigned int)data[0];
2074 pi[1] = (
unsigned int)data[1];
2078 case NT_packed_dcba:
2079 case NT_packed_dabc:
2085 PN_float32 *pi = (PN_float32 *)pointer;
2093 PN_float64 *pi = (PN_float64 *)pointer;
2105 int8_t *pi = (int8_t *)pointer;
2106 pi[0] = (int)data[0];
2107 pi[1] = (int)data[1];
2113 int16_t *pi = (int16_t *)pointer;
2114 pi[0] = (int)data[0];
2115 pi[1] = (int)data[1];
2121 int32_t *pi = (int32_t *)pointer;
2122 pi[0] = (int)data[0];
2123 pi[1] = (int)data[1];
2127 case NT_packed_ufloat:
2134 set_data3d(pointer, LVecBase3d(data[0], data[1], 0.0f));
2138 set_data4d(pointer, LVecBase4d(data[0], data[1], 0.0f, 0.0f));
2146 void GeomVertexColumn::Packer::
2147 set_data3d(
unsigned char *pointer,
const LVecBase3d &data) {
2148 switch (_column->get_num_values()) {
2150 set_data1d(pointer, data[0]);
2154 set_data2d(pointer, LVecBase2d(data[0], data[1]));
2158 switch (_column->get_numeric_type()) {
2161 uint8_t *pi = (uint8_t *)pointer;
2162 pi[0] = (
unsigned int)data[0];
2163 pi[1] = (
unsigned int)data[1];
2164 pi[2] = (
unsigned int)data[2];
2170 uint16_t *pi = (uint16_t *)pointer;
2171 pi[0] = (
unsigned int)data[0];
2172 pi[1] = (
unsigned int)data[1];
2173 pi[2] = (
unsigned int)data[2];
2179 uint32_t *pi = (uint32_t *)pointer;
2180 pi[0] = (
unsigned int)data[0];
2181 pi[1] = (
unsigned int)data[1];
2182 pi[2] = (
unsigned int)data[2];
2186 case NT_packed_dcba:
2187 case NT_packed_dabc:
2193 PN_float32 *pi = (PN_float32 *)pointer;
2202 PN_float64 *pi = (PN_float64 *)pointer;
2215 int8_t *pi = (int8_t *)pointer;
2216 pi[0] = (int)data[0];
2217 pi[1] = (int)data[1];
2218 pi[2] = (int)data[2];
2224 int16_t *pi = (int16_t *)pointer;
2225 pi[0] = (int)data[0];
2226 pi[1] = (int)data[1];
2227 pi[2] = (int)data[2];
2233 int32_t *pi = (int32_t *)pointer;
2234 pi[0] = (int)data[0];
2235 pi[1] = (int)data[1];
2236 pi[2] = (int)data[2];
2240 case NT_packed_ufloat:
2247 set_data4d(pointer, LVecBase4d(data[0], data[1], data[2], 0.0f));
2255 void GeomVertexColumn::Packer::
2256 set_data4d(
unsigned char *pointer,
const LVecBase4d &data) {
2257 switch (_column->get_num_values()) {
2259 set_data1d(pointer, data[0]);
2263 set_data2d(pointer, LVecBase2d(data[0], data[1]));
2267 set_data3d(pointer, LVecBase3d(data[0], data[1], data[2]));
2271 switch (_column->get_numeric_type()) {
2274 uint8_t *pi = (uint8_t *)pointer;
2275 pi[0] = (
unsigned int)data[0];
2276 pi[1] = (
unsigned int)data[1];
2277 pi[2] = (
unsigned int)data[2];
2278 pi[3] = (
unsigned int)data[3];
2284 uint16_t *pi = (uint16_t *)pointer;
2285 pi[0] = (
unsigned int)data[0];
2286 pi[1] = (
unsigned int)data[1];
2287 pi[2] = (
unsigned int)data[2];
2288 pi[3] = (
unsigned int)data[3];
2294 uint32_t *pi = (uint32_t *)pointer;
2295 pi[0] = (
unsigned int)data[0];
2296 pi[1] = (
unsigned int)data[1];
2297 pi[2] = (
unsigned int)data[2];
2298 pi[3] = (
unsigned int)data[3];
2302 case NT_packed_dcba:
2306 case NT_packed_dabc:
2312 PN_float32 *pi = (PN_float32 *)pointer;
2322 PN_float64 *pi = (PN_float64 *)pointer;
2336 int8_t *pi = (int8_t *)pointer;
2337 pi[0] = (int)data[0];
2338 pi[1] = (int)data[1];
2339 pi[2] = (int)data[2];
2340 pi[3] = (int)data[3];
2346 int16_t *pi = (int16_t *)pointer;
2347 pi[0] = (int)data[0];
2348 pi[1] = (int)data[1];
2349 pi[2] = (int)data[2];
2350 pi[3] = (int)data[3];
2356 int32_t *pi = (int32_t *)pointer;
2357 pi[0] = (int)data[0];
2358 pi[1] = (int)data[1];
2359 pi[2] = (int)data[2];
2360 pi[3] = (int)data[3];
2364 case NT_packed_ufloat:
2375 void GeomVertexColumn::Packer::
2376 set_data1i(
unsigned char *pointer,
int data) {
2377 switch (_column->get_num_values()) {
2379 switch (_column->get_numeric_type()) {
2382 nassertv((*pointer) == data);
2386 *(uint16_t *)pointer = data;
2387 nassertv(*(uint16_t *)pointer == data);
2391 *(uint32_t *)pointer = data;
2394 case NT_packed_dcba:
2395 case NT_packed_dabc:
2400 *(PN_float32 *)pointer = (
float)data;
2404 *(PN_float64 *)pointer = (
double)data;
2412 *(int8_t *)pointer = data;
2413 nassertv(*(int8_t *)pointer == data);
2417 *(int16_t *)pointer = data;
2418 nassertv(*(int16_t *)pointer == data);
2422 *(int32_t *)pointer = data;
2425 case NT_packed_ufloat:
2432 set_data2i(pointer, LVecBase2i(data, 0));
2436 set_data3i(pointer, LVecBase3i(data, 0, 0));
2440 set_data4i(pointer, LVecBase4i(data, 0, 0, 0));
2448 void GeomVertexColumn::Packer::
2449 set_data2i(
unsigned char *pointer,
const LVecBase2i &data) {
2450 switch (_column->get_num_values()) {
2452 set_data1i(pointer, data[0]);
2456 switch (_column->get_numeric_type()) {
2458 pointer[0] = data[0];
2459 pointer[1] = data[1];
2464 uint16_t *pi = (uint16_t *)pointer;
2472 uint32_t *pi = (uint32_t *)pointer;
2478 case NT_packed_dcba:
2479 case NT_packed_dabc:
2485 PN_float32 *pi = (PN_float32 *)pointer;
2493 PN_float64 *pi = (PN_float64 *)pointer;
2505 int8_t *pi = (int8_t *)pointer;
2513 int16_t *pi = (int16_t *)pointer;
2521 int32_t *pi = (int32_t *)pointer;
2527 case NT_packed_ufloat:
2534 set_data3i(pointer, LVecBase3i(data[0], data[1], 0));
2538 set_data4i(pointer, LVecBase4i(data[0], data[1], 0, 0));
2546 void GeomVertexColumn::Packer::
2547 set_data3i(
unsigned char *pointer,
const LVecBase3i &data) {
2548 switch (_column->get_num_values()) {
2550 set_data1i(pointer, data[0]);
2554 set_data2i(pointer, LVecBase2i(data[0], data[1]));
2558 switch (_column->get_numeric_type()) {
2560 pointer[0] = data[0];
2561 pointer[1] = data[1];
2562 pointer[2] = data[2];
2567 uint16_t *pi = (uint16_t *)pointer;
2576 uint32_t *pi = (uint32_t *)pointer;
2583 case NT_packed_dcba:
2584 case NT_packed_dabc:
2590 PN_float32 *pi = (PN_float32 *)pointer;
2599 PN_float64 *pi = (PN_float64 *)pointer;
2612 int8_t *pi = (int8_t *)pointer;
2621 int16_t *pi = (int16_t *)pointer;
2630 int32_t *pi = (int32_t *)pointer;
2637 case NT_packed_ufloat:
2644 set_data4i(pointer, LVecBase4i(data[0], data[1], data[2], 0));
2652 void GeomVertexColumn::Packer::
2653 set_data4i(
unsigned char *pointer,
const LVecBase4i &data) {
2654 switch (_column->get_num_values()) {
2656 set_data1i(pointer, data[0]);
2660 set_data2i(pointer, LVecBase2i(data[0], data[1]));
2664 set_data3i(pointer, LVecBase3i(data[0], data[1], data[2]));
2668 switch (_column->get_numeric_type()) {
2670 pointer[0] = data[0];
2671 pointer[1] = data[1];
2672 pointer[2] = data[2];
2673 pointer[3] = data[3];
2678 uint16_t *pi = (uint16_t *)pointer;
2688 uint32_t *pi = (uint32_t *)pointer;
2696 case NT_packed_dcba:
2700 case NT_packed_dabc:
2706 PN_float32 *pi = (PN_float32 *)pointer;
2716 PN_float64 *pi = (PN_float64 *)pointer;
2730 int8_t *pi = (int8_t *)pointer;
2740 int16_t *pi = (int16_t *)pointer;
2750 int32_t *pi = (int32_t *)pointer;
2758 case NT_packed_ufloat:
2769 float GeomVertexColumn::Packer_point::
2770 get_data1f(
const unsigned char *pointer) {
2771 if (_column->get_num_values() == 4) {
2772 const LVecBase4f &v4 = get_data4f(pointer);
2773 return v4[0] / v4[3];
2775 return Packer::get_data1f(pointer);
2782 const LVecBase2f &GeomVertexColumn::Packer_point::
2783 get_data2f(
const unsigned char *pointer) {
2784 if (_column->get_num_values() == 4) {
2785 const LVecBase4f &v4 = get_data4f(pointer);
2786 _v2.set(v4[0] / v4[3], v4[1] / v4[3]);
2789 return Packer::get_data2f(pointer);
2796 const LVecBase3f &GeomVertexColumn::Packer_point::
2797 get_data3f(
const unsigned char *pointer) {
2798 if (_column->get_num_values() == 4) {
2799 const LVecBase4f &v4 = get_data4f(pointer);
2800 _v3.set(v4[0] / v4[3], v4[1] / v4[3], v4[2] / v4[3]);
2803 return Packer::get_data3f(pointer);
2810 const LVecBase4f &GeomVertexColumn::Packer_point::
2811 get_data4f(
const unsigned char *pointer) {
2812 switch (_column->get_num_values()) {
2814 _v4.set(get_data1f(pointer), 0.0f, 0.0f, 1.0f);
2819 const LVecBase2f &v2 = get_data2f(pointer);
2820 _v4.set(v2[0], v2[1], 0.0f, 1.0f);
2826 const LVecBase3f &v3 = get_data3f(pointer);
2827 _v4.set(v3[0], v3[1], v3[2], 1.0f);
2832 switch (_column->get_numeric_type()) {
2835 const uint8_t *pi = (
const uint8_t *)pointer;
2836 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2842 const uint16_t *pi = (
const uint16_t *)pointer;
2843 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2849 const uint32_t *pi = (
const uint32_t *)pointer;
2850 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2854 case NT_packed_dcba:
2856 uint32_t dword = *(
const uint32_t *)pointer;
2864 case NT_packed_dabc:
2866 uint32_t dword = *(
const uint32_t *)pointer;
2876 const PN_float32 *pi = (
const PN_float32 *)pointer;
2877 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2883 const PN_float64 *pi = (
const PN_float64 *)pointer;
2884 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2889 nassertr(
false, _v4);
2894 const int8_t *pi = (
const int8_t *)pointer;
2895 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2901 const int16_t *pi = (
const int16_t *)pointer;
2902 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2908 const int32_t *pi = (
const int32_t *)pointer;
2909 _v4.set(pi[0], pi[1], pi[2], pi[3]);
2913 case NT_packed_ufloat:
2914 nassertr(
false, _v4);
2925 double GeomVertexColumn::Packer_point::
2926 get_data1d(
const unsigned char *pointer) {
2927 if (_column->get_num_values() == 4) {
2928 const LVecBase4d &v4 = get_data4d(pointer);
2929 return v4[0] / v4[3];
2931 return Packer::get_data1d(pointer);
2938 const LVecBase2d &GeomVertexColumn::Packer_point::
2939 get_data2d(
const unsigned char *pointer) {
2940 if (_column->get_num_values() == 4) {
2941 const LVecBase4d &v4 = get_data4d(pointer);
2942 _v2d.set(v4[0] / v4[3], v4[1] / v4[3]);
2945 return Packer::get_data2d(pointer);
2952 const LVecBase3d &GeomVertexColumn::Packer_point::
2953 get_data3d(
const unsigned char *pointer) {
2954 if (_column->get_num_values() == 4) {
2955 const LVecBase4d &v4 = get_data4d(pointer);
2956 _v3d.set(v4[0] / v4[3], v4[1] / v4[3], v4[2] / v4[3]);
2959 return Packer::get_data3d(pointer);
2966 const LVecBase4d &GeomVertexColumn::Packer_point::
2967 get_data4d(
const unsigned char *pointer) {
2968 switch (_column->get_num_values()) {
2970 _v4d.set(get_data1d(pointer), 0.0f, 0.0f, 1.0f);
2975 const LVecBase2d &v2 = get_data2d(pointer);
2976 _v4d.set(v2[0], v2[1], 0.0f, 1.0f);
2982 const LVecBase3d &v3 = get_data3d(pointer);
2983 _v4d.set(v3[0], v3[1], v3[2], 1.0f);
2988 switch (_column->get_numeric_type()) {
2991 const uint8_t *pi = (
const uint8_t *)pointer;
2992 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
2998 const uint16_t *pi = (
const uint16_t *)pointer;
2999 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3005 const uint32_t *pi = (
const uint32_t *)pointer;
3006 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3010 case NT_packed_dcba:
3012 uint32_t dword = *(
const uint32_t *)pointer;
3020 case NT_packed_dabc:
3022 uint32_t dword = *(
const uint32_t *)pointer;
3032 const PN_float32 *pi = (
const PN_float32 *)pointer;
3033 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3039 const PN_float64 *pi = (
const PN_float64 *)pointer;
3040 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3045 nassertr(
false, _v4d);
3050 const int8_t *pi = (
const int8_t *)pointer;
3051 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3057 const int16_t *pi = (
const int16_t *)pointer;
3058 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3064 const int32_t *pi = (
const int32_t *)pointer;
3065 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3069 case NT_packed_ufloat:
3070 nassertr(
false, _v4d);
3081 void GeomVertexColumn::Packer_point::
3082 set_data1f(
unsigned char *pointer,
float data) {
3083 if (_column->get_num_values() == 4) {
3084 set_data4f(pointer, LVecBase4f(data, 0.0f, 0.0f, 1.0f));
3086 Packer::set_data1f(pointer, data);
3093 void GeomVertexColumn::Packer_point::
3094 set_data2f(
unsigned char *pointer,
const LVecBase2f &data) {
3095 if (_column->get_num_values() == 4) {
3096 set_data4f(pointer, LVecBase4f(data[0], data[1], 0.0f, 1.0f));
3098 Packer::set_data2f(pointer, data);
3105 void GeomVertexColumn::Packer_point::
3106 set_data3f(
unsigned char *pointer,
const LVecBase3f &data) {
3107 if (_column->get_num_values() == 4) {
3108 set_data4f(pointer, LVecBase4f(data[0], data[1], data[2], 1.0f));
3110 Packer::set_data3f(pointer, data);
3117 void GeomVertexColumn::Packer_point::
3118 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
3119 switch (_column->get_num_values()) {
3121 set_data1f(pointer, data[0] / data[3]);
3125 set_data2f(pointer, LVecBase2f(data[0] / data[3], data[1] / data[3]));
3129 set_data3f(pointer, LVecBase3f(data[0] / data[3], data[1] / data[3], data[2] / data[3]));
3133 switch (_column->get_numeric_type()) {
3136 uint8_t *pi = (uint8_t *)pointer;
3137 pi[0] = (
unsigned int)data[0];
3138 pi[1] = (
unsigned int)data[1];
3139 pi[2] = (
unsigned int)data[2];
3140 pi[3] = (
unsigned int)data[3];
3146 uint16_t *pi = (uint16_t *)pointer;
3147 pi[0] = (
unsigned int)data[0];
3148 pi[1] = (
unsigned int)data[1];
3149 pi[2] = (
unsigned int)data[2];
3150 pi[3] = (
unsigned int)data[3];
3156 uint32_t *pi = (uint32_t *)pointer;
3157 pi[0] = (
unsigned int)data[0];
3158 pi[1] = (
unsigned int)data[1];
3159 pi[2] = (
unsigned int)data[2];
3160 pi[3] = (
unsigned int)data[3];
3164 case NT_packed_dcba:
3168 case NT_packed_dabc:
3174 PN_float32 *pi = (PN_float32 *)pointer;
3184 PN_float64 *pi = (PN_float64 *)pointer;
3198 int8_t *pi = (int8_t *)pointer;
3199 pi[0] = (int)data[0];
3200 pi[1] = (int)data[1];
3201 pi[2] = (int)data[2];
3202 pi[3] = (int)data[3];
3208 int16_t *pi = (int16_t *)pointer;
3209 pi[0] = (int)data[0];
3210 pi[1] = (int)data[1];
3211 pi[2] = (int)data[2];
3212 pi[3] = (int)data[3];
3218 int32_t *pi = (int32_t *)pointer;
3219 pi[0] = (int)data[0];
3220 pi[1] = (int)data[1];
3221 pi[2] = (int)data[2];
3222 pi[3] = (int)data[3];
3226 case NT_packed_ufloat:
3237 void GeomVertexColumn::Packer_point::
3238 set_data1d(
unsigned char *pointer,
double data) {
3239 if (_column->get_num_values() == 4) {
3240 set_data4d(pointer, LVecBase4d(data, 0.0f, 0.0f, 1.0f));
3242 Packer::set_data1d(pointer, data);
3249 void GeomVertexColumn::Packer_point::
3250 set_data2d(
unsigned char *pointer,
const LVecBase2d &data) {
3251 if (_column->get_num_values() == 4) {
3252 set_data4d(pointer, LVecBase4d(data[0], data[1], 0.0f, 1.0f));
3254 Packer::set_data2d(pointer, data);
3261 void GeomVertexColumn::Packer_point::
3262 set_data3d(
unsigned char *pointer,
const LVecBase3d &data) {
3263 if (_column->get_num_values() == 4) {
3264 set_data4d(pointer, LVecBase4d(data[0], data[1], data[2], 1.0f));
3266 Packer::set_data3d(pointer, data);
3273 void GeomVertexColumn::Packer_point::
3274 set_data4d(
unsigned char *pointer,
const LVecBase4d &data) {
3275 switch (_column->get_num_values()) {
3277 set_data1d(pointer, data[0] / data[3]);
3281 set_data2d(pointer, LVecBase2d(data[0] / data[3], data[1] / data[3]));
3285 set_data3d(pointer, LVecBase3d(data[0] / data[3], data[1] / data[3], data[2] / data[3]));
3289 switch (_column->get_numeric_type()) {
3292 uint8_t *pi = (uint8_t *)pointer;
3293 pi[0] = (
unsigned int)data[0];
3294 pi[1] = (
unsigned int)data[1];
3295 pi[2] = (
unsigned int)data[2];
3296 pi[3] = (
unsigned int)data[3];
3302 uint16_t *pi = (uint16_t *)pointer;
3303 pi[0] = (
unsigned int)data[0];
3304 pi[1] = (
unsigned int)data[1];
3305 pi[2] = (
unsigned int)data[2];
3306 pi[3] = (
unsigned int)data[3];
3312 uint32_t *pi = (uint32_t *)pointer;
3313 pi[0] = (
unsigned int)data[0];
3314 pi[1] = (
unsigned int)data[1];
3315 pi[2] = (
unsigned int)data[2];
3316 pi[3] = (
unsigned int)data[3];
3320 case NT_packed_dcba:
3324 case NT_packed_dabc:
3330 PN_float32 *pi = (PN_float32 *)pointer;
3340 PN_float64 *pi = (PN_float64 *)pointer;
3354 int8_t *pi = (int8_t *)pointer;
3355 pi[0] = (int)data[0];
3356 pi[1] = (int)data[1];
3357 pi[2] = (int)data[2];
3358 pi[3] = (int)data[3];
3364 int16_t *pi = (int16_t *)pointer;
3365 pi[0] = (int)data[0];
3366 pi[1] = (int)data[1];
3367 pi[2] = (int)data[2];
3368 pi[3] = (int)data[3];
3374 int32_t *pi = (int32_t *)pointer;
3375 pi[0] = (int)data[0];
3376 pi[1] = (int)data[1];
3377 pi[2] = (int)data[2];
3378 pi[3] = (int)data[3];
3382 case NT_packed_ufloat:
3393 float GeomVertexColumn::Packer_color::
3394 get_data1f(
const unsigned char *pointer) {
3395 switch (_column->get_numeric_type()) {
3397 return (*(
const uint8_t *)pointer) / 255.0f;
3400 return (*(
const uint16_t *)pointer) / 65535.0f;
3403 return (*(
const uint32_t *)pointer) / 4294967295.0f;
3405 case NT_packed_dcba:
3407 uint32_t dword = *(
const uint32_t *)pointer;
3411 case NT_packed_dabc:
3413 uint32_t dword = *(
const uint32_t *)pointer;
3418 return *(
const PN_float32 *)pointer;
3421 return *(
const PN_float64 *)pointer;
3424 nassertr(
false, 0.0f);
3433 const LVecBase2f &GeomVertexColumn::Packer_color::
3434 get_data2f(
const unsigned char *pointer) {
3435 if (_column->get_num_values() == 3) {
3436 const LVecBase3f &v3 = get_data3f(pointer);
3437 _v2.set(v3[0], v3[1]);
3440 const LVecBase4f &v4 = get_data4f(pointer);
3441 _v2.set(v4[0], v4[1]);
3449 const LVecBase3f &GeomVertexColumn::Packer_color::
3450 get_data3f(
const unsigned char *pointer) {
3451 if (_column->get_num_values() == 3) {
3452 switch (_column->get_numeric_type()) {
3455 const uint8_t *pi = (
const uint8_t *)pointer;
3456 _v3.set(pi[0], pi[1], pi[2]);
3463 const uint16_t *pi = (
const uint16_t *)pointer;
3464 _v3.set(pi[0], pi[1], pi[2]);
3471 const uint32_t *pi = (
const uint32_t *)pointer;
3472 _v3.set(pi[0], pi[1], pi[2]);
3473 _v3 /= 4294967295.0f;
3477 case NT_packed_dcba:
3478 case NT_packed_dabc:
3479 nassertr(
false, _v3);
3484 const PN_float32 *pi = (
const PN_float32 *)pointer;
3485 _v3.set(pi[0], pi[1], pi[2]);
3491 const PN_float64 *pi = (
const PN_float64 *)pointer;
3492 _v3.set(pi[0], pi[1], pi[2]);
3500 nassertr(
false, _v3);
3503 case NT_packed_ufloat:
3505 uint32_t dword = *(
const uint32_t *)pointer;
3513 const LVecBase4f &v4 = get_data4f(pointer);
3514 _v3.set(v4[0], v4[1], v4[2]);
3524 const LVecBase4f &GeomVertexColumn::Packer_color::
3525 get_data4f(
const unsigned char *pointer) {
3526 if (_column->get_num_values() == 3) {
3527 const LVecBase3f &v3 = get_data3f(pointer);
3528 _v4.set(v3[0], v3[1], v3[2], 1.0f);
3531 switch (_column->get_numeric_type()) {
3534 const uint8_t *pi = (
const uint8_t *)pointer;
3535 _v4.set(pi[0], pi[1], pi[2], pi[3]);
3542 const uint16_t *pi = (
const uint16_t *)pointer;
3543 _v4.set(pi[0], pi[1], pi[2], pi[3]);
3550 const uint32_t *pi = (
const uint32_t *)pointer;
3551 _v4.set(pi[0], pi[1], pi[2], pi[3]);
3552 _v4 /= 4294967295.0f;
3556 case NT_packed_dcba:
3558 uint32_t dword = *(
const uint32_t *)pointer;
3567 case NT_packed_dabc:
3569 uint32_t dword = *(
const uint32_t *)pointer;
3580 const PN_float32 *pi = (
const PN_float32 *)pointer;
3581 _v4.set(pi[0], pi[1], pi[2], pi[3]);
3587 const PN_float64 *pi = (
const PN_float64 *)pointer;
3588 _v4.set(pi[0], pi[1], pi[2], pi[3]);
3596 case NT_packed_ufloat:
3597 nassertr(
false, _v4);
3608 double GeomVertexColumn::Packer_color::
3609 get_data1d(
const unsigned char *pointer) {
3610 switch (_column->get_numeric_type()) {
3612 return (*(
const uint8_t *)pointer) / 255.0;
3615 return (*(
const uint16_t *)pointer) / 65535.0;
3618 return (*(
const uint32_t *)pointer) / 4294967295.0;
3620 case NT_packed_dcba:
3622 uint32_t dword = *(
const uint32_t *)pointer;
3626 case NT_packed_dabc:
3628 uint32_t dword = *(
const uint32_t *)pointer;
3633 return *(
const PN_float32 *)pointer;
3636 return *(
const PN_float64 *)pointer;
3639 nassertr(
false, 0.0);
3648 const LVecBase2d &GeomVertexColumn::Packer_color::
3649 get_data2d(
const unsigned char *pointer) {
3650 if (_column->get_num_values() == 3) {
3651 const LVecBase3d &v3 = get_data3d(pointer);
3652 _v2d.set(v3[0], v3[1]);
3655 const LVecBase4d &v4 = get_data4d(pointer);
3656 _v2d.set(v4[0], v4[1]);
3664 const LVecBase3d &GeomVertexColumn::Packer_color::
3665 get_data3d(
const unsigned char *pointer) {
3666 if (_column->get_num_values() == 3) {
3667 switch (_column->get_numeric_type()) {
3670 const uint8_t *pi = (
const uint8_t *)pointer;
3671 _v3d.set(pi[0], pi[1], pi[2]);
3678 const uint16_t *pi = (
const uint16_t *)pointer;
3679 _v3d.set(pi[0], pi[1], pi[2]);
3686 const uint32_t *pi = (
const uint32_t *)pointer;
3687 _v3d.set(pi[0], pi[1], pi[2]);
3688 _v3d /= 4294967295.0;
3692 case NT_packed_dcba:
3693 case NT_packed_dabc:
3694 nassertr(
false, _v3d);
3699 const PN_float32 *pi = (
const PN_float32 *)pointer;
3700 _v3d.set(pi[0], pi[1], pi[2]);
3706 const PN_float64 *pi = (
const PN_float64 *)pointer;
3707 _v3d.set(pi[0], pi[1], pi[2]);
3715 nassertr(
false, _v3d);
3718 case NT_packed_ufloat:
3720 uint32_t dword = *(
const uint32_t *)pointer;
3728 const LVecBase4d &v4 = get_data4d(pointer);
3729 _v3d.set(v4[0], v4[1], v4[2]);
3739 const LVecBase4d &GeomVertexColumn::Packer_color::
3740 get_data4d(
const unsigned char *pointer) {
3741 if (_column->get_num_values() == 3) {
3742 const LVecBase3d &v3 = get_data3d(pointer);
3743 _v4d.set(v3[0], v3[1], v3[2], 1.0);
3746 switch (_column->get_numeric_type()) {
3749 const uint8_t *pi = (
const uint8_t *)pointer;
3750 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3757 const uint16_t *pi = (
const uint16_t *)pointer;
3758 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3765 const uint32_t *pi = (
const uint32_t *)pointer;
3766 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3767 _v4d /= 4294967295.0;
3771 case NT_packed_dcba:
3773 uint32_t dword = *(
const uint32_t *)pointer;
3782 case NT_packed_dabc:
3784 uint32_t dword = *(
const uint32_t *)pointer;
3795 const PN_float32 *pi = (
const PN_float32 *)pointer;
3796 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3802 const PN_float64 *pi = (
const PN_float64 *)pointer;
3803 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
3811 case NT_packed_ufloat:
3812 nassertr(
false, _v4d);
3823 void GeomVertexColumn::Packer_color::
3824 set_data1f(
unsigned char *pointer,
float data) {
3825 if (_column->get_num_values() == 3) {
3826 set_data3f(pointer, LVecBase3f(data, 0.0f, 0.0f));
3828 set_data4f(pointer, LVecBase4f(data, 0.0f, 0.0f, 1.0f));
3835 void GeomVertexColumn::Packer_color::
3836 set_data2f(
unsigned char *pointer,
const LVecBase2f &data) {
3837 if (_column->get_num_values() == 3) {
3838 set_data3f(pointer, LVecBase3f(data[0], data[1], 0.0f));
3840 set_data4f(pointer, LVecBase4f(data[0], data[1], 0.0f, 1.0f));
3847 void GeomVertexColumn::Packer_color::
3848 set_data3f(
unsigned char *pointer,
const LVecBase3f &data) {
3849 if (_column->get_num_values() == 3) {
3850 switch (_column->get_numeric_type()) {
3853 LVecBase3f scaled = data * 255.0f;
3854 uint8_t *pi = (uint8_t *)pointer;
3855 pi[0] = (
unsigned int)scaled[0];
3856 pi[1] = (
unsigned int)scaled[1];
3857 pi[2] = (
unsigned int)scaled[2];
3863 LVecBase3f scaled = data * 65535.0f;
3864 uint16_t *pi = (uint16_t *)pointer;
3865 pi[0] = (
unsigned int)scaled[0];
3866 pi[1] = (
unsigned int)scaled[1];
3867 pi[2] = (
unsigned int)scaled[2];
3873 LVecBase3f scaled = data * 4294967295.0f;
3874 uint32_t *pi = (uint32_t *)pointer;
3875 pi[0] = (
unsigned int)scaled[0];
3876 pi[1] = (
unsigned int)scaled[1];
3877 pi[2] = (
unsigned int)scaled[2];
3881 case NT_packed_dcba:
3883 LVecBase3f scaled = data * 255.0f;
3885 1.0f, scaled[2], scaled[1], scaled[0]);
3889 case NT_packed_dabc:
3891 LVecBase3f scaled = data * 255.0f;
3893 1.0f, scaled[0], scaled[1], scaled[2]);
3899 PN_float32 *pi = (PN_float32 *)pointer;
3908 PN_float64 *pi = (PN_float64 *)pointer;
3922 case NT_packed_ufloat:
3927 set_data4f(pointer, LVecBase4f(data[0], data[1], data[2], 1.0f));
3934 void GeomVertexColumn::Packer_color::
3935 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
3936 if (_column->get_num_values() == 3) {
3937 set_data3f(pointer, LVecBase3f(data[0], data[1], data[2]));
3939 switch (_column->get_numeric_type()) {
3942 LVecBase4f scaled = data * 255.0f;
3943 uint8_t *pi = (uint8_t *)pointer;
3944 pi[0] = (
unsigned int)scaled[0];
3945 pi[1] = (
unsigned int)scaled[1];
3946 pi[2] = (
unsigned int)scaled[2];
3947 pi[3] = (
unsigned int)scaled[3];
3953 LVecBase4f scaled = data * 65535.0f;
3954 uint16_t *pi = (uint16_t *)pointer;
3955 pi[0] = (
unsigned int)scaled[0];
3956 pi[1] = (
unsigned int)scaled[1];
3957 pi[2] = (
unsigned int)scaled[2];
3958 pi[3] = (
unsigned int)scaled[3];
3964 LVecBase4f scaled = data * 4294967295.0f;
3965 uint32_t *pi = (uint32_t *)pointer;
3966 pi[0] = (
unsigned int)scaled[0];
3967 pi[1] = (
unsigned int)scaled[1];
3968 pi[2] = (
unsigned int)scaled[2];
3969 pi[3] = (
unsigned int)scaled[3];
3973 case NT_packed_dcba:
3975 LVecBase4f scaled = data * 255.0f;
3977 scaled[3], scaled[2], scaled[1], scaled[0]);
3981 case NT_packed_dabc:
3983 LVecBase4f scaled = data * 255.0f;
3985 scaled[3], scaled[0], scaled[1], scaled[2]);
3991 PN_float32 *pi = (PN_float32 *)pointer;
4001 PN_float64 *pi = (PN_float64 *)pointer;
4016 case NT_packed_ufloat:
4026 void GeomVertexColumn::Packer_color::
4027 set_data1d(
unsigned char *pointer,
double data) {
4028 if (_column->get_num_values() == 3) {
4029 set_data3d(pointer, LVecBase3d(data, 0.0, 0.0));
4031 set_data4d(pointer, LVecBase4d(data, 0.0, 0.0, 1.0));
4038 void GeomVertexColumn::Packer_color::
4039 set_data2d(
unsigned char *pointer,
const LVecBase2d &data) {
4040 if (_column->get_num_values() == 3) {
4041 set_data3d(pointer, LVecBase3d(data[0], data[1], 0.0));
4043 set_data4d(pointer, LVecBase4d(data[0], data[1], 0.0, 1.0));
4050 void GeomVertexColumn::Packer_color::
4051 set_data3d(
unsigned char *pointer,
const LVecBase3d &data) {
4052 if (_column->get_num_values() == 3) {
4053 switch (_column->get_numeric_type()) {
4056 LVecBase3d scaled = data * 255.0;
4057 uint8_t *pi = (uint8_t *)pointer;
4058 pi[0] = (
unsigned int)scaled[0];
4059 pi[1] = (
unsigned int)scaled[1];
4060 pi[2] = (
unsigned int)scaled[2];
4066 LVecBase3d scaled = data * 65535.0;
4067 uint16_t *pi = (uint16_t *)pointer;
4068 pi[0] = (
unsigned int)scaled[0];
4069 pi[1] = (
unsigned int)scaled[1];
4070 pi[2] = (
unsigned int)scaled[2];
4076 LVecBase3d scaled = data * 4294967295.0;
4077 uint32_t *pi = (uint32_t *)pointer;
4078 pi[0] = (
unsigned int)scaled[0];
4079 pi[1] = (
unsigned int)scaled[1];
4080 pi[2] = (
unsigned int)scaled[2];
4084 case NT_packed_dcba:
4086 LVecBase3d scaled = data * 255.0;
4088 1.0, scaled[2], scaled[1], scaled[0]);
4092 case NT_packed_dabc:
4094 LVecBase3d scaled = data * 255.0;
4096 1.0, scaled[0], scaled[1], scaled[2]);
4102 PN_float32 *pi = (PN_float32 *)pointer;
4111 PN_float64 *pi = (PN_float64 *)pointer;
4125 case NT_packed_ufloat:
4130 set_data4d(pointer, LVecBase4d(data[0], data[1], data[2], 1.0f));
4137 void GeomVertexColumn::Packer_color::
4138 set_data4d(
unsigned char *pointer,
const LVecBase4d &data) {
4139 if (_column->get_num_values() == 3) {
4140 set_data3d(pointer, LVecBase3d(data[0], data[1], data[2]));
4142 switch (_column->get_numeric_type()) {
4145 LVecBase4d scaled = data * 255.0;
4146 uint8_t *pi = (uint8_t *)pointer;
4147 pi[0] = (
unsigned int)scaled[0];
4148 pi[1] = (
unsigned int)scaled[1];
4149 pi[2] = (
unsigned int)scaled[2];
4150 pi[3] = (
unsigned int)scaled[3];
4156 LVecBase4d scaled = data * 65535.0;
4157 uint16_t *pi = (uint16_t *)pointer;
4158 pi[0] = (
unsigned int)scaled[0];
4159 pi[1] = (
unsigned int)scaled[1];
4160 pi[2] = (
unsigned int)scaled[2];
4161 pi[3] = (
unsigned int)scaled[3];
4167 LVecBase4d scaled = data * 4294967295.0;
4168 uint32_t *pi = (uint32_t *)pointer;
4169 pi[0] = (
unsigned int)scaled[0];
4170 pi[1] = (
unsigned int)scaled[1];
4171 pi[2] = (
unsigned int)scaled[2];
4172 pi[3] = (
unsigned int)scaled[3];
4176 case NT_packed_dcba:
4178 LVecBase4d scaled = data * 255.0;
4180 scaled[3], scaled[2], scaled[1], scaled[0]);
4184 case NT_packed_dabc:
4186 LVecBase4d scaled = data * 255.0;
4188 scaled[3], scaled[0], scaled[1], scaled[2]);
4194 PN_float32 *pi = (PN_float32 *)pointer;
4204 PN_float64 *pi = (PN_float64 *)pointer;
4219 case NT_packed_ufloat:
4229 const LVecBase3f &GeomVertexColumn::Packer_float32_3::
4230 get_data3f(
const unsigned char *pointer) {
4231 const PN_float32 *pi = (
const PN_float32 *)pointer;
4232 _v3.set(pi[0], pi[1], pi[2]);
4239 void GeomVertexColumn::Packer_float32_3::
4240 set_data3f(
unsigned char *pointer,
const LVecBase3f &data) {
4241 PN_float32 *pi = (PN_float32 *)pointer;
4250 const LVecBase2f &GeomVertexColumn::Packer_point_float32_2::
4251 get_data2f(
const unsigned char *pointer) {
4252 const PN_float32 *pi = (
const PN_float32 *)pointer;
4253 _v2.set(pi[0], pi[1]);
4260 void GeomVertexColumn::Packer_point_float32_2::
4261 set_data2f(
unsigned char *pointer,
const LVecBase2f &data) {
4262 PN_float32 *pi = (PN_float32 *)pointer;
4270 const LVecBase3f &GeomVertexColumn::Packer_point_float32_3::
4271 get_data3f(
const unsigned char *pointer) {
4272 const PN_float32 *pi = (
const PN_float32 *)pointer;
4273 _v3.set(pi[0], pi[1], pi[2]);
4280 void GeomVertexColumn::Packer_point_float32_3::
4281 set_data3f(
unsigned char *pointer,
const LVecBase3f &data) {
4282 PN_float32 *pi = (PN_float32 *)pointer;
4291 const LVecBase4f &GeomVertexColumn::Packer_point_float32_4::
4292 get_data4f(
const unsigned char *pointer) {
4293 const PN_float32 *pi = (
const PN_float32 *)pointer;
4294 _v4.set(pi[0], pi[1], pi[2], pi[3]);
4301 void GeomVertexColumn::Packer_point_float32_4::
4302 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
4303 PN_float32 *pi = (PN_float32 *)pointer;
4313 const LVecBase3f &GeomVertexColumn::Packer_nativefloat_3::
4314 get_data3f(
const unsigned char *pointer) {
4315 return *(
const LVecBase3f *)pointer;
4321 const LVecBase2f &GeomVertexColumn::Packer_point_nativefloat_2::
4322 get_data2f(
const unsigned char *pointer) {
4323 return *(
const LVecBase2f *)pointer;
4329 const LVecBase3f &GeomVertexColumn::Packer_point_nativefloat_3::
4330 get_data3f(
const unsigned char *pointer) {
4331 return *(
const LVecBase3f *)pointer;
4337 const LVecBase4f &GeomVertexColumn::Packer_point_nativefloat_4::
4338 get_data4f(
const unsigned char *pointer) {
4339 return *(
const LVecBase4f *)pointer;
4345 const LVecBase3d &GeomVertexColumn::Packer_float64_3::
4346 get_data3d(
const unsigned char *pointer) {
4347 const PN_float64 *pi = (
const PN_float64 *)pointer;
4348 _v3d.set(pi[0], pi[1], pi[2]);
4355 void GeomVertexColumn::Packer_float64_3::
4356 set_data3d(
unsigned char *pointer,
const LVecBase3d &data) {
4357 PN_float64 *pi = (PN_float64 *)pointer;
4366 const LVecBase2d &GeomVertexColumn::Packer_point_float64_2::
4367 get_data2d(
const unsigned char *pointer) {
4368 const PN_float64 *pi = (
const PN_float64 *)pointer;
4369 _v2d.set(pi[0], pi[1]);
4376 void GeomVertexColumn::Packer_point_float64_2::
4377 set_data2d(
unsigned char *pointer,
const LVecBase2d &data) {
4378 PN_float64 *pi = (PN_float64 *)pointer;
4386 const LVecBase3d &GeomVertexColumn::Packer_point_float64_3::
4387 get_data3d(
const unsigned char *pointer) {
4388 const PN_float64 *pi = (
const PN_float64 *)pointer;
4389 _v3d.set(pi[0], pi[1], pi[2]);
4396 void GeomVertexColumn::Packer_point_float64_3::
4397 set_data3d(
unsigned char *pointer,
const LVecBase3d &data) {
4398 PN_float64 *pi = (PN_float64 *)pointer;
4407 const LVecBase4d &GeomVertexColumn::Packer_point_float64_4::
4408 get_data4d(
const unsigned char *pointer) {
4409 const PN_float64 *pi = (
const PN_float64 *)pointer;
4410 _v4d.set(pi[0], pi[1], pi[2], pi[3]);
4417 void GeomVertexColumn::Packer_point_float64_4::
4418 set_data4d(
unsigned char *pointer,
const LVecBase4d &data) {
4419 PN_float64 *pi = (PN_float64 *)pointer;
4429 const LVecBase3d &GeomVertexColumn::Packer_nativedouble_3::
4430 get_data3d(
const unsigned char *pointer) {
4431 return *(
const LVecBase3d *)pointer;
4437 const LVecBase2d &GeomVertexColumn::Packer_point_nativedouble_2::
4438 get_data2d(
const unsigned char *pointer) {
4439 return *(
const LVecBase2d *)pointer;
4445 const LVecBase3d &GeomVertexColumn::Packer_point_nativedouble_3::
4446 get_data3d(
const unsigned char *pointer) {
4447 return *(
const LVecBase3d *)pointer;
4453 const LVecBase4d &GeomVertexColumn::Packer_point_nativedouble_4::
4454 get_data4d(
const unsigned char *pointer) {
4455 return *(
const LVecBase4d *)pointer;
4461 const LVecBase4f &GeomVertexColumn::Packer_argb_packed::
4462 get_data4f(
const unsigned char *pointer) {
4463 uint32_t dword = *(
const uint32_t *)pointer;
4475 void GeomVertexColumn::Packer_argb_packed::
4476 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
4480 ((
unsigned int)(min(max(data[3], 0.0f), 1.0f) * 255.0f),
4481 (
unsigned int)(min(max(data[0], 0.0f), 1.0f) * 255.0f),
4482 (
unsigned int)(min(max(data[1], 0.0f), 1.0f) * 255.0f),
4483 (
unsigned int)(min(max(data[2], 0.0f), 1.0f) * 255.0f));
4489 const LVecBase4f &GeomVertexColumn::Packer_rgba_uint8_4::
4490 get_data4f(
const unsigned char *pointer) {
4491 _v4.set((
float)pointer[0], (
float)pointer[1],
4492 (
float)pointer[2], (
float)pointer[3]);
4500 void GeomVertexColumn::Packer_rgba_uint8_4::
4501 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
4502 pointer[0] = (
unsigned int)(min(max(data[0], 0.0f), 1.0f) * 255.0f);
4503 pointer[1] = (
unsigned int)(min(max(data[1], 0.0f), 1.0f) * 255.0f);
4504 pointer[2] = (
unsigned int)(min(max(data[2], 0.0f), 1.0f) * 255.0f);
4505 pointer[3] = (
unsigned int)(min(max(data[3], 0.0f), 1.0f) * 255.0f);
4511 const LVecBase4f &GeomVertexColumn::Packer_rgba_float32_4::
4512 get_data4f(
const unsigned char *pointer) {
4513 const PN_float32 *pi = (
const PN_float32 *)pointer;
4514 _v4.set(pi[0], pi[1], pi[2], pi[3]);
4521 void GeomVertexColumn::Packer_rgba_float32_4::
4522 set_data4f(
unsigned char *pointer,
const LVecBase4f &data) {
4523 PN_float32 *pi = (PN_float32 *)pointer;
4533 const LVecBase4f &GeomVertexColumn::Packer_rgba_nativefloat_4::
4534 get_data4f(
const unsigned char *pointer) {
4535 return *(
const LVecBase4f *)pointer;
4541 int GeomVertexColumn::Packer_uint16_1::
4542 get_data1i(
const unsigned char *pointer) {
4543 return *(
const uint16_t *)pointer;
4549 void GeomVertexColumn::Packer_uint16_1::
4550 set_data1i(
unsigned char *pointer,
int data) {
4551 *(uint16_t *)pointer = data;
4552 nassertv(*(uint16_t *)pointer == data);
static unsigned int unpack_abcd_d(uint32_t data)
Returns the fourth packed value from a DirectX-style NT_packed_abcd.
Contents get_contents() const
Returns the token representing the semantic meaning of the stored value.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is called by make_from_bam to read in all of the relevant data from the BamFil...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
void set_contents(Contents contents)
Changes the semantic meaning of an existing column.
NumericType get_numeric_type() const
Returns the token representing the numeric type of the data storage.
Base class for objects that can be written to and read from Bam files.
static unsigned int unpack_abcd_b(uint32_t data)
Returns the second packed value from a DirectX-style NT_packed_abcd.
void set_start(int start)
Changes the start byte of an existing column.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being written.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
void set_num_components(int num_components)
Changes the number of components of an existing column.
void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static unsigned int unpack_abcd_c(uint32_t data)
Returns the third packed value from a DirectX-style NT_packed_abcd.
static float unpack_ufloat_a(uint32_t data)
Unpacks an unsigned float11 value from an uint32.
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
This defines how a single column is interleaved within a vertex array stored within a Geom.
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
static float unpack_ufloat_b(uint32_t data)
Unpacks an unsigned float11 value from an uint32.
static uint32_t pack_abcd(unsigned int a, unsigned int b, unsigned int c, unsigned int d)
Packs four values in a DirectX-style NT_packed_abcd value.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_num_values() const
Returns the number of numeric values of the column: the number of distinct numeric values that go int...
void set_name(InternalName *name)
Replaces the name of an existing column.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Encodes a string name in a hash table, mapping it to a pointer.
static uint32_t pack_ufloat(float a, float b, float c)
Packs three float values in an unsigned 32-bit int.
static unsigned int unpack_abcd_a(uint32_t data)
Returns the first packed value from a DirectX-style NT_packed_abcd.
void set_numeric_type(NumericType numeric_type)
Changes the numeric type an existing column.
void set_column_alignment(int column_alignment)
Changes the column alignment of an existing column.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
A class to retrieve the individual data elements previously stored in a Datagram.
const InternalName * get_name() const
Returns the name of this particular data field, e.g.
int get_num_components() const
Returns the number of components of the column: the number of instances of the NumericType in each el...
static float unpack_ufloat_c(uint32_t data)
Unpacks an unsigned float10 value from an uint32.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.