public void ConstructPieces() { GroundPieces = new TestGroundPiece[NPieces.Height, NPieces.Width]; float xstep = Size.Width / NPieces.Width; float ystep = Size.Height / NPieces.Height; for (int y = 0; y < NPieces.Height; y++) { for (int x = 0; x < NPieces.Width; x++) { AddChild(GroundPieces[y, x] = new TestGroundPiece { Translation = new Vector3(xstep * x, ystep * y, 0), Ground = this, HeightmapSelection = new RectangleF( x / (float)NPieces.Width, y / (float)NPieces.Height, 1 / (float)NPieces.Width, 1 / (float)NPieces.Height), Size = new Vector2(xstep, ystep) }); } } }
public void ConstructPieces() { GroundPieces = new TestGroundPiece[NPieces.Height, NPieces.Width]; float xstep = Size.Width / NPieces.Width; float ystep = Size.Height / NPieces.Height; for (int y = 0; y < NPieces.Height; y++) for (int x = 0; x < NPieces.Width; x++) AddChild(GroundPieces[y, x] = new TestGroundPiece { Translation = new Vector3(xstep*x, ystep*y, 0), Ground = this, HeightmapSelection = new RectangleF( x / (float)NPieces.Width, y / (float)NPieces.Height, 1 / (float)NPieces.Width, 1 / (float)NPieces.Height), Size = new Vector2(xstep, ystep) }); }