   Help checking mesh normals....
  Could someone please run this and tell me if the normals and everything for that matter is correct?thanks,Devin[source lang=c#]   public Mesh CreatePlatform()   {  bool bump = false;  //21x by 21y 2D array represented by a 1D array  int numverts = 21 * 21;  float baseelev = 25f;  float elev = baseelev;  //create one long array for 2 dimensional array representation  CustomVertex.PositionNormalTextured[] verts = new CustomVertex.PositionNormalTextured[numverts];  for (int i = -100; i <= 100; i += 10) for (int j = -100; j <= 100; j += 10) {int ind = (((i + 100) / 10) * 21) + ((j + 100) / 10);verts[ind] =    new CustomVertex.PositionNormalTextured((float)i, elev, (float)j, 0f, 1f, 0f, (float)((j + 100f) / 200f), (float)((i + 100f) / 200f));if (bump){    if (elev > 20f + baseelev)   elev = baseelev;    else elev += 5;} }  //20x20 grid with 2 triangles per grid square and 3 vertices per triangle.  short[] indices = new short[20 * 20 * 2 * 3];  int c = 0;  for (int i = 0; i < 20; i++) for (int j = 0; j < 20; j++) {//first triangle//first this rowindices[c] = (short)((i * 21) + j);//first next row indices[c + 1] = (short)(((i + 1) * 21) + j);//second next row indices[c + 2] = (short)(((i + 1) * 21) + j + 1);//second triangle//first this row indices[c + 3] = (short)((i * 21) + j);//second next row indices[c + 4] = (short)(((i + 1) * 21) + j + 1);//second first rowindices[c + 5] = (short)((i * 21) + j + 1); //advance cc += 6; }  Mesh platform =    new Mesh(20*20*2, numverts, MeshFlags.Managed, CustomVertex.PositionNormalTextured.Format, device);  using (VertexBuffer vb = this.platform.VertexBuffer)  { GraphicsStream data = vb.Lock(0, 0, LockFlags.None); data.Write(verts); vb.Unlock();  }  //this.platformverts = new CustomVertex.PositionNormalTextured[verts.Length];  //verts.CopyTo(this.platformverts, 0);  //this.platformindices = new short[indices.Length];  //indices.CopyTo(this.platformindices, 0);  //this.platformvbuffer =  //  new VertexBuffer(typeof(CustomVertex.PositionNormalTextured),  //    this.platformverts.Length, this.device, Usage.None,  //    CustomVertex.PositionNormalTextured.Format, Pool.Default);  //GraphicsStream platformgstr = this.platformvbuffer.Lock(0, 0, 0);  //platformgstr.Write(this.platformverts);  //this.platformvbuffer.Unlock();  //this.platformibuffer = new IndexBuffer(typeof(short),  //  indices.Length, this.device, Usage.None, Pool.Managed);  //GraphicsStream istr = this.platformibuffer.Lock(0, 0, 0);  //istr.Write(indices);  //this.platformibuffer.Unlock();  using (IndexBuffer ib = this.platform.IndexBuffer)  { ib.SetData(indices, 0, LockFlags.None);  }  this.platform.ComputeNormals();  return platform;   }source edited by k2 for readability[Edited by - kSquared on December 15, 2005 11:33:43 AM]