public Kernel2D(T[] input, bool horizontal = true, Allocator allocator = Allocator.Persistent) { Weights = new NativeArray <T>(input, allocator); Width = horizontal ? input.Length : 1; Height = horizontal ? 1 : input.Length; Bounds = new KernelBounds(Width, Height); }
public Kernel2D(int width, int height, Allocator allocator = Allocator.Persistent) { Width = width; Height = height; Bounds = new KernelBounds(Width, Height); Weights = new NativeArray <T>(Width * Height, allocator); }
public Kernel2D(T[,] input, Allocator allocator = Allocator.Persistent) { Width = input.GetLength(0); Height = input.GetLength(1); Bounds = new KernelBounds(Width, Height); Weights = new NativeArray <T>(Width * Height, allocator); var flatIndex = 0; for (var y = 0; y < Height; y++) { for (var x = 0; x < Width; x++) { Weights[flatIndex] = input[y, x]; flatIndex++; } } }