2009-01-14 04:37:51 -08:00
|
|
|
// Copyright (C) 2002-2009 Nikolaus Gebhardt
|
2008-05-22 04:51:37 -07:00
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
2008-03-04 16:02:00 -08:00
|
|
|
#include "IrrCompileConfig.h"
|
|
|
|
|
|
|
|
#ifdef _IRR_COMPILE_WITH_COLLADA_WRITER_
|
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
#include "CColladaMeshWriter.h"
|
|
|
|
#include "os.h"
|
2007-09-08 03:51:27 -07:00
|
|
|
#include "IFileSystem.h"
|
2007-09-19 07:08:28 -07:00
|
|
|
#include "IWriteFile.h"
|
2007-09-07 23:10:52 -07:00
|
|
|
#include "IXMLWriter.h"
|
|
|
|
#include "IMesh.h"
|
|
|
|
#include "IAttributes.h"
|
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2007-09-19 07:08:28 -07:00
|
|
|
CColladaMeshWriter::CColladaMeshWriter(video::IVideoDriver* driver,
|
|
|
|
io::IFileSystem* fs)
|
2007-09-08 03:51:27 -07:00
|
|
|
: FileSystem(fs), VideoDriver(driver), Writer(0)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
2008-04-29 13:54:12 -07:00
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
setDebugName("CColladaMeshWriter");
|
|
|
|
#endif
|
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
if (VideoDriver)
|
|
|
|
VideoDriver->grab();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
if (FileSystem)
|
|
|
|
FileSystem->grab();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CColladaMeshWriter::~CColladaMeshWriter()
|
|
|
|
{
|
|
|
|
if (VideoDriver)
|
|
|
|
VideoDriver->drop();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
if (FileSystem)
|
|
|
|
FileSystem->drop();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//! Returns the type of the mesh writer
|
|
|
|
EMESH_WRITER_TYPE CColladaMeshWriter::getType() const
|
|
|
|
{
|
|
|
|
return EMWT_COLLADA;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
//! writes a mesh
|
2007-09-07 23:10:52 -07:00
|
|
|
bool CColladaMeshWriter::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 COLLADA header
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
Writer->writeXMLHeader();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeElement(L"COLLADA", false,
|
2008-01-26 16:35:01 -08:00
|
|
|
L"xmlns", L"http://www.collada.org/2005/11/COLLADASchema",
|
|
|
|
L"version", L"1.4.1");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write asset data
|
|
|
|
|
|
|
|
Writer->writeElement(L"asset", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"contributor", false);
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"authoring_tool", false);
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeText(L"Irrlicht Engine / irrEdit"); // this code has originated from irrEdit 0.7
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeClosingTag(L"authoring_tool");
|
|
|
|
Writer->writeLineBreak();
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"contributor");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// The next two are required
|
|
|
|
Writer->writeElement(L"created", false);
|
|
|
|
Writer->writeText(L"2008-01-31T00:00:00Z");
|
|
|
|
Writer->writeClosingTag(L"created");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"modified", false);
|
|
|
|
Writer->writeText(L"2008-01-31T00:00:00Z");
|
|
|
|
Writer->writeClosingTag(L"modified");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"revision", false);
|
|
|
|
Writer->writeText(L"1.0");
|
|
|
|
Writer->writeClosingTag(L"revision");
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeClosingTag(L"asset");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write all materials
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"library_materials", false);
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
u32 i;
|
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw strMat = "mat";
|
|
|
|
strMat += i;
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
Writer->writeElement(L"material", false,
|
2008-01-26 16:35:01 -08:00
|
|
|
L"id", strMat.c_str(),
|
|
|
|
L"name", strMat.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
strMat += L"-fx";
|
|
|
|
Writer->writeElement(L"instance_effect", true,
|
|
|
|
L"url", (core::stringw(L"#") + strMat).c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"material");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"library_materials");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"library_effects", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
|
|
|
{
|
|
|
|
core::stringw strMat = "mat";
|
|
|
|
strMat += i;
|
|
|
|
strMat += L"-fx";
|
|
|
|
|
|
|
|
Writer->writeElement(L"effect", false,
|
|
|
|
L"id", strMat.c_str(),
|
|
|
|
L"name", strMat.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"profile_COMMON", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"technique", false, L"sid", L"common");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"blinn", false);
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write all interesting material parameters as parameter
|
|
|
|
|
2007-09-19 07:08:28 -07:00
|
|
|
io::IAttributes* attributes = VideoDriver->createAttributesFromMaterial(
|
2007-09-07 23:10:52 -07:00
|
|
|
mesh->getMeshBuffer(i)->getMaterial());
|
|
|
|
|
2007-09-14 15:25:59 -07:00
|
|
|
u32 count = attributes->getAttributeCount();
|
|
|
|
for (u32 attridx=0; attridx<count; ++attridx)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
2008-01-26 16:35:01 -08:00
|
|
|
core::stringc str = attributes->getAttributeName(attridx);
|
|
|
|
if (str=="Emissive")
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"emission", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"color", false);
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
str = attributes->getAttributeAsString(attridx);
|
|
|
|
str.replace(',',' ');
|
|
|
|
Writer->writeText(core::stringw(str.c_str()).c_str());
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"color");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"emission");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (str=="Ambient")
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"ambient", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"color", false);
|
|
|
|
Writer->writeLineBreak();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
str = attributes->getAttributeAsString(attridx);
|
|
|
|
str.replace(',',' ');
|
|
|
|
Writer->writeText(core::stringw(str.c_str()).c_str());
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"color");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"ambient");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (str=="Diffuse")
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"diffuse", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"color", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
str = attributes->getAttributeAsString(attridx);
|
|
|
|
str.replace(',',' ');
|
|
|
|
Writer->writeText(core::stringw(str.c_str()).c_str());
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"color");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"diffuse");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (str=="Specular")
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"specular", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"color", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
str = attributes->getAttributeAsString(attridx);
|
|
|
|
str.replace(',',' ');
|
|
|
|
Writer->writeText(core::stringw(str.c_str()).c_str());
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"color");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"specular");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (str=="Shininess")
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"shininess", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"float", false);
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeText(core::stringw(attributes->getAttributeAsString(attridx).c_str()).c_str());
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"float");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"shininess");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
2007-09-07 23:10:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
attributes->drop();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"blinn");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"technique");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"profile_COMMON");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"effect");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"library_effects");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write mesh
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"library_geometries", false);
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"geometry", false, L"id", L"mesh", L"name", L"mesh");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"mesh");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// do some statistics for the mesh to know which stuff needs to be saved into
|
|
|
|
// the file:
|
|
|
|
// - count vertices
|
|
|
|
// - check for the need of a second texture coordinate
|
|
|
|
// - count amount of second texture coordinates
|
|
|
|
// - check for the need of tangents (TODO)
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
u32 totalVertexCount = 0;
|
|
|
|
u32 totalTCoords2Count = 0;
|
2007-09-07 23:10:52 -07:00
|
|
|
bool needsTangents = false; // TODO: tangents not supported here yet
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
totalVertexCount += mesh->getMeshBuffer(i)->getVertexCount();
|
|
|
|
|
|
|
|
if (hasSecondTextureCoordinates(mesh->getMeshBuffer(i)->getVertexType()))
|
|
|
|
totalTCoords2Count += mesh->getMeshBuffer(i)->getVertexCount();
|
|
|
|
|
|
|
|
if (!needsTangents)
|
|
|
|
needsTangents = mesh->getMeshBuffer(i)->getVertexType() == video::EVT_TANGENTS;
|
|
|
|
}
|
|
|
|
|
|
|
|
SComponentGlobalStartPos* globalIndices = new SComponentGlobalStartPos[mesh->getMeshBufferCount()];
|
|
|
|
|
|
|
|
// write positions
|
|
|
|
|
|
|
|
Writer->writeElement(L"source", false, L"id", L"mesh-Pos");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
core::stringw vertexCountStr(totalVertexCount*3);
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"float_array", false, L"id", L"mesh-Pos-array",
|
|
|
|
L"count", vertexCountStr.c_str());
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
|
|
|
|
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
|
2007-09-08 03:51:27 -07:00
|
|
|
u32 vertexCount = buffer->getVertexCount();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
globalIndices[i].PosStartIndex = 0;
|
|
|
|
|
|
|
|
if (i!=0)
|
|
|
|
globalIndices[i].PosStartIndex = globalIndices[i-1].PosLastIndex + 1;
|
|
|
|
|
|
|
|
globalIndices[i].PosLastIndex = globalIndices[i].PosStartIndex + vertexCount - 1;
|
|
|
|
|
|
|
|
switch(vtxType)
|
|
|
|
{
|
|
|
|
case video::EVT_STANDARD:
|
|
|
|
{
|
|
|
|
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].Pos.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Pos.Y;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Pos.Z;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case video::EVT_2TCOORDS:
|
|
|
|
{
|
|
|
|
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].Pos.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Pos.Y;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Pos.Z;
|
|
|
|
|
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case video::EVT_TANGENTS:
|
|
|
|
{
|
|
|
|
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].Pos.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Pos.Y;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Pos.Z;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"float_array");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"technique_common", false);
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalVertexCount);
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"accessor", false, L"source", L"#mesh-Pos-array",
|
2007-09-08 03:51:27 -07:00
|
|
|
L"count", vertexCountStr.c_str(), L"stride", L"3");
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"param", true, L"name", L"X", L"type", L"float");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"param", true, L"name", L"Y", L"type", L"float");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"param", true, L"name", L"Z", L"type", L"float");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
Writer->writeClosingTag(L"accessor");
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"technique_common");
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeClosingTag(L"source");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
// write texture coordinates
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeElement(L"source", false, L"id", L"mesh-TexCoord0");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalVertexCount*2);
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"float_array", false, L"id", L"mesh-TexCoord0-array",
|
|
|
|
L"count", vertexCountStr.c_str());
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
|
|
|
|
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
|
2007-09-08 03:51:27 -07:00
|
|
|
u32 vertexCount = buffer->getVertexCount();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
globalIndices[i].TCoord0StartIndex = 0;
|
|
|
|
|
|
|
|
if (i!=0)
|
|
|
|
globalIndices[i].TCoord0StartIndex = globalIndices[i-1].TCoord0LastIndex + 1;
|
|
|
|
|
|
|
|
globalIndices[i].TCoord0LastIndex = globalIndices[i].TCoord0StartIndex + vertexCount - 1;
|
|
|
|
|
|
|
|
switch(vtxType)
|
|
|
|
{
|
|
|
|
case video::EVT_STANDARD:
|
|
|
|
{
|
|
|
|
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].TCoords.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].TCoords.Y;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case video::EVT_2TCOORDS:
|
|
|
|
{
|
|
|
|
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].TCoords.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].TCoords.Y;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case video::EVT_TANGENTS:
|
|
|
|
{
|
|
|
|
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].TCoords.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].TCoords.Y;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"float_array");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"technique_common", false);
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalVertexCount);
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"accessor", false, L"source", L"#mesh-TexCoord0-array",
|
2007-09-08 03:51:27 -07:00
|
|
|
L"count", vertexCountStr.c_str(), L"stride", L"2");
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"U", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"V", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"accessor");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"technique_common");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeClosingTag(L"source");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write normals
|
|
|
|
|
|
|
|
Writer->writeElement(L"source", false, L"id", L"mesh-Normal");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalVertexCount*3);
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"float_array", false, L"id", L"mesh-Normal-array",
|
|
|
|
L"count", vertexCountStr.c_str());
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
|
|
|
|
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
|
2007-09-08 03:51:27 -07:00
|
|
|
u32 vertexCount = buffer->getVertexCount();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
globalIndices[i].NormalStartIndex = 0;
|
|
|
|
|
|
|
|
if (i!=0)
|
|
|
|
globalIndices[i].NormalStartIndex = globalIndices[i-1].NormalLastIndex + 1;
|
|
|
|
|
|
|
|
globalIndices[i].NormalLastIndex = globalIndices[i].NormalStartIndex + vertexCount - 1;
|
|
|
|
|
|
|
|
switch(vtxType)
|
|
|
|
{
|
|
|
|
case video::EVT_STANDARD:
|
|
|
|
{
|
|
|
|
video::S3DVertex* vtx = (video::S3DVertex*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].Normal.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Normal.Y;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Normal.Z;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case video::EVT_2TCOORDS:
|
|
|
|
{
|
|
|
|
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].Normal.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Normal.Y;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Normal.Z;
|
|
|
|
|
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case video::EVT_TANGENTS:
|
|
|
|
{
|
|
|
|
video::S3DVertexTangents* vtx = (video::S3DVertexTangents*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].Normal.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Normal.Y;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].Normal.Z;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"float_array");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"technique_common", false);
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalVertexCount);
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeElement(L"accessor", false, L"source", L"#mesh-Normal-array",
|
|
|
|
L"count", vertexCountStr.c_str(), L"stride", L"3");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"X", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"Y", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"Z", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"accessor");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"technique_common");
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeClosingTag(L"source");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write second set of texture coordinates
|
|
|
|
|
|
|
|
if (totalTCoords2Count)
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"source", false, L"id", L"mesh-TexCoord1");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalTCoords2Count*2);
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"float_array", false, L"id", L"mesh-TexCoord1-array",
|
|
|
|
L"count", vertexCountStr.c_str());
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
|
|
|
|
video::E_VERTEX_TYPE vtxType = buffer->getVertexType();
|
2007-09-08 03:51:27 -07:00
|
|
|
u32 vertexCount = buffer->getVertexCount();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
if (hasSecondTextureCoordinates(vtxType))
|
|
|
|
{
|
|
|
|
globalIndices[i].TCoord1StartIndex = 0;
|
|
|
|
|
|
|
|
if (i!=0 && globalIndices[i-1].TCoord1LastIndex != -1)
|
|
|
|
globalIndices[i].TCoord1StartIndex = globalIndices[i-1].TCoord1LastIndex + 1;
|
|
|
|
|
|
|
|
globalIndices[i].TCoord1LastIndex = globalIndices[i].TCoord1StartIndex + vertexCount - 1;
|
|
|
|
|
|
|
|
switch(vtxType)
|
|
|
|
{
|
|
|
|
case video::EVT_2TCOORDS:
|
|
|
|
{
|
|
|
|
video::S3DVertex2TCoords* vtx = (video::S3DVertex2TCoords*)buffer->getVertices();
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 j=0; j<vertexCount; ++j)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw str;
|
|
|
|
str += vtx[j].TCoords2.X;
|
|
|
|
str += " ";
|
|
|
|
str += vtx[j].TCoords2.Y;
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(str.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2007-09-10 02:27:37 -07:00
|
|
|
default:
|
|
|
|
break;
|
2007-09-07 23:10:52 -07:00
|
|
|
}
|
|
|
|
} // end this buffer has 2 texture coordinates
|
|
|
|
}
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"float_array");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"technique_common", false);
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-09-04 06:18:58 -07:00
|
|
|
vertexCountStr = core::stringw(totalTCoords2Count);
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeElement(L"accessor", false, L"source", L"#mesh-TexCoord1-array",
|
|
|
|
L"count", vertexCountStr.c_str(), L"stride", L"2");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"U", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"param", true, L"name", L"V", L"type", L"float", L"flow", L"OUT");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"accessor");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"technique_common");
|
|
|
|
Writer->writeLineBreak();
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeClosingTag(L"source");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
|
|
|
|
// write tangents
|
|
|
|
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
// write vertices
|
|
|
|
|
|
|
|
Writer->writeElement(L"vertices", false, L"id", L"mesh-Vtx");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"input", true, L"semantic", L"POSITION", L"source", L"#mesh-Pos");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"vertices");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// write polygons
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
for (i=0; i<mesh->getMeshBufferCount(); ++i)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
const u32 polyCount = buffer->getIndexCount() / 3;
|
2008-09-04 06:18:58 -07:00
|
|
|
core::stringw strPolyCount(polyCount);
|
2007-09-07 23:10:52 -07:00
|
|
|
core::stringw strMat = "#mat";
|
|
|
|
strMat += i;
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"triangles", false, L"count", strPolyCount.c_str(),
|
2007-09-07 23:10:52 -07:00
|
|
|
L"material", strMat.c_str());
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
Writer->writeElement(L"input", true, L"semantic", L"VERTEX", L"source", L"#mesh-Vtx", L"idx", L"0");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"input", true, L"semantic", L"TEXCOORD", L"source", L"#mesh-TexCoord0", L"idx", L"1");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeElement(L"input", true, L"semantic", L"NORMAL", L"source", L"#mesh-Normal", L"idx", L"2");
|
|
|
|
Writer->writeLineBreak();
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
bool has2ndTexCoords = hasSecondTextureCoordinates(buffer->getVertexType());
|
|
|
|
if (has2ndTexCoords)
|
|
|
|
{
|
|
|
|
Writer->writeElement(L"input", true, L"semantic", L"TEXCOORD", L"source", L"#mesh-TexCoord1", L"idx", L"3");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
|
|
|
|
// write indices now
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
s32 posIdx = globalIndices[i].PosStartIndex;
|
|
|
|
s32 tCoordIdx = globalIndices[i].TCoord0StartIndex;
|
|
|
|
s32 normalIdx = globalIndices[i].NormalStartIndex;
|
|
|
|
s32 tCoord2Idx = globalIndices[i].TCoord1StartIndex;
|
2007-09-07 23:10:52 -07:00
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeElement(L"p", false);
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
for (u32 p=0; p<polyCount; ++p)
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
core::stringw strP;
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 0] + posIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 0] + tCoordIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 0] + normalIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
|
|
|
if (has2ndTexCoords)
|
|
|
|
{
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 0] + tCoord2Idx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
|
|
|
}
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 1] + posIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 1] + tCoordIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 1] + normalIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
|
|
|
if (has2ndTexCoords)
|
|
|
|
{
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 1] + tCoord2Idx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
|
|
|
}
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 2] + posIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 2] + tCoordIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 2] + normalIdx;
|
2007-09-07 23:10:52 -07:00
|
|
|
if (has2ndTexCoords)
|
|
|
|
{
|
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
strP += buffer->getIndices()[(p*3) + 2] + tCoord2Idx;
|
2007-09-07 23:10:52 -07:00
|
|
|
}
|
2008-01-26 16:35:01 -08:00
|
|
|
strP += " ";
|
2007-09-08 03:51:27 -07:00
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeText(strP.c_str());
|
|
|
|
}
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"p");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2007-09-07 23:10:52 -07:00
|
|
|
// close index buffer section
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"triangles");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
}
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
// close mesh and geometry
|
2007-09-07 23:10:52 -07:00
|
|
|
|
|
|
|
Writer->writeClosingTag(L"mesh");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
Writer->writeClosingTag(L"geometry");
|
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
2008-01-26 16:35:01 -08:00
|
|
|
Writer->writeClosingTag(L"library_geometries");
|
2007-09-07 23:10:52 -07:00
|
|
|
Writer->writeLineBreak();
|
|
|
|
|
|
|
|
// close everything
|
|
|
|
|
|
|
|
Writer->writeClosingTag(L"COLLADA");
|
|
|
|
Writer->drop();
|
|
|
|
|
|
|
|
delete [] globalIndices;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-10 02:27:37 -07:00
|
|
|
bool CColladaMeshWriter::hasSecondTextureCoordinates(video::E_VERTEX_TYPE type) const
|
2007-09-07 23:10:52 -07:00
|
|
|
{
|
|
|
|
return type == video::EVT_2TCOORDS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-09-08 03:51:27 -07:00
|
|
|
} // end namespace
|
2007-09-07 23:10:52 -07:00
|
|
|
} // end namespace
|
2008-01-26 16:35:01 -08:00
|
|
|
|
2008-03-04 16:02:00 -08:00
|
|
|
#endif
|
|
|
|
|