Panda3D
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes

LwoInputFile Class Reference

A specialization of IffInputFile to handle reading a Lightwave Object file. More...

#include "lwoInputFile.h"

Inheritance diagram for LwoInputFile:
IffInputFile TypedObject MemoryBase

List of all members.

Public Member Functions

void align ()
 If the current file pointer is not positioned on an even-byte boundary, reads and discards one byte so that it is.
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.
virtual TypeHandle force_init_type ()
float get_be_float32 ()
 Extracts a 32-bit big-endian single-precision floating-point number.
PN_int16 get_be_int16 ()
 Extracts a signed 16-bit big-endian integer.
PN_int32 get_be_int32 ()
 Extracts a signed 32-bit big-endian integer.
PN_uint16 get_be_uint16 ()
 Extracts an unsigned 16-bit big-endian integer.
PN_uint32 get_be_uint32 ()
 Extracts an unsigned 32-bit big-endian integer.
int get_best_parent_from_Set (const std::set< int > &) const
size_t get_bytes_read () const
 Returns the number of bytes read so far from the input file.
const Filenameget_filename () const
 Returns the filename that the InputFile is currently opened on, if available.
Filename get_filename ()
 Reads a Lightwave platform-neutral filename and converts it to a Panda platform-neutral filename.
IffId get_id ()
 Extracts a 4-character IFF ID.
PN_int8 get_int8 ()
 Extracts a signed 8-bit integer.
double get_lwo_version () const
 Returns the version of the Lightwave file being read.
string get_string ()
 Extracts a null-terminated string.
virtual TypeHandle get_type () const
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
PN_uint8 get_uint8 ()
 Extracts an unsigned 8-bit integer.
LVecBase3f get_vec3 ()
 Reads a three-component vector of floats.
int get_vx ()
 Reads a Lightwave variable-length index.
bool is_eof () const
 Returns true if the last read operation failed because of reaching EOF, false otherwise.
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.
bool open_read (Filename filename)
 Attempts to open the indicated filename for reading.
void operator delete (void *ptr)
void operator delete (void *ptr, void *)
void operator delete[] (void *, void *)
void operator delete[] (void *ptr)
void * operator new (size_t size, void *ptr)
void * operator new (size_t size)
void * operator new[] (size_t size)
void * operator new[] (size_t size, void *ptr)
 PT (IffChunk) get_subchunk(IffChunk *context)
 PT (IffChunk) get_chunk()
bool read_byte (char &byte)
 Reads a single byte.
bool read_bytes (Datagram &datagram, int length)
 Reads a series of bytes, and stores them in the indicated Datagram.
void set_filename (const Filename &filename)
 Indicates the filename that the InputFile is currently opened on.
void set_input (istream *input, bool owns_istream)
 Sets up the input to use an arbitrary istream.
void set_lwo_version (double version)
 Changes the version number reported for the Lightwave file.
bool skip_bytes (int length)
 Reads a series of bytes, but does not store them.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96.

Protected Member Functions

virtual IffChunkmake_new_chunk (IffId id)
 Allocates and returns a new chunk of the appropriate type based on the given ID.

Protected Attributes

size_t _bytes_read
bool _eof
Filename _filename
istream * _input
bool _owns_istream
bool _unexpected_eof

Detailed Description

A specialization of IffInputFile to handle reading a Lightwave Object file.

Definition at line 29 of file lwoInputFile.h.


Member Function Documentation

void IffInputFile::align ( ) [inline, inherited]

If the current file pointer is not positioned on an even-byte boundary, reads and discards one byte so that it is.

Definition at line 68 of file iffInputFile.I.

References IffInputFile::get_int8().

Referenced by IffInputFile::get_string(), and IffGenericChunk::read_iff().

TypedObject * TypedObject::as_typed_object ( ) [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 99 of file typedObject.I.

const TypedObject * TypedObject::as_typed_object ( ) const [inline, inherited]

Returns the object, upcast (if necessary) to a TypedObject pointer.

Definition at line 110 of file typedObject.I.

float IffInputFile::get_be_float32 ( ) [inherited]
PN_int16 IffInputFile::get_be_int16 ( ) [inherited]

Extracts a signed 16-bit big-endian integer.

Definition at line 129 of file iffInputFile.cxx.

References DatagramIterator::get_be_int16(), and IffInputFile::read_bytes().

Referenced by LwoSurfaceSidedness::read_iff(), LwoPolygonTags::read_iff(), and LwoPolygons::read_iff().

PN_int32 IffInputFile::get_be_int32 ( ) [inherited]

Extracts a signed 32-bit big-endian integer.

Definition at line 144 of file iffInputFile.cxx.

References DatagramIterator::get_be_int32(), and IffInputFile::read_bytes().

Referenced by LwoClip::read_iff().

PN_uint16 IffInputFile::get_be_uint16 ( ) [inherited]
PN_uint32 IffInputFile::get_be_uint32 ( ) [inherited]

Extracts an unsigned 32-bit big-endian integer.

Definition at line 174 of file iffInputFile.cxx.

References DatagramIterator::get_be_uint32(), and IffInputFile::read_bytes().

size_t IffInputFile::get_bytes_read ( ) const [inline, inherited]
Filename LwoInputFile::get_filename ( )

Reads a Lightwave platform-neutral filename and converts it to a Panda platform-neutral filename.

Definition at line 90 of file lwoInputFile.cxx.

References IffInputFile::get_string().

Referenced by LwoStillImage::read_iff().

const Filename & IffInputFile::get_filename ( ) const [inline, inherited]

Returns the filename that the InputFile is currently opened on, if available.

Definition at line 34 of file iffInputFile.I.

IffId IffInputFile::get_id ( ) [inherited]
PN_int8 IffInputFile::get_int8 ( ) [inherited]

Extracts a signed 8-bit integer.

Definition at line 99 of file iffInputFile.cxx.

References DatagramIterator::get_int8(), and IffInputFile::read_bytes().

Referenced by IffInputFile::align().

double LwoInputFile::get_lwo_version ( ) const [inline]

Returns the version of the Lightwave file being read.

This is unknown until the header record has been read; then it will be set by the header.

Definition at line 24 of file lwoInputFile.I.

Referenced by LwoPolygons::read_iff().

string IffInputFile::get_string ( ) [inherited]
int TypedObject::get_type_index ( ) const [inline, inherited]

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 52 of file typedObject.I.

References TypeHandle::get_index().

PN_uint8 IffInputFile::get_uint8 ( ) [inherited]

Extracts an unsigned 8-bit integer.

Definition at line 114 of file iffInputFile.cxx.

References DatagramIterator::get_int8(), and IffInputFile::read_bytes().

LVecBase3f LwoInputFile::get_vec3 ( )
int LwoInputFile::get_vx ( )
static void LwoInputFile::init_type ( ) [inline, static]

This function is declared non-inline to work around a compiler bug in g++ 2.96.

Making it inline seems to cause problems in the optimizer.

Reimplemented from IffInputFile.

Definition at line 55 of file lwoInputFile.h.

bool IffInputFile::is_eof ( ) const [inline, inherited]
bool TypedObject::is_exact_type ( TypeHandle  handle) const [inline, inherited]
bool TypedObject::is_of_type ( TypeHandle  handle) const [inline, inherited]

Returns true if the current object is or derives from the indicated type.

Definition at line 63 of file typedObject.I.

References TypeHandle::is_derived_from().

Referenced by EggSliderData::add_back_pointer(), EggJointData::add_back_pointer(), CIntervalManager::add_c_interval(), XFileNode::add_child(), CollisionTraverser::add_collider(), CollisionHandlerPhysical::add_collider(), EggXfmSAnim::add_data(), CharacterJointBundle::add_node(), NonlinearImager::add_screen(), EggGroupNode::apply_first_attribute(), EggGroupNode::apply_last_attribute(), DeferredNodeProperty::apply_to_node(), RecorderController::begin_playback(), NodePath::clear_clip_plane(), EggGroupNode::clear_connected_shading(), NodePath::clear_light(), EggBase::convert_paths(), NodePath::decode_from_bam_stream(), VrpnClient::disconnect_device(), PhysicsManager::do_physics(), GraphicsStateGuardian::fetch_specified_part(), EggRenderState::fill_state(), AnimBundleNode::find_anim_bundle(), EggGroupNode::find_coordsys_entry(), XFile::find_data_object(), Character::find_joint(), EggGroupNode::find_materials(), Character::find_slider(), XFile::find_template(), EggGroupNode::find_textures(), EggMaterialCollection::find_used_materials(), EggTextureCollection::find_used_textures(), EggGroupNode::force_filenames(), EggJointData::force_initial_rest_frame(), WindowFramework::get_aspect_2d(), EggPoolUniquifier::get_category(), EggGroupUniquifier::get_category(), EggGroupNode::get_connected_shading(), PandaFramework::get_mouse(), FactoryParams::get_param_of_type(), EggGroupNode::has_absolute_pathnames(), NodePath::has_clip_plane(), NodePath::has_clip_plane_off(), NodePath::has_light(), PandaFramework::hide_collision_solids(), x11GraphicsWindow::open_window(), eglGraphicsWindow::open_window(), EggNode::parse_egg(), CharacterMaker::part_to_node(), EggGroupNode::post_apply_flat_attribute(), EggBinner::prepare_node(), PortalClipper::prepare_portal(), NodePath::project_texture(), EggMatrixTablePointer::quantize_channels(), ParametricCurveCollection::r_add_curves(), SceneGraphReducer::r_collect_vertex_data(), EggGroupNode::r_load_externals(), EggGroupNode::rebuild_vertex_pools(), EggGroupNode::recompute_polygon_normals(), EggGroupNode::remove_invalid_primitives(), EggGroupNode::remove_unused_vertices(), EggLoader::reparent_decals(), EggMaterialCollection::replace_materials(), EggTextureCollection::replace_textures(), EggGroupNode::resolve_filenames(), EggGroupNode::reverse_vertex_ordering(), NodePath::set_clip_plane(), NodePath::set_clip_plane_off(), NodePath::set_light(), ProjectionScreen::set_projector(), NonlinearImager::set_source_camera(), EggXfmSAnim::set_value(), NonlinearImager::set_viewer_camera(), PandaFramework::show_collision_solids(), BamCache::store(), XFileToEggConverter::strip_nodes(), EggGroupNode::strip_normals(), DataGraphTraverser::traverse(), DataGraphTraverser::traverse_below(), EggGroupNode::triangulate_polygons(), EggGroupNode::unify_attributes(), EggNameUniquifier::uniquify(), NodeCullCallbackData::upcall(), PhysicsCollisionHandler::validate_target(), EggXfmSAnim::write(), EggGroup::write(), EggToDXFLayer::write_3d_face(), and EggToDXFLayer::write_entities().

IffChunk * LwoInputFile::make_new_chunk ( IffId  id) [protected, virtual]

Allocates and returns a new chunk of the appropriate type based on the given ID.

Reimplemented from IffInputFile.

Definition at line 113 of file lwoInputFile.cxx.

bool IffInputFile::open_read ( Filename  filename) [inherited]

Attempts to open the indicated filename for reading.

Returns true if successful, false otherwise.

Definition at line 57 of file iffInputFile.cxx.

References VirtualFileSystem::get_global_ptr(), VirtualFileSystem::open_read_file(), Filename::set_binary(), IffInputFile::set_filename(), and IffInputFile::set_input().

Referenced by LwoToEggConverter::convert_file().

bool IffInputFile::read_byte ( char &  byte) [inherited]

Reads a single byte.

Returns true if successful, false otherwise.

Definition at line 348 of file iffInputFile.cxx.

References IffInputFile::is_eof().

Referenced by IffInputFile::get_string(), and IffInputFile::skip_bytes().

bool IffInputFile::read_bytes ( Datagram datagram,
int  length 
) [inherited]
void IffInputFile::set_filename ( const Filename filename) [inline, inherited]

Indicates the filename that the InputFile is currently opened on.

Definition at line 23 of file iffInputFile.I.

Referenced by IffInputFile::open_read().

void IffInputFile::set_input ( istream *  input,
bool  owns_istream 
) [inherited]

Sets up the input to use an arbitrary istream.

If owns_istream is true, the istream will be deleted (via vfs->close_read_file()) when the IffInputFile destructs.

Definition at line 81 of file iffInputFile.cxx.

References VirtualFileSystem::close_read_file(), and VirtualFileSystem::get_global_ptr().

Referenced by IffInputFile::open_read().

void LwoInputFile::set_lwo_version ( double  lwo_version) [inline]

Changes the version number reported for the Lightwave file.

Normally this is only called by LwoHeader as it is read.

Definition at line 37 of file lwoInputFile.I.

Referenced by LwoHeader::read_iff().

bool IffInputFile::skip_bytes ( int  length) [inherited]

Reads a series of bytes, but does not store them.

Returns true if successful, false otherwise.

Definition at line 392 of file iffInputFile.cxx.

References IffInputFile::is_eof(), and IffInputFile::read_byte().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations