public unsafe ushort AddNoResize(float3 vertex) { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); #endif return(HashedVerticesUtility.AddNoResize((ushort *)m_HashTable, m_ChainedIndices, m_Vertices, vertex)); }
public unsafe float3 SnapToExistingVertex(float3 input) { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); #endif return(HashedVerticesUtility.SnapToExistingVertex((ushort *)m_HashTable, m_ChainedIndices, m_Vertices, input)); }
public unsafe float3 GetUniqueVertex(float3 vertex) { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); #endif float3 *verticesPtr = (float3 *)m_Vertices->Ptr; return(verticesPtr[HashedVerticesUtility.AddNoResize((ushort *)m_HashTable, m_ChainedIndices, m_Vertices, vertex)]); }
public unsafe void ReplaceIfExists(NativeListArray <float3> .NativeList uniqueVertices) { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); #endif // Add Unique vertex for (int i = 0; i < uniqueVertices.Length; i++) { var vertex = uniqueVertices[i]; HashedVerticesUtility.ReplaceIfExists((ushort *)m_HashTable, m_ChainedIndices, m_Vertices, vertex); } }
public unsafe void ReplaceIfExists(ref ChiselBlobArray <float3> uniqueVertices, float4x4 nodeToTreeSpaceMatrix) { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); #endif // Add Unique vertex for (int i = 0; i < uniqueVertices.Length; i++) { var vertex = math.mul(nodeToTreeSpaceMatrix, new float4(uniqueVertices[i], 1)).xyz; HashedVerticesUtility.ReplaceIfExists((ushort *)m_HashTable, m_ChainedIndices, m_Vertices, vertex); } }
public HashedVertices(ref ChiselBlobArray <float3> uniqueVertices, Allocator allocator = Allocator.Persistent) : this(uniqueVertices.Length, allocator) { // Add Unique vertex for (int i = 0; i < uniqueVertices.Length; i++) { var vertex = uniqueVertices[i]; var centerIndex = new int3((int)(vertex.x / kCellSize), (int)(vertex.y / kCellSize), (int)(vertex.z / kCellSize)); var hashCode = HashedVerticesUtility.GetHash(centerIndex); var prevChainIndex = ((ushort *)m_HashTable)[hashCode]; var newChainIndex = m_ChainedIndices->Length; m_Vertices->AddNoResize(vertex); m_ChainedIndices->AddNoResize((ushort)prevChainIndex); ((ushort *)m_HashTable)[(int)hashCode] = (ushort)(newChainIndex + 1); } }
public unsafe void AddUniqueVertices(ref ChiselBlobArray <float3> uniqueVertices) { #if ENABLE_UNITY_COLLECTIONS_CHECKS AtomicSafetyHandle.CheckWriteAndThrow(m_Safety); #endif // Add Unique vertex for (int i = 0; i < uniqueVertices.Length; i++) { var vertex = uniqueVertices[i]; var centerIndex = new int3((int)(vertex.x / kCellSize), (int)(vertex.y / kCellSize), (int)(vertex.z / kCellSize)); var hashCode = HashedVerticesUtility.GetHash(centerIndex); var prevChainIndex = ((ushort *)m_HashTable)[hashCode]; var newChainIndex = m_ChainedIndices->Length; m_Vertices->AddNoResize(vertex); m_ChainedIndices->AddNoResize((ushort)prevChainIndex); ((ushort *)m_HashTable)[(int)hashCode] = (ushort)(newChainIndex + 1); } }