summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-04-22 15:59:35 +0800
committerchai <chaifix@163.com>2021-04-22 15:59:35 +0800
commit0f9d1967ca4358d01a9720ead0c8841d68f6638b (patch)
treef383f47bd70c2880680c551f3d44400120a44222
parent97ea5499f0237dcf531d66dd8846d2689d1cc00f (diff)
*debug
-rw-r--r--Assets/LensFlare/FlareBatch.cs2
-rw-r--r--Assets/LensFlare/FlareSource.cs6
2 files changed, 3 insertions, 5 deletions
diff --git a/Assets/LensFlare/FlareBatch.cs b/Assets/LensFlare/FlareBatch.cs
index b8c8e4f..f25dc0e 100644
--- a/Assets/LensFlare/FlareBatch.cs
+++ b/Assets/LensFlare/FlareBatch.cs
@@ -92,6 +92,8 @@ public class FlareBatch : MonoBehaviour
void UpdateGeometry(FlareSource source)
{
Vector3 viewportPos = source.ViewportPosition;
+ if (viewportPos.z < 0) // 光在背后
+ return;
Vector2 center = source.Center; // 光晕“中心”,后续这个值可以变
Vector2 flareSpacePos = ViewportToFlareSpace(viewportPos); // 光源在flare space的坐标
Vector2 flareVec = flareSpacePos - center;
diff --git a/Assets/LensFlare/FlareSource.cs b/Assets/LensFlare/FlareSource.cs
index 2e88ba5..d313080 100644
--- a/Assets/LensFlare/FlareSource.cs
+++ b/Assets/LensFlare/FlareSource.cs
@@ -143,6 +143,7 @@ public class FlareSource : MonoBehaviour
IsVisible = true;
IsHitLast = false;
}
+ Debug.DrawLine(transform.position, m_GameCamera.transform.position, IsHitLast ? Color.red : Color.white);
}
// 获取flare space下的初始大小,用来构建mesh
@@ -160,11 +161,6 @@ public class FlareSource : MonoBehaviour
return size;
}
- private void OnDrawGizmos()
- {
- Gizmos.DrawLine(transform.position, m_GameCamera.transform.position);
- }
-
public float GetScaleCurveValue(float fac)
{
return ScaleCurve.Evaluate(fac);