Esempio n. 1
0
		public void Build(StridingMeshInterface triangles)
		{
			NodeTriangleCallback callback = new NodeTriangleCallback(_leafNodes);

			Vector3 aabbMin = new Vector3(-1e30f, -1e30f, -1e30f);
			Vector3 aabbMax = new Vector3(1e30f, 1e30f, 1e30f);

			triangles.InternalProcessAllTriangles(callback, aabbMin, aabbMax);

			//now we have an array of leafnodes in m_leafNodes
			_contiguousNodes = new OptimizedBvhNode[2 * _leafNodes.Count];
            for (int i = 0; i < _contiguousNodes.Length; i++)
                _contiguousNodes[i] = new OptimizedBvhNode();
			_curNodeIndex = 0;

			_rootNode = BuildTree(_leafNodes, 0, _leafNodes.Count);
		}
Esempio n. 2
0
        public void Build(StridingMeshInterface triangles)
        {
            NodeTriangleCallback callback = new NodeTriangleCallback(_leafNodes);

            Vector3 aabbMin = new Vector3(-1e30f, -1e30f, -1e30f);
            Vector3 aabbMax = new Vector3(1e30f, 1e30f, 1e30f);

            triangles.InternalProcessAllTriangles(callback, aabbMin, aabbMax);

            //now we have an array of leafnodes in m_leafNodes
            _contiguousNodes = new OptimizedBvhNode[2 * _leafNodes.Count];
            for (int i = 0; i < _contiguousNodes.Length; i++)
            {
                _contiguousNodes[i] = new OptimizedBvhNode();
            }
            _curNodeIndex = 0;

            _rootNode = BuildTree(_leafNodes, 0, _leafNodes.Count);
        }