From f11ad65f141ee94d102c15b5d750e7aa1a06b40f Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Wed, 17 Oct 2012 11:20:44 +0000 Subject: [PATCH] minor changes --- wrap/io_trimesh/import_field.h | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/wrap/io_trimesh/import_field.h b/wrap/io_trimesh/import_field.h index 7b7483da..bea0a97a 100644 --- a/wrap/io_trimesh/import_field.h +++ b/wrap/io_trimesh/import_field.h @@ -41,7 +41,7 @@ class ImporterFIELD public: - static bool LoadGrad(MeshType *mesh, + static bool LoadGrad(MeshType &mesh, const char *path) { FILE *f = fopen(path,"rt"); @@ -51,13 +51,13 @@ public: } int numF; fscanf(f,"%d\n",&numF); - assert(numF==mesh->fn); + assert(numF==mesh.fn); char skipstr[200]; //int readed0; for (int i=0;i<9;i++) fscanf(f,"%s",&skipstr[0]); - for (int i=0;ifn;i++) + for (int i=0;i(u2,v2); CoordType dir1; CoordType dir2; - vcg::tri::CrossField::GradientToCross(mesh->face[i],UV[0],UV[1],UV[2],dir1,dir2); + vcg::tri::CrossField::GradientToCross(mesh.face[i],UV[0],UV[1],UV[2],dir1,dir2); dir1.Normalize(); dir2.Normalize(); - mesh->face[i].PD1()=dir1; - mesh->face[i].PD2()=dir2; + mesh.face[i].PD1()=dir1; + mesh.face[i].PD2()=dir2; } fclose(f); return true; @@ -83,7 +83,7 @@ public: ///load a field on the mesh, it could be a vfield file (per vertex) ///or an ffield file (per face) - static bool LoadFFIELD(MeshType *mesh, + static bool LoadFFIELD(MeshType &mesh, const char *path, bool per_vertex=false) { @@ -111,9 +111,9 @@ public: while (fscanf(f,"%c",&c)!=EOF) if (c=='\n') break; // skip fscanf(f,"%d",&nnv); } - int targetnum=mesh->fn; + int targetnum=mesh.fn; if (per_vertex) - targetnum=mesh->vn; + targetnum=mesh.vn; if (nnv != (int)targetnum) { //if (errorMsg) sprintf(errorMsg,"Wrong element number. Found: %d. Expected: %d.",nnv,mesh->vn); @@ -140,23 +140,23 @@ public: if (per_vertex) { - mesh->vert[i].PD1().X()=(ScalarType) u.X(); - mesh->vert[i].PD1().Y()=(ScalarType) u.Y(); - mesh->vert[i].PD1().Z()=(ScalarType) u.Z(); - mesh->vert[i].PD2().X()=(ScalarType) v.X(); - mesh->vert[i].PD2().Y()=(ScalarType) v.Y(); - mesh->vert[i].PD2().Z()=(ScalarType) v.Z(); + mesh.vert[i].PD1().X()=(ScalarType) u.X(); + mesh.vert[i].PD1().Y()=(ScalarType) u.Y(); + mesh.vert[i].PD1().Z()=(ScalarType) u.Z(); + mesh.vert[i].PD2().X()=(ScalarType) v.X(); + mesh.vert[i].PD2().Y()=(ScalarType) v.Y(); + mesh.vert[i].PD2().Z()=(ScalarType) v.Z(); } else { - mesh->face[i].PD1().X()=(ScalarType) u.X(); - mesh->face[i].PD1().Y()=(ScalarType) u.Y(); - mesh->face[i].PD1().Z()=(ScalarType) u.Z(); - mesh->face[i].PD2().X()=(ScalarType) v.X(); - mesh->face[i].PD2().Y()=(ScalarType) v.Y(); - mesh->face[i].PD2().Z()=(ScalarType) v.Z(); - mesh->face[i].PD1().Normalize(); - mesh->face[i].PD2().Normalize(); + mesh.face[i].PD1().X()=(ScalarType) u.X(); + mesh.face[i].PD1().Y()=(ScalarType) u.Y(); + mesh.face[i].PD1().Z()=(ScalarType) u.Z(); + mesh.face[i].PD2().X()=(ScalarType) v.X(); + mesh.face[i].PD2().Y()=(ScalarType) v.Y(); + mesh.face[i].PD2().Z()=(ScalarType) v.Z(); + mesh.face[i].PD1().Normalize(); + mesh.face[i].PD2().Normalize(); } } }