public static Texture CreateTexture(string file, TextureInterp interp) { Texture tex = new Texture(file); SetTextureParams(tex, interp); return(tex); }
public static Texture CreateTexture(Vector3[,] vecColours, TextureInterp interp) { Color[,] colours = new Color[vecColours.GetLength(0), vecColours.GetLength(1)]; for (int i = 0; i < vecColours.GetLength(0); i++) { for (int j = 0; j < vecColours.GetLength(1); j++) { colours[i, j] = Color.FromArgb(255, (int)(255 * vecColours[i, j].x), (int)(255 * vecColours[i, j].y), (int)(255 * vecColours[i, j].z)); } } return(CreateTexture(colours, interp)); }
public static Texture CreateTexture(Color[,] colours, TextureInterp interp) { Bitmap bmp = new Bitmap(colours.GetLength(0), colours.GetLength(1)); for (int i = 0; i < colours.GetLength(0); i++) { for (int j = 0; j < colours.GetLength(1); j++) { bmp.SetPixel(i, j, colours[i, j]); } } Texture tex = new Texture(bmp); SetTextureParams(tex, interp); return(tex); }
private static void SetTextureParams(Texture tex, TextureInterp interp) { switch (interp) { case TextureInterp.Linear: SetTextureParamsLinear(tex); break; case TextureInterp.Nearest: SetTextureParamsNearest(tex); break; default: break; } }