27 _primitive_type = PT_tristrip;
35 bool FltMeshPrimitive::
37 if (!FltBead::extract_record(reader)) {
41 nassertr(reader.
get_opcode() == FO_mesh_primitive,
false);
44 _primitive_type = (PrimitiveType)iterator.
get_be_int16();
49 if (vertex_width == 1) {
50 for (
int i = 0; i < num_vertices; i++) {
51 _vertices.push_back(iterator.
get_uint8());
54 }
else if (vertex_width == 2) {
55 for (
int i = 0; i < num_vertices; i++) {
59 }
else if (vertex_width == 4) {
60 for (
int i = 0; i < num_vertices; i++) {
65 nout <<
"Invalid vertex width in mesh primitive: " << vertex_width
79 bool FltMeshPrimitive::
81 if (!FltBead::build_record(writer)) {
92 Vertices::const_iterator vi;
93 for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) {
94 max_index = std::max(max_index, (*vi));
98 if (max_index < 0x100) {
100 }
else if (max_index < 0x10000) {
109 if (vertex_width == 1) {
110 for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) {
114 }
else if (vertex_width == 2) {
115 for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) {
120 for (vi = _vertices.begin(); vi != _vertices.end(); ++vi) {
A class to retrieve the individual data elements previously stored in a Datagram.
uint8_t get_uint8()
Extracts an unsigned 8-bit integer.
uint16_t get_be_uint16()
Extracts an unsigned 16-bit big-endian integer.
int32_t get_be_int32()
Extracts a signed 32-bit big-endian integer.
int16_t get_be_int16()
Extracts a signed 16-bit big-endian integer.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
void add_be_uint16(uint16_t value)
Adds an unsigned 16-bit big-endian integer to the datagram.
void add_be_int32(int32_t value)
Adds a signed 32-bit big-endian integer to the datagram.
void add_uint8(uint8_t value)
Adds an unsigned 8-bit integer to the datagram.
void add_be_int16(int16_t value)
Adds a signed 16-bit big-endian integer to the datagram.
A base class for any of a broad family of flt records that represent particular beads in the hierarch...
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
FltOpcode get_opcode() const
Returns the opcode associated with the current record.
DatagramIterator & get_iterator()
Returns an iterator suitable for extracting data from the current record.
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly.
void set_opcode(FltOpcode opcode)
Sets the opcode associated with the current record.
Datagram & update_datagram()
Returns a modifiable reference to the datagram associated with the current record.
void check_remaining_size(const DatagramIterator &di, const std::string &name=std::string()) const
Checks that the iterator has no bytes left, as it should at the end of a successfully read record.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.