Here are the examples of the csharp api System.Collections.Generic.List.Add(hkcdStaticTreeCodec3Axis5) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
View Source File : BVH.cs
License : MIT License
Project Creator : katalash
License : MIT License
Project Creator : katalash
public List<hkcdStaticTreeCodec3Axis5> BuildAxis5Tree()
{
var ret = new List<hkcdStaticTreeCodec3Axis5>();
void CompressNode(BVNode node, Vector3 pbbmin, Vector3 pbbmax, bool root = false)
{
var currindex = ret.Count();
var compressed = new hkcdStaticTreeCodec3Axis5();
ret.Add(compressed);
// Compress the bounding box
compressed.m_xyz_0 = CompressDim(node.Min.X, node.Max.X, pbbmin.X, pbbmax.X);
compressed.m_xyz_1 = CompressDim(node.Min.Y, node.Max.Y, pbbmin.Y, pbbmax.Y);
compressed.m_xyz_2 = CompressDim(node.Min.Z, node.Max.Z, pbbmin.Z, pbbmax.Z);
// Read back the decompressed bounding box to use as reference for next compression
var min = compressed.DecompressMin(pbbmin, pbbmax);
var max = compressed.DecompressMax(pbbmin, pbbmax);
if (node.IsLeaf)
{
ushort data = (ushort)(node.Primitive);
compressed.m_loData = (byte)(data & 0xFF);
compressed.m_hiData = (byte)((data >> 8) & 0x7F);
}
else
{
// Add the left as the very next node
CompressNode(node.Left, min, max);
// Encode the index of the right then add it. The index should
// always be even
ushort data = (ushort)((ret.Count() - currindex) / 2);
compressed.m_loData = (byte)(data & 0xFF);
compressed.m_hiData = (byte)(((data >> 8) & 0x7F) | 0x80);
// Now encode the right
CompressNode(node.Right, min, max);
}
if (root)
{
compressed.m_xyz_0 = 0;
compressed.m_xyz_1 = 0;
compressed.m_xyz_2 = 0;
}
}
CompressNode(this, Min, Max, true);
return ret;
}