/// <summary> /// Maps all UV values to a new range. /// </summary> public void MapUVs(float xmin, float xmax, float ymin, float ymax) { for (int i = 0; i < uvs.Length; i++) { float x = Mathl.Map(uvs[i].X, 0, 1, xmin, xmax); float y = Mathl.Map(uvs[i].Y, 0, 1, ymin, ymax); uvs[i] = new Vector4(x, y, 0, 0); } }
/// <summary> /// Maps all UV values to a new range. /// </summary> public static Vector4[] MapUvArray(Vector4[] uvs, float xmin, float xmax, float ymin, float ymax) { Vector4[] newUvs = new Vector4[uvs.Length]; for (int i = 0; i < uvs.Length; i++) { float x = Mathl.Map(uvs[i].X, 0, 1, xmin, xmax); float y = Mathl.Map(uvs[i].Y, 0, 1, ymin, ymax); newUvs[i] = new Vector4(x, y, 0, 0); } return(newUvs); }