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 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... | |
string | get_color_name (int color_index) const |
Returns the name associated with the given color, if any. More... | |
FltEyepoint * | get_eyepoint (int n) |
Returns the nth eyepoint in the eyepoint/trackplane palette. More... | |
const Filename & | get_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... | |
FltInstanceDefinition * | get_instance (int instance_index) const |
Returns the instance subtree associated with the given index, or NULL if there is no such instance. More... | |
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. More... | |
FltMaterial * | get_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... | |
PathReplace * | get_path_replace () |
Returns a pointer to the PathReplace object associated with this converter. More... | |
const PathReplace * | get_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... | |
FltTexture * | get_texture (int texture_index) const |
Returns the texture associated with the given index, or NULL if there is no such texture. More... | |
FltTrackplane * | get_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... | |
FltVertex * | get_vertex (int n) const |
Returns the nth vertex of the vertex palette. More... | |
FltVertex * | get_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 (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 (ostream &out) |
Attempts to write a complete Flt file to the already-opened stream. More... | |
![]() | |
FltBeadID (FltHeader *header) | |
const string & | get_id () const |
Returns the id (name) of this particular bead. More... | |
virtual void | output (ostream &out) const |
Writes a quick one-line description of the record, but not its children. More... | |
void | set_id (const string &id) |
Changes the id (name) of this particular bead. More... | |
![]() | |
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... | |
FltTransformRecord * | get_transform_step (int n) |
Returns the nth individual step that defines the net transform on this bead. More... | |
const FltTransformRecord * | get_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... | |
![]() | |
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 string &name=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... | |
FltRecord * | get_ancillary (int n) const |
Returns the nth unsupported ancillary record of this record. More... | |
FltRecord * | get_child (int n) const |
Returns the nth child of this record. More... | |
const string & | get_comment () const |
Retrieves the comment for this record, or empty string if the record has no comment. More... | |
FltRecord * | get_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... | |
FltRecord * | get_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 string &comment) |
Changes the comment for this record. More... | |
virtual void | write (ostream &out, int indent_level=0) const |
Writes a multiple-line description of the record and all of its children. More... | |
![]() | |
TypedReferenceCount (const TypedReferenceCount ©) | |
void | operator= (const TypedReferenceCount ©) |
![]() | |
TypedObject (const TypedObject ©) | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_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... | |
void | operator= (const TypedObject ©) |
![]() | |
int | get_ref_count () const |
Returns the current reference count. More... | |
WeakReferenceList * | get_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 | 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... | |
void | weak_ref (WeakPointerToVoid *ptv) |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref (WeakPointerToVoid *ptv) |
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 TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
static TypeHandle | get_class_type () |
static void | init_type () |
![]() | |
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 TypeHandle | get_class_type () |
static void | init_type () |
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.
References apply_converted_filenames().
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.
References remove_instance().
Referenced by clear_instances().
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.
References remove_light_source().
Referenced by clear_light_sources(), and get_trackplane().
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.
References remove_material().
Referenced by clear_materials(), and get_trackplane().
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.
References remove_texture().
Referenced by clear_textures(), and get_trackplane().
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.
References get_vertex_by_offset().
Referenced by clear_vertices().
|
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(), FltRecord::apply_converted_filenames(), and set_path_replace().
Referenced by FltHeader().
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(), get_units(), max_flt_version(), and min_flt_version().
Referenced by max_flt_version().
void FltHeader::clear_instances | ( | ) |
Removes all instance subtrees from the instance pool.
Definition at line 506 of file fltHeader.cxx.
References add_instance().
Referenced by get_instance().
void FltHeader::clear_light_sources | ( | ) |
Removes all light sources from the palette.
Definition at line 1102 of file fltHeader.cxx.
References add_light_source().
Referenced by get_light_source().
void FltHeader::clear_materials | ( | ) |
Removes all materials from the palette.
Definition at line 958 of file fltHeader.cxx.
References add_material().
Referenced by get_material().
void FltHeader::clear_textures | ( | ) |
Removes all textures from the palette.
Definition at line 1030 of file fltHeader.cxx.
References add_texture().
Referenced by get_texture().
void FltHeader::clear_vertices | ( | ) |
Removes all vertices from the vertex palette.
Definition at line 562 of file fltHeader.cxx.
References add_vertex().
Referenced by get_trackplane(), and get_vertex().
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(), Filename::get_dirname(), and set_flt_filename().
Referenced by get_path_replace().
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.
References get_flt_version().
Referenced by set_auto_attr_update().
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_closest_rgb(), get_num_color_entries(), and get_num_color_shades().
Referenced by get_color_name().
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 get_closest_color().
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(), get_num_colors(), and get_rgb().
Referenced by get_color(), get_num_color_shades(), and get_num_colors().
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(), and get_rgb().
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.
References get_closest_color().
Referenced by has_color_name().
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(), and get_num_trackplanes().
Referenced by 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.
References read_flt().
Referenced by set_flt_filename().
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.
References set_flt_version().
Referenced by check_version(), get_auto_attr_update(), and get_trackplane().
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.
References clear_instances().
Referenced by has_instance(), 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.
References clear_light_sources().
Referenced by has_light_source().
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.
References clear_materials().
Referenced by has_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.
References get_num_color_shades().
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.
References get_color().
Referenced by get_closest_color(), get_closest_rgb(), get_color(), get_num_color_entries(), 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_color(), and get_num_color_shades().
Referenced by get_color(), get_offset_by_vertex(), 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.
References get_eyepoint().
Referenced by get_eyepoint(), get_trackplane(), and set_eyepoint_trackplane_palette().
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.
References get_trackplane().
Referenced by get_eyepoint(), and 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.
References get_vertex().
Referenced by remove_instance().
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.
References get_num_colors().
Referenced by get_vertex_by_offset().
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.
Referenced by set_path_replace().
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.
References convert_path().
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(), get_num_colors(), and has_color_name().
Referenced by get_color(), and 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(), and has_material().
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.
References clear_textures().
Referenced by has_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 FltRecord::add_ancillary(), Datagram::add_be_float64(), Datagram::add_be_int16(), Datagram::add_be_int32(), Datagram::add_be_uint16(), Datagram::add_be_uint32(), Datagram::add_fixed_string(), Datagram::add_int8(), add_light_source(), add_material(), add_texture(), FltRecordWriter::advance(), FltMaterial::build_14_record(), FltRecord::check_remaining_size(), clear_vertices(), get_flt_version(), FltRecordReader::get_iterator(), get_num_eyepoints(), get_num_trackplanes(), FltRecordReader::get_opcode(), FltVertex::get_record_length(), FltRecordReader::get_record_length(), Datagram::pad_bytes(), FltRecordWriter::set_opcode(), DatagramIterator::skip_bytes(), FltRecordWriter::update_datagram(), and FltRecordWriter::write_record().
Referenced by 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.
References has_instance().
Referenced by check_version().
FltVertex * FltHeader::get_vertex | ( | int | n | ) | const |
Returns the nth vertex of the vertex palette.
Definition at line 551 of file fltHeader.cxx.
References clear_vertices().
Referenced by get_num_vertices().
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.
References get_offset_by_vertex().
Referenced by add_vertex().
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.
References set_eyepoint_trackplane_palette().
Referenced by remove_light_source().
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.
References get_color_name().
Referenced by get_rgb().
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.
References get_instance().
Referenced by get_units().
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.
References get_light_source().
Referenced by remove_texture().
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.
References get_material().
Referenced by get_rgb().
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.
References get_texture().
Referenced by remove_material().
|
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.
References check_version().
Referenced by check_version(), and 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.
References max_flt_version().
Referenced by check_version(), and set_flt_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().
Referenced by get_flt_filename().
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 write_flt().
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.
References get_num_vertices().
Referenced by add_instance().
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.
References got_eyepoint_trackplane_palette().
Referenced by add_light_source().
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.
References has_texture().
Referenced by add_material().
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.
References has_light_source().
Referenced by add_texture().
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.
References get_auto_attr_update().
Referenced by write_flt().
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.
References get_num_eyepoints().
Referenced by got_eyepoint_trackplane_palette().
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.
References get_flt_filename().
Referenced by convert_path().
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.
References min_flt_version().
Referenced by get_flt_version().
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.
References get_path_replace().
Referenced by apply_converted_filenames().
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().
Referenced by read_flt().
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 set_auto_attr_update().