internal void Load(byte[] byteArray)
        {
            using (MemoryStream ms = new MemoryStream(byteArray))
                using (BinaryReader br = new BinaryReader(ms))
                {
                    m_num_nodes = br.ReadInt32();
                    var min = ReadIndexedVector3(br);
                    var max = ReadIndexedVector3(br);
                    m_global_bound    = new AABB(ref min, ref max);
                    m_bvhQuantization = ReadIndexedVector3(br);

                    m_node_array = new GIM_QUANTIZED_BVH_NODE_ARRAY(m_num_nodes);
                    for (int i = 0; i < m_num_nodes; i++)
                    {
                        int count = br.ReadInt32();

                        BT_QUANTIZED_BVH_NODE node = new BT_QUANTIZED_BVH_NODE();
                        node.m_escapeIndexOrDataIndex = new int[count];
                        for (int j = 0; j < count; j++)
                        {
                            node.m_escapeIndexOrDataIndex[j] = br.ReadInt32();
                        }
                        node.m_quantizedAabbMin = ReadUShortVector3(br);
                        node.m_quantizedAabbMax = ReadUShortVector3(br);
                        m_node_array.Add(node);
                    }
                }
        }
 internal QuantizedBvhTree()
 {
     m_num_nodes  = 0;
     m_node_array = new GIM_QUANTIZED_BVH_NODE_ARRAY();
 }
Esempio n. 3
0
 public QuantizedBvhTree(int defaultCapacity)
 {
     m_num_nodes  = 0;
     m_node_array = new GIM_QUANTIZED_BVH_NODE_ARRAY(defaultCapacity);
 }