cull(engine-cleanup): pass-9 cascade round 1 after UIPanel stub
This commit is contained in:
@@ -24,14 +24,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
[HideInInspector]
|
||||
public int widgetCount;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public int depthStart = int.MaxValue;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public int depthEnd = int.MinValue;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public UIPanel manager;
|
||||
@@ -40,10 +32,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
[HideInInspector]
|
||||
public UIPanel panel;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public Texture2D clipTexture;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public bool alwaysOnScreen;
|
||||
@@ -148,18 +136,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public Transform cachedTransform
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mTrans == null)
|
||||
{
|
||||
mTrans = base.transform;
|
||||
}
|
||||
return mTrans;
|
||||
}
|
||||
}
|
||||
|
||||
public Material baseMaterial
|
||||
{
|
||||
get
|
||||
@@ -357,125 +333,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateGeometry(int widgetCount)
|
||||
{
|
||||
this.widgetCount = widgetCount;
|
||||
int size = verts.size;
|
||||
if (size > 0 && size == uvs.size && size == cols.size && size % 4 == 0)
|
||||
{
|
||||
if (mFilter == null)
|
||||
{
|
||||
mFilter = base.gameObject.GetComponent<MeshFilter>();
|
||||
}
|
||||
if (mFilter == null)
|
||||
{
|
||||
mFilter = base.gameObject.AddComponent<MeshFilter>();
|
||||
}
|
||||
if (verts.size < 65000)
|
||||
{
|
||||
int num = (size >> 1) * 3;
|
||||
bool flag = mIndices == null || mIndices.Length != num;
|
||||
if (mMesh == null)
|
||||
{
|
||||
mMesh = new Mesh();
|
||||
mMesh.hideFlags = HideFlags.DontSave;
|
||||
mMesh.name = ((mMaterial != null) ? ("[NGUI] " + mMaterial.name) : "[NGUI] Mesh");
|
||||
mMesh.MarkDynamic();
|
||||
flag = true;
|
||||
}
|
||||
bool flag2 = uvs.buffer.Length != verts.buffer.Length || cols.buffer.Length != verts.buffer.Length || (norms.buffer != null && norms.buffer.Length != verts.buffer.Length) || (tans.buffer != null && tans.buffer.Length != verts.buffer.Length);
|
||||
if (!flag2 && panel != null && panel.renderQueue != UIPanel.RenderQueue.Automatic)
|
||||
{
|
||||
flag2 = mMesh == null || mMesh.vertexCount != verts.buffer.Length;
|
||||
}
|
||||
if (!flag2 && verts.size << 1 < verts.buffer.Length)
|
||||
{
|
||||
flag2 = true;
|
||||
}
|
||||
mTriangles = verts.size >> 1;
|
||||
if (flag2 || verts.buffer.Length > 65000)
|
||||
{
|
||||
if (flag2 || mMesh.vertexCount != verts.size)
|
||||
{
|
||||
mMesh.Clear();
|
||||
flag = true;
|
||||
}
|
||||
mMesh.vertices = verts.ToArray();
|
||||
mMesh.uv = uvs.ToArray();
|
||||
mMesh.colors32 = cols.ToArray();
|
||||
if (norms != null)
|
||||
{
|
||||
mMesh.normals = norms.ToArray();
|
||||
}
|
||||
if (tans != null)
|
||||
{
|
||||
mMesh.tangents = tans.ToArray();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mMesh.vertexCount != verts.buffer.Length)
|
||||
{
|
||||
mMesh.Clear();
|
||||
flag = true;
|
||||
}
|
||||
mMesh.vertices = verts.buffer;
|
||||
mMesh.uv = uvs.buffer;
|
||||
mMesh.colors32 = cols.buffer;
|
||||
if (norms != null)
|
||||
{
|
||||
mMesh.normals = norms.buffer;
|
||||
}
|
||||
if (tans != null)
|
||||
{
|
||||
mMesh.tangents = tans.buffer;
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
mIndices = GenerateCachedIndexBuffer(size, num);
|
||||
mMesh.triangles = mIndices;
|
||||
}
|
||||
if (flag2 || !alwaysOnScreen)
|
||||
{
|
||||
mMesh.RecalculateBounds();
|
||||
}
|
||||
mFilter.mesh = mMesh;
|
||||
}
|
||||
else
|
||||
{
|
||||
mTriangles = 0;
|
||||
if (mFilter.mesh != null)
|
||||
{
|
||||
mFilter.mesh.Clear();
|
||||
}
|
||||
Debug.LogError("Too many vertices on one panel: " + verts.size);
|
||||
}
|
||||
if (mRenderer == null)
|
||||
{
|
||||
mRenderer = base.gameObject.GetComponent<MeshRenderer>();
|
||||
}
|
||||
if (mRenderer == null)
|
||||
{
|
||||
mRenderer = base.gameObject.AddComponent<MeshRenderer>();
|
||||
}
|
||||
UpdateMaterials();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mFilter.mesh != null)
|
||||
{
|
||||
mFilter.mesh.Clear();
|
||||
}
|
||||
Debug.LogError("UIWidgets must fill the buffer with 4 vertices per quad. Found " + size);
|
||||
}
|
||||
verts.Clear();
|
||||
uvs.Clear();
|
||||
cols.Clear();
|
||||
norms.Clear();
|
||||
tans.Clear();
|
||||
}
|
||||
|
||||
private int[] GenerateCachedIndexBuffer(int vertexCount, int indexCount)
|
||||
{
|
||||
int i = 0;
|
||||
@@ -530,11 +387,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public static UIDrawCall Create(UIPanel panel, Material mat, Texture tex, Shader shader)
|
||||
{
|
||||
return Create(null, panel, mat, tex, shader);
|
||||
}
|
||||
|
||||
private static UIDrawCall Create(string name, UIPanel pan, Material mat, Texture tex, Shader shader)
|
||||
{
|
||||
UIDrawCall uIDrawCall = Create(name);
|
||||
@@ -590,12 +442,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
mActiveList.Clear();
|
||||
}
|
||||
|
||||
public static void ReleaseAll()
|
||||
{
|
||||
ClearAll();
|
||||
ReleaseInactive();
|
||||
}
|
||||
|
||||
public static void ReleaseInactive()
|
||||
{
|
||||
int num = mInactiveList.size;
|
||||
@@ -609,26 +455,4 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
mInactiveList.Clear();
|
||||
}
|
||||
|
||||
public static void Destroy(UIDrawCall dc)
|
||||
{
|
||||
if (!dc)
|
||||
{
|
||||
return;
|
||||
}
|
||||
dc.onRender = null;
|
||||
if (Application.isPlaying)
|
||||
{
|
||||
if (mActiveList.Remove(dc))
|
||||
{
|
||||
NGUITools.SetActive(dc.gameObject, state: false);
|
||||
mInactiveList.Add(dc);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mActiveList.Remove(dc);
|
||||
NGUITools.DestroyImmediate(dc.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user