// now layout is complete do culling... ClipperRegistry.instance.Cull();//调用所有裁剪的部分,比如RectMask2D
//Graphic部分的重建 m_PerformingGraphicUpdate = true;
for (var i = (int)CanvasUpdate.PreRender; i < (int)CanvasUpdate.MaxUpdateValue; i++) { for (var k = 0; k < m_GraphicRebuildQueue.Count; k++) { try { var element = m_GraphicRebuildQueue[k]; if (ObjectValidForUpdate(element)) element.Rebuild((CanvasUpdate)i); } catch (Exception e) { Debug.LogException(e, m_GraphicRebuildQueue[k].transform); } } }
for (int i = 0; i < m_GraphicRebuildQueue.Count; ++i) m_GraphicRebuildQueue[i].GraphicUpdateComplete();
///<summary> /// Rebuilds the graphic geometry and its material on the PreRender cycle. ///</summary> ///<param name="update">The current step of the rendering CanvasUpdate cycle.</param> ///<remarks> /// See CanvasUpdateRegistry for more details on the canvas update cycle. ///</remarks> publicvirtualvoidRebuild(CanvasUpdate update) { if (canvasRenderer == null || canvasRenderer.cull) return;
switch (update) { case CanvasUpdate.PreRender: if (m_VertsDirty) { UpdateGeometry(); m_VertsDirty = false; } if (m_MaterialDirty) { UpdateMaterial(); m_MaterialDirty = false; } break; } }
///<summary> /// Mark the Graphic and the canvas as having been changed. ///</summary> protectedoverridevoidOnEnable() { base.OnEnable(); CacheCanvas(); GraphicRegistry.RegisterGraphicForCanvas(canvas, this);