Panda3D
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
FltHeader Class Reference

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"

Inheritance diagram for FltHeader:
FltBeadID FltBead FltRecord TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

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. More...
 
void add_instance (FltInstanceDefinition *instance)
 Defines a new instance subtree. More...
 
void add_light_source (FltLightSourceDefinition *light_source)
 Defines a new light source. More...
 
void add_material (FltMaterial *material)
 Defines a new material. More...
 
void add_texture (FltTexture *texture)
 Defines a new texture. More...
 
void add_vertex (FltVertex *vertex)
 Adds a new vertex to the end of the vertex palette. More...
 
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. More...
 
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. More...
 
void clear_instances ()
 Removes all instance subtrees from the instance pool. More...
 
void clear_light_sources ()
 Removes all light sources from the palette. More...
 
void clear_materials ()
 Removes all materials from the palette. More...
 
void clear_textures ()
 Removes all textures from the palette. More...
 
void clear_vertices ()
 Removes all vertices from the vertex palette. More...
 
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. More...
 
virtual TypeHandle force_init_type ()
 
AttrUpdate get_auto_attr_update () const
 Returns the current setting of the auto_attr_update flag. More...
 
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. More...
 
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. More...
 
LColor get_color (int color_index) const
 Returns the four-component color corresponding to the given color index. More...
 
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. More...
 
std::string get_color_name (int color_index) const
 Returns the name associated with the given color, if any. More...
 
FltEyepointget_eyepoint (int n)
 Returns the nth eyepoint in the eyepoint/trackplane palette. More...
 
const Filenameget_flt_filename () const
 Returns the directory in which the flt file is considered to reside. More...
 
int get_flt_version () const
 Returns the version number of the flt file as reported in the header, times 100. More...
 
FltInstanceDefinitionget_instance (int instance_index) const
 Returns the instance subtree associated with the given index, or NULL if there is no such instance. More...
 
FltLightSourceDefinitionget_light_source (int light_index) const
 Returns the light source associated with the given index, or NULL if there is no such light source. More...
 
FltMaterialget_material (int material_index) const
 Returns the material associated with the given index, or NULL if there is no such material. More...
 
int get_num_color_entries () const
 Returns the number of actual entries in the color palette. More...
 
int get_num_color_shades () const
 Returns the number of shades of brightness of each entry in the color palette. More...
 
int get_num_colors () const
 Returns the total number of different colors in the color palette. More...
 
int get_num_eyepoints () const
 Returns the number of eyepoints in the eyepoint/trackplane palette. More...
 
int get_num_trackplanes () const
 Returns the number of trackplanes in the eyepoint/trackplane palette. More...
 
int get_num_vertices () const
 Returns the number of vertices in the vertex palette. More...
 
int get_offset_by_vertex (FltVertex *vertex)
 Returns the byte offset into the vertex palette associated with the given vertex pointer. More...
 
PathReplaceget_path_replace ()
 Returns a pointer to the PathReplace object associated with this converter. More...
 
const PathReplaceget_path_replace () const
 Returns a pointer to the PathReplace object associated with this converter. More...
 
LRGBColor get_rgb (int color_index) const
 Returns the three-component color corresponding to the given color index, ignoring the alpha component. More...
 
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. More...
 
FltTextureget_texture (int texture_index) const
 Returns the texture associated with the given index, or NULL if there is no such texture. More...
 
FltTrackplaneget_trackplane (int n)
 Returns the nth trackplane in the eyepoint/trackplane palette. More...
 
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. More...
 
FltVertexget_vertex (int n) const
 Returns the nth vertex of the vertex palette. More...
 
FltVertexget_vertex_by_offset (int offset)
 Returns the particular vertex pointer associated with the given byte offset into the vertex palette. More...
 
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. More...
 
bool has_color_name (int color_index) const
 Returns true if the given color is named, false otherwise. More...
 
bool has_instance (int instance_index) const
 Returns true if a instance subtree with the given index has been defined. More...
 
bool has_light_source (int light_index) const
 Returns true if a light source with the given index has been defined. More...
 
bool has_material (int material_index) const
 Returns true if a material with the given index has been defined. More...
 
bool has_texture (int texture_index) const
 Returns true if a texture with the given index has been defined. More...
 
FltError read_flt (Filename filename)
 Opens the indicated filename for reading and attempts to read the complete Flt file. More...
 
FltError read_flt (std::istream &in)
 Attempts to read a complete Flt file from the already-opened stream. More...
 
void remove_instance (int instance_index)
 Removes a particular instance subtree from the pool, if it exists. More...
 
void remove_light_source (int light_index)
 Removes a particular light source from the light source palette, if it exists. More...
 
void remove_material (int material_index)
 Removes a particular material from the material palette, if it exists. More...
 
void remove_texture (int texture_index)
 Removes a particular texture from the texture palette, if it exists. More...
 
void set_auto_attr_update (AttrUpdate attr)
 Controls whether texture .attr files are written automatically when write_flt() is called. More...
 
void set_eyepoint_trackplane_palette (bool flag)
 Sets the state of the eyepoint/trackplane palette flag. More...
 
void set_flt_filename (const Filename &flt_filename)
 Sets the filename–especially the directory part–in which the flt file is considered to reside. More...
 
void set_flt_version (int version)
 Changes the version number of the flt file that will be reported in the header. More...
 
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. More...
 
FltError write_flt (Filename filename)
 Opens the indicated filename for writing and attempts to write the complete Flt file. More...
 
FltError write_flt (std::ostream &out)
 Attempts to write a complete Flt file to the already-opened stream. More...
 
- Public Member Functions inherited from FltBeadID
 FltBeadID (FltHeader *header)
 
const std::string & get_id () const
 Returns the id (name) of this particular bead. More...
 
virtual void output (std::ostream &out) const
 Writes a quick one-line description of the record, but not its children. More...
 
void set_id (const std::string &id)
 Changes the id (name) of this particular bead. More...
 
- Public Member Functions inherited from FltBead
 FltBead (FltHeader *header)
 
void add_transform_step (FltTransformRecord *record)
 Applies the indicated transform step to the net transformation applied to the bead. More...
 
void clear_transform ()
 Removes any transform matrix and all transform steps on this bead. More...
 
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(). More...
 
int get_replicate_count () const
 Returns the replicate count of this bead. More...
 
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. More...
 
FltTransformRecordget_transform_step (int n)
 Returns the nth individual step that defines the net transform on this bead. More...
 
const FltTransformRecordget_transform_step (int n) const
 Returns the nth individual step that defines the net transform on this bead. More...
 
bool has_transform () const
 Returns true if the bead has been transformed, false otherwise. More...
 
void set_replicate_count (int count)
 Changes the replicate count of this bead. More...
 
void set_transform (const LMatrix4d &mat)
 Replaces the transform matrix on this bead. More...
 
- Public Member Functions inherited from FltRecord
 FltRecord (FltHeader *header)
 
void add_ancillary (FltRecord *ancillary)
 Adds a new unsupported ancillary record to the end of the list of ancillary records for this record. More...
 
void add_child (FltRecord *child)
 Adds a new child to the end of the list of children for this record. More...
 
void add_extension (FltRecord *extension)
 Adds a new extension to the end of the list of extensions for this record. More...
 
void add_subface (FltRecord *subface)
 Adds a new subface to the end of the list of subfaces for this record. More...
 
void check_remaining_size (const DatagramIterator &di, const std::string &name=std::string()) const
 Checks that the iterator has no bytes left, as it should at the end of a successfully read record. More...
 
void clear_ancillary ()
 Removes all unsupported ancillary records from this record. More...
 
void clear_children ()
 Removes all children from this record. More...
 
void clear_comment ()
 Removes the comment for this record. More...
 
void clear_extensions ()
 Removes all extensions from this record. More...
 
void clear_subfaces ()
 Removes all subfaces from this record. More...
 
FltRecordget_ancillary (int n) const
 Returns the nth unsupported ancillary record of this record. More...
 
FltRecordget_child (int n) const
 Returns the nth child of this record. More...
 
const std::string & get_comment () const
 Retrieves the comment for this record, or empty string if the record has no comment. More...
 
FltRecordget_extension (int n) const
 Returns the nth extension of this record. More...
 
int get_num_ancillary () const
 Returns the number of unsupported ancillary records of this record. More...
 
int get_num_children () const
 Returns the number of child records of this record. More...
 
int get_num_extensions () const
 Returns the number of extension attribute records for this object. More...
 
int get_num_subfaces () const
 Returns the number of subface records of this record. More...
 
FltRecordget_subface (int n) const
 Returns the nth subface of this record. More...
 
bool has_comment () const
 Returns true if this record has a nonempty comment, false otherwise. More...
 
void set_comment (const std::string &comment)
 Changes the comment for this record. More...
 
virtual void write (std::ostream &out, int indent_level=0) const
 Writes a multiple-line description of the record and all of its children. More...
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
static int max_flt_version ()
 Returns the latest flt version number that this codebase is known to support (times 100). More...
 
static int min_flt_version ()
 Returns the earliest flt version number that this codebase supports (times 100). More...
 
- Static Public Member Functions inherited from FltBeadID
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from FltBead
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from FltRecord
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
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. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

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
 
std::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
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

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 44 of file fltHeader.h.

Constructor & Destructor Documentation

◆ FltHeader()

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 39 of file fltHeader.cxx.

Member Function Documentation

◆ add_instance()

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 445 of file fltHeader.cxx.

◆ add_light_source()

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 948 of file fltHeader.cxx.

◆ add_material()

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 830 of file fltHeader.cxx.

◆ add_texture()

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 889 of file fltHeader.cxx.

◆ add_vertex()

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 491 of file fltHeader.cxx.

◆ apply_converted_filenames()

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 113 of file fltHeader.cxx.

References FltTexture::apply_converted_filenames(), and FltRecord::apply_converted_filenames().

◆ check_version()

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 357 of file fltHeader.cxx.

References get_flt_version(), and min_flt_version().

◆ clear_instances()

void FltHeader::clear_instances ( )

Removes all instance subtrees from the instance pool.

Definition at line 435 of file fltHeader.cxx.

◆ clear_light_sources()

void FltHeader::clear_light_sources ( )

Removes all light sources from the palette.

Definition at line 938 of file fltHeader.cxx.

◆ clear_materials()

void FltHeader::clear_materials ( )

Removes all materials from the palette.

Definition at line 820 of file fltHeader.cxx.

◆ clear_textures()

void FltHeader::clear_textures ( )

Removes all textures from the palette.

Definition at line 879 of file fltHeader.cxx.

◆ clear_vertices()

void FltHeader::clear_vertices ( )

Removes all vertices from the vertex palette.

Definition at line 478 of file fltHeader.cxx.

◆ convert_path()

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 157 of file fltHeader.cxx.

References DSearchPath::append_directory(), DSearchPath::append_path(), and Filename::get_dirname().

◆ get_auto_attr_update()

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 300 of file fltHeader.cxx.

◆ get_closest_color()

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 618 of file fltHeader.cxx.

◆ get_closest_rgb()

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 680 of file fltHeader.cxx.

◆ get_color() [1/2]

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 559 of file fltHeader.cxx.

Referenced by get_color().

◆ get_color() [2/2]

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 758 of file fltHeader.cxx.

References get_color().

◆ get_color_name()

std::string FltHeader::get_color_name ( int  color_index) const

Returns the name associated with the given color, if any.

Definition at line 604 of file fltHeader.cxx.

◆ get_eyepoint()

FltEyepoint * FltHeader::get_eyepoint ( int  n)

Returns the nth eyepoint in the eyepoint/trackplane palette.

Definition at line 995 of file fltHeader.cxx.

◆ get_flt_filename()

const Filename & FltHeader::get_flt_filename ( ) const

Returns the directory in which the flt file is considered to reside.

Definition at line 179 of file fltHeader.cxx.

◆ get_flt_version()

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 309 of file fltHeader.cxx.

Referenced by FltRecord::check_remaining_size(), and check_version().

◆ get_instance()

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 422 of file fltHeader.cxx.

◆ get_light_source()

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 925 of file fltHeader.cxx.

◆ get_material()

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 807 of file fltHeader.cxx.

◆ get_num_color_entries()

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 738 of file fltHeader.cxx.

◆ get_num_color_shades()

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 748 of file fltHeader.cxx.

Referenced by get_num_colors().

◆ get_num_colors()

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 550 of file fltHeader.cxx.

References get_num_color_shades().

◆ get_num_eyepoints()

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 987 of file fltHeader.cxx.

◆ get_num_trackplanes()

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 1005 of file fltHeader.cxx.

◆ get_num_vertices()

int FltHeader::get_num_vertices ( ) const

Returns the number of vertices in the vertex palette.

Definition at line 461 of file fltHeader.cxx.

◆ get_offset_by_vertex()

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 526 of file fltHeader.cxx.

◆ get_path_replace() [1/2]

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 138 of file fltHeader.cxx.

◆ get_path_replace() [2/2]

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 148 of file fltHeader.cxx.

◆ get_rgb() [1/2]

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 578 of file fltHeader.cxx.

Referenced by get_rgb().

◆ get_rgb() [2/2]

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 781 of file fltHeader.cxx.

References get_rgb().

◆ get_texture()

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 866 of file fltHeader.cxx.

◆ get_trackplane()

FltTrackplane * FltHeader::get_trackplane ( int  n)

Returns the nth trackplane in the eyepoint/trackplane palette.

Definition at line 1013 of file fltHeader.cxx.

◆ get_units()

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 387 of file fltHeader.cxx.

◆ get_vertex()

FltVertex * FltHeader::get_vertex ( int  n) const

Returns the nth vertex of the vertex palette.

Definition at line 469 of file fltHeader.cxx.

◆ get_vertex_by_offset()

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 506 of file fltHeader.cxx.

◆ got_eyepoint_trackplane_palette()

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 967 of file fltHeader.cxx.

◆ has_color_name()

bool FltHeader::has_color_name ( int  color_index) const

Returns true if the given color is named, false otherwise.

Definition at line 596 of file fltHeader.cxx.

◆ has_instance()

bool FltHeader::has_instance ( int  instance_index) const

Returns true if a instance subtree with the given index has been defined.

Definition at line 413 of file fltHeader.cxx.

◆ has_light_source()

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 916 of file fltHeader.cxx.

◆ has_material()

bool FltHeader::has_material ( int  material_index) const

Returns true if a material with the given index has been defined.

Definition at line 798 of file fltHeader.cxx.

◆ has_texture()

bool FltHeader::has_texture ( int  texture_index) const

Returns true if a texture with the given index has been defined.

Definition at line 857 of file fltHeader.cxx.

◆ max_flt_version()

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 345 of file fltHeader.cxx.

Referenced by FltRecord::check_remaining_size().

◆ min_flt_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 335 of file fltHeader.cxx.

Referenced by check_version().

◆ read_flt() [1/2]

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 188 of file fltHeader.cxx.

References Filename::set_binary().

◆ read_flt() [2/2]

FltError FltHeader::read_flt ( std::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 208 of file fltHeader.cxx.

References FltRecordReader::advance().

◆ remove_instance()

void FltHeader::remove_instance ( int  instance_index)

Removes a particular instance subtree from the pool, if it exists.

Definition at line 453 of file fltHeader.cxx.

◆ remove_light_source()

void FltHeader::remove_light_source ( int  light_index)

Removes a particular light source from the light source palette, if it exists.

Definition at line 957 of file fltHeader.cxx.

◆ remove_material()

void FltHeader::remove_material ( int  material_index)

Removes a particular material from the material palette, if it exists.

Definition at line 849 of file fltHeader.cxx.

◆ remove_texture()

void FltHeader::remove_texture ( int  texture_index)

Removes a particular texture from the texture palette, if it exists.

Definition at line 908 of file fltHeader.cxx.

◆ set_auto_attr_update()

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 291 of file fltHeader.cxx.

◆ set_eyepoint_trackplane_palette()

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 978 of file fltHeader.cxx.

◆ set_flt_filename()

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 171 of file fltHeader.cxx.

◆ set_flt_version()

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 322 of file fltHeader.cxx.

◆ set_path_replace()

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 128 of file fltHeader.cxx.

◆ write_flt() [1/2]

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 237 of file fltHeader.cxx.

References Filename::open_write(), and Filename::set_binary().

◆ write_flt() [2/2]

FltError FltHeader::write_flt ( std::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 263 of file fltHeader.cxx.


The documentation for this class was generated from the following files: