Panda3D
|
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to reading and writing a Flt file. More...
#include "fltHeader.h"
Public Types | |
enum | AttrUpdate { AU_none, AU_if_missing, AU_always } |
enum | DatabaseOrigin { DO_open_flight = 100, DO_dig = 200, DO_es_ct6 = 300, DO_psp = 400, DO_ge_civ = 600, DO_es_gdf = 700 } |
enum | EarthModel { EM_wgs84 = 0, EM_wgs72 = 1, EM_bessel = 2, EM_clarke_1866 = 3, EM_nad27 = 4 } |
enum | Flags { F_save_vertex_normals = 0x80000000 } |
enum | ProjectionType { PT_flat_earth = 0, PT_trapezoidal = 1, PT_round_earth = 2, PT_lambert = 3, PT_utm = 4 } |
enum | Units { U_meters = 0, U_kilometers = 1, U_feet = 4, U_inches = 5, U_nautical_miles = 8 } |
enum | VertexStorageType { VTS_double = 1 } |
Public Member Functions | |
FltHeader (PathReplace *path_replace) | |
The FltHeader constructor accepts a PathReplace pointer; it uses this object to automatically convert all external filename and texture references. | |
void | add_ancillary (FltRecord *ancillary) |
Adds a new unsupported ancillary record to the end of the list of ancillary records for this record. | |
void | add_child (FltRecord *child) |
Adds a new child to the end of the list of children for this record. | |
void | add_extension (FltRecord *extension) |
Adds a new extension to the end of the list of extensions for this record. | |
void | add_instance (FltInstanceDefinition *instance) |
Defines a new instance subtree. | |
void | add_light_source (FltLightSourceDefinition *light_source) |
Defines a new light source. | |
void | add_material (FltMaterial *material) |
Defines a new material. | |
void | add_subface (FltRecord *subface) |
Adds a new subface to the end of the list of subfaces for this record. | |
void | add_texture (FltTexture *texture) |
Defines a new texture. | |
void | add_transform_step (FltTransformRecord *record) |
Applies the indicated transform step to the net transformation applied to the bead. | |
void | add_vertex (FltVertex *vertex) |
Adds a new vertex to the end of the vertex palette. | |
virtual void | apply_converted_filenames () |
Walks the hierarchy at this record and below and copies the _converted_filename record into the _orig_filename record, so the flt file will be written out with the converted filename instead of what was originally read in. | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. | |
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 | check_version () const |
Verifies that the version number read from the header is an understood version number, and prints a warning to the user if this is not so--the read may or may not succeed. | |
void | clear_ancillary () |
Removes all unsupported ancillary records from this record. | |
void | clear_children () |
Removes all children from this record. | |
void | clear_comment () |
Removes the comment for this record. | |
void | clear_extensions () |
Removes all extensions from this record. | |
void | clear_instances () |
Removes all instance subtrees from the instance pool. | |
void | clear_light_sources () |
Removes all light sources from the palette. | |
void | clear_materials () |
Removes all materials from the palette. | |
void | clear_subfaces () |
Removes all subfaces from this record. | |
void | clear_textures () |
Removes all textures from the palette. | |
void | clear_transform () |
Removes any transform matrix and all transform steps on this bead. | |
void | clear_vertices () |
Removes all vertices from the vertex palette. | |
Filename | convert_path (const Filename &orig_filename, const DSearchPath &additional_path=DSearchPath()) |
Uses the PathReplace object to convert the named filename as read from the flt record to its actual name. | |
virtual TypeHandle | force_init_type () |
FltRecord * | get_ancillary (int n) const |
Returns the nth unsupported ancillary record of this record. | |
AttrUpdate | get_auto_attr_update () const |
Returns the current setting of the auto_attr_update flag. | |
int | get_best_parent_from_Set (const std::set< int > &) const |
FltRecord * | get_child (int n) const |
Returns the nth child of this record. | |
int | get_closest_color (Colorf color) const |
Returns the color index of the nearest color in the palette that matches the given four-component color, including alpha. | |
int | get_closest_rgb (RGBColorf color) const |
Returns the color index of the nearest color in the palette that matches the given three-component color, ignoring alpha. | |
Colorf | get_color (int color_index, bool use_packed_color, const FltPackedColor &packed_color, int transparency) |
Decodes a MultiGen color, as stored on a face or vertex, into an actual four-component Colorf. | |
Colorf | get_color (int color_index) const |
Returns the four-component color corresponding to the given color index. | |
string | get_color_name (int color_index) const |
Returns the name associated with the given color, if any. | |
const string & | get_comment () const |
Retrieves the comment for this record, or empty string if the record has no comment. | |
FltRecord * | get_extension (int n) const |
Returns the nth extension of this record. | |
FltEyepoint * | get_eyepoint (int n) |
Returns the nth eyepoint in the eyepoint/trackplane palette. | |
const Filename & | get_flt_filename () const |
Returns the directory in which the flt file is considered to reside. | |
int | get_flt_version () const |
Returns the version number of the flt file as reported in the header, times 100. | |
const string & | get_id () const |
Returns the id (name) of this particular bead. | |
FltInstanceDefinition * | get_instance (int instance_index) const |
Returns the instance subtree associated with the given index, or NULL if there is no such instance. | |
FltLightSourceDefinition * | get_light_source (int light_index) const |
Returns the light source associated with the given index, or NULL if there is no such light source. | |
FltMaterial * | get_material (int material_index) const |
Returns the material associated with the given index, or NULL if there is no such material. | |
int | get_num_ancillary () const |
Returns the number of unsupported ancillary records of this record. | |
int | get_num_children () const |
Returns the number of child records of this record. | |
int | get_num_color_entries () const |
Returns the number of actual entries in the color palette. | |
int | get_num_color_shades () const |
Returns the number of shades of brightness of each entry in the color palette. | |
int | get_num_colors () const |
Returns the total number of different colors in the color palette. | |
int | get_num_extensions () const |
Returns the number of extension attribute records for this object. | |
int | get_num_eyepoints () const |
Returns the number of eyepoints in the eyepoint/trackplane palette. | |
int | get_num_subfaces () const |
Returns the number of subface records of this record. | |
int | get_num_trackplanes () const |
Returns the number of trackplanes in the eyepoint/trackplane palette. | |
int | get_num_transform_steps () const |
Returns the number of individual steps that define the net transform on this bead as returned by set_transform(). | |
int | get_num_vertices () const |
Returns the number of vertices in the vertex palette. | |
int | get_offset_by_vertex (FltVertex *vertex) |
Returns the byte offset into the vertex palette associated with the given vertex pointer. | |
PathReplace * | get_path_replace () |
Returns a pointer to the PathReplace object associated with this converter. | |
const PathReplace * | get_path_replace () const |
Returns a pointer to the PathReplace object associated with this converter. | |
int | get_ref_count () const |
Returns the current reference count. | |
int | get_replicate_count () const |
Returns the replicate count of this bead. | |
RGBColorf | get_rgb (int color_index) const |
Returns the three-component color corresponding to the given color index, ignoring the alpha component. | |
RGBColorf | get_rgb (int color_index, bool use_packed_color, const FltPackedColor &packed_color) |
Decodes a MultiGen color, as stored on a face or vertex, into an actual three-component RGBColorf. | |
FltRecord * | get_subface (int n) const |
Returns the nth subface of this record. | |
FltTexture * | get_texture (int texture_index) const |
Returns the texture associated with the given index, or NULL if there is no such texture. | |
FltTrackplane * | get_trackplane (int n) |
Returns the nth trackplane in the eyepoint/trackplane palette. | |
const LMatrix4d & | get_transform () const |
Returns the single-precision 4x4 matrix that represents the transform applied to this bead, or the identity matrix if the bead has not been transformed. | |
FltTransformRecord * | get_transform_step (int n) |
Returns the nth individual step that defines the net transform on this bead. | |
const FltTransformRecord * | get_transform_step (int n) const |
Returns the nth individual step that defines the net transform on this bead. | |
virtual TypeHandle | get_type () const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
DistanceUnit | get_units () const |
Returns the units indicated by the flt header, or DU_invalid if the units in the header are not understood. | |
FltVertex * | get_vertex (int n) const |
Returns the nth vertex of the vertex palette. | |
FltVertex * | get_vertex_by_offset (int offset) |
Returns the particular vertex pointer associated with the given byte offset into the vertex palette. | |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. | |
bool | got_eyepoint_trackplane_palette () const |
Returns true if we have read an eyepoint/trackplane palette, and at least some of the eyepoints and trackplanes are therefore expected to be meaningful. | |
bool | has_color_name (int color_index) const |
Returns true if the given color is named, false otherwise. | |
bool | has_comment () const |
Returns true if this record has a nonempty comment, false otherwise. | |
bool | has_instance (int instance_index) const |
Returns true if a instance subtree with the given index has been defined. | |
bool | has_light_source (int light_index) const |
Returns true if a light source with the given index has been defined. | |
bool | has_material (int material_index) const |
Returns true if a material with the given index has been defined. | |
bool | has_texture (int texture_index) const |
Returns true if a texture with the given index has been defined. | |
bool | has_transform () const |
Returns true if the bead has been transformed, false otherwise. | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. | |
void | operator delete (void *ptr) |
void | operator delete (void *ptr) |
void | operator delete (void *ptr, void *) |
void | operator delete (void *ptr, void *) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *, void *) |
void | operator delete[] (void *ptr) |
void | operator delete[] (void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new (size_t size) |
void * | operator new (size_t size, void *ptr) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size) |
void * | operator new[] (size_t size, void *ptr) |
void * | operator new[] (size_t size, void *ptr) |
virtual void | output (ostream &out) const |
Writes a quick one-line description of the record, but not its children. | |
FltError | read_flt (Filename filename) |
Opens the indicated filename for reading and attempts to read the complete Flt file. | |
FltError | read_flt (istream &in) |
Attempts to read a complete Flt file from the already-opened stream. | |
void | ref () const |
Explicitly increments the reference count. | |
void | remove_instance (int instance_index) |
Removes a particular instance subtree from the pool, if it exists. | |
void | remove_light_source (int light_index) |
Removes a particular light source from the light source palette, if it exists. | |
void | remove_material (int material_index) |
Removes a particular material from the material palette, if it exists. | |
void | remove_texture (int texture_index) |
Removes a particular texture from the texture palette, if it exists. | |
void | set_auto_attr_update (AttrUpdate attr) |
Controls whether texture .attr files are written automatically when write_flt() is called. | |
void | set_comment (const string &comment) |
Changes the comment for this record. | |
void | set_eyepoint_trackplane_palette (bool flag) |
Sets the state of the eyepoint/trackplane palette flag. | |
void | set_flt_filename (const Filename &flt_filename) |
Sets the filename--especially the directory part--in which the flt file is considered to reside. | |
void | set_flt_version (int version) |
Changes the version number of the flt file that will be reported in the header. | |
void | set_id (const string &id) |
Changes the id (name) of this particular bead. | |
void | set_path_replace (PathReplace *path_replace) |
Replaces the PathReplace object (which specifies how to mangle paths from the source to the destination file) with a new one. | |
void | set_replicate_count (int count) |
Changes the replicate count of this bead. | |
void | set_transform (const LMatrix4d &mat) |
Replaces the transform matrix on this bead. | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
virtual bool | unref () const |
Explicitly decrements the reference count. | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. | |
void | weak_unref (WeakPointerToVoid *ptv) |
Removes the indicated PointerToVoid as a weak reference to this object. | |
virtual void | write (ostream &out, int indent_level=0) const |
Writes a multiple-line description of the record and all of its children. | |
FltError | write_flt (ostream &out) |
Attempts to write a complete Flt file to the already-opened stream. | |
FltError | write_flt (Filename filename) |
Opens the indicated filename for writing and attempts to write the complete Flt file. | |
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. | |
static int | max_flt_version () |
Returns the latest flt version number that this codebase is known to support (times 100). | |
static int | min_flt_version () |
Returns the earliest flt version number that this codebase supports (times 100). | |
Public Attributes | |
DatabaseOrigin | _database_origin |
double | _delta_x |
double | _delta_y |
double | _delta_z |
EarthModel | _earth_model |
int | _edit_revision_level |
unsigned int | _flags |
int | _format_revision_level |
double | _lambert_lower_lat |
double | _lambert_upper_lat |
string | _last_revision |
double | _ne_lat |
double | _ne_long |
int | _next_adaptive_id |
int | _next_bsp_id |
int | _next_cat_id |
int | _next_clip_id |
int | _next_curve_id |
int | _next_dof_id |
int | _next_face_id |
int | _next_group_id |
int | _next_light_id |
int | _next_lod_id |
int | _next_mesh_id |
int | _next_object_id |
int | _next_path_id |
int | _next_road_id |
int | _next_sound_id |
int | _next_switch_id |
int | _next_text_id |
double | _origin_lat |
double | _origin_long |
ProjectionType | _projection_type |
double | _radius |
double | _sw_lat |
double | _sw_long |
double | _sw_x |
double | _sw_y |
bool | _texwhite_new |
int | _unit_multiplier |
VertexStorageType | _vertex_storage_type |
Units | _vertex_units |
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. | |
FltRecord * | create_new_record (FltOpcode opcode) const |
Creates a new FltRecord corresponding to the opcode. | |
bool | do_test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | do_test_ref_count_nonzero () const |
Returns true if the reference count is nonzero, false otherwise. | |
virtual bool | extract_ancillary (FltRecordReader &reader) |
Checks whether the given bead, which follows this bead sequentially in the file, is an ancillary record of this bead. | |
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. | |
FltError | read_record_and_children (FltRecordReader &reader) |
Extracts this record information from the current record presented in the reader, then advances the reader and continues to read any children, if present. | |
virtual FltError | write_ancillary (FltRecordWriter &writer) const |
Writes whatever ancillary records are required for this bead. | |
void | write_children (ostream &out, int indent_level) const |
Assuming the current write position has been left at the end of the last line of the record description, writes out the list of children. | |
virtual FltError | write_record_and_children (FltRecordWriter &writer) const |
Writes this record out to the flt file, along with all of its ancillary records and children records. | |
Static Protected Member Functions | |
static bool | is_ancillary (FltOpcode opcode) |
Returns true if the indicated opcode corresponds to an ancillary record type, false otherwise. | |
Protected Attributes | |
FltHeader * | _header |
This is the first bead in the file, the top of the bead hierarchy, and the primary interface to reading and writing a Flt file.
You always read a Flt file by creating a header and calling read_flt(), which fills in its children beads automatically; you write a Flt file by creating a header, adding its children, and calling write_flt().
Definition at line 48 of file fltHeader.h.
FltHeader::FltHeader | ( | PathReplace * | path_replace | ) |
The FltHeader constructor accepts a PathReplace pointer; it uses this object to automatically convert all external filename and texture references.
(This is necessary because the FltHeader has to look in the same directory as the texture to find the .attr file, so it must pre-convert at least the texture references.)
Most of the other file converters do not have this requirement, so they do not need to pre-convert any pathname references.
Definition at line 45 of file fltHeader.cxx.
void FltRecord::add_ancillary | ( | FltRecord * | ancillary | ) | [inherited] |
Adds a new unsupported ancillary record to the end of the list of ancillary records for this record.
This record will be written to the flt file following this record, without attempting to understand what is in it.
Normally, there is no reason to use this function; if the data stored in the FltRecord requires one or more ancillary record, the appropriate records will automatically be generated when the record is written. This function is only required to output a record whose type is not supported by the flt loader. But it would be better to extend the flt loader to know about this new kind of data record.
Definition at line 253 of file fltRecord.cxx.
void FltRecord::add_child | ( | FltRecord * | child | ) | [inherited] |
Adds a new child to the end of the list of children for this record.
Definition at line 102 of file fltRecord.cxx.
Referenced by FltRecord::read_record_and_children().
void FltRecord::add_extension | ( | FltRecord * | extension | ) | [inherited] |
Adds a new extension to the end of the list of extensions for this record.
This should be a record of type FO_extension.
Definition at line 193 of file fltRecord.cxx.
Referenced by FltRecord::read_record_and_children().
void FltHeader::add_instance | ( | FltInstanceDefinition * | instance | ) |
Defines a new instance subtree.
This subtree is not itself part of the hierarchy; it marks geometry that may be instanced to various beads elsewhere in the hierarchy by creating a corresponding FltInstanceRef bead.
Definition at line 520 of file fltHeader.cxx.
Referenced by FltRecord::read_record_and_children().
void FltHeader::add_light_source | ( | FltLightSourceDefinition * | light_source | ) |
Defines a new light source.
The light source is added in the position indicated by its light index number. If there is already a light source defined for that index number, it is replaced.
Definition at line 1113 of file fltHeader.cxx.
void FltHeader::add_material | ( | FltMaterial * | material | ) |
Defines a new material.
The material is added in the position indicated by the material's index number. If there is already a material defined for that index number, it is replaced.
Definition at line 969 of file fltHeader.cxx.
Referenced by FltGeometry::set_material().
void FltRecord::add_subface | ( | FltRecord * | subface | ) | [inherited] |
Adds a new subface to the end of the list of subfaces for this record.
Definition at line 147 of file fltRecord.cxx.
Referenced by FltRecord::read_record_and_children().
void FltHeader::add_texture | ( | FltTexture * | texture | ) |
Defines a new texture.
The texture is added in the position indicated by the texture's index number. If there is already a texture defined for that index number, it is replaced.
Definition at line 1041 of file fltHeader.cxx.
Referenced by FltGeometry::set_texture().
void FltBead::add_transform_step | ( | FltTransformRecord * | record | ) | [inherited] |
Applies the indicated transform step to the net transformation applied to the bead.
Definition at line 149 of file fltBead.cxx.
References FltTransformRecord::get_matrix().
Referenced by FltBead::set_transform().
void FltHeader::add_vertex | ( | FltVertex * | vertex | ) |
Adds a new vertex to the end of the vertex palette.
If this particular vertex was already present in the palette, does nothing.
Definition at line 578 of file fltHeader.cxx.
Referenced by FltVertexList::add_vertex().
void FltHeader::apply_converted_filenames | ( | ) | [virtual] |
Walks the hierarchy at this record and below and copies the _converted_filename record into the _orig_filename record, so the flt file will be written out with the converted filename instead of what was originally read in.
Reimplemented from FltRecord.
Definition at line 122 of file fltHeader.cxx.
References FltTexture::apply_converted_filenames().
TypedObject * TypedObject::as_typed_object | ( | ) | [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 99 of file typedObject.I.
const TypedObject * TypedObject::as_typed_object | ( | ) | const [inline, inherited] |
Returns the object, upcast (if necessary) to a TypedObject pointer.
Definition at line 110 of file typedObject.I.
bool FltHeader::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.
Definition at line 1381 of file fltHeader.cxx.
References Datagram::add_be_float64(), Datagram::add_be_int16(), Datagram::add_be_int32(), Datagram::add_be_uint32(), Datagram::add_fixed_string(), Datagram::add_int8(), FltBeadID::build_record(), get_flt_version(), Datagram::pad_bytes(), FltRecordWriter::set_opcode(), and FltRecordWriter::update_datagram().
void FltRecord::check_remaining_size | ( | const DatagramIterator & | di, |
const string & | name = string() |
||
) | const [inherited] |
Checks that the iterator has no bytes left, as it should at the end of a successfully read record.
If there *are* remaining bytes, print a warning message but otherwise don't worry about it.
If we are attempting to read a flt file whose version is newer than the newest this program understands, don't even print a warning message, since this is exactly the sort of thing we expect.
Definition at line 313 of file fltRecord.cxx.
References get_flt_version(), DatagramIterator::get_remaining_size(), and max_flt_version().
Referenced by FltVertexList::extract_record(), FltVertex::extract_record(), FltVectorRecord::extract_record(), FltTransformTranslate::extract_record(), FltTransformScale::extract_record(), FltTransformRotateScale::extract_record(), FltTransformRotateAboutPoint::extract_record(), FltTransformRotateAboutEdge::extract_record(), FltTransformPut::extract_record(), FltTransformGeneralMatrix::extract_record(), FltTexture::extract_record(), FltObject::extract_record(), FltMeshPrimitive::extract_record(), FltMesh::extract_record(), FltMaterial::extract_record(), FltLOD::extract_record(), FltLocalVertexPool::extract_record(), FltLightSourceDefinition::extract_record(), FltInstanceRef::extract_record(), FltInstanceDefinition::extract_record(), extract_record(), FltGroup::extract_record(), FltFace::extract_record(), FltExternalReference::extract_record(), and FltCurve::extract_record().
bool FltHeader::check_version | ( | ) | const |
Verifies that the version number read from the header is an understood version number, and prints a warning to the user if this is not so--the read may or may not succeed.
Returns true if the version number is acceptable (and no warning is printed), or false if it is questionable (and a warning is printed).
Definition at line 418 of file fltHeader.cxx.
References get_flt_version(), max_flt_version(), and min_flt_version().
void FltRecord::clear_ancillary | ( | ) | [inherited] |
Removes all unsupported ancillary records from this record.
See get_num_ancillary().
Definition at line 231 of file fltRecord.cxx.
void FltRecord::clear_children | ( | ) | [inherited] |
Removes all children from this record.
Definition at line 91 of file fltRecord.cxx.
void FltRecord::clear_comment | ( | ) | [inherited] |
Removes the comment for this record.
Definition at line 285 of file fltRecord.cxx.
void FltRecord::clear_extensions | ( | ) | [inherited] |
Removes all extensions from this record.
Definition at line 181 of file fltRecord.cxx.
void FltHeader::clear_instances | ( | ) |
Removes all instance subtrees from the instance pool.
Definition at line 506 of file fltHeader.cxx.
void FltHeader::clear_light_sources | ( | ) |
Removes all light sources from the palette.
Definition at line 1100 of file fltHeader.cxx.
void FltHeader::clear_materials | ( | ) |
Removes all materials from the palette.
Definition at line 956 of file fltHeader.cxx.
void FltRecord::clear_subfaces | ( | ) | [inherited] |
Removes all subfaces from this record.
Definition at line 136 of file fltRecord.cxx.
void FltHeader::clear_textures | ( | ) |
Removes all textures from the palette.
Definition at line 1028 of file fltHeader.cxx.
void FltBead::clear_transform | ( | ) | [inherited] |
Removes any transform matrix and all transform steps on this bead.
Definition at line 93 of file fltBead.cxx.
References LMatrix4d::ident_mat().
Referenced by FltBead::set_transform().
void FltHeader::clear_vertices | ( | ) |
Removes all vertices from the vertex palette.
Definition at line 562 of file fltHeader.cxx.
Referenced by extract_ancillary().
Filename FltHeader::convert_path | ( | const Filename & | orig_filename, |
const DSearchPath & | additional_path = DSearchPath() |
||
) |
Uses the PathReplace object to convert the named filename as read from the flt record to its actual name.
Definition at line 178 of file fltHeader.cxx.
References DSearchPath::append_directory(), DSearchPath::append_path(), and Filename::get_dirname().
Referenced by FltTexture::extract_record(), and FltExternalReference::extract_record().
FltRecord * FltRecord::create_new_record | ( | FltOpcode | opcode | ) | const [protected, inherited] |
Creates a new FltRecord corresponding to the opcode.
If the opcode is unknown, creates a FltUnsupportedRecord.
Definition at line 521 of file fltRecord.cxx.
Referenced by FltRecord::read_record_and_children().
bool ReferenceCount::do_test_ref_count_integrity | ( | ) | const [protected, inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
Definition at line 29 of file referenceCount.cxx.
Referenced by ReferenceCount::do_test_ref_count_nonzero(), and ReferenceCount::test_ref_count_integrity().
bool ReferenceCount::do_test_ref_count_nonzero | ( | ) | const [protected, inherited] |
Returns true if the reference count is nonzero, false otherwise.
Definition at line 56 of file referenceCount.cxx.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by ReferenceCount::test_ref_count_nonzero().
bool FltHeader::extract_ancillary | ( | FltRecordReader & | reader | ) | [protected, virtual] |
Checks whether the given bead, which follows this bead sequentially in the file, is an ancillary record of this bead.
If it is, extracts the relevant information and returns true; otherwise, leaves it alone and returns false.
Reimplemented from FltBeadID.
Definition at line 1331 of file fltHeader.cxx.
References clear_vertices(), FltRecordReader::get_opcode(), and FltRecordReader::get_record_length().
bool FltHeader::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.
Definition at line 1241 of file fltHeader.cxx.
References FltRecord::check_remaining_size(), FltBeadID::extract_record(), get_flt_version(), FltRecordReader::get_iterator(), and FltRecordReader::get_opcode().
FltRecord * FltRecord::get_ancillary | ( | int | n | ) | const [inherited] |
Returns the nth unsupported ancillary record of this record.
See get_num_ancillary().
Definition at line 219 of file fltRecord.cxx.
FltHeader::AttrUpdate FltHeader::get_auto_attr_update | ( | ) | const |
Returns the current setting of the auto_attr_update flag.
See sett_auto_attr_update().
Definition at line 347 of file fltHeader.cxx.
Referenced by FltTexture::build_record().
FltRecord * FltRecord::get_child | ( | int | n | ) | const [inherited] |
Returns the nth child of this record.
Definition at line 80 of file fltRecord.cxx.
int FltHeader::get_closest_color | ( | Colorf | color | ) | const |
Returns the color index of the nearest color in the palette that matches the given four-component color, including alpha.
Definition at line 730 of file fltHeader.cxx.
References get_num_color_entries(), and get_num_color_shades().
int FltHeader::get_closest_rgb | ( | RGBColorf | color | ) | const |
Returns the color index of the nearest color in the palette that matches the given three-component color, ignoring alpha.
Definition at line 795 of file fltHeader.cxx.
References get_num_color_entries(), and get_num_color_shades().
Referenced by FltLocalVertexPool::build_record().
Colorf FltHeader::get_color | ( | int | color_index | ) | const |
Returns the four-component color corresponding to the given color index.
Each component will be in the range [0, 1].
Definition at line 659 of file fltHeader.cxx.
References get_num_color_shades(), and get_num_colors().
Referenced by FltGeometry::get_alt_color(), FltVertex::get_color(), and get_color().
Colorf FltHeader::get_color | ( | int | color_index, |
bool | use_packed_color, | ||
const FltPackedColor & | packed_color, | ||
int | transparency | ||
) |
Decodes a MultiGen color, as stored on a face or vertex, into an actual four-component Colorf.
Normally you need not call this directly; there are color accessors defined on faces and vertices that do this.
Definition at line 883 of file fltHeader.cxx.
References get_color().
string FltHeader::get_color_name | ( | int | color_index | ) | const |
Returns the name associated with the given color, if any.
Definition at line 713 of file fltHeader.cxx.
const string & FltRecord::get_comment | ( | ) | const [inherited] |
Retrieves the comment for this record, or empty string if the record has no comment.
Definition at line 275 of file fltRecord.cxx.
FltRecord * FltRecord::get_extension | ( | int | n | ) | const [inherited] |
Returns the nth extension of this record.
Definition at line 170 of file fltRecord.cxx.
FltEyepoint * FltHeader::get_eyepoint | ( | int | n | ) |
Returns the nth eyepoint in the eyepoint/trackplane palette.
Definition at line 1173 of file fltHeader.cxx.
References get_num_eyepoints().
const Filename & FltHeader::get_flt_filename | ( | ) | const |
Returns the directory in which the flt file is considered to reside.
Definition at line 206 of file fltHeader.cxx.
int FltHeader::get_flt_version | ( | ) | const |
Returns the version number of the flt file as reported in the header, times 100.
Divide by 100 to get the floating-point version number.
Definition at line 359 of file fltHeader.cxx.
Referenced by FltVertex::build_record(), build_record(), FltGeometry::build_record(), FltRecord::check_remaining_size(), check_version(), FltVertex::extract_record(), FltTexture::extract_record(), extract_record(), FltGroup::extract_record(), FltGeometry::extract_record(), and FltVertex::get_record_length().
const string & FltBeadID::get_id | ( | ) | const [inherited] |
Returns the id (name) of this particular bead.
Each MultiGen bead will have a unique name.
Definition at line 37 of file fltBeadID.cxx.
FltInstanceDefinition * FltHeader::get_instance | ( | int | instance_index | ) | const |
Returns the instance subtree associated with the given index, or NULL if there is no such instance.
Definition at line 491 of file fltHeader.cxx.
Referenced by FltInstanceRef::get_instance(), FltInstanceRef::write(), and FltRecordWriter::write_instance_def().
FltLightSourceDefinition * FltHeader::get_light_source | ( | int | light_index | ) | const |
Returns the light source associated with the given index, or NULL if there is no such light source.
Definition at line 1085 of file fltHeader.cxx.
FltMaterial * FltHeader::get_material | ( | int | material_index | ) | const |
Returns the material associated with the given index, or NULL if there is no such material.
Definition at line 941 of file fltHeader.cxx.
Referenced by FltGeometry::get_material().
int FltRecord::get_num_ancillary | ( | ) | const [inherited] |
Returns the number of unsupported ancillary records of this record.
These are ancillary records that appeared following this record in the flt file but that aren't directly understood by the flt loader--normally, an ancillary record is examined and decoded on the spot, and no pointer to it is kept.
Definition at line 208 of file fltRecord.cxx.
int FltRecord::get_num_children | ( | ) | const [inherited] |
Returns the number of child records of this record.
This reflects the normal scene graph hierarchy.
Definition at line 70 of file fltRecord.cxx.
int FltHeader::get_num_color_entries | ( | ) | const |
Returns the number of actual entries in the color palette.
This is based on the version of the flt file, and is usually either 512 or 1024.
Definition at line 856 of file fltHeader.cxx.
Referenced by get_closest_color(), and get_closest_rgb().
int FltHeader::get_num_color_shades | ( | ) | const |
Returns the number of shades of brightness of each entry in the color palette.
This is a fixed property of MultiGen files: each entry in the palette actually represents a range of this many colors.
Definition at line 869 of file fltHeader.cxx.
Referenced by get_closest_color(), get_closest_rgb(), get_color(), get_num_colors(), and get_rgb().
int FltHeader::get_num_colors | ( | ) | const |
Returns the total number of different colors in the color palette.
This includes all different colors, and represents the complete range of alloable color indices. This is different from the actual number of color entries as read directly from the color palette, since each color entry defines a number of different intensity levels--the value returned by get_num_colors() is equal to get_num_color_entries() get_num_color_shades().
Definition at line 647 of file fltHeader.cxx.
References get_num_color_shades().
Referenced by get_color(), and get_rgb().
int FltRecord::get_num_extensions | ( | ) | const [inherited] |
Returns the number of extension attribute records for this object.
These are auxiliary nodes, presumably of type FO_extension, that have some local meaning to the object.
Definition at line 160 of file fltRecord.cxx.
int FltHeader::get_num_eyepoints | ( | ) | const |
Returns the number of eyepoints in the eyepoint/trackplane palette.
This is presently fixed at 10, according to the MultiGen specs.
Definition at line 1162 of file fltHeader.cxx.
Referenced by get_eyepoint().
int FltRecord::get_num_subfaces | ( | ) | const [inherited] |
Returns the number of subface records of this record.
Normally, subfaces will only be present on object records, although it is logically possible for them to appear anywhere.
Definition at line 115 of file fltRecord.cxx.
int FltHeader::get_num_trackplanes | ( | ) | const |
Returns the number of trackplanes in the eyepoint/trackplane palette.
This is presently fixed at 10, according to the MultiGen specs.
Definition at line 1186 of file fltHeader.cxx.
Referenced by get_trackplane().
int FltBead::get_num_transform_steps | ( | ) | const [inherited] |
Returns the number of individual steps that define the net transform on this bead as returned by set_transform().
Each step is a single transformation; the concatenation of all transformations will produce the matrix represented by set_transform().
Definition at line 110 of file fltBead.cxx.
Referenced by FltToEggLevelState::set_transform().
int FltHeader::get_num_vertices | ( | ) | const |
Returns the number of vertices in the vertex palette.
Definition at line 541 of file fltHeader.cxx.
int FltHeader::get_offset_by_vertex | ( | FltVertex * | vertex | ) |
Returns the byte offset into the vertex palette associated with the given vertex pointer.
If there is no such vertex in the palette, this generates an error message and returns 0.
Definition at line 619 of file fltHeader.cxx.
Referenced by FltVertexList::build_record().
const PathReplace * FltHeader::get_path_replace | ( | ) | const |
Returns a pointer to the PathReplace object associated with this converter.
If the converter is non-const, this returns a non-const pointer, which can be adjusted.
Definition at line 166 of file fltHeader.cxx.
PathReplace * FltHeader::get_path_replace | ( | ) |
Returns a pointer to the PathReplace object associated with this converter.
If the converter is non-const, this returns a non-const pointer, which can be adjusted.
Definition at line 153 of file fltHeader.cxx.
int ReferenceCount::get_ref_count | ( | ) | const [inline, inherited] |
Returns the current reference count.
Definition at line 155 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by TransformState::clear_cache(), RenderState::clear_cache(), RenderState::finalize(), RenderEffects::finalize(), RenderEffect::finalize(), RenderAttrib::finalize(), InternalName::finalize(), TransformState::get_num_unused_states(), RenderState::get_num_unused_states(), TransformState::list_cycles(), RenderState::list_cycles(), GeomVertexFormat::remove_column(), TransformState::unref(), RenderState::unref(), RenderState::~RenderState(), and TransformState::~TransformState().
int FltBead::get_replicate_count | ( | ) | const [inherited] |
Returns the replicate count of this bead.
If this is nonzero, it means that the bead is implicitly copied this number of additional times (for replicate_count + 1 total copies), applying the transform on this bead for each copy. In this case, the transform does not* apply to the initial copy of the bead.
Definition at line 170 of file fltBead.cxx.
RGBColorf FltHeader::get_rgb | ( | int | color_index | ) | const |
Returns the three-component color corresponding to the given color index, ignoring the alpha component.
Each component will be in the range [0, 1].
Definition at line 681 of file fltHeader.cxx.
References get_num_color_shades(), and get_num_colors().
Referenced by FltGeometry::get_alt_rgb(), FltGeometry::get_color(), FltVertex::get_rgb(), get_rgb(), and FltGeometry::get_rgb().
RGBColorf FltHeader::get_rgb | ( | int | color_index, |
bool | use_packed_color, | ||
const FltPackedColor & | packed_color | ||
) |
Decodes a MultiGen color, as stored on a face or vertex, into an actual three-component RGBColorf.
Normally you need not call this directly; there are color accessors defined on faces and vertices that do this.
Definition at line 910 of file fltHeader.cxx.
References get_rgb().
FltRecord * FltRecord::get_subface | ( | int | n | ) | const [inherited] |
Returns the nth subface of this record.
Definition at line 125 of file fltRecord.cxx.
FltTexture * FltHeader::get_texture | ( | int | texture_index | ) | const |
Returns the texture associated with the given index, or NULL if there is no such texture.
Definition at line 1013 of file fltHeader.cxx.
Referenced by FltGeometry::get_texture().
FltTrackplane * FltHeader::get_trackplane | ( | int | n | ) |
Returns the nth trackplane in the eyepoint/trackplane palette.
Definition at line 1197 of file fltHeader.cxx.
References get_num_trackplanes().
const LMatrix4d & FltBead::get_transform | ( | ) | const [inherited] |
Returns the single-precision 4x4 matrix that represents the transform applied to this bead, or the identity matrix if the bead has not been transformed.
Definition at line 66 of file fltBead.cxx.
References LMatrix4d::ident_mat().
Referenced by FltToEggLevelState::get_synthetic_group(), and FltToEggLevelState::set_transform().
FltTransformRecord * FltBead::get_transform_step | ( | int | n | ) | [inherited] |
Returns the nth individual step that defines the net transform on this bead.
See get_num_transform_steps().
Definition at line 122 of file fltBead.cxx.
Referenced by FltToEggLevelState::set_transform().
const FltTransformRecord * FltBead::get_transform_step | ( | int | n | ) | const [inherited] |
Returns the nth individual step that defines the net transform on this bead.
See get_num_transform_steps().
Definition at line 136 of file fltBead.cxx.
int TypedObject::get_type_index | ( | ) | const [inline, inherited] |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
This is equivalent to get_type().get_index().
Definition at line 52 of file typedObject.I.
References TypeHandle::get_index().
DistanceUnit FltHeader::get_units | ( | ) | const |
Returns the units indicated by the flt header, or DU_invalid if the units in the header are not understood.
Definition at line 451 of file fltHeader.cxx.
FltVertex * FltHeader::get_vertex | ( | int | n | ) | const |
Returns the nth vertex of the vertex palette.
Definition at line 551 of file fltHeader.cxx.
FltVertex * FltHeader::get_vertex_by_offset | ( | int | offset | ) |
Returns the particular vertex pointer associated with the given byte offset into the vertex palette.
If there is no such vertex in the palette, this generates an error message and returns NULL.
Definition at line 596 of file fltHeader.cxx.
Referenced by FltVertexList::extract_record().
WeakReferenceList * ReferenceCount::get_weak_list | ( | ) | const [inline, inherited] |
Returns the WeakReferenceList associated with this ReferenceCount object.
If there has never been a WeakReferenceList associated with this object, creates one now.
Definition at line 307 of file referenceCount.I.
Referenced by ReferenceCount::weak_ref().
bool FltHeader::got_eyepoint_trackplane_palette | ( | ) | const |
Returns true if we have read an eyepoint/trackplane palette, and at least some of the eyepoints and trackplanes are therefore expected to be meaningful.
Definition at line 1136 of file fltHeader.cxx.
bool FltHeader::has_color_name | ( | int | color_index | ) | const |
Returns true if the given color is named, false otherwise.
Definition at line 702 of file fltHeader.cxx.
bool FltRecord::has_comment | ( | ) | const [inherited] |
Returns true if this record has a nonempty comment, false otherwise.
Definition at line 264 of file fltRecord.cxx.
bool FltHeader::has_instance | ( | int | instance_index | ) | const |
Returns true if a instance subtree with the given index has been defined.
Definition at line 480 of file fltHeader.cxx.
bool FltHeader::has_light_source | ( | int | light_index | ) | const |
Returns true if a light source with the given index has been defined.
Definition at line 1074 of file fltHeader.cxx.
bool FltHeader::has_material | ( | int | material_index | ) | const |
Returns true if a material with the given index has been defined.
Definition at line 930 of file fltHeader.cxx.
Referenced by FltGeometry::has_material().
bool FltHeader::has_texture | ( | int | texture_index | ) | const |
Returns true if a texture with the given index has been defined.
Definition at line 1002 of file fltHeader.cxx.
Referenced by FltGeometry::has_texture().
bool FltBead::has_transform | ( | ) | const [inherited] |
Returns true if the bead has been transformed, false otherwise.
If this returns true, get_transform() will return the single-precision net transformation, and get_num_transform_steps() will return nonzero.
Definition at line 54 of file fltBead.cxx.
Referenced by FltToEggLevelState::set_transform().
bool ReferenceCount::has_weak_list | ( | ) | const [inline, inherited] |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
In general, this will be true if there was ever a WeakPointerTo created for this object (even if there is not any for it now).
Definition at line 294 of file referenceCount.I.
Referenced by ReferenceCount::weak_unref().
static void FltHeader::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.
Definition at line 334 of file fltHeader.h.
bool FltRecord::is_ancillary | ( | FltOpcode | opcode | ) | [static, protected, inherited] |
Returns true if the indicated opcode corresponds to an ancillary record type, false otherwise.
In general, this function is used to identify ancillary records that are not presently supported by the FltReader; these will be ignored. Normally, ancillary records will be detected and processed by extract_ancillary().
Definition at line 429 of file fltRecord.cxx.
Referenced by FltRecord::read_record_and_children().
bool TypedObject::is_exact_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is the indicated type exactly.
Definition at line 74 of file typedObject.I.
References TypeHandle::get_name().
Referenced by GraphicsStateGuardian::async_reload_texture(), PortalNode::combine_with(), PandaNode::combine_with(), GeomNode::combine_with(), CollisionNode::combine_with(), Character::combine_with(), PGItem::cull_callback(), FactoryParams::get_param_of_type(), CollisionHandlerPusher::handle_entries(), SceneGraphReducer::r_flatten(), ConnectionWriter::send(), FltToEggLevelState::set_transform(), and VirtualFileSystem::unmount().
bool TypedObject::is_of_type | ( | TypeHandle | handle | ) | const [inline, inherited] |
Returns true if the current object is or derives from the indicated type.
Definition at line 63 of file typedObject.I.
References TypeHandle::is_derived_from().
Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().
void ReferenceCount::local_object | ( | ) | [inline, inherited] |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
This allows the object to be passed to functions that will increment and decrement the object's reference count temporarily, and it will prevent the object from being deleted (inappropriately), when the reference count returns to zero. It actually achieves this by setting a large positive value in the reference count field.
Definition at line 276 of file referenceCount.I.
Referenced by PGTop::cull_callback(), BoundingSphere::extend_by_hexahedron(), AsyncTaskManager::find_task(), AsyncTaskManager::find_tasks(), and AsyncTaskManager::find_tasks_matching().
int FltHeader::max_flt_version | ( | ) | [static] |
Returns the latest flt version number that this codebase is known to support (times 100).
Later versions might work, but then again they may not.
Definition at line 403 of file fltHeader.cxx.
Referenced by FltRecord::check_remaining_size(), and check_version().
int FltHeader::min_flt_version | ( | ) | [static] |
Returns the earliest flt version number that this codebase supports (times 100).
Earlier versions will probably not work.
Definition at line 391 of file fltHeader.cxx.
Referenced by check_version().
void FltBeadID::output | ( | ostream & | out | ) | const [virtual, inherited] |
Writes a quick one-line description of the record, but not its children.
This is a human-readable description, primarily for debugging; to write a flt file, use FltHeader::write_flt().
Reimplemented from FltRecord.
Definition at line 61 of file fltBeadID.cxx.
FltError FltHeader::read_flt | ( | Filename | filename | ) |
Opens the indicated filename for reading and attempts to read the complete Flt file.
Returns FE_ok on success, otherwise on failure.
Definition at line 218 of file fltHeader.cxx.
References VirtualFileSystem::close_read_file(), VirtualFileSystem::get_global_ptr(), VirtualFileSystem::open_read_file(), and Filename::set_binary().
FltError FltHeader::read_flt | ( | istream & | in | ) |
Attempts to read a complete Flt file from the already-opened stream.
Returns FE_ok on success, otherwise on failure.
Definition at line 241 of file fltHeader.cxx.
References FltRecordReader::advance(), FltRecordReader::eof(), and FltRecord::read_record_and_children().
FltError FltRecord::read_record_and_children | ( | FltRecordReader & | reader | ) | [protected, inherited] |
Extracts this record information from the current record presented in the reader, then advances the reader and continues to read any children, if present.
On return, the reader is position on the next sibling record to this record.
Returns FE_ok if successful, otherwise on error.
Definition at line 580 of file fltRecord.cxx.
References FltRecord::add_child(), FltRecord::add_extension(), add_instance(), FltRecord::add_subface(), FltRecordReader::advance(), FltRecord::create_new_record(), FltRecordReader::eof(), FltRecordReader::error(), FltRecord::extract_ancillary(), FltRecord::extract_record(), FltRecordReader::get_opcode(), FltRecord::is_ancillary(), and FltRecord::read_record_and_children().
Referenced by read_flt(), and FltRecord::read_record_and_children().
void ReferenceCount::ref | ( | ) | const [inline, inherited] |
Explicitly increments the reference count.
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
Definition at line 179 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_ref(), TypedWritable::decode_raw_from_bam_stream(), NodeCachedReferenceCount::node_ref(), NodeReferenceCount::node_ref(), BamCacheRecord::set_data(), CullableObject::set_draw_callback(), and ModelRoot::set_reference().
void FltHeader::remove_instance | ( | int | instance_index | ) |
Removes a particular instance subtree from the pool, if it exists.
Definition at line 531 of file fltHeader.cxx.
void FltHeader::remove_light_source | ( | int | light_index | ) |
Removes a particular light source from the light source palette, if it exists.
Definition at line 1124 of file fltHeader.cxx.
void FltHeader::remove_material | ( | int | material_index | ) |
Removes a particular material from the material palette, if it exists.
Definition at line 991 of file fltHeader.cxx.
void FltHeader::remove_texture | ( | int | texture_index | ) |
Removes a particular texture from the texture palette, if it exists.
Definition at line 1063 of file fltHeader.cxx.
void FltHeader::set_auto_attr_update | ( | FltHeader::AttrUpdate | attr | ) |
Controls whether texture .attr files are written automatically when write_flt() is called.
There are three possibilities:
AU_none: the .attr files are not written automatically; they must be written explicitly via a call to FltTexture::write_attr_data() if you want them to be written.
AU_if_missing: the .attr files are written only if they do not already exist. This will not update any .attr files, even if the data is changed.
AU_always: the .attr files are always rewritten, even if they already exist and even if the data has not changed.
The default is AU_if_missing.
Definition at line 336 of file fltHeader.cxx.
void FltRecord::set_comment | ( | const string & | comment | ) | [inherited] |
Changes the comment for this record.
Definition at line 295 of file fltRecord.cxx.
void FltHeader::set_eyepoint_trackplane_palette | ( | bool | flag | ) |
Sets the state of the eyepoint/trackplane palette flag.
When this is false, the palette is believed to be meaningless, and will not be written; when it is true, the palette is believed to contain at least some meaningful data, and will be written.
Definition at line 1150 of file fltHeader.cxx.
void FltHeader::set_flt_filename | ( | const Filename & | flt_filename | ) |
Sets the filename--especially the directory part--in which the flt file is considered to reside.
This is also implicitly set by read_flt().
Definition at line 195 of file fltHeader.cxx.
void FltHeader::set_flt_version | ( | int | version | ) |
Changes the version number of the flt file that will be reported in the header.
Pass in the floating-point version number times 100.
Definition at line 375 of file fltHeader.cxx.
void FltBeadID::set_id | ( | const string & | id | ) | [inherited] |
Changes the id (name) of this particular bead.
This should be a name that is unique to this bead.
Definition at line 48 of file fltBeadID.cxx.
void FltHeader::set_path_replace | ( | PathReplace * | path_replace | ) |
Replaces the PathReplace object (which specifies how to mangle paths from the source to the destination file) with a new one.
Definition at line 140 of file fltHeader.cxx.
void FltBead::set_replicate_count | ( | int | count | ) | [inherited] |
Changes the replicate count of this bead.
If you are setting the replicate count to some nonzero number, you must also set a transform on the bead. See set_replicate_count().
Definition at line 183 of file fltBead.cxx.
void FltBead::set_transform | ( | const LMatrix4d & | mat | ) | [inherited] |
Replaces the transform matrix on this bead.
This implicitly removes all of the transform steps added previously, and replaces them with a single 4x4 general matrix transform step.
Definition at line 79 of file fltBead.cxx.
References FltBead::add_transform_step(), FltBead::clear_transform(), and FltTransformGeneralMatrix::set_matrix().
bool ReferenceCount::test_ref_count_integrity | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
Definition at line 236 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_integrity().
Referenced by EggGroupNode::add_child(), InternalName::find_ancestor(), InternalName::get_ancestor(), ReferenceCount::get_ref_count(), InternalName::get_top(), ReferenceCount::ref(), EggVertex::test_gref_integrity(), EggVertex::test_pref_integrity(), EggNode::test_under_integrity(), EggPrimitive::test_vref_integrity(), EggGroup::test_vref_integrity(), MouseWatcher::throw_event_pattern(), ReferenceCount::unref(), and EggNode::update_under().
bool ReferenceCount::test_ref_count_nonzero | ( | ) | const [inline, inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
Definition at line 252 of file referenceCount.I.
References ReferenceCount::do_test_ref_count_nonzero().
Referenced by CopyOnWritePointer::test_ref_count_nonzero().
bool ReferenceCount::unref | ( | ) | const [inline, virtual, inherited] |
Explicitly decrements the reference count.
Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.
Reimplemented in GeomVertexArrayFormat, GeomVertexFormat, InternalName, RenderAttrib, RenderEffects, RenderState, and TransformState.
Definition at line 214 of file referenceCount.I.
References ReferenceCount::test_ref_count_integrity().
Referenced by CachedTypedWritableReferenceCount::cache_unref(), TypedWritable::decode_raw_from_bam_stream(), RenderEffect::finalize(), NodeCachedReferenceCount::node_unref(), NodeReferenceCount::node_unref(), TransformState::unref(), RenderState::unref(), RenderEffects::unref(), RenderAttrib::unref(), InternalName::unref(), GeomVertexFormat::unref(), and GeomVertexArrayFormat::unref().
void ReferenceCount::weak_ref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Adds the indicated PointerToVoid as a weak reference to this object.
Definition at line 321 of file referenceCount.I.
References WeakReferenceList::add_reference(), and ReferenceCount::get_weak_list().
void ReferenceCount::weak_unref | ( | WeakPointerToVoid * | ptv | ) | [inline, inherited] |
Removes the indicated PointerToVoid as a weak reference to this object.
It must have previously been added via a call to weak_ref().
Definition at line 334 of file referenceCount.I.
References WeakReferenceList::clear_reference(), and ReferenceCount::has_weak_list().
void FltRecord::write | ( | ostream & | out, |
int | indent_level = 0 |
||
) | const [virtual, inherited] |
Writes a multiple-line description of the record and all of its children.
This is a human-readable description, primarily for debugging; to write a flt file, use FltHeader::write_flt().
Reimplemented in FltInstanceRef.
Definition at line 372 of file fltRecord.cxx.
References FltRecord::write_children().
Referenced by FltInfo::list_hierarchy().
FltError FltHeader::write_ancillary | ( | FltRecordWriter & | writer | ) | const [protected, virtual] |
Writes whatever ancillary records are required for this bead.
Returns FE_ok on success, or something else on error.
Reimplemented from FltBeadID.
Definition at line 1466 of file fltHeader.cxx.
void FltRecord::write_children | ( | ostream & | out, |
int | indent_level | ||
) | const [protected, inherited] |
Assuming the current write position has been left at the end of the last line of the record description, writes out the list of children.
Definition at line 385 of file fltRecord.cxx.
Referenced by FltRecord::write(), and FltInstanceRef::write().
FltError FltHeader::write_flt | ( | ostream & | out | ) |
Attempts to write a complete Flt file to the already-opened stream.
Returns FE_ok on success, otherwise on failure.
Definition at line 302 of file fltHeader.cxx.
References FltRecord::write_record_and_children().
FltError FltHeader::write_flt | ( | Filename | filename | ) |
Opens the indicated filename for writing and attempts to write the complete Flt file.
Returns FE_ok on success, otherwise on failure.
Definition at line 273 of file fltHeader.cxx.
References Filename::get_extension(), Filename::open_write(), and Filename::set_binary().
FltError FltRecord::write_record_and_children | ( | FltRecordWriter & | writer | ) | const [protected, virtual, inherited] |
Writes this record out to the flt file, along with all of its ancillary records and children records.
Returns FE_ok on success, or something else on error.
Reimplemented in FltInstanceRef.
Definition at line 726 of file fltRecord.cxx.
References FltRecordWriter::advance(), FltRecord::build_record(), FltRecord::write_ancillary(), and FltRecordWriter::write_record().
Referenced by write_flt(), and FltRecordWriter::write_instance_def().