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")
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace UnityEngine
|
||||
public override bool Equals(object o) => o is Rect r && this == r;
|
||||
public override int GetHashCode() => x.GetHashCode() ^ (y.GetHashCode() << 2) ^ (width.GetHashCode() << 4) ^ (height.GetHashCode() << 6);
|
||||
}
|
||||
public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); public Vector3 MultiplyPoint3x4(Vector3 p) => p; public Vector3 MultiplyVector(Vector3 v) => v; public static Matrix4x4 operator *(Matrix4x4 a, Matrix4x4 b) => identity; }
|
||||
public struct Matrix4x4 { public static Matrix4x4 identity => new Matrix4x4(); public Vector3 MultiplyPoint3x4(Vector3 p) => p; public static Matrix4x4 operator *(Matrix4x4 a, Matrix4x4 b) => identity; }
|
||||
public struct Plane { public Plane(Vector3 normal, Vector3 point) { } public Plane(Vector3 inNormal, float d) { } public Plane(Vector3 a, Vector3 b, Vector3 c) { } public bool Raycast(Ray r, out float enter) { enter = 0; return false; } }
|
||||
public struct Ray { public Ray(Vector3 origin, Vector3 dir) { this.origin = origin; this.direction = dir; } public Vector3 origin; public Vector3 direction; public Vector3 GetPoint(float d) => origin; }
|
||||
public struct RaycastHit { public Vector3 point; public Vector3 normal; public float distance; public Collider collider; }
|
||||
@@ -292,7 +292,6 @@ public int particleCount => 0;
|
||||
public Texture mainTexture { get; set; }
|
||||
public Vector2 mainTextureOffset { get; set; }
|
||||
public Vector2 mainTextureScale { get; set; }
|
||||
public int renderQueue { get; set; }
|
||||
public string[] shaderKeywords { get; set; }
|
||||
public Color GetColor(string n) => Color.white;
|
||||
public void SetFloat(string n, float v) { }
|
||||
|
||||
Reference in New Issue
Block a user