Panda3D
|
This is a base class for both FltFace and FltMesh, which are two different kinds of geometric primitives that might be encountered in a MultiGen file. More...
#include "fltGeometry.h"
Public Types | |
enum | BillboardType { BT_none = 0, BT_fixed = 1, BT_axial = 2, BT_point = 4 } |
enum | DrawType { DT_solid_cull_backface = 0, DT_solid_no_cull = 1, DT_wireframe = 2, DT_wireframe_close = 3, DT_wireframe_highlight = 4, DT_omni_light = 8, DT_uni_light = 9, DT_bi_light = 10 } |
enum | Flags { F_terrain = 0x80000000, F_no_color = 0x40000000, F_no_alt_color = 0x20000000, F_packed_color = 0x10000000, F_terrain_footprint = 0x08000000, F_hidden = 0x04000000 } |
enum | LightMode { LM_face_no_normal = 0, LM_vertex_no_normal = 1, LM_face_with_normal = 2, LM_vertex_with_normal = 3 } |
Public Member Functions | |
FltGeometry (FltHeader *header) | |
virtual TypeHandle | force_init_type () |
LColor | get_alt_color () const |
If has_alt_color() indicates true, returns the alternate color of the face, as a four-component value (including alpha as the transparency channel). | |
LRGBColor | get_alt_rgb () const |
If has_alt_color() indicates true, returns the alternate color of the face, as a three-component value ignoring transparency. | |
LColor | get_color () const |
Returns the primary color of the face, as a four-component value (including alpha as the transparency channel). | |
FltMaterial * | get_material () const |
Returns the material applied to this face, or NULL if no material was applied. | |
LRGBColor | get_rgb () const |
Returns the primary color of the face, as a three-component value ignoring transparency. | |
FltTexture * | get_texture () const |
Returns the texture applied to this face, or NULL if no texture was applied. | |
virtual TypeHandle | get_type () const |
bool | has_alt_color () const |
Returns true if the face has an alternate color indicated, false otherwise. | |
bool | has_color () const |
Returns true if the face has a primary color indicated, false otherwise. | |
bool | has_material () const |
Returns true if the face has a material applied, false otherwise. | |
bool | has_texture () const |
Returns true if the face has a texture applied, false otherwise. | |
void | set_color (const LColor &color) |
Sets the primary color of the face, using the packed color convention. | |
void | set_material (FltMaterial *material) |
Applies the indicated material to this face, or if the material is NULL, clears it. | |
void | set_rgb (const LRGBColor &rgb) |
Sets the primary color of the face, using the packed color convention; does not affect transparency. | |
void | set_texture (FltTexture *texture) |
Applies the indicated texture to this face, or if the texture is NULL, clears it. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Public Attributes | |
int | _alt_color_index |
int | _alt_color_name_index |
FltPackedColor | _alt_packed_color |
BillboardType | _billboard_type |
int | _color_index |
int | _color_name_index |
int | _detail_texture_index |
int | _dfad_feature_id |
int | _dfad_material_code |
DrawType | _draw_type |
unsigned int | _flags |
int | _ir_color |
int | _ir_material_code |
LightMode | _light_mode |
int | _line_style_index |
int | _lod_generation_control |
int | _material_index |
FltPackedColor | _packed_color |
int | _relative_priority |
int | _texture_index |
int | _texture_mapping_index |
bool | _texwhite |
int | _transparency |
Protected Member Functions | |
virtual bool | build_record (FltRecordWriter &writer) const |
Fills up the current record on the FltRecordWriter with data for this record, but does not advance the writer. | |
virtual bool | extract_record (FltRecordReader &reader) |
Fills in the information in this bead based on the information given in the indicated datagram, whose opcode has already been read. |
This is a base class for both FltFace and FltMesh, which are two different kinds of geometric primitives that might be encountered in a MultiGen file.
They have similar properties.
Definition at line 36 of file fltGeometry.h.
bool FltGeometry::build_record | ( | FltRecordWriter & | writer | ) | const [protected, virtual] |
Fills up the current record on the FltRecordWriter with data for this record, but does not advance the writer.
Returns true on success, false if there is some error.
Reimplemented from FltBeadID.
Reimplemented in FltMesh, and FltFace.
Definition at line 248 of file fltGeometry.cxx.
References Datagram::add_be_int16(), Datagram::add_be_int32(), Datagram::add_be_uint16(), Datagram::add_be_uint32(), Datagram::add_int8(), Datagram::add_uint8(), FltHeader::get_flt_version(), Datagram::pad_bytes(), and FltRecordWriter::update_datagram().
Referenced by FltFace::build_record(), and FltMesh::build_record().
bool FltGeometry::extract_record | ( | FltRecordReader & | reader | ) | [protected, virtual] |
Fills in the information in this bead based on the information given in the indicated datagram, whose opcode has already been read.
Returns true on success, false if the datagram is invalid.
Reimplemented from FltBeadID.
Reimplemented in FltMesh, and FltFace.
Definition at line 194 of file fltGeometry.cxx.
References DatagramIterator::get_be_int16(), DatagramIterator::get_be_int32(), DatagramIterator::get_be_uint16(), DatagramIterator::get_be_uint32(), FltHeader::get_flt_version(), DatagramIterator::get_int8(), FltRecordReader::get_iterator(), DatagramIterator::get_uint8(), and DatagramIterator::skip_bytes().
Referenced by FltFace::extract_record(), and FltMesh::extract_record().
LColor FltGeometry::get_alt_color | ( | ) | const |
If has_alt_color() indicates true, returns the alternate color of the face, as a four-component value (including alpha as the transparency channel).
Definition at line 163 of file fltGeometry.cxx.
References FltHeader::get_color(), and has_alt_color().
LRGBColor FltGeometry::get_alt_rgb | ( | ) | const |
If has_alt_color() indicates true, returns the alternate color of the face, as a three-component value ignoring transparency.
Definition at line 178 of file fltGeometry.cxx.
References FltHeader::get_rgb(), and has_alt_color().
LColor FltGeometry::get_color | ( | ) | const |
Returns the primary color of the face, as a four-component value (including alpha as the transparency channel).
If has_color() is false, the result is white, but still reflects the transparency correctly.
Definition at line 65 of file fltGeometry.cxx.
References get_material(), FltHeader::get_rgb(), has_color(), has_material(), and has_texture().
FltMaterial * FltGeometry::get_material | ( | ) | const [inline] |
Returns the material applied to this face, or NULL if no material was applied.
Definition at line 72 of file fltGeometry.I.
References FltHeader::get_material().
Referenced by get_color(), and get_rgb().
LRGBColor FltGeometry::get_rgb | ( | ) | const |
Returns the primary color of the face, as a three-component value ignoring transparency.
Definition at line 112 of file fltGeometry.cxx.
References get_material(), FltHeader::get_rgb(), has_color(), has_material(), and has_texture().
FltTexture * FltGeometry::get_texture | ( | ) | const [inline] |
Returns the texture applied to this face, or NULL if no texture was applied.
Definition at line 34 of file fltGeometry.I.
References FltHeader::get_texture().
bool FltGeometry::has_alt_color | ( | ) | const |
Returns true if the face has an alternate color indicated, false otherwise.
Definition at line 151 of file fltGeometry.cxx.
Referenced by get_alt_color(), and get_alt_rgb().
bool FltGeometry::has_color | ( | ) | const [inline] |
Returns true if the face has a primary color indicated, false otherwise.
Definition at line 99 of file fltGeometry.I.
References has_material().
Referenced by get_color(), and get_rgb().
bool FltGeometry::has_material | ( | ) | const [inline] |
Returns true if the face has a material applied, false otherwise.
Definition at line 61 of file fltGeometry.I.
References FltHeader::has_material().
Referenced by get_color(), get_rgb(), and has_color().
bool FltGeometry::has_texture | ( | ) | const [inline] |
Returns true if the face has a texture applied, false otherwise.
Definition at line 23 of file fltGeometry.I.
References FltHeader::has_texture().
Referenced by get_color(), and get_rgb().
static void FltGeometry::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from FltBeadID.
Reimplemented in FltMesh, and FltFace.
Definition at line 130 of file fltGeometry.h.
void FltGeometry::set_color | ( | const LColor & | color | ) |
Sets the primary color of the face, using the packed color convention.
Definition at line 100 of file fltGeometry.cxx.
References set_rgb().
void FltGeometry::set_material | ( | FltMaterial * | material | ) | [inline] |
Applies the indicated material to this face, or if the material is NULL, clears it.
Definition at line 83 of file fltGeometry.I.
References FltHeader::add_material().
void FltGeometry::set_rgb | ( | const LRGBColor & | rgb | ) |
Sets the primary color of the face, using the packed color convention; does not affect transparency.
Definition at line 135 of file fltGeometry.cxx.
References FltPackedColor::set_rgb().
Referenced by set_color().
void FltGeometry::set_texture | ( | FltTexture * | texture | ) | [inline] |
Applies the indicated texture to this face, or if the texture is NULL, clears it.
Definition at line 45 of file fltGeometry.I.
References FltHeader::add_texture().