cull(engine-cleanup): pass-9 cascade round 2 after UIPanel stub
This commit is contained in:
@@ -32,30 +32,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
[HideInInspector]
|
||||
public UIPanel panel;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public bool alwaysOnScreen;
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector3> verts = new BetterList<Vector3>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector3> norms = new BetterList<Vector3>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector4> tans = new BetterList<Vector4>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Vector2> uvs = new BetterList<Vector2>();
|
||||
|
||||
[NonSerialized]
|
||||
[HideInInspector]
|
||||
public BetterList<Color32> cols = new BetterList<Color32>();
|
||||
|
||||
private Material mMaterial;
|
||||
|
||||
private Texture mTexture;
|
||||
@@ -64,34 +40,22 @@ public class UIDrawCall : MonoBehaviour
|
||||
|
||||
private int mClipCount;
|
||||
|
||||
private Transform mTrans;
|
||||
|
||||
private Mesh mMesh;
|
||||
|
||||
private MeshFilter mFilter;
|
||||
|
||||
private MeshRenderer mRenderer;
|
||||
|
||||
private Material mDynamicMat;
|
||||
|
||||
private int[] mIndices;
|
||||
|
||||
private bool mRebuildMat = true;
|
||||
|
||||
private bool mLegacyShader;
|
||||
|
||||
private int mRenderQueue = 3000;
|
||||
|
||||
private int mTriangles;
|
||||
|
||||
[NonSerialized]
|
||||
public bool isDirty;
|
||||
|
||||
[NonSerialized]
|
||||
private bool mTextureClip;
|
||||
|
||||
public OnRenderCallback onRender;
|
||||
|
||||
private static List<int[]> mCache = new List<int[]>(10);
|
||||
|
||||
private static int[] ClipRange = null;
|
||||
@@ -317,52 +281,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
return mDynamicMat;
|
||||
}
|
||||
|
||||
private void UpdateMaterials()
|
||||
{
|
||||
if (!(panel == null))
|
||||
{
|
||||
if (mRebuildMat || mDynamicMat == null || mClipCount != panel.clipCount || mTextureClip != (panel.clipping == Clipping.TextureMask))
|
||||
{
|
||||
RebuildMaterial();
|
||||
mRebuildMat = false;
|
||||
}
|
||||
else if (mRenderer.sharedMaterial != mDynamicMat)
|
||||
{
|
||||
mRenderer.sharedMaterials = new Material[1] { mDynamicMat };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int[] GenerateCachedIndexBuffer(int vertexCount, int indexCount)
|
||||
{
|
||||
int i = 0;
|
||||
for (int count = mCache.Count; i < count; i++)
|
||||
{
|
||||
int[] array = mCache[i];
|
||||
if (array != null && array.Length == indexCount)
|
||||
{
|
||||
return array;
|
||||
}
|
||||
}
|
||||
int[] array2 = new int[indexCount];
|
||||
int num = 0;
|
||||
for (int j = 0; j < vertexCount; j += 4)
|
||||
{
|
||||
array2[num++] = j;
|
||||
array2[num++] = j + 1;
|
||||
array2[num++] = j + 2;
|
||||
array2[num++] = j + 2;
|
||||
array2[num++] = j + 3;
|
||||
array2[num++] = j;
|
||||
}
|
||||
if (mCache.Count > 10)
|
||||
{
|
||||
mCache.RemoveAt(0);
|
||||
}
|
||||
mCache.Add(array2);
|
||||
return array2;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (ClipRange == null)
|
||||
@@ -387,19 +305,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private static UIDrawCall Create(string name, UIPanel pan, Material mat, Texture tex, Shader shader)
|
||||
{
|
||||
UIDrawCall uIDrawCall = Create(name);
|
||||
uIDrawCall.gameObject.layer = pan.cachedGameObject.layer;
|
||||
uIDrawCall.baseMaterial = mat;
|
||||
uIDrawCall.mainTexture = tex;
|
||||
uIDrawCall.shader = shader;
|
||||
uIDrawCall.renderQueue = pan.startingRenderQueue;
|
||||
uIDrawCall.sortingOrder = pan.sortingOrder;
|
||||
uIDrawCall.manager = pan;
|
||||
return uIDrawCall;
|
||||
}
|
||||
|
||||
private static UIDrawCall Create(string name)
|
||||
{
|
||||
if (mInactiveList.size > 0)
|
||||
@@ -420,28 +325,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
return uIDrawCall2;
|
||||
}
|
||||
|
||||
public static void ClearAll()
|
||||
{
|
||||
bool isPlaying = Application.isPlaying;
|
||||
int num = mActiveList.size;
|
||||
while (num > 0)
|
||||
{
|
||||
UIDrawCall uIDrawCall = mActiveList[--num];
|
||||
if ((bool)uIDrawCall)
|
||||
{
|
||||
if (isPlaying)
|
||||
{
|
||||
NGUITools.SetActive(uIDrawCall.gameObject, state: false);
|
||||
}
|
||||
else
|
||||
{
|
||||
NGUITools.DestroyImmediate(uIDrawCall.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
mActiveList.Clear();
|
||||
}
|
||||
|
||||
public static void ReleaseInactive()
|
||||
{
|
||||
int num = mInactiveList.size;
|
||||
|
||||
Reference in New Issue
Block a user