private Vector2 GetPixelFromUV(Vector2 uv, FloatToIntMethod method) { Vector2 output = Vector2.zero; float x = uv.x * (float)(heightmapResolution - 1f); float y = uv.y * (float)(heightmapResolution - 1f); if (method == FloatToIntMethod.ROUND) { output.x = Mathf.Round(x); output.y = Mathf.Round(y); } else if (method == FloatToIntMethod.FLOOR) { output.x = Mathf.Floor(x); output.y = Mathf.Floor(y); } else if (method == FloatToIntMethod.CEIL) { output.x = Mathf.Ceil(x); output.y = Mathf.Ceil(y); } else if (method == FloatToIntMethod.NONE) { output.x = x; output.y = y; } else { Debug.LogError("Invalid Float To Int Method"); } return(output); }
private Vector2 GetPixelFromUV (Vector2 uv, FloatToIntMethod method) { Vector2 output = Vector2.zero; float x = uv.x * (float)(heightmapResolution - 1f); float y = uv.y * (float)(heightmapResolution - 1f); if (method == FloatToIntMethod.ROUND) { output.x = Mathf.Round(x); output.y = Mathf.Round(y); } else if (method == FloatToIntMethod.FLOOR) { output.x = Mathf.Floor(x); output.y = Mathf.Floor(y); } else if (method == FloatToIntMethod.CEIL) { output.x = Mathf.Ceil(x); output.y = Mathf.Ceil(y); } else if (method == FloatToIntMethod.NONE) { output.x = x; output.y = y; } else { Debug.LogError("Invalid Float To Int Method"); } return output; }