+ Obj: implement exporting of p and l entities.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1074 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/2/head
aramis_acg 2011-08-27 23:32:53 +00:00
parent 40ed87e05c
commit 78493b833c
2 changed files with 27 additions and 8 deletions

View File

@ -220,15 +220,23 @@ void ObjExporter :: WriteGeometryFile()
mOutput << "usemtl " << m.matname << endl;
BOOST_FOREACH(const Face& f, m.faces) {
mOutput << "f ";
mOutput << f.kind << ' ';
BOOST_FOREACH(const FaceVertex& fv, f.indices) {
mOutput << " " << fv.vp << "/";
if (fv.vt) {
mOutput << fv.vt;
}
mOutput << "/";
if (fv.vn) {
mOutput << fv.vn;
mOutput << ' ' << fv.vp;
if (f.kind != 'p') {
if (fv.vt || f.kind == 'f') {
mOutput << '/';
}
if (fv.vt) {
mOutput << fv.vt;
}
if (f.kind == 'f') {
mOutput << '/';
if (fv.vn) {
mOutput << fv.vn;
}
}
}
}
@ -252,6 +260,16 @@ void ObjExporter :: AddMesh(const aiString& name, const aiMesh* m, const aiMatri
const aiFace& f = m->mFaces[i];
Face& face = mesh.faces[i];
switch (f.mNumIndices) {
case 1:
face.kind = 'p';
break;
case 2:
face.kind = 'l';
break;
default:
face.kind = 'f';
}
face.indices.resize(f.mNumIndices);
for(unsigned int a = 0; a < f.mNumIndices; ++a) {

View File

@ -86,6 +86,7 @@ private:
};
struct Face {
char kind;
std::vector<FaceVertex> indices;
};