15 #include "fltGeometry.h"
16 #include "fltRecordReader.h"
17 #include "fltRecordWriter.h"
18 #include "fltHeader.h"
19 #include "fltMaterial.h"
31 _relative_priority = 0;
32 _draw_type = DT_solid_cull_backface;
34 _color_name_index = 0;
35 _alt_color_name_index = 0;
36 _billboard_type = BT_none;
37 _detail_texture_index = -1;
40 _dfad_material_code = 0;
42 _ir_material_code = 0;
44 _lod_generation_control = 0;
45 _line_style_index = 0;
47 _light_mode = LM_face_no_normal;
48 _texture_mapping_index = 0;
70 color.set(1.0, 1.0, 1.0, 1.0);
75 color.set(material->_diffuse[0],
76 material->_diffuse[1],
77 material->_diffuse[2],
81 _header->get_rgb(_color_index, (_flags & F_packed_color) != 0,
83 color.set(rgb[0], rgb[1], rgb[2], 1.0);
87 PN_stdfloat alpha = 1.0 - (_transparency / 65535.0);
102 _transparency = (int)floor((1.0 - color[3]) * 65535.0);
121 return material->_diffuse;
124 return _header->get_rgb(_color_index, (_flags & F_packed_color) != 0,
137 _flags = ((_flags & ~F_no_color) | F_packed_color);
140 _material_index = -1;
152 return (_flags & F_no_alt_color) == 0;
166 return _header->get_color(_alt_color_index, (_flags & F_packed_color) != 0,
167 _alt_packed_color, _transparency);
181 return _header->get_rgb(_alt_color_index, (_flags & F_packed_color) != 0,
199 _draw_type = (DrawType)iterator.
get_int8();
200 _texwhite = (iterator.
get_int8() != 0);
204 _billboard_type = (BillboardType)iterator.
get_int8();
212 _lod_generation_control = iterator.
get_uint8();
213 _line_style_index = iterator.
get_uint8();
214 if (_header->get_flt_version() >= 1420) {
216 _light_mode = (LightMode)iterator.
get_uint8();
220 if (!_packed_color.extract_record(reader)) {
223 if (!_alt_packed_color.extract_record(reader)) {
227 if (_header->get_flt_version() >= 1520) {
266 datagram.
add_uint8(_lod_generation_control);
273 if (!_packed_color.build_record(writer)) {
276 if (!_alt_packed_color.build_record(writer)) {
280 if (_header->get_flt_version() >= 1520) {
LRGBColor get_rgb() const
Returns the primary color of the face, as a three-component value ignoring transparency.
PN_int8 get_int8()
Extracts a signed 8-bit integer.
void add_uint8(PN_uint8 value)
Adds an unsigned 8-bit integer to the datagram.
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...
A base class for any of a broad family of flt beads that include an ID.
This class turns an istream into a sequence of FltRecords by reading a sequence of Datagrams and extr...
void add_int8(PN_int8 value)
Adds a signed 8-bit integer to the datagram.
bool has_alt_color() const
Returns true if the face has an alternate color indicated, false otherwise.
bool has_material() const
Returns true if the face has a material applied, false otherwise.
void set_color(const LColor &color)
Sets the primary color of the face, using the packed color convention.
Represents a single material in the material palette.
DatagramIterator & get_iterator()
Returns an iterator suitable for extracting data from the current record.
PN_uint8 get_uint8()
Extracts an unsigned 8-bit integer.
void set_rgb(const LRGBColor &rgb)
Sets the color according to the indicated three-component LRGBColor value, and set the alpha to 1...
bool has_texture() const
Returns true if the face has a texture applied, false otherwise.
void pad_bytes(size_t size)
Adds the indicated number of zero bytes to the datagram.
void skip_bytes(size_t size)
Skips over the indicated number of bytes in the datagram.
void add_be_int32(PN_int32 value)
Adds a signed 32-bit big-endian integer to the datagram.
PN_uint32 get_be_uint32()
Extracts an unsigned 32-bit big-endian integer.
FltMaterial * get_material() const
Returns the material applied to this face, or NULL if no material was applied.
LRGBColor get_alt_rgb() const
If has_alt_color() indicates true, returns the alternate color of the face, as a three-component valu...
bool has_color() const
Returns true if the face has a primary color indicated, false otherwise.
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.
LColor get_alt_color() const
If has_alt_color() indicates true, returns the alternate color of the face, as a four-component value...
void add_be_uint16(PN_uint16 value)
Adds an unsigned 16-bit big-endian integer to the datagram.
LColor get_color() const
Returns the primary color of the face, as a four-component value (including alpha as the transparency...
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.
Datagram & update_datagram()
Returns a modifiable reference to the datagram associated with the current record.
void set_rgb(const LRGBColor &rgb)
Sets the primary color of the face, using the packed color convention; does not affect transparency...
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
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.