15 #include "fltVertex.h"
16 #include "fltRecordReader.h"
17 #include "fltRecordWriter.h"
18 #include "fltHeader.h"
29 _color_name_index = 0;
31 _pos.set(0.0, 0.0, 0.0);
32 _normal.set(0.0, 0.0, 0.0);
71 if (_header->get_flt_version() < 1520) {
126 return _header->get_color(_color_index, (_flags & F_packed_color) != 0,
140 return _header->get_rgb(_color_index, (_flags & F_packed_color) != 0,
153 _flags = ((_flags & ~F_no_color) | F_packed_color);
166 if (!FltRecord::extract_record(reader)) {
192 nassertr(
false,
false);
214 if (!_packed_color.extract_record(reader)) {
217 if (_header->get_flt_version() >= 1520) {
242 if (!FltRecord::build_record(writer)) {
265 if (!_packed_color.build_record(writer)) {
269 if (_header->get_flt_version() >= 1520) {
This is the base class for all three-component vectors and points.
This class writes a sequence of FltRecords to an ostream, handling opcode and size counts properly...
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
PN_float64 get_be_float64()
Extracts a 64-bit big-endian floating-point number.
LRGBColor get_rgb() const
If has_color() indicates true, returns the color of the vertex, as a three-component value...
PN_float32 get_be_float32()
Extracts a 32-bit big-endian single-precision floating-point number.
DatagramIterator & get_iterator()
Returns an iterator suitable for extracting data from the current record.
void set_rgb(const LRGBColor &rgb)
Sets the color according to the indicated three-component LRGBColor value, and set the alpha to 1...
size_t get_length() const
Returns the number of bytes in the datagram.
void set_rgb(const LRGBColor &rgb)
Sets the color of the vertex, using the packed color convention.
void pad_bytes(size_t size)
Adds the indicated number of zero bytes to the datagram.
void add_be_float64(PN_float64 value)
Adds a 64-bit big-endian floating-point number to the datagram.
int get_remaining_size() const
Return the bytes left in the datagram.
void add_be_float32(PN_float32 value)
Adds a 32-bit single-precision big-endian floating-point number to the datagram.
void skip_bytes(size_t size)
Skips over the indicated number of bytes in the datagram.
The base class for all kinds of records in a MultiGen OpenFlight file.
int get_record_length() const
Returns the length of this record in bytes as it will be written to the flt file. ...
PN_int16 get_be_int16()
Extracts a signed 16-bit big-endian integer.
This is the base class for all three-component vectors and points.
void check_remaining_size(const DatagramIterator &di, const string &name=string()) const
Checks that the iterator has no bytes left, as it should at the end of a successfully read record...
bool has_color() const
Returns true if the vertex has a primary color indicated, false otherwise.
FltOpcode get_opcode() const
Returns the opcode associated with the current record.
void add_be_uint16(PN_uint16 value)
Adds an unsigned 16-bit big-endian integer to the datagram.
LColor get_color() const
If has_color() indicates true, returns the color of the vertex, as a four-component value...
A class to retrieve the individual data elements previously stored in a Datagram. ...
void add_be_uint32(PN_uint32 value)
Adds an unsigned 32-bit big-endian integer to the datagram.
TypeHandle is the identifier used to differentiate C++ class types.
PN_uint16 get_be_uint16()
Extracts an unsigned 16-bit big-endian integer.
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.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
FltOpcode get_opcode() const
Returns the opcode that this record will be written as.
PN_int32 get_be_int32()
Extracts a signed 32-bit big-endian integer.
void add_be_int16(PN_int16 value)
Adds a signed 16-bit big-endian integer to the datagram.