QuantizedBvh m_optimizedTree; // for quantization

        public QuantizedNodeTriangleCallback(ObjectArray<QuantizedBvhNode> triangleNodes, QuantizedBvh tree)
		{
			m_triangleNodes = triangleNodes;
            m_optimizedTree = tree;
        }
Пример #2
0
 public void BuildTree(ref IndexedVector3 bvhAabbMin, ref IndexedVector3 bvhAabbMax)
 {
     m_optimizedAabbTree = new QuantizedBvh();
     m_optimizedAabbTree.SetQuantizationValues(ref bvhAabbMin, ref bvhAabbMax);
     IList<QuantizedBvhNode> nodes = m_optimizedAabbTree.GetLeafNodeArray();
     for (int i = 0; i < m_sapBroadphases.Count; i++)
     {
         QuantizedBvhNode node = new QuantizedBvhNode();
         IndexedVector3 aabbMin;
         IndexedVector3 aabbMax;
         m_sapBroadphases[i].GetBroadphaseAabb(out aabbMin, out aabbMax);
         m_optimizedAabbTree.Quantize(out node.m_quantizedAabbMin, ref aabbMin, false);
         m_optimizedAabbTree.Quantize(out node.m_quantizedAabbMax, ref aabbMax, true);
         int partId = 0;
         node.m_escapeIndexOrTriangleIndex = (partId << (31 - QuantizedBvh.MAX_NUM_PARTS_IN_BITS)) | i;
         nodes.Add(node);
     }
     m_optimizedAabbTree.BuildInternal();
 }