From 0d943a8a9dbf41abc46d1282d006291e9f11a6df Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Fri, 13 Sep 2013 00:58:48 +0900 Subject: [PATCH] Fix texcoord export. --- examples/obj_sticher/obj_writer.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/obj_sticher/obj_writer.cc b/examples/obj_sticher/obj_writer.cc index 7d0f1ba..aa9b244 100644 --- a/examples/obj_sticher/obj_writer.cc +++ b/examples/obj_sticher/obj_writer.cc @@ -99,14 +99,14 @@ bool WriteObj(const std::string& filename, std::vector shapes) } if (shapes[i].mesh.normals.size() > 0) has_vn = true; - // texcoord + // facevarying texcoord if (shapes[i].mesh.texcoords.size() > 0) { for (size_t k = 0; k < shapes[i].mesh.indices.size() / 3; k++) { for (int j = 0; j < 3; j++) { int idx = shapes[i].mesh.indices[3*k+j]; fprintf(fp, "vt %f %f %f\n", - shapes[i].mesh.texcoords[3*idx+0], - shapes[i].mesh.texcoords[3*idx+1]); + shapes[i].mesh.texcoords[2*idx+0], + shapes[i].mesh.texcoords[2*idx+1]); } } }