public void RemoveProxy(Node node) { int lastIndex = m_nodes.Count - 1; int index = NativeDAABBTreeInterop.RemoveAndChangeData(m_handle, node.Handle, m_nodes[lastIndex].Handle); m_nodes[index] = m_nodes[lastIndex]; m_nodes.RemoveAt(lastIndex); }
public Node AddProxy(T data, ref BoundingBox aabb) { int nextIndex = m_nodes.Count; var handle = NativeDAABBTreeInterop.Insert(m_handle, ref aabb, nextIndex); var node = new Node(handle, data); m_nodes.Add(node); return(node); }
public static unsafe int OverlapFrustum(int[] resultList, ref BoundingFrustum frustum, IntPtr handle) { float *x = stackalloc float[6]; float *y = stackalloc float[6]; float *z = stackalloc float[6]; float *d = stackalloc float[6]; Over(ref frustum, x, y, z, d); return(NativeDAABBTreeInterop.QuerySixPlanes(handle, x, y, z, d, resultList, 0, resultList.Length)); }
public void RayQuery(List <T> addToList, Vector3 from, Vector3 to) { if (m_resultList == null) { m_resultList = new int[DEFAULT_SIZE]; } int count; while ((count = NativeDAABBTreeInterop.QueryRay(m_handle, ref from, ref to, m_resultList, 0, m_resultList.Length)) < 0) { m_resultList = new int[m_resultList.Length * 2]; } for (int i = 0; i < count; i++) { int dataIndex = m_resultList[i]; addToList.Add(m_nodes[dataIndex].UserData); } }
public void OverlapSphere(List <T> addToList, ref BoundingSphere sphere) { if (m_resultList == null) { m_resultList = new int[DEFAULT_SIZE]; } int count; while ((count = NativeDAABBTreeInterop.QuerySphere(m_handle, ref sphere.Center, sphere.Radius, m_resultList, 0, m_resultList.Length)) < 0) { m_resultList = new int[m_resultList.Length * 2]; } for (int i = 0; i < count; i++) { int dataIndex = m_resultList[i]; addToList.Add(m_nodes[dataIndex].UserData); } }
public void OptimizeIncremental(int passes) { NativeDAABBTreeInterop.OptimizeIncremental(m_handle, passes); }
public void OptimizeTopDown(int bu_threshold = 128) { NativeDAABBTreeInterop.OptimizeTopDown(m_handle, bu_threshold); }
public void OptimizeBottomUp() { NativeDAABBTreeInterop.OptimizeBottomUp(m_handle); }
public void MoveProxy(Node node, ref BoundingBox aabb, Vector3 velocity, float margin) { NativeDAABBTreeInterop.Move(m_handle, node.Handle, ref aabb, ref velocity, margin); }
public void MoveProxy(Node node, ref BoundingBox aabb) { NativeDAABBTreeInterop.Move(m_handle, node.Handle, ref aabb, m_margin); }
public void Clear() { NativeDAABBTreeInterop.Clear(m_handle); m_nodes.Clear(); }
public NativeDAABBTree(float extension) { m_handle = NativeDAABBTreeInterop.Create(); m_margin = extension; }