aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/others/irrlicht-1.8.1/source/Irrlicht/CIrrMeshFileLoader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/others/irrlicht-1.8.1/source/Irrlicht/CIrrMeshFileLoader.h')
-rw-r--r--src/others/irrlicht-1.8.1/source/Irrlicht/CIrrMeshFileLoader.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/others/irrlicht-1.8.1/source/Irrlicht/CIrrMeshFileLoader.h b/src/others/irrlicht-1.8.1/source/Irrlicht/CIrrMeshFileLoader.h
new file mode 100644
index 0000000..39b2332
--- /dev/null
+++ b/src/others/irrlicht-1.8.1/source/Irrlicht/CIrrMeshFileLoader.h
@@ -0,0 +1,90 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __C_IRR_MESH_FILE_LOADER_H_INCLUDED__
6#define __C_IRR_MESH_FILE_LOADER_H_INCLUDED__
7
8#include "IMeshLoader.h"
9#include "IFileSystem.h"
10#include "IVideoDriver.h"
11#include "irrString.h"
12#include "SMesh.h"
13#include "SMeshBuffer.h"
14#include "CDynamicMeshBuffer.h"
15#include "ISceneManager.h"
16
17namespace irr
18{
19namespace scene
20{
21
22
23//! Meshloader capable of loading .irrmesh meshes, the Irrlicht Engine mesh format for static meshes
24class CIrrMeshFileLoader : public IMeshLoader
25{
26public:
27
28 //! Constructor
29 CIrrMeshFileLoader(scene::ISceneManager* smgr, io::IFileSystem* fs);
30
31 //! returns true if the file maybe is able to be loaded by this class
32 //! based on the file extension (e.g. ".cob")
33 virtual bool isALoadableFileExtension(const io::path& filename) const;
34
35 //! creates/loads an animated mesh from the file.
36 //! \return Pointer to the created mesh. Returns 0 if loading failed.
37 //! If you no longer need the mesh, you should call IAnimatedMesh::drop().
38 //! See IReferenceCounted::drop() for more information.
39 virtual IAnimatedMesh* createMesh(io::IReadFile* file);
40
41private:
42
43 //! reads a mesh sections and creates a mesh from it
44 IAnimatedMesh* readMesh(io::IXMLReader* reader);
45
46 //! reads a mesh sections and creates a mesh buffer from it
47 IMeshBuffer* readMeshBuffer(io::IXMLReader* reader);
48
49 //! skips an (unknown) section in the irrmesh file
50 void skipSection(io::IXMLReader* reader, bool reportSkipping);
51
52 //! reads a <material> element and stores it in the material section
53 void readMaterial(io::IXMLReader* reader);
54
55 //! parses a float from a char pointer and moves the pointer to
56 //! the end of the parsed float
57 inline f32 readFloat(const c8** p);
58
59 //! parses an int from a char pointer and moves the pointer to
60 //! the end of the parsed float
61 inline s32 readInt(const c8** p);
62
63 //! places pointer to next begin of a token
64 void findNextNoneWhiteSpace(const c8** p);
65
66 //! places pointer to next begin of a token
67 void skipCurrentNoneWhiteSpace(const c8** p);
68
69 //! reads floats from inside of xml element until end of xml element
70 void readFloatsInsideElement(io::IXMLReader* reader, f32* floats, u32 count);
71
72 //! read the mesh buffers
73 void readMeshBuffer(io::IXMLReader* reader, int vertexCount, CDynamicMeshBuffer* sbuffer);
74
75 //! read indices
76 void readIndices(io::IXMLReader* reader, int indexCount, IIndexBuffer& indices);
77
78
79 // member variables
80
81 scene::ISceneManager* SceneManager;
82 io::IFileSystem* FileSystem;
83};
84
85
86} // end namespace scene
87} // end namespace irr
88
89#endif
90