Cafu Engine
ModelLoaderT Class Referenceabstract

The base class for importing arbitrary model files into Cafu models. More...

#include "Loader.hpp"

Inheritance diagram for ModelLoaderT:

Classes

class  LoadErrorT
 A class that is thrown on model load errors. More...
 
class  UserCallbacksI
 An interface for user callbacks. More...
 

Public Types

enum  FlagsT { NONE =0x00, REMOVE_DEGEN_TRIANGLES =0x01, REMOVE_UNUSED_VERTICES =0x02, REMOVE_UNUSED_WEIGHTS =0x04 }
 

Public Member Functions

 ModelLoaderT (const std::string &FileName, int Flags)
 The constructor. More...
 
virtual ~ModelLoaderT ()
 The virtual destructor. More...
 
virtual const std::string & GetFileName () const
 Returns the file name of the imported model. More...
 
virtual void Load (ArrayT< CafuModelT::JointT > &Joints, ArrayT< CafuModelT::MeshT > &Meshes, ArrayT< CafuModelT::AnimT > &Anims, MaterialManagerImplT &MaterialMan)=0
 Actually loads the file data into the appropriate parts of the Cafu model. More...
 
virtual void Load (ArrayT< CafuModelT::SkinT > &Skins, const MaterialManagerImplT &MaterialMan)=0
 Loads the skins of the Cafu model. More...
 
virtual void Load (ArrayT< CafuModelT::GuiFixtureT > &GuiFixtures)=0
 Loads the GUI fixtures of the Cafu model. More...
 
virtual void Load (ArrayT< CafuModelT::ChannelT > &Channels)=0
 Loads the animation channels (groups of joints) of the Cafu model. More...
 
virtual bool Load (unsigned int Level, CafuModelT *&DlodModel, float &DlodDist)=0
 Loads the dlod-model and dlod-distance at the given level. More...
 
virtual void Postprocess (ArrayT< CafuModelT::MeshT > &Meshes)
 Postprocesses the file data according to flags given to the constructor. More...
 

Protected Member Functions

void RemoveDegenTriangles (CafuModelT::MeshT &Mesh)
 Removes triangles with zero-length edges from the given mesh. More...
 
void RemoveUnusedVertices (CafuModelT::MeshT &Mesh)
 Removes unused vertices from the given mesh. More...
 
void AbandonDuplicateWeights (CafuModelT::MeshT &Mesh)
 Makes sure that vertices that are geo-dups of each other refer to the same set of weights. More...
 
void RemoveUnusedWeights (CafuModelT::MeshT &Mesh)
 Removes unused weights from the given mesh (should be called after RemoveUnusedVertices()). More...
 
MaterialT CreateDefaultMaterial (const std::string &MatName, bool EditorSave=true) const
 Creates and returns a fail-safe wire-frame material with the given name, for use when a material with more detailed or more specific settings is not available. More...
 

Protected Attributes

const std::string m_FileName
 
const int m_Flags
 

Detailed Description

The base class for importing arbitrary model files into Cafu models.

The concrete derived classes determine which specific file format is imported.

Constructor & Destructor Documentation

ModelLoaderT::ModelLoaderT ( const std::string &  FileName,
int  Flags 
)

The constructor.

virtual ModelLoaderT::~ModelLoaderT ( )
inlinevirtual

The virtual destructor.

Member Function Documentation

void ModelLoaderT::AbandonDuplicateWeights ( CafuModelT::MeshT Mesh)
protected

Makes sure that vertices that are geo-dups of each other refer to the same set of weights.

MaterialT ModelLoaderT::CreateDefaultMaterial ( const std::string &  MatName,
bool  EditorSave = true 
) const
protected

Creates and returns a fail-safe wire-frame material with the given name, for use when a material with more detailed or more specific settings is not available.

virtual const std::string& ModelLoaderT::GetFileName ( ) const
inlinevirtual

Returns the file name of the imported model.

This method is reimplemented in the LoaderDlodT class.

Reimplemented in LoaderDlodT.

virtual void ModelLoaderT::Load ( ArrayT< CafuModelT::JointT > &  Joints,
ArrayT< CafuModelT::MeshT > &  Meshes,
ArrayT< CafuModelT::AnimT > &  Anims,
MaterialManagerImplT MaterialMan 
)
pure virtual

Actually loads the file data into the appropriate parts of the Cafu model.

Implemented in LoaderDummyT, LoaderHL1mdlT, LoaderHL2mdlT, LoaderCafuT, LoaderDlodT, LoaderFbxT, LoaderAseT, LoaderMdlT, LoaderMd5T, and LoaderLwoT.

virtual void ModelLoaderT::Load ( ArrayT< CafuModelT::SkinT > &  Skins,
const MaterialManagerImplT MaterialMan 
)
pure virtual

Loads the skins of the Cafu model.

Implemented in LoaderDummyT, LoaderHL1mdlT, LoaderHL2mdlT, LoaderCafuT, LoaderDlodT, LoaderFbxT, LoaderAseT, LoaderMdlT, LoaderMd5T, and LoaderLwoT.

virtual void ModelLoaderT::Load ( ArrayT< CafuModelT::GuiFixtureT > &  GuiFixtures)
pure virtual

Loads the GUI fixtures of the Cafu model.

Implemented in LoaderDummyT, LoaderHL1mdlT, LoaderHL2mdlT, LoaderCafuT, LoaderDlodT, LoaderFbxT, LoaderAseT, LoaderMdlT, LoaderMd5T, and LoaderLwoT.

virtual void ModelLoaderT::Load ( ArrayT< CafuModelT::ChannelT > &  Channels)
pure virtual

Loads the animation channels (groups of joints) of the Cafu model.

Implemented in LoaderDummyT, LoaderHL1mdlT, LoaderHL2mdlT, LoaderCafuT, LoaderDlodT, LoaderFbxT, LoaderAseT, LoaderMdlT, LoaderMd5T, and LoaderLwoT.

virtual bool ModelLoaderT::Load ( unsigned int  Level,
CafuModelT *&  DlodModel,
float &  DlodDist 
)
pure virtual

Loads the dlod-model and dlod-distance at the given level.

Implemented in LoaderDummyT, LoaderHL1mdlT, LoaderHL2mdlT, LoaderCafuT, LoaderDlodT, LoaderFbxT, LoaderAseT, LoaderMdlT, LoaderMd5T, and LoaderLwoT.

void ModelLoaderT::Postprocess ( ArrayT< CafuModelT::MeshT > &  Meshes)
virtual

Postprocesses the file data according to flags given to the constructor.

Reimplemented in LoaderMdlT.

void ModelLoaderT::RemoveDegenTriangles ( CafuModelT::MeshT Mesh)
protected

Removes triangles with zero-length edges from the given mesh.

This is especially important because such triangles "connect" two vertices that the CafuModelT code considers as "geometrical duplicates" of each other. That is, a single triangle refers to the same vertex coordinate twice, which triggers related assertions in debug builds.

void ModelLoaderT::RemoveUnusedVertices ( CafuModelT::MeshT Mesh)
protected

Removes unused vertices from the given mesh.

void ModelLoaderT::RemoveUnusedWeights ( CafuModelT::MeshT Mesh)
protected

Removes unused weights from the given mesh (should be called after RemoveUnusedVertices()).


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