public void Unpin() { Assert(_pinnedVoxels.IsAllocated); voxels = new VoxelArray1D(); _pinnedVoxels.Free(); #if DEBUG_VOXEL_MESH voxelsDebug = new Debug.VoxelArray1D(); _pinnedVoxelsDebug.Free(); #endif }
public void Pin() { Assert(!_pinnedVoxels.IsAllocated); _pinnedVoxels = GCHandle.Alloc(_voxels, GCHandleType.Pinned); unsafe { voxels = VoxelArray1D.New((BlendedVoxel_t *)_pinnedVoxels.AddrOfPinnedObject().ToPointer(), _voxels.Length); } #if DEBUG_VOXEL_MESH _pinnedVoxelsDebug = GCHandle.Alloc(_voxelsDebug, GCHandleType.Pinned); unsafe { voxelsDebug = Debug.VoxelArray1D.New((Debug.BlendedVoxel_t *)_pinnedVoxelsDebug.AddrOfPinnedObject().ToPointer(), _voxelsDebug.Length); } #endif }