private void GenerateVertex() { verts = new CustomVertex.PositionColored[vertCount]; int k = 0; DiamondSquare a = terra; for (int z = 0; z < terWidth; z++) { for (int x = 0; x < terLength; x++) { verts[k].Position = new Vector3(x, 60 * (float)a.GetValue(x, z), z); if (50 * a.GetValue(x, z) < 0) { verts[k].Color = Color.Blue.ToArgb(); } else if (50 * a.GetValue(x, z) >= 0 && 50 * a.GetValue(x, z) < 5) { verts[k].Color = Color.Yellow.ToArgb(); } else if (50 * a.GetValue(x, z) >= 5 && 50 * a.GetValue(x, z) < 30) { verts[k].Color = Color.Green.ToArgb(); } else if (50 * a.GetValue(x, z) >= 30 && 50 * a.GetValue(x, z) < 50) { verts[k].Color = Color.Gray.ToArgb(); } else { verts[k].Color = Color.White.ToArgb(); } k++; } } }
private void Generate_BMP() { if (canShow) { terra_bmp = new Bitmap(terra.Size, terra.Size); Color tmp; for (int x = 0; x < terra.Size; x++) { for (int z = 0; z < terra.Size; z++) { if (50 * terra.GetValue(x, z) < 0) { tmp = Color.Blue; } else if (50 * terra.GetValue(x, z) >= 0 && 50 * terra.GetValue(x, z) < 5) { tmp = Color.Yellow; } else if (50 * terra.GetValue(x, z) >= 5 && 50 * terra.GetValue(x, z) < 30) { tmp = Color.Green; } else if (50 * terra.GetValue(x, z) >= 30 && 50 * terra.GetValue(x, z) < 50) { tmp = Color.Gray; } else { tmp = Color.White; } terra_bmp.SetPixel(x, z, tmp); } } } }