private int BuildArray2(Node node, int offset) { var nd = node; LNode p; while (nd != null) { var firstOffset = offset; p = new LNode() { Bounds = new BBox(nd.Bound) }; offset = BuildArray(nd.Left, offset + 1); if (nd.Primitives != null) { p.PrimitiveIndex = (uint)nd.Primitives[0].Index; p.IsLeaf = true; } else { p.Axis = (byte)nd.SplitAxis; p.SkipIndex = (uint)offset; } nodes[firstOffset] = p; nd = nd.Right; } return offset; }
private int BuildArray(Node node, int offset) { var nd = node; while (nd != null) { var firstOffset = offset; var p = new LNode() { Bounds = nd.Bound, PrimitiveIndex = nd.Primitives != null ? (uint) nd.PrimitiveIndexStart : NoHit, }; offset = BuildArray(nd.Left, offset + 1); p.SetSkipIndex((uint) offset); nodes[firstOffset] = p; nd = nd.Right; } return offset; }