コード例 #1
0
        private void SaveImage(Vector[,] buffer, string fileName)
        {
            Bitmap image = new Bitmap(buffer.GetLength(0), buffer.GetLength(1));
            //StreamWriter normals = new StreamWriter(new FileStream(fileName + ".normals.txt", FileMode.Create));
            //StreamWriter mats = new StreamWriter(new FileStream(fileName + ".mats.txt", FileMode.Create));

            for (int i = 0; i < buffer.GetLength(0); i++)
            {
                for (int j = 0; j < buffer.GetLength(1); j++)
                {
                    int r = (int)(255 * buffer[i, j].x);
                    int g = (int)(255 * buffer[i, j].y);
                    int b = (int)(255 * buffer[i, j].z);
                    image.SetPixel(i, buffer.GetLength(1) - 1 - j, Color.FromArgb(r, g, b));

                }
            }
            image.Save(fileName);
            return;
        }
コード例 #2
0
        private void SaveImage(Vector[,] buffer, string fileName)
        {
            Bitmap image = new Bitmap(buffer.GetLength(0), buffer.GetLength(1));

            for (int i = 0; i < buffer.GetLength(0); i++)
            {
                for (int j = 0; j < buffer.GetLength(1); j++)
                {
                    int r = (int)( 255*buffer[i,j].x);
                    int g = (int)( 255*buffer[i,j].y);
                    int b = (int)( 255*buffer[i,j].z);
                    image.SetPixel(i, buffer.GetLength(1) - 1 - j, Color.FromArgb(r, g, b));
                }
            }
            image.Save(fileName);
            return;
        }