c4bbe0d7c2
git-svn-id: http://svn.code.sf.net/p/irrlicht/code/trunk@924 dfc29bdd-3216-0410-991c-e03cc46cb475
79 lines
1.3 KiB
C++
79 lines
1.3 KiB
C++
#include "CIrrMeshWriter.h"
|
|
#include "os.h"
|
|
#include "IXMLWriter.h"
|
|
#include "IMesh.h"
|
|
#include "IAttributes.h"
|
|
|
|
namespace irr
|
|
{
|
|
namespace scene
|
|
{
|
|
|
|
|
|
CIrrMeshWriter::CIrrMeshWriter(irr::video::IVideoDriver* driver,
|
|
irr::io::IFileSystem* fs)
|
|
: VideoDriver(driver), FileSystem(fs)
|
|
{
|
|
if (VideoDriver)
|
|
VideoDriver->grab();
|
|
|
|
if (FileSystem)
|
|
FileSystem->grab();
|
|
}
|
|
|
|
|
|
CIrrMeshWriter::~CIrrMeshWriter()
|
|
{
|
|
if (VideoDriver)
|
|
VideoDriver->drop();
|
|
|
|
if (FileSystem)
|
|
FileSystem->drop();
|
|
}
|
|
|
|
|
|
//! Returns the type of the mesh writer
|
|
EMESH_WRITER_TYPE CIrrMeshWriter::getType() const
|
|
{
|
|
return EMWT_IRR_MESH;
|
|
}
|
|
|
|
|
|
//! writes a mesh
|
|
bool CIrrMeshWriter::writeMesh(io::IWriteFile* file, scene::IMesh* mesh, s32 flags)
|
|
{
|
|
if (!file)
|
|
return false;
|
|
|
|
Writer = FileSystem->createXMLWriter(file);
|
|
|
|
if (!Writer)
|
|
{
|
|
os::Printer::log("Could not write file", file->getFileName());
|
|
return false;
|
|
}
|
|
|
|
os::Printer::log("Writing mesh", file->getFileName());
|
|
|
|
// write IRR MESH header
|
|
|
|
Writer->writeXMLHeader();
|
|
|
|
Writer->writeElement(L"irrmesh", false,
|
|
L"xmlns", L"http://irrlicht.sourceforge.net/IRRMESH_08_2007",
|
|
L"version", L"1.0");
|
|
Writer->writeLineBreak();
|
|
|
|
// write mesh
|
|
|
|
// TODO: implement
|
|
|
|
Writer->drop();
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
} // end namespace
|
|
} // end namespace
|