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_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_texture (FltTexture *texture) |
Defines a new texture. | |
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. | |
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_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_textures () |
Removes all textures from the palette. | |
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 () |
AttrUpdate | get_auto_attr_update () const |
Returns the current setting of the auto_attr_update flag. | |
int | get_closest_color (const LColor &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 (const LRGBColor &color) const |
Returns the color index of the nearest color in the palette that matches the given three-component color, ignoring alpha. | |
LColor | 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 LColor. | |
LColor | 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. | |
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. | |
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_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_eyepoints () const |
Returns the number of eyepoints in the eyepoint/trackplane palette. | |
int | get_num_trackplanes () const |
Returns the number of trackplanes in the eyepoint/trackplane palette. | |
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. | |
LRGBColor | get_rgb (int color_index) const |
Returns the three-component color corresponding to the given color index, ignoring the alpha component. | |
LRGBColor | 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 LRGBColor. | |
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. | |
virtual TypeHandle | get_type () const |
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. | |
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_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. | |
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 | 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_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_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. | |
FltError | write_flt (Filename filename) |
Opens the indicated filename for writing and attempts to write the complete Flt file. | |
FltError | write_flt (ostream &out) |
Attempts to write a complete Flt file to the already-opened stream. | |
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. | |
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. | |
virtual FltError | write_ancillary (FltRecordWriter &writer) const |
Writes whatever ancillary records are required for this bead. |
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 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 1115 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 971 of file fltHeader.cxx.
Referenced by FltGeometry::set_material().
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 1043 of file fltHeader.cxx.
Referenced by FltGeometry::set_texture().
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().
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 1383 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().
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 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 1102 of file fltHeader.cxx.
void FltHeader::clear_materials | ( | ) |
Removes all materials from the palette.
Definition at line 958 of file fltHeader.cxx.
void FltHeader::clear_textures | ( | ) |
Removes all textures from the palette.
Definition at line 1030 of file fltHeader.cxx.
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().
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 1333 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 1243 of file fltHeader.cxx.
References FltRecord::check_remaining_size(), FltBeadID::extract_record(), get_flt_version(), FltRecordReader::get_iterator(), and FltRecordReader::get_opcode().
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().
int FltHeader::get_closest_color | ( | const LColor & | 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 | ( | const LRGBColor & | 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 796 of file fltHeader.cxx.
References get_num_color_entries(), and get_num_color_shades().
Referenced by FltLocalVertexPool::build_record().
LColor 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().
LColor 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 LColor.
Normally you need not call this directly; there are color accessors defined on faces and vertices that do this.
Definition at line 885 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.
FltEyepoint * FltHeader::get_eyepoint | ( | int | n | ) |
Returns the nth eyepoint in the eyepoint/trackplane palette.
Definition at line 1175 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().
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 1087 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 943 of file fltHeader.cxx.
Referenced by FltGeometry::get_material().
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 858 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 871 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 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 1164 of file fltHeader.cxx.
Referenced by get_eyepoint().
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 1188 of file fltHeader.cxx.
Referenced by get_trackplane().
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.
LRGBColor 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().
LRGBColor 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 LRGBColor.
Normally you need not call this directly; there are color accessors defined on faces and vertices that do this.
Definition at line 912 of file fltHeader.cxx.
References get_rgb().
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 1015 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 1199 of file fltHeader.cxx.
References get_num_trackplanes().
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().
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 1138 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 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 1076 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 932 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 1004 of file fltHeader.cxx.
Referenced by FltGeometry::has_texture().
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.
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().
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().
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 1126 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 993 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 1065 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 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 1152 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 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.
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 1468 of file fltHeader.cxx.
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 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().