/// <summary> /// Rebuilds the graphic geometry and its material on the PreRender cycle. /// 重建图形及其材质 (处于 PreRender cycle) /// </summary> /// <param name="update">The current step of the rendering CanvasUpdate cycle.</param> public virtual void Rebuild(CanvasUpdateStep update) { //如被剔除,则不重建 if (canvasRenderer.cull) { return; } switch (update) { case CanvasUpdateStep.PreRender: if (m_VertsDirty) { //更新几何信息(顶点,网格) UpdateGeometry(); m_VertsDirty = false; } if (m_MaterialDirty) { //更新图像信息(Mat,材质) UpdateMaterial(); m_MaterialDirty = false; } break; } }
public void Rebuild(CanvasUpdateStep executing) { switch (executing) { case CanvasUpdateStep.Layout: // It's unfortunate that we'll perform the same GetComponents querys for the tree 2 times, // but each tree have to be fully iterated before going to the next action, // so reusing the results would entail storing results in a Dictionary or similar, // which is probably a bigger overhead than performing GetComponents multiple times. PerformLayoutCalculation(m_ToRebuild, e => (e as ILayoutElement).CalculateLayoutInputHorizontal()); PerformLayoutControl(m_ToRebuild, e => (e as ILayoutController).SetLayoutHorizontal()); PerformLayoutCalculation(m_ToRebuild, e => (e as ILayoutElement).CalculateLayoutInputVertical()); PerformLayoutControl(m_ToRebuild, e => (e as ILayoutController).SetLayoutVertical()); break; } }