From b4bb377ae50a43c60169fde7a3a8d2eff0ee3adb Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 30 Jun 2003 18:09:08 +0000 Subject: [PATCH] - this probably fixes export to vrml 1.0 output for textures (UV coords) it needs tests... just a simple cube with sides texmapped. and then import to whatever vrml viewer or importer you have around. the trick lies in adding textureCoordIndex nodes to file. --- source/blender/blenkernel/intern/exotic.c | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c index a0979892c07..c1575609fa5 100644 --- a/source/blender/blenkernel/intern/exotic.c +++ b/source/blender/blenkernel/intern/exotic.c @@ -2363,7 +2363,7 @@ static void write_mesh_vrml(FILE *fp, Mesh *me) MFace *mface; TFace *tface; Image *ima; - int a, b, totcol; + int a, b, totcol, texind; char str[32]; replace_chars(str, me->id.name+2); @@ -2422,6 +2422,7 @@ static void write_mesh_vrml(FILE *fp, Mesh *me) totcol= me->totcol; if(totcol==0) totcol= 1; + texind= 0; // index for uv coords for(b=0; btface) { + fprintf(fp, "\t\t\ttextureCoordIndex [\n"); + + a= me->totface; + mface= me->mface; + while(a--) { + if(mface->mat_nr==b) { + if(mface->v4) { + fprintf(fp, "\t\t\t\t %d, %d, %d, %d, -1,\n", texind, texind+1, texind+2, texind+3); + texind+= 4; + } + else if(mface->v3) { + fprintf(fp, "\t\t\t\t %d, %d, %d, -1,\n", texind, texind+1, texind+2); + texind+= 3; + } + } + mface++; + } + fprintf(fp, "\t\t\t]\n"); + } + fprintf(fp, "\t\t}\n"); } fprintf(fp, "\t}\n");