Exemplo n.º 1
0
 public GpuShape(VoxelCell[,,] shape)
 {
     Shape = new GpuShapeInfo
     {
         Bounds = DiscreteBounds.Of(shape),
         Voxels = Gpu.Default.Allocate(Flatten(shape))
     };
 }
Exemplo n.º 2
0
        private static VoxelCell[] Flatten(VoxelCell[,,] shape)
        {
            var bounds = DiscreteBounds.Of(shape);

            var flatShape = new VoxelCell[bounds.Length];

            foreach (var coordinates in bounds)
            {
                flatShape[bounds.Index(coordinates)] = shape.At(coordinates);
            }

            return(flatShape);
        }