Corrected Grid

This commit is contained in:
Paolo Cignoni 2006-01-30 08:09:05 +00:00
parent e61203f1ba
commit 558c52d8cb
1 changed files with 7 additions and 1 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.6 2006/01/22 17:10:15 cignoni
Added Grid function (to build range map meshes...)
Revision 1.5 2005/07/11 13:16:34 cignoni Revision 1.5 2005/07/11 13:16:34 cignoni
small gcc-related compiling issues (typenames,ending cr, initialization order) small gcc-related compiling issues (typenames,ending cr, initialization order)
@ -628,9 +631,12 @@ void Grid(MeshType & in, int w, int h, float wl, float hl, float *data)
Allocator<MeshType>::AddVertices(in,w*h); Allocator<MeshType>::AddVertices(in,w*h);
Allocator<MeshType>::AddFaces(in,(w-1)*(h-1)*2); Allocator<MeshType>::AddFaces(in,(w-1)*(h-1)*2);
float wld=wl/float(w);
float hld=hl/float(h);
for(int i=0;i<h;++i) for(int i=0;i<h;++i)
for(int j=0;j<w;++j) for(int j=0;j<w;++j)
in.vert[i*w+j].P()=CoordType ( i, j, data[i*w+j]); in.vert[i*w+j].P()=CoordType ( j*wld, i*hld, data[i*w+j]);
// i+0,j+0 -- i+0,j+1 // i+0,j+0 -- i+0,j+1
// | \ | // | \ |