/** * Clear the queue of line segments to render. */ public void Clear() { for (int i = 0; i < gizmos.Count; i++) { pool.Put(gizmos[i]); } gizmos.Clear(); }
/** * Update the highlight and wireframe graphics. */ public void RebuildGraphics(pb_Object[] selection, pb_Edge[][] universalEdgesDistinct, EditLevel editLevel, SelectMode selectionMode) { // in the event that the editor starts calling UpdateGraphics before the object has run OnEnable() (which happens on script reloads) if (pool == null) { return; } // clear t he current renderables foreach (pb_Renderable ren in pbRenderer.renderables) { pool.Put(ren); } pbRenderer.renderables.Clear(); // update wireframe wireframeMaterial.SetColor("_Color", (selectionMode == SelectMode.Edge && editLevel == EditLevel.Geometry) ? edgeSelectionColor : wireframeColor); for (int i = 0; i < selection.Length; i++) { pbRenderer.renderables.Add(BuildEdgeMesh(selection[i], universalEdgesDistinct[i])); } if (editLevel == EditLevel.Geometry) { // update vert / edge / face switch (selectionMode) { case SelectMode.Face: foreach (pb_Object pb in selection) { pbRenderer.renderables.Add(BuildFaceMesh(pb)); } break; case SelectMode.Vertex: foreach (pb_Object pb in selection) { pbRenderer.renderables.Add(BuildVertexMesh(pb)); } break; default: break; } } }