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 __IRR_IRR_MESH_WRITER_H_INCLUDED__
6 #define __IRR_IRR_MESH_WRITER_H_INCLUDED__
7 
8 #include "IMeshWriter.h"
9 #include "S3DVertex.h"
10 #include "IVideoDriver.h"
11 #include "IFileSystem.h"
12 
13 namespace irr
14 {
15 namespace io
16 {
17 	class IXMLWriter;
18 }
19 namespace scene
20 {
21 	class IMeshBuffer;
22 
23 
24 	//! class to write meshes, implementing a IrrMesh (.irrmesh, .xml) writer
25 	/** This writer implementation has been originally developed for irrEdit and then
26 	merged out to the Irrlicht Engine */
27 	class CIrrMeshWriter : public IMeshWriter
28 	{
29 	public:
30 
31 		CIrrMeshWriter(video::IVideoDriver* driver, io::IFileSystem* fs);
32 		virtual ~CIrrMeshWriter();
33 
34 		//! Returns the type of the mesh writer
35 		virtual EMESH_WRITER_TYPE getType() const;
36 
37 		//! writes a mesh
38 		virtual bool writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags=EMWF_NONE);
39 
40 	protected:
41 
42 		void writeBoundingBox(const core::aabbox3df& box);
43 
44 		void writeMeshBuffer(const scene::IMeshBuffer* buffer);
45 
46 		void writeMaterial(const video::SMaterial& material);
47 
48 		core::stringw getVectorAsStringLine(const core::vector3df& v) const;
49 
50 		core::stringw getVectorAsStringLine(const core::vector2df& v) const;
51 
52 		// member variables:
53 
54 		io::IFileSystem* FileSystem;
55 		video::IVideoDriver* VideoDriver;
56 		io::IXMLWriter* Writer;
57 	};
58 
59 } // end namespace
60 } // end namespace
61 
62 #endif
63 
64