public void Dispose() { if (_points.IsCreated) { _points.Dispose(); } }
public void Update() { collection_mesh_job.FinishUpdateMesh(); NativeBuffer <JobHandle> handles = new NativeBuffer <JobHandle>(batches.Count, Allocator.Temp); bool has_job = false; foreach (var b in batches) { var handle = b.BuildJob(out has_job); if (has_job) { handles.Add(handle); } } //if(handles.Length > 0) { collection_mesh_job.BeginCollectionMeshInfo(); foreach (var g in group_rebuild_mesh) { if (g.mesh == null) { continue; } collection_mesh_job.CollectionMeshfInfo(g); } collection_mesh_job.EndCollectionMeshInfo(JobHandle.CombineDependencies(handles)); group_rebuild_mesh.Clear(); } handles.Dispose(); }
public static int ClipFaceAgainstAnother(ref NativeManifold output, int referenceFaceIndex, RigidTransform transform1, NativeHull hull1, int incidentFaceIndex, RigidTransform transform2, NativeHull hull2) { Debug.Assert(output.IsCreated); var refPlane = hull1.GetPlane(referenceFaceIndex); NativePlane referencePlane = transform1 * refPlane; NativeBuffer <ClipPlane> clippingPlanes = new NativeBuffer <ClipPlane>(hull1.FaceCount, Allocator.Temp); // Get every plane on the other polygon GetClippingPlanes(ref clippingPlanes, referencePlane, referenceFaceIndex, transform1, hull1); // Create face polygon. NativeBuffer <ClipVertex> incidentPolygon = new NativeBuffer <ClipVertex>(hull1.VertexCount, Allocator.Temp); ComputeFaceClippingPolygon(ref incidentPolygon, incidentFaceIndex, transform2, hull2); // Clip face polygon against the clipping planes. for (int i = 0; i < clippingPlanes.Length; ++i) { NativeBuffer <ClipVertex> outputPolygon = new NativeBuffer <ClipVertex>(math.max(hull1.VertexCount, hull2.VertexCount), Allocator.Temp); Clip(clippingPlanes[i], ref incidentPolygon, ref outputPolygon); if (outputPolygon.Length == 0) { return(-1); } incidentPolygon.Dispose(); incidentPolygon = outputPolygon; } for (int i = 0; i < incidentPolygon.Length; ++i) { ClipVertex vertex = incidentPolygon[i]; float distance = referencePlane.Distance(vertex.position); output.Add(vertex.position, distance, new ContactID { FeaturePair = vertex.featurePair }); } clippingPlanes.Dispose(); incidentPolygon.Dispose(); return(incidentFaceIndex); }
public void DisposedBufferIsEmpty() { var buffer = new NativeBuffer(5); buffer.ByteCapacity.Should().Be(5); buffer.Dispose(); buffer.ByteCapacity.Should().Be(0); buffer.DangerousGetHandle().Should().Be(IntPtr.Zero); }
public void Dispose() { CompleteJob(); transform_indices.Dispose(); indeices_offset.Dispose(); out_poices.Dispose(); out_uv0.Dispose(); out_uv1.Dispose(); out_colors.Dispose(); out_indices.Dispose(); }
public void DisposeTest() { NativeBuffer buffer = new NativeBuffer(20); buffer.Write(1); buffer.Write(2); buffer.Dispose(); Assert.AreEqual(0, buffer.Length); Assert.AreEqual(0, buffer.Capacity); Assert.IsFalse(buffer.IsValid); Assert.IsTrue(buffer.IsEmpty); }
public void Dispose() { outlineTexture.Dispose(); renderTexture.Dispose(); depthStencilZWrite.Dispose(); depthStencilNoZWrite.Dispose(); defaultSampler.Dispose(); instancesBuffer.Dispose(); pixelShaderSceneBuffer.Dispose(); objectBuffer.Dispose(); sceneBuffer.Dispose(); }
public override unsafe void Close() { if (_isClosed) { return; } _isClosed = true; if (_mode == CompressionMode.Compress) { // Mark end of stream var endSize = LZ4F_compressEnd(_ctx, _dstBuffer.Ptr, (IntPtr)_dstBuffer.Size); if (LZ4F_isError(endSize)) { throw new LZ4Exception(endSize, $"End of file generation failed {GetErrorName(endSize)}"); } _baseStream.Write(_dstBuffer.Buffer, 0, endSize.ToInt32()); var rc = LZ4F_freeCompressionContext(_ctx); if (LZ4F_isError(rc)) { throw new LZ4Exception(rc, $"Error : can't free LZ4F context resource: {GetErrorName(rc)}"); } } else { // Decompress var rc = LZ4Native.LZ4F_freeDecompressionContext(_ctx); if (LZ4Native.LZ4F_isError(rc)) { throw new LZ4Exception(rc, $"Error : can't free LZ4F context resource : {LZ4Native.GetErrorName(rc)}"); } } _baseStream.Close(); if (_srcBuffer != null) { _srcBuffer.Dispose(); _srcBuffer = null; } if (_dstBuffer != null) { _dstBuffer.Dispose(); _dstBuffer = null; } }
protected override void OnUnmanagedDispose() { _variables.Dispose(); }
public void Dispose() { dirty_indices.Dispose(); }
public void Dispose() { build_transform_job_datas.Dispose(); build_quad_datas.Dispose(); vertex_datas.Dispose(); }