Esempio n. 1
0
 public void UpdateCanvas(ref Rgba32[] canvas, ref float[] positionX, ref float[] positionY)
 {
     for (int i = 0; i < numParticles; i++)
     {
         var x = (int)positionX[i];
         var y = (int)positionY[i];
         if (x < width && y < height)
         {
             var index = ArrayIndex.From2DTo1D(x, y, width);
             canvas[index] = new Rgba32(255, 255, 255, 255);
         }
     }
 }
Esempio n. 2
0
        internal void Update(ref float[] positionX, ref float[] positionY)
        {
            frame = new Image <Rgba32>(width, height);
            var pixels = frame.GetPixelSpan();

            for (int i = 0; i < positionX.Length; i++)
            {
                var px = wrapAround(positionX[i], width - 1);
                var py = wrapAround(positionY[i], height - 1);

                var index = ArrayIndex.From2DTo1D((int)px, (int)py, width);
                pixels[index] = new Rgba32(255, 255, 255);
            }
        }