コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
 public void OptimizeIncremental(int passes)
 {
     NativeDAABBTreeInterop.OptimizeIncremental(m_handle, passes);
 }
コード例 #7
0
 public void OptimizeTopDown(int bu_threshold = 128)
 {
     NativeDAABBTreeInterop.OptimizeTopDown(m_handle, bu_threshold);
 }
コード例 #8
0
 public void OptimizeBottomUp()
 {
     NativeDAABBTreeInterop.OptimizeBottomUp(m_handle);
 }
コード例 #9
0
 public void MoveProxy(Node node, ref BoundingBox aabb, Vector3 velocity, float margin)
 {
     NativeDAABBTreeInterop.Move(m_handle, node.Handle, ref aabb, ref velocity, margin);
 }
コード例 #10
0
 public void MoveProxy(Node node, ref BoundingBox aabb)
 {
     NativeDAABBTreeInterop.Move(m_handle, node.Handle, ref aabb, m_margin);
 }
コード例 #11
0
 public void Clear()
 {
     NativeDAABBTreeInterop.Clear(m_handle);
     m_nodes.Clear();
 }
コード例 #12
0
 public NativeDAABBTree(float extension)
 {
     m_handle = NativeDAABBTreeInterop.Create();
     m_margin = extension;
 }