protected override void OnPopulateMesh(Mesh m) { if (mMesh == null) { mMesh = new WorldSpaceChartMesh(1); } else { mMesh.Clear(); } int vPos = 0; mMinModifyIndex = 0; // not supported here foreach (UIVertex v in getVerices()) { mTmpVerts[vPos++] = v; if (vPos == 4) { vPos = 0; mMesh.AddQuad(mTmpVerts[0], mTmpVerts[1], mTmpVerts[2], mTmpVerts[3]); } } mMesh.ApplyToMesh(m); }
#pragma warning disable 0672 #if !UNITY_2017_1_OR_NEWER protected override void OnPopulateMesh(Mesh m) { m.Clear(); if (mPopulated == false) { return; } WorldSpaceChartMesh chartmesh = new WorldSpaceChartMesh(true); FillChartMesh(chartmesh); chartmesh.ApplyToMesh(m); }
#pragma warning disable 0672 protected override void OnPopulateMesh(Mesh m) { WorldSpaceChartMesh mesh = new WorldSpaceChartMesh(1); int vPos = 0; foreach (UIVertex v in getVerices()) { mTmpVerts[vPos++] = v; if (vPos == 4) { vPos = 0; mesh.AddQuad(mTmpVerts[0], mTmpVerts[1], mTmpVerts[2], mTmpVerts[3]); } } mesh.ApplyToMesh(m); }
public void Generate(float startAngle, float angleSpan, float radius, float innerRadius, int segments, float outerDepth, float innerDepth) { WorldSpaceChartMesh mesh = new WorldSpaceChartMesh(1); float maxDepth = Mathf.Max(outerDepth, innerDepth); if (maxDepth <= 0f) { PieMesh.Generate2dMesh(mesh, startAngle, angleSpan, radius, innerRadius, segments); } else { PieMesh.Generate3dMesh(mesh, startAngle, angleSpan, radius, innerRadius, segments, outerDepth, innerDepth); } if (mCleanMesh != null) { mCleanMesh.Clear(); mesh.ApplyToMesh(mCleanMesh); MeshCollider collider = ChartCommon.EnsureComponent <MeshCollider>(gameObject); if (collider != null) { collider.sharedMesh = null; collider.sharedMesh = mCleanMesh; } } else { Mesh newMesh = mesh.Generate(); newMesh.hideFlags = HideFlags.DontSave; if (mFilter == null) { mFilter = GetComponent <MeshFilter>(); } mFilter.sharedMesh = newMesh; MeshCollider collider = ChartCommon.EnsureComponent <MeshCollider>(gameObject); if (collider != null) { collider.sharedMesh = newMesh; } ChartCommon.CleanMesh(newMesh, ref mCleanMesh); } }
#pragma warning disable 0672 #if !UNITY_2017_1_OR_NEWER protected override void OnPopulateMesh(Mesh m) { if (mPath == null) { m.Clear(); return; } WorldSpaceChartMesh mesh = new WorldSpaceChartMesh(1); foreach (UIVertex v in getVerices()) { mesh.AddVertex(v); } for (int i = 0; i < mPath.Length; i++) { int prev = i - 1; if (prev < 0) { prev = mPath.Length - 1; } mesh.AddTringle(prev, i, mPath.Length); } mesh.ApplyToMesh(m); }