Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Imports::LWModel Class Reference

LightWave object file loader. More...

#include <LWModel.h>

Inheritance diagram for Teddy::Imports::LWModel:

Inheritance graph
[legend]
Collaboration diagram for Teddy::Imports::LWModel:

Collaboration graph
[legend]
List of all members.

Public Methods

 LWModel (const std::string &name)
 Constructor for submodels, simply calls Model constructor. More...

 LWModel (const std::string &fname, Uint32 options)
 Constructor which loads LightWave object file. More...

virtual ~LWModel ()
 Destructor. More...

LWFilegetFile () const
LWLayergetLayer (int layer_number)
std::string getTag (VX tag_index)
void layer_U2_U2_S0 ()
void layer_U2_U2_VEC12_S0_U2 ()
void tags_d ()

Protected Attributes

LWFilef
U4_to_LWLayer layers
 Layers of Lightwave Object. More...

U4_to_string tags
U4 num_tags

Detailed Description

LightWave object file loader.

Warning:
Many features are not yet implemented
Todo:
Detail polygons

Points

Lines

Polygon tessalation

Layers

Texture and Image maps

Bug:
Destructors missing

This class implements loader for LightWave object files. It is a subclass of Meodel that contains no Elements, only submodels. Each Layer that is encountered in the file is placed into a submesh. If the file has data for arbitrary layer, eg., there is data before layer, a default layer 1 is created and data is placed there.

Data in layers is organized by surfaces. For each surface found in the file a submesh for the layer is created and LWSurface is created. Thus each layer mesh contains no Elements, just submeshes.

The LightWave object file format spesification is available from NewTek internet pages. Parts LightWave object file format specifications are placed into comments into source-code.

Definition at line 81 of file LWModel.h.


Constructor & Destructor Documentation

Teddy::Imports::LWModel::LWModel const std::string &    name
 

Constructor for submodels, simply calls Model constructor.

Definition at line 59 of file LWModel.cpp.

References Teddy::SysSupport::dmsg, and Teddy::SysSupport::M_LWO.

Teddy::Imports::LWModel::LWModel const std::string &    fname,
Uint32    options
 

Constructor which loads LightWave object file.

Definition at line 65 of file LWModel.cpp.

References Teddy::Models::Model::add, Teddy::Imports::did, Teddy::SysSupport::dmsg, Teddy::SysSupport::emsg, f, Teddy::SysSupport::fix_file_name, Teddy::Imports::ID4, layers, Teddy::SysSupport::M_LWO, num_tags, Teddy::MixIn::Options::options, Teddy::Models::Model::setMaterial, Teddy::Models::Model::setupClipRadius, and Vector.

Teddy::Imports::LWModel::~LWModel   [virtual]
 

Destructor.

Definition at line 120 of file LWModel.cpp.


Member Function Documentation

LWFile * Teddy::Imports::LWModel::getFile   const
 

Definition at line 126 of file LWModel.cpp.

References f.

LWLayer * Teddy::Imports::LWModel::getLayer int    layer_number
 

Definition at line 130 of file LWModel.cpp.

References Teddy::SysSupport::emsg, layers, and Teddy::SysSupport::M_LWO.

std::string Teddy::Imports::LWModel::getTag VX    tag_index
 

Definition at line 251 of file LWModel.cpp.

References Teddy::SysSupport::emsg, Teddy::SysSupport::M_LWO, tags, and Teddy::Imports::VX.

void Teddy::Imports::LWModel::layer_U2_U2_S0  
 

LWLO LAYR Chunk

An LAYR chunk must precede each set of PNTS, POLS and CRVS data chunks and indicates to which layer those data belong. An LAYR chunk consists of two unsigned short values and a string. The first is the layer number which should be from 1 to 10 to operate correctly in Modeler. This restriction may be lifted in future versions of the format. The second value is a bitfield where only the lowest order bit is defined and all others should be zero. This bit is one if this is an active layer and zero if it is a background layer. The string which follows is the name of the layer and should be null-terminated and padded to even length.

Definition at line 159 of file LWModel.cpp.

References Teddy::Models::Model::add, Teddy::SysSupport::dmsg, f, Teddy::Models::Model::getClipRadius, layers, Teddy::SysSupport::M_LWO, Teddy::Models::Model::setClipRadius, Teddy::Imports::U2, and Vector.

void Teddy::Imports::LWModel::layer_U2_U2_VEC12_S0_U2  
 

LWO2 Start Layer

LAYR { number[U2], flags[U2], pivot[VEC12], name[S0], parent[U2] }

Signals the start of a new layer. All the data chunks which follow will be included in this layer until another layer chunk is encountered. If data is encountered before a layer chunk, it goes into an arbitrary layer. If the least significant bit of flags is set, the layer is hidden. The parent index indicates the default parent for this layer and can be -1 or missing to indicate no parent.

Definition at line 198 of file LWModel.cpp.

References Teddy::Models::Model::add, Teddy::SysSupport::dmsg, f, Teddy::Models::Model::getClipRadius, layers, Teddy::SysSupport::M_LWO, Teddy::Models::Model::setClipRadius, Teddy::Imports::U2, and Vector.

void Teddy::Imports::LWModel::tags_d  
 

LWO2 Tag Strings

TAGS { tag-string[S0] * }

This chunk lists the tags strings that can be associated with polygons by the PTAG chunk. Strings should be read until as many bytes as the chunk size specifies have been read, and each string is assigned an index starting from zero.

Definition at line 241 of file LWModel.cpp.

References Teddy::SysSupport::dmsg, f, Teddy::SysSupport::M_LWO, num_tags, and tags.


Member Data Documentation

LWFile* Teddy::Imports::LWModel::f [protected]
 

Definition at line 95 of file LWModel.h.

Referenced by getFile, layer_U2_U2_S0, layer_U2_U2_VEC12_S0_U2, LWModel, and tags_d.

U4_to_LWLayer Teddy::Imports::LWModel::layers [protected]
 

Layers of Lightwave Object.

Definition at line 96 of file LWModel.h.

Referenced by getLayer, layer_U2_U2_S0, layer_U2_U2_VEC12_S0_U2, and LWModel.

U4 Teddy::Imports::LWModel::num_tags [protected]
 

Definition at line 98 of file LWModel.h.

Referenced by LWModel, and tags_d.

U4_to_string Teddy::Imports::LWModel::tags [protected]
 

Definition at line 97 of file LWModel.h.

Referenced by getTag, and tags_d.


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