All pastes #969005 Raw Edit

Stuff

public cpp v1 · immutable
·published 2008-04-03 13:03 UTC
rendered paste body
#include "irrlicht/irrlicht.h"#include "irrlicht/IMeshLoader.h"#include <string>#include <vector>namespace irr{namespace scene{class CM2MeshFileLoader : public IMeshLoader{public:	//! Constructor	CM2MeshFileLoader(IrrlichtDevice* device);	//! destructor	virtual ~CM2MeshFileLoader();	//! returns true if the file maybe is able to be loaded by this class	//! based on the file extension (e.g. ".cob")	virtual bool isALoadableFileExtension(const c8* fileName)const;	//! creates/loads an animated mesh from the file.	//! \return Pointer to the created mesh. Returns 0 if loading failed.	//! If you no longer need the mesh, you should call IAnimatedMesh::drop().	//! See IUnknown::drop() for more information.	virtual scene::IAnimatedMesh* createMesh(irr::io::IReadFile* file);private:struct ModelHeader {	c8 id[4];	u8 version[4];	u32 nameLength;	u32 nameOfs;	u32 type;	u32 nGlobalSequences;	u32 ofsGlobalSequences;	u32 nAnimations;	u32 ofsAnimations;	u32 nC;	u32 ofsC;	u32 nD;	u32 ofsD;	u32 nBones;	u32 ofsBones;	u32 nF;	u32 ofsF;	u32 nVertices;	u32 ofsVertices;	u32 nViews;	u32 ofsViews;	u32 nColors;	u32 ofsColors;	u32 nTextures;	u32 ofsTextures;	u32 nTransparency; // H	u32 ofsTransparency;	u32 nI;   // always unused ?	u32 ofsI;	u32 nTexAnims;	// J	u32 ofsTexAnims;	u32 nTexReplace;	u32 ofsTexReplace;	u32 nTexFlags;	u32 ofsTexFlags;	u32 nY;	u32 ofsY;	u32 nTexLookup;	u32 ofsTexLookup;	u32 nTexUnitLookup;		// L	u32 ofsTexUnitLookup;	u32 nTransparencyLookup; // M	u32 ofsTransparencyLookup;	u32 nTexAnimLookup;	u32 ofsTexAnimLookup;	f32 floats[14];	u32 nBoundingTriangles;	u32 ofsBoundingTriangles;	u32 nBoundingVertices;	u32 ofsBoundingVertices;	u32 nBoundingNormals;	u32 ofsBoundingNormals;	u32 nAttachments; // O	u32 ofsAttachments;	u32 nAttachLookup; // P	u32 ofsAttachLookup;	u32 nQ; // Q	u32 ofsQ;	u32 nLights; // R	u32 ofsLights;	u32 nCameras; // S	u32 ofsCameras;	u32 nT;	u32 ofsT;	u32 nRibbonEmitters; // U	u32 ofsRibbonEmitters;	u32 nParticleEmitters; // V	u32 ofsParticleEmitters;} header;struct ModelVertex {	core::vector3df pos;//Use Irrlicht Vector here!	u8 weights[4];	u8 bones[4];	core::vector3df normal;//Use Irrlicht Vector here!	core::vector2df texcoords;//Use Irrlicht Vector here!	u32 unk1, unk2; // always 0,0 so this is probably unused};struct ModelView {    u32 nIndex, ofsIndex; // Vertices in this model (index into vertices[])    u32 nTris, ofsTris;	 // indices    u32 nProps, ofsProps; // additional vtx properties    u32 nSub, ofsSub;	 // materials/renderops/submeshes    u32 nTex, ofsTex;	 // material properties/textures	s32 lod;				 // LOD bias?};//	io::IFileSystem* FileSystem;	IrrlichtDevice* Device;//    scene::IMeshManipulator* Manipulator;    std::string M2MeshName;    SAnimatedMesh* aniMesh;    SMesh* Mesh;    //Taken from the Model file, thus m2M*    std::vector<ModelVertex> M2MVertices;    std::vector<ModelView> M2MViews;    std::vector<u16> M2MIndices;    std::vector<u16> M2MTriangles;    std::vector<u16> M2MTextureLookup;    //Used for the Mesh, thus m2_noM_*    core::array<video::S3DVertex> M2Vertices;    core::array<u16> M2Indices;};}//namespace scene}//namespace irr