Exemplo n.º 1
0
        private static void WaveClean(string filePath)
        {
            // Create a new Voxel volume (maximum dimensions are 256x256x256 right now)
            var vox = new VoxWriterClean(125, 125, 125);
            // Wave
            var cx = 63;
            var cy = 63;
            var cz = 63;

            byte colorIndex = 2;

            for (byte x = 0; x < 126; x++)
            {
                for (byte y = 0; y < 126; y++)
                {
                    for (byte z = 0; z < 126; z++)
                    {
                        double t = Math.Sqrt(Math.Pow(x - cx, 2) + Math.Pow(y - cy, 2));
                        double s = cz * (Math.Cos(t * 3.14159 * 0.1) * 0.25 + 1.0);
                        if (Math.Abs(z - s) <= 2.0)
                        {
                            vox.SetVoxel(new Voxel(x, y, z, colorIndex));
                            Console.WriteLine($"{x} {y} {z}");
                        }
                    }
                }
            }

            // Set color index #2
            vox.Palette[1] = new RGBA(0xff, 0x80, 0x00, 0xff);

            // Save to file
            vox.Export(filePath);
        }
Exemplo n.º 2
0
        private static void Test(string filePath)
        {
            var vox = new VoxWriterClean(255, 255, 25);

            for (int x = 0; x < 256; x++)
            {
                vox.SetVoxel(new Voxel((byte)x, 0, 0, 2));
            }
            vox.Palette[1] = new RGBA(0xff, 0x80, 0x00, 0xff);
            vox.Export(filePath);
        }