cull(engine-cleanup): pass-9 cascade round 4 after UIPanel stub
This commit is contained in:
@@ -83,15 +83,4 @@ public class BetterList<T>
|
||||
buffer[size] = default(T);
|
||||
}
|
||||
}
|
||||
|
||||
public T Pop()
|
||||
{
|
||||
if (buffer != null && size != 0)
|
||||
{
|
||||
T result = buffer[--size];
|
||||
buffer[size] = default(T);
|
||||
return result;
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
|
||||
public delegate void OnRenderCallback(Material mat);
|
||||
|
||||
private static BetterList<UIDrawCall> mActiveList = new BetterList<UIDrawCall>();
|
||||
|
||||
private static BetterList<UIDrawCall> mInactiveList = new BetterList<UIDrawCall>();
|
||||
|
||||
[NonSerialized]
|
||||
@@ -36,16 +34,12 @@ public class UIDrawCall : MonoBehaviour
|
||||
|
||||
private int mClipCount;
|
||||
|
||||
private MeshRenderer mRenderer;
|
||||
|
||||
private Material mDynamicMat;
|
||||
|
||||
private bool mRebuildMat = true;
|
||||
|
||||
private bool mLegacyShader;
|
||||
|
||||
private int mRenderQueue = 3000;
|
||||
|
||||
[NonSerialized]
|
||||
public bool isDirty;
|
||||
|
||||
@@ -90,103 +84,6 @@ public class UIDrawCall : MonoBehaviour
|
||||
|
||||
public bool isClipped => mClipCount != 0;
|
||||
|
||||
private void CreateMaterial()
|
||||
{
|
||||
mTextureClip = false;
|
||||
mLegacyShader = false;
|
||||
mClipCount = ((panel != null) ? panel.clipCount : 0);
|
||||
string text = ((mShader != null) ? mShader.name : ((mMaterial != null) ? mMaterial.shader.name : "Unlit/Transparent Colored"));
|
||||
text = text.Replace("GUI/Text Shader", "Unlit/Text");
|
||||
if (text.Length > 2 && text[text.Length - 2] == ' ')
|
||||
{
|
||||
int num = text[text.Length - 1];
|
||||
if (num > 48 && num <= 57)
|
||||
{
|
||||
text = text.Substring(0, text.Length - 2);
|
||||
}
|
||||
}
|
||||
if (text.StartsWith("Hidden/"))
|
||||
{
|
||||
text = text.Substring(7);
|
||||
}
|
||||
text = text.Replace(" (SoftClip)", "");
|
||||
text = text.Replace(" (TextureClip)", "");
|
||||
if (panel != null && panel.clipping == Clipping.TextureMask)
|
||||
{
|
||||
mTextureClip = true;
|
||||
shader = Shader.Find("Hidden/" + text + " (TextureClip)");
|
||||
}
|
||||
else if (mClipCount != 0)
|
||||
{
|
||||
shader = Shader.Find("Hidden/" + text + " " + mClipCount);
|
||||
if (shader == null)
|
||||
{
|
||||
shader = Shader.Find(text + " " + mClipCount);
|
||||
}
|
||||
if (shader == null && mClipCount == 1)
|
||||
{
|
||||
mLegacyShader = true;
|
||||
shader = Shader.Find(text + " (SoftClip)");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
shader = Shader.Find(text);
|
||||
}
|
||||
if (shader == null)
|
||||
{
|
||||
shader = Shader.Find("Unlit/Transparent Colored");
|
||||
}
|
||||
if (mMaterial != null)
|
||||
{
|
||||
if (IsWizardMaterial())
|
||||
{
|
||||
mDynamicMat = new Material(mMaterial);
|
||||
mDynamicMat.EnableKeyword("USE_VERTEX_COLOR");
|
||||
mDynamicMat.SetFloat("_SleeveSrcFactor", 5f);
|
||||
mDynamicMat.SetFloat("_SleeveDstFactor", 10f);
|
||||
mDynamicMat.SetFloat("_CullMode", 0f);
|
||||
mDynamicMat.SetFloat("_ZWriteMode", 0f);
|
||||
mLegacyShader = false;
|
||||
if (isClipped)
|
||||
{
|
||||
mDynamicMat.EnableKeyword("USE_CLIP");
|
||||
}
|
||||
if (IsSleeveMaterial())
|
||||
{
|
||||
mDynamicMat.EnableKeyword("USE_SLEEVE");
|
||||
}
|
||||
mDynamicMat.shader = Shader.Find(mMaterial.shader.name);
|
||||
}
|
||||
else
|
||||
{
|
||||
mDynamicMat = new Material(mMaterial);
|
||||
mDynamicMat.name = "[NGUI] " + mMaterial.name;
|
||||
mDynamicMat.hideFlags = HideFlags.DontSave | HideFlags.NotEditable;
|
||||
mDynamicMat.CopyPropertiesFromMaterial(mMaterial);
|
||||
string[] shaderKeywords = mMaterial.shaderKeywords;
|
||||
for (int i = 0; i < shaderKeywords.Length; i++)
|
||||
{
|
||||
mDynamicMat.EnableKeyword(shaderKeywords[i]);
|
||||
}
|
||||
if (shader != null)
|
||||
{
|
||||
mDynamicMat.shader = shader;
|
||||
}
|
||||
else if (mClipCount != 0)
|
||||
{
|
||||
Debug.LogError(text + " shader doesn't have a clipped shader version for " + mClipCount + " clip regions");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mDynamicMat = new Material(shader);
|
||||
mDynamicMat.name = "[NGUI] " + shader.name;
|
||||
mDynamicMat.hideFlags = HideFlags.DontSave | HideFlags.NotEditable;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsWizardMaterial()
|
||||
{
|
||||
if (mMaterial.shader.name == "Wizard/VariantSleeveShader")
|
||||
|
||||
Reference in New Issue
Block a user