1 // Copyright (C) 2006-2012 Luke Hoschke
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
6 // File format designed by Mark Sibly for the Blitz3D engine and has been
\r
7 // declared public domain
\r
9 #include "IrrCompileConfig.h"
\r
11 #ifndef __C_B3D_MESH_LOADER_H_INCLUDED__
\r
12 #define __C_B3D_MESH_LOADER_H_INCLUDED__
\r
14 #include "IMeshLoader.h"
\r
15 #include "ISceneManager.h"
\r
16 #include "CSkinnedMesh.h"
\r
17 #include "SB3DStructs.h"
\r
18 #include "IReadFile.h"
\r
26 //! Meshloader for B3D format
\r
27 class CB3DMeshFileLoader : public IMeshLoader
\r
32 CB3DMeshFileLoader(scene::ISceneManager* smgr);
\r
34 //! returns true if the file maybe is able to be loaded by this class
\r
35 //! based on the file extension (e.g. ".bsp")
\r
36 bool isALoadableFileExtension(const io::path& filename) const override;
\r
38 //! creates/loads an animated mesh from the file.
\r
39 //! \return Pointer to the created mesh. Returns 0 if loading failed.
\r
40 //! If you no longer need the mesh, you should call IAnimatedMesh::drop().
\r
41 //! See IReferenceCounted::drop() for more information.
\r
42 IAnimatedMesh* createMesh(io::IReadFile* file) override;
\r
47 bool readChunkNODE(CSkinnedMesh::SJoint* InJoint);
\r
48 bool readChunkMESH(CSkinnedMesh::SJoint* InJoint);
\r
49 bool readChunkVRTS(CSkinnedMesh::SJoint* InJoint);
\r
50 bool readChunkTRIS(scene::SSkinMeshBuffer *MeshBuffer, u32 MeshBufferID, s32 Vertices_Start);
\r
51 bool readChunkBONE(CSkinnedMesh::SJoint* InJoint);
\r
52 bool readChunkKEYS(CSkinnedMesh::SJoint* InJoint);
\r
53 bool readChunkANIM();
\r
54 bool readChunkTEXS();
\r
55 bool readChunkBRUS();
\r
57 void readString(core::stringc& newstring);
\r
58 void readFloats(f32* vec, u32 count);
\r
60 core::array<SB3dChunk> B3dStack;
\r
62 core::array<SB3dMaterial> Materials;
\r
63 core::array<SB3dTexture> Textures;
\r
65 core::array<s32> AnimatedVertices_VertexID;
\r
67 core::array<s32> AnimatedVertices_BufferID;
\r
69 core::array<video::S3DVertex2TCoords> BaseVertices;
\r
71 CSkinnedMesh* AnimatedMesh;
\r
72 io::IReadFile* B3DFile;
\r
74 //B3Ds have Vertex ID's local within the mesh I don't want this
\r
75 // Variable needs to be class member due to recursion in calls
\r
79 bool HasVertexColors;
\r
84 } // end namespace scene
\r
85 } // end namespace irr
\r
87 #endif // __C_B3D_MESH_LOADER_H_INCLUDED__
\r