Beispiel #1
0
        public static Texture CreateTexture(string file, TextureInterp interp)
        {
            Texture tex = new Texture(file);

            SetTextureParams(tex, interp);
            return(tex);
        }
Beispiel #2
0
 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));
 }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        private static void SetTextureParams(Texture tex, TextureInterp interp)
        {
            switch (interp)
            {
            case TextureInterp.Linear:
                SetTextureParamsLinear(tex);
                break;

            case TextureInterp.Nearest:
                SetTextureParamsNearest(tex);
                break;

            default:
                break;
            }
        }