#if !defined(__C_LMTS_MESH_FILE_LOADER_H_INCLUDED__)
#define __C_LMTS_MESH_FILE_LOADER_H_INCLUDED__
#include "IMeshLoader.h"
#include "SMesh.h"
#include "IFileSystem.h"
#include "IVideoDriver.h"
namespace irr
{
namespace scene
{
class CLMTSMeshFileLoader : public IMeshLoader
{
public:
CLMTSMeshFileLoader(io::IFileSystem* fs,
video::IVideoDriver* driver, io::IAttributes* parameters);
virtual ~CLMTSMeshFileLoader();
virtual bool isALoadableFileExtension(const io::path& filename) const;
virtual IAnimatedMesh* createMesh(io::IReadFile* file);
private:
void constructMesh(SMesh* mesh);
void loadTextures(SMesh* mesh);
void cleanup();
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( push, packing )
# pragma pack( 1 )
# define PACK_STRUCT
#elif defined( __GNUC__ )
# define PACK_STRUCT __attribute__((packed))
#else
# error compiler not supported
#endif
struct SLMTSHeader
{
u32 MagicID;
u32 Version;
u32 HeaderSize;
u16 TextureCount;
u16 SubsetCount;
u32 TriangleCount;
u16 SubsetSize;
u16 VertexSize;
} PACK_STRUCT;
struct SLMTSTextureInfoEntry
{
c8 Filename[256];
u16 Flags;
} PACK_STRUCT;
struct SLMTSSubsetInfoEntry
{
u32 Offset;
u32 Count;
u16 TextID1;
u16 TextID2;
} PACK_STRUCT;
struct SLMTSTriangleDataEntry
{
f32 X;
f32 Y;
f32 Z;
f32 U1;
f32 V1;
f32 U2;
f32 V2;
} PACK_STRUCT;
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
# pragma pack( pop, packing )
#endif
#undef PACK_STRUCT
SLMTSHeader Header;
SLMTSTextureInfoEntry* Textures;
SLMTSSubsetInfoEntry* Subsets;
SLMTSTriangleDataEntry* Triangles;
io::IAttributes* Parameters;
video::IVideoDriver* Driver;
io::IFileSystem* FileSystem;
bool FlipEndianess;
};
}
}
#endif