private void DoDrawGizomsElements(hwmQuadtree <T> .Node node) { if (node == null) { return; } hwmBetterList <T> elements = node.GetElements(); for (int iElement = 0; iElement < elements.Count; iElement++) { hwmUtility.GizmosDrawBox2D(elements[iElement].AABB, m_GizmosZ); } if (m_GizomosDisplayChilderElement && !node.IsLeaf()) { DoDrawGizomsElements(node.GetChilder(hwmQuadtreeChilderNodeIndex.LeftDown)); DoDrawGizomsElements(node.GetChilder(hwmQuadtreeChilderNodeIndex.LeftUp)); DoDrawGizomsElements(node.GetChilder(hwmQuadtreeChilderNodeIndex.RightUp)); DoDrawGizomsElements(node.GetChilder(hwmQuadtreeChilderNodeIndex.RightDown)); } }
public void OnGUI() { while (m_Current == null) { if (m_LastNodes.Count > 0) { m_Current = m_LastNodes.Pop(); } else { m_Current = m_Quadtree.GetRootNode(); break; } } if (m_Current == null) { EditorGUILayout.HelpBox("not found any node", MessageType.Error); return; } hwmQuadtree <T> .Node displayNode = GetDisplayNode(); EditorGUILayout.LabelField("Depth:", displayNode.GetDepth().ToString()); EditorGUILayout.LabelField("Element Count:", displayNode.GetElements().Count.ToString()); EditorGUILayout.LabelField("Element Count In Self&Childers :", displayNode.GetAllElementCount().ToString()); EditorGUILayout.Space(); if (m_Current.GetParent() == null && m_ChilderIndex == NOTSET_CHILDER_INDEX) { GUILayout.Button("No Parent"); } else if (GUILayout.Button("Parent")) { if (m_ChilderIndex != NOTSET_CHILDER_INDEX) { m_ChilderIndex = NOTSET_CHILDER_INDEX; } else { m_Current = m_LastNodes.Pop(); } } EditorGUILayout.BeginHorizontal(); OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.LeftUp); OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.RightUp); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.LeftDown); OnGUI_ChildersButton(hwmQuadtreeChilderNodeIndex.RightDown); EditorGUILayout.EndHorizontal(); if (m_Current.IsLeaf() || m_ChilderIndex == NOTSET_CHILDER_INDEX) { GUILayout.Button("Cant Enter Childer"); } else if (GUILayout.Button("Enter Childer: " + m_ChilderIndex.ToString())) { m_LastNodes.Push(m_Current); m_Current = m_Current.GetChilder(m_ChilderIndex); m_ChilderIndex = NOTSET_CHILDER_INDEX; } EditorGUILayout.Space(); EditorGUILayout.LabelField("Gizmos"); m_GizmosColor = EditorGUILayout.ColorField("Color", m_GizmosColor); m_GizmosZ = EditorGUILayout.FloatField("Z", m_GizmosZ); m_GizomosDisplayChilderElement = EditorGUILayout.Toggle("Display Childer Element", m_GizomosDisplayChilderElement); if (GUI.changed) { GetWindow <SceneView>().Focus(); } }