]> git.lizzy.rs Git - irrlicht.git/blob - source/Irrlicht/CB3DMeshFileLoader.h
765405f7a1f65b2f9d7c6cbc74fd43d50b92200f
[irrlicht.git] / source / Irrlicht / CB3DMeshFileLoader.h
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
4 \r
5 // B3D Mesh loader\r
6 // File format designed by Mark Sibly for the Blitz3D engine and has been\r
7 // declared public domain\r
8 \r
9 #include "IrrCompileConfig.h"\r
10 \r
11 #ifndef __C_B3D_MESH_LOADER_H_INCLUDED__\r
12 #define __C_B3D_MESH_LOADER_H_INCLUDED__\r
13 \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
19 \r
20 namespace irr\r
21 {\r
22 \r
23 namespace scene\r
24 {\r
25 \r
26 //! Meshloader for B3D format\r
27 class CB3DMeshFileLoader : public IMeshLoader\r
28 {\r
29 public:\r
30 \r
31         //! Constructor\r
32         CB3DMeshFileLoader(scene::ISceneManager* smgr);\r
33 \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
37 \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
43 \r
44 private:\r
45 \r
46         bool load();\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
56 \r
57         void readString(core::stringc& newstring);\r
58         void readFloats(f32* vec, u32 count);\r
59 \r
60         core::array<SB3dChunk> B3dStack;\r
61 \r
62         core::array<SB3dMaterial> Materials;\r
63         core::array<SB3dTexture> Textures;\r
64 \r
65         core::array<s32> AnimatedVertices_VertexID;\r
66 \r
67         core::array<s32> AnimatedVertices_BufferID;\r
68 \r
69         core::array<video::S3DVertex2TCoords> BaseVertices;\r
70 \r
71         CSkinnedMesh*   AnimatedMesh;\r
72         io::IReadFile*  B3DFile;\r
73 \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
76         u32 VerticesStart;\r
77 \r
78         bool NormalsInFile;\r
79         bool HasVertexColors;\r
80         bool ShowWarning;\r
81 };\r
82 \r
83 \r
84 } // end namespace scene\r
85 } // end namespace irr\r
86 \r
87 #endif // __C_B3D_MESH_LOADER_H_INCLUDED__\r
88 \r