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); } }
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]); } }
public static int ContriveResult(Vector2Int *output) { for (int i = 0; i < RasterizeResultLength; i++) { output[i] = _rasterizeBufferPtr[i]; } int temp = RasterizeResultLength; RasterizeResultLength = 0; return(temp); }
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; }
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; }
public void Initialize(int size) { if (PixelCount == size) { return; } if (PixelCount == 0) { Rasterization = Alloc <Vector2Int>(size); } else { ReAlloc(Rasterization, size); } PixelCount = size; }
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; } }