示例#1
0
 public unsafe void WritePixel(Vector2Int *uvs, int pixelCount, GenericVector <T> color)
 {
     for (int i = 0; i < pixelCount; i++)
     {
         _pixels[UVToIndex(uvs[i].X, uvs[i].Y)].Write(color);
     }
 }
示例#2
0
 public unsafe void WritePixel(Vector2Int *uvs, int pixelCount, Vector4 *colors)
 {
     for (int i = 0; i < pixelCount; i++)
     {
         _pixels[UVToIndex(uvs[i].X, uvs[i].Y)].Write(colors[i]);
     }
 }
示例#3
0
        public static int ContriveResult(Vector2Int *output)
        {
            for (int i = 0; i < RasterizeResultLength; i++)
            {
                output[i] = _rasterizeBufferPtr[i];
            }

            int temp = RasterizeResultLength;

            RasterizeResultLength = 0;
            return(temp);
        }
示例#4
0
        public static unsafe void StartRasterize(Vector2 resolution)
        {
            if (_initialized)
            {
                throw new Exception("Rasterization has begun");
            }
            _initialized = true;

            _resolution          = resolution;
            _rasterizeBufferPtr  = (Vector2Int *)Marshal.AllocHGlobal(sizeof(Vector2Int) * (int)resolution.X * (int)resolution.Y);
            _rasterizeBufferUsed = 0;
        }
示例#5
0
        public static void StartRasterize(Vector2 resolution)
        {
            if (_initialized)
            {
                throw new Exception("Rasterization has begun");
            }
            _initialized = true;

            _resolution           = resolution;
            _discardInterval      = new Vector2(1e-2f / _resolution.X, 1e-2f / _resolution.Y);
            _pixelSize            = new Vector2(1f / _resolution.X, 1f / _resolution.Y);
            _rasterizeBufferPtr   = Alloc <Vector2Int>((int)resolution.X * (int)resolution.Y);
            RasterizeResultLength = 0;
        }
示例#6
0
 public void Initialize(int size)
 {
     if (PixelCount == size)
     {
         return;
     }
     if (PixelCount == 0)
     {
         Rasterization = Alloc <Vector2Int>(size);
     }
     else
     {
         ReAlloc(Rasterization, size);
     }
     PixelCount = size;
 }
示例#7
0
 public void Free()
 {
     MarshalExtension.Free(Rasterization);
     Rasterization = null;
     MarshalExtension.Free(FragmentColor);
     FragmentColor = null;
     if (FragmentData != null)
     {
         for (int i = 0; i < PixelCount; i++)
         {
             MarshalExtension.Free(FragmentData[i]);
         }
         MarshalExtension.Free(FragmentData);
         FragmentData = null;
     }
 }