void Start() { m_center = GetComponent <Transform>().position; m_root = OctNode.Create(new OctNode(m_center, Radius)); Leaf.ms_material = m_material; Leaf.ms_camera = m_camera; }
void EnsureChildren() { fixed(int *c = m_children) { if (c[0] == -1) { float radius = m_radius * 0.5f; for (int i = 0; i < 8; ++i) { float3 center = m_center; center.x += (i & 1) == 0 ? -radius : radius; center.y += (i & 2) == 0 ? -radius : radius; center.z += (i & 4) == 0 ? -radius : radius; c[i] = OctNode.Create(new OctNode(center, radius, m_depth + 1)); } } } }