+ Obj: implement exporting of p and l entities.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1074 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/2/head
parent
40ed87e05c
commit
78493b833c
|
@ -220,15 +220,23 @@ void ObjExporter :: WriteGeometryFile()
|
||||||
mOutput << "usemtl " << m.matname << endl;
|
mOutput << "usemtl " << m.matname << endl;
|
||||||
|
|
||||||
BOOST_FOREACH(const Face& f, m.faces) {
|
BOOST_FOREACH(const Face& f, m.faces) {
|
||||||
mOutput << "f ";
|
mOutput << f.kind << ' ';
|
||||||
BOOST_FOREACH(const FaceVertex& fv, f.indices) {
|
BOOST_FOREACH(const FaceVertex& fv, f.indices) {
|
||||||
mOutput << " " << fv.vp << "/";
|
mOutput << ' ' << fv.vp;
|
||||||
if (fv.vt) {
|
|
||||||
mOutput << fv.vt;
|
if (f.kind != 'p') {
|
||||||
}
|
if (fv.vt || f.kind == 'f') {
|
||||||
mOutput << "/";
|
mOutput << '/';
|
||||||
if (fv.vn) {
|
}
|
||||||
mOutput << fv.vn;
|
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];
|
const aiFace& f = m->mFaces[i];
|
||||||
|
|
||||||
Face& face = mesh.faces[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);
|
face.indices.resize(f.mNumIndices);
|
||||||
|
|
||||||
for(unsigned int a = 0; a < f.mNumIndices; ++a) {
|
for(unsigned int a = 0; a < f.mNumIndices; ++a) {
|
||||||
|
|
|
@ -86,6 +86,7 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Face {
|
struct Face {
|
||||||
|
char kind;
|
||||||
std::vector<FaceVertex> indices;
|
std::vector<FaceVertex> indices;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue