private void CalculateShadowChunk(Vector2Int origin) { PerformanceLogger.Push("Shadow Map"); // Clear var texture = new int[DataSize * DataSize]; for (var i = 0; i < DataSize; i++) { for (var j = 0; j < DataSize; j++) { var index = i * DataSize + j; var v = CalcShadow(new Vector3Int(i + origin.x, 0, j + origin.y)); texture[index] = v; } } if (!_buffers.ContainsKey(origin)) { _buffers[origin] = new ComputeBuffer(DataSize * DataSize, sizeof(int)); } _buffers[origin].SetData(texture); PerformanceLogger.Pop(); }