ODFL loader

From ODF::Wiki

Jump to: navigation, search
ODFL loader

Flight Back ODFL loader on OpenSuSE 11.1
Information
Producer: The Open Descent Foundation
Developers: King Lo, D.Cent
Current version: none
Latest release: none
Operating systems: Linux, Windows, Mac
Category: File Loader
License: GPL version 3
Languages: C++
Website: none yet
Project page: click here

The ODFL loader is a library which is used by Flight Back to import Descent 1,2,3 levels. It is a library that you need to link against if you want to read it with irrlicht.

The ODFL loader loads the ODFL mesh into irrlicht to let you handle it like a mesh of any other file type. Note that the ODFL file must end on ".odfl" to be recognized as such.

[edit] Basic Functionality

For the ODFL loader, the following functions had to be implemented:

class CODFLMeshFileLoader : public IMeshLoader
{
public:
        CODFLMeshFileLoader(scene::ISceneManager* smgr);
        virtual bool isALoadableFileExtension(const c8* fileName) const;
        virtual IAnimatedMesh* createMesh(io::IReadFile* file);
private:
 // ... helper structs and routines
}

Since ODFL also contains format specific data (aka. entities, e.g. objects) the reader reads all the data from the file and puts it into a special SMesh:

class CODFLMesh : public SMesh
{
 // ... extra definitions
}

Read the mesh like

scene::IAnimatedMesh* odfllevelmesh = smgr->getMesh("testlevel.odfl");

and add the following lines above to allow irrlicht to access the ODFL loader:

CODFLMeshFileLoader OdflLoader(smgr);
smgr->addExternalMeshLoader(&OdflLoader);

Remember to include and link against the CODFLMeshFileLoader library. For more Information, read the README file.

[edit] Related Links

Personal tools