public string StringifyHierarchy() { string result = ""; result += ToString() + "\n"; if (children != null) { for (int i = 0; i < 8; i++) { Node n = children[i]; if (n != null) { result += n.StringifyHierarchy(); } } } return(result); }
public static void TestSVOCompaction() { NaiveCreator creator = new NaiveCreator(); List <int> nodes = new List <int>(); List <uint> attachments = new List <uint>(); Node root = new Node(new Vector3(1, 1, 1), 1, 1, false); creator.BuildTree(root, 1, SampleFunctions.functions[(int)SampleFunctions.Type.Sphere], 3); creator.CompressSVO(root, nodes, attachments); string output = "NaiveCreator SVO Compaction Test\n"; output += "Original Hierarchy:\n" + root.StringifyHierarchy() + "\n\n"; output += "Compressed:\n"; for (int i = 0; i < nodes.Count; i++) { int normal = (int)(attachments[i * 2 + 1] >> 16); output += "CD: " + new ChildDescriptor(nodes[i]) + ", Normal: v" + Vector3.Normalize(NaiveCreator.decodeRawNormal16(normal)) + ", " + Convert.ToString(normal, 2).PadLeft(16, '0') + "(" + normal + ")\n"; } Debug.Log(output); }