Panda3D
Loading...
Searching...
No Matches
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.
 
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) const
 Returns the four-component color corresponding to the given color index.
 
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.
 
std::string get_color_name (int color_index) const
 Returns the name associated with the given color, if any.
 
FltEyepointget_eyepoint (int n)
 Returns the nth eyepoint in the eyepoint/trackplane palette.
 
const Filenameget_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.
 
FltInstanceDefinitionget_instance (int instance_index) const
 Returns the instance subtree associated with the given index, or NULL if there is no such instance.
 
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.
 
FltMaterialget_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.
 
PathReplaceget_path_replace ()
 Returns a pointer to the PathReplace object associated with this converter.
 
const PathReplaceget_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.
 
FltTextureget_texture (int texture_index) const
 Returns the texture associated with the given index, or NULL if there is no such texture.
 
FltTrackplaneget_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.
 
FltVertexget_vertex (int n) const
 Returns the nth vertex of the vertex palette.
 
FltVertexget_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 (std::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 (std::ostream &out)
 Attempts to write a complete Flt file to the already-opened stream.
 
- Public Member Functions inherited from FltBeadID
 FltBeadID (FltHeader *header)
 
const std::string & get_id () const
 Returns the id (name) of this particular bead.
 
virtual void output (std::ostream &out) const
 Writes a quick one-line description of the record, but not its children.
 
void set_id (const std::string &id)
 Changes the id (name) of this particular bead.
 
- 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.
 
void clear_transform ()
 Removes any transform matrix and all transform steps on this bead.
 
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_replicate_count () const
 Returns the replicate count of this bead.
 
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.
 
FltTransformRecordget_transform_step (int n)
 Returns the nth individual step that defines the net transform on this bead.
 
const FltTransformRecordget_transform_step (int n) const
 Returns the nth individual step that defines the net transform on this bead.
 
bool has_transform () const
 Returns true if the bead has been transformed, false otherwise.
 
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.
 
- 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.
 
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_subface (FltRecord *subface)
 Adds a new subface to the end of the list of subfaces for this record.
 
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.
 
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_subfaces ()
 Removes all subfaces from this record.
 
FltRecordget_ancillary (int n) const
 Returns the nth unsupported ancillary record of this record.
 
FltRecordget_child (int n) const
 Returns the nth child of this record.
 
const std::string & get_comment () const
 Retrieves the comment for this record, or empty string if the record has no comment.
 
FltRecordget_extension (int n) const
 Returns the nth extension of this record.
 
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_extensions () const
 Returns the number of extension attribute records for this object.
 
int get_num_subfaces () const
 Returns the number of subface records of this record.
 
FltRecordget_subface (int n) const
 Returns the nth subface of this record.
 
bool has_comment () const
 Returns true if this record has a nonempty comment, false otherwise.
 
void set_comment (const std::string &comment)
 Changes the comment for this record.
 
virtual void write (std::ostream &out, int indent_level=0) const
 Writes a multiple-line description of the record and all of its children.
 
- 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.
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer.
 
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.
 
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.
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from MemoryBase
void operator delete (void *, void *)
 
void operator delete (void *ptr)
 
void operator delete[] (void *, void *)
 
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)
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object.
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
 
void ref () const
 Explicitly increments the reference count.
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero.
 
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.
 
bool unref_if_one () const
 Atomically decreases the reference count of this object if it is one.
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object.
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object.
 

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).
 
static int min_flt_version ()
 Returns the earliest flt version number that this codebase supports (times 100).
 
- 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.
 
- 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.
 

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.

Member Enumeration Documentation

◆ AttrUpdate

enum FltHeader::AttrUpdate

Definition at line 64 of file fltHeader.h.

◆ DatabaseOrigin

enum FltHeader::DatabaseOrigin

Definition at line 97 of file fltHeader.h.

◆ EarthModel

enum FltHeader::EarthModel

Definition at line 106 of file fltHeader.h.

◆ Flags

enum FltHeader::Flags

Definition at line 81 of file fltHeader.h.

◆ ProjectionType

enum FltHeader::ProjectionType

Definition at line 85 of file fltHeader.h.

◆ Units

enum FltHeader::Units

Definition at line 73 of file fltHeader.h.

◆ VertexStorageType

enum FltHeader::VertexStorageType

Definition at line 93 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 38 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 444 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 947 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 829 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 888 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 490 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 112 of file fltHeader.cxx.

References FltRecord::apply_converted_filenames(), and FltTexture::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 356 of file fltHeader.cxx.

References get_flt_version(), max_flt_version(), and min_flt_version().

◆ clear_instances()

void FltHeader::clear_instances ( )

Removes all instance subtrees from the instance pool.

Definition at line 434 of file fltHeader.cxx.

◆ clear_light_sources()

void FltHeader::clear_light_sources ( )

Removes all light sources from the palette.

Definition at line 937 of file fltHeader.cxx.

◆ clear_materials()

void FltHeader::clear_materials ( )

Removes all materials from the palette.

Definition at line 819 of file fltHeader.cxx.

◆ clear_textures()

void FltHeader::clear_textures ( )

Removes all textures from the palette.

Definition at line 878 of file fltHeader.cxx.

◆ clear_vertices()

void FltHeader::clear_vertices ( )

Removes all vertices from the vertex palette.

Definition at line 477 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 156 of file fltHeader.cxx.

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

◆ force_init_type()

virtual TypeHandle FltHeader::force_init_type ( )
inlinevirtual

Reimplemented from FltBeadID.

Definition at line 326 of file fltHeader.h.

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

◆ get_class_type()

static TypeHandle FltHeader::get_class_type ( )
inlinestatic

Definition at line 327 of file fltHeader.h.

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

References get_num_color_entries(), and get_num_color_shades().

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

References get_num_color_entries(), and get_num_color_shades().

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

References get_num_color_shades(), and get_num_colors().

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

◆ get_eyepoint()

FltEyepoint * FltHeader::get_eyepoint ( int n)

Returns the nth eyepoint in the eyepoint/trackplane palette.

Definition at line 994 of file fltHeader.cxx.

References get_num_eyepoints().

◆ 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 178 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 308 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 421 of file fltHeader.cxx.

Referenced by FltRecordWriter::write_instance_def().

◆ 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 924 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 806 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 737 of file fltHeader.cxx.

Referenced by get_closest_color(), and get_closest_rgb().

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

Referenced by get_closest_color(), get_closest_rgb(), get_color(), get_num_colors(), and get_rgb().

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

References get_num_color_shades().

Referenced by get_color(), and get_rgb().

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

Referenced by get_eyepoint().

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

Referenced by get_trackplane().

◆ get_num_vertices()

int FltHeader::get_num_vertices ( ) const

Returns the number of vertices in the vertex palette.

Definition at line 460 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 525 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 137 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 147 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 577 of file fltHeader.cxx.

References get_num_color_shades(), and get_num_colors().

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

◆ get_trackplane()

FltTrackplane * FltHeader::get_trackplane ( int n)

Returns the nth trackplane in the eyepoint/trackplane palette.

Definition at line 1012 of file fltHeader.cxx.

References get_num_trackplanes().

◆ get_type()

virtual TypeHandle FltHeader::get_type ( ) const
inlinevirtual

Reimplemented from FltBeadID.

Definition at line 323 of file fltHeader.h.

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

◆ get_vertex()

FltVertex * FltHeader::get_vertex ( int n) const

Returns the nth vertex of the vertex palette.

Definition at line 468 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 505 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 966 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 595 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 412 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 915 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 797 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 856 of file fltHeader.cxx.

◆ init_type()

static void FltHeader::init_type ( )
inlinestatic

Definition at line 330 of file fltHeader.h.

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

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

◆ 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 334 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 187 of file fltHeader.cxx.

References VirtualFileSystem::close_read_file(), VirtualFileSystem::get_global_ptr(), VirtualFileSystem::open_read_file(), read_flt(), and Filename::set_binary().

Referenced by read_flt().

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

References FltRecordReader::advance(), and FltRecordReader::eof().

◆ remove_instance()

void FltHeader::remove_instance ( int instance_index)

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

Definition at line 452 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 956 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 848 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 907 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 290 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 977 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 170 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 321 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 127 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 236 of file fltHeader.cxx.

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

Referenced by write_flt().

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

Member Data Documentation

◆ _database_origin

DatabaseOrigin FltHeader::_database_origin

Definition at line 128 of file fltHeader.h.

◆ _delta_x

double FltHeader::_delta_x

Definition at line 130 of file fltHeader.h.

◆ _delta_y

double FltHeader::_delta_y

Definition at line 130 of file fltHeader.h.

◆ _delta_z

double FltHeader::_delta_z

Definition at line 147 of file fltHeader.h.

◆ _earth_model

EarthModel FltHeader::_earth_model

Definition at line 144 of file fltHeader.h.

◆ _edit_revision_level

int FltHeader::_edit_revision_level

Definition at line 115 of file fltHeader.h.

◆ _flags

unsigned int FltHeader::_flags

Definition at line 124 of file fltHeader.h.

◆ _format_revision_level

int FltHeader::_format_revision_level

Definition at line 114 of file fltHeader.h.

◆ _lambert_lower_lat

double FltHeader::_lambert_lower_lat

Definition at line 140 of file fltHeader.h.

◆ _lambert_upper_lat

double FltHeader::_lambert_upper_lat

Definition at line 140 of file fltHeader.h.

◆ _last_revision

std::string FltHeader::_last_revision

Definition at line 116 of file fltHeader.h.

◆ _ne_lat

double FltHeader::_ne_lat

Definition at line 138 of file fltHeader.h.

◆ _ne_long

double FltHeader::_ne_long

Definition at line 138 of file fltHeader.h.

◆ _next_adaptive_id

int FltHeader::_next_adaptive_id

Definition at line 145 of file fltHeader.h.

◆ _next_bsp_id

int FltHeader::_next_bsp_id

Definition at line 135 of file fltHeader.h.

◆ _next_cat_id

int FltHeader::_next_cat_id

Definition at line 143 of file fltHeader.h.

◆ _next_clip_id

int FltHeader::_next_clip_id

Definition at line 133 of file fltHeader.h.

◆ _next_curve_id

int FltHeader::_next_curve_id

Definition at line 146 of file fltHeader.h.

◆ _next_dof_id

int FltHeader::_next_dof_id

Definition at line 126 of file fltHeader.h.

◆ _next_face_id

int FltHeader::_next_face_id

Definition at line 120 of file fltHeader.h.

◆ _next_group_id

int FltHeader::_next_group_id

Definition at line 117 of file fltHeader.h.

◆ _next_light_id

int FltHeader::_next_light_id

Definition at line 141 of file fltHeader.h.

◆ _next_lod_id

int FltHeader::_next_lod_id

Definition at line 118 of file fltHeader.h.

◆ _next_mesh_id

int FltHeader::_next_mesh_id

Definition at line 149 of file fltHeader.h.

◆ _next_object_id

int FltHeader::_next_object_id

Definition at line 119 of file fltHeader.h.

◆ _next_path_id

int FltHeader::_next_path_id

Definition at line 132 of file fltHeader.h.

◆ _next_road_id

int FltHeader::_next_road_id

Definition at line 142 of file fltHeader.h.

◆ _next_sound_id

int FltHeader::_next_sound_id

Definition at line 131 of file fltHeader.h.

◆ _next_switch_id

int FltHeader::_next_switch_id

Definition at line 136 of file fltHeader.h.

◆ _next_text_id

int FltHeader::_next_text_id

Definition at line 134 of file fltHeader.h.

◆ _origin_lat

double FltHeader::_origin_lat

Definition at line 139 of file fltHeader.h.

◆ _origin_long

double FltHeader::_origin_long

Definition at line 139 of file fltHeader.h.

◆ _projection_type

ProjectionType FltHeader::_projection_type

Definition at line 125 of file fltHeader.h.

◆ _radius

double FltHeader::_radius

Definition at line 148 of file fltHeader.h.

◆ _sw_lat

double FltHeader::_sw_lat

Definition at line 137 of file fltHeader.h.

◆ _sw_long

double FltHeader::_sw_long

Definition at line 137 of file fltHeader.h.

◆ _sw_x

double FltHeader::_sw_x

Definition at line 129 of file fltHeader.h.

◆ _sw_y

double FltHeader::_sw_y

Definition at line 129 of file fltHeader.h.

◆ _texwhite_new

bool FltHeader::_texwhite_new

Definition at line 123 of file fltHeader.h.

◆ _unit_multiplier

int FltHeader::_unit_multiplier

Definition at line 121 of file fltHeader.h.

◆ _vertex_storage_type

VertexStorageType FltHeader::_vertex_storage_type

Definition at line 127 of file fltHeader.h.

◆ _vertex_units

Units FltHeader::_vertex_units

Definition at line 122 of file fltHeader.h.


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