diff options
Diffstat (limited to 'Assets/Scripts/Unit/Components')
-rw-r--r-- | Assets/Scripts/Unit/Components/UnitPreprocessing.cs | 77 | ||||
-rw-r--r-- | Assets/Scripts/Unit/Components/UnitState/PCState.cs | 2 |
2 files changed, 40 insertions, 39 deletions
diff --git a/Assets/Scripts/Unit/Components/UnitPreprocessing.cs b/Assets/Scripts/Unit/Components/UnitPreprocessing.cs index 44ab73b7..8c56f0b6 100644 --- a/Assets/Scripts/Unit/Components/UnitPreprocessing.cs +++ b/Assets/Scripts/Unit/Components/UnitPreprocessing.cs @@ -2,28 +2,28 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using UnityEngine.Rendering; - -// 给每个角色准备一些特殊的前置渲染 +using UnityEngine.Rendering;
+
+// 给每个角色准备一些特殊的前置渲染
public class UnitPreprocessing : UnitComponent { [Flags] public enum EUnitPreprocessing { - None , - DepthTexture, // Unit Depth Texture - WorldNormalTexture, // Unit World Normal Texture + None, + DepthTexture, // Unit Depth Texture
+ WorldNormalTexture, // Unit World Normal Texture
} public EUnitPreprocessing preprocessing;
- #region render textures - public RenderTexture unitDepthTexture { get; private set; } + #region render textures + public RenderTexture unitDepthTexture { get; private set; } public RenderTexture unitWorldNormalTexture { get; private set; }
- public RenderTexture unitMotionVectorTexture { get; private set; }
- #endregion + public RenderTexture unitMotionVectorTexture { get; private set; }
+ #endregion - private CommandBuffer m_CBBeforeDepthTexture; + private CommandBuffer m_CommandBufferBeforeDepth; private Material m_MaterialDepth; @@ -39,7 +39,8 @@ public class UnitPreprocessing : UnitComponent MainCamera.Instance.customRenderingPipeline.onPreCull += OnWillRenderUnit; MainCamera.Instance.customRenderingPipeline.onPostRender += OnRenderUnit; - m_CBBeforeDepthTexture = new CommandBuffer(); + m_CommandBufferBeforeDepth = new CommandBuffer(); + m_CommandBufferBeforeDepth.name = "Unit Preprocessing(" + owner.unitObj.name + ")"; PrepareRenderTextures(); PrepareMaterials(); @@ -74,16 +75,16 @@ public class UnitPreprocessing : UnitComponent } private void OnWillRenderUnit() - { - RenderDepthTexture();
- //RenderWorldNormal();
- RenderMotionVector();
- MainCamera.Instance.camera.AddCommandBuffer(CameraEvent.BeforeDepthTexture, m_CBBeforeDepthTexture); - } + {
+ RenderDepthTexture();
+ //RenderWorldNormal();
+ RenderMotionVector();
+ MainCamera.Instance.camera.AddCommandBuffer(CameraEvent.BeforeDepthTexture, m_CommandBufferBeforeDepth);
+ } void RenderDepthTexture() { - var cb = m_CBBeforeDepthTexture; + var cb = m_CommandBufferBeforeDepth; cb.Clear(); cb.SetRenderTarget(unitDepthTexture); cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0)); @@ -100,21 +101,21 @@ public class UnitPreprocessing : UnitComponent continue; cb.DrawRenderer(renderer, m_MaterialDepth); } - } - - void RenderMotionVector()
- {
- } - - //void RenderWorldNormal() - //{ - // var cb = m_CBBeforeDepthTexture; - // cb.Clear(); - // cb.GetTemporaryRT(unitWorldNormalTextureID, -1, -1, 24, FilterMode.Point, RenderTextureFormat.RG16, RenderTextureReadWrite.Linear); - // cb.SetRenderTarget(unitWorldNormalTextureID); - // cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0)); - //} - + }
+
+ void RenderMotionVector()
+ {
+ }
+
+ //void RenderWorldNormal()
+ //{
+ // var cb = m_CommandBufferBeforeDepth;
+ // cb.Clear();
+ // cb.GetTemporaryRT(unitWorldNormalTextureID, -1, -1, 24, FilterMode.Point, RenderTextureFormat.RG16, RenderTextureReadWrite.Linear);
+ // cb.SetRenderTarget(unitWorldNormalTextureID);
+ // cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0));
+ //}
+
IEnumerable GetRenderers() { IBodyRendererAgent body = owner.unitRender.body; @@ -127,9 +128,9 @@ public class UnitPreprocessing : UnitComponent } private void OnRenderUnit() - { - //m_CBBeforeDepthTexture.ReleaseTemporaryRT(unitDepthTextureID); - - MainCamera.Instance.camera.RemoveCommandBuffer(CameraEvent.BeforeDepthTexture, m_CBBeforeDepthTexture); + {
+ //m_CommandBufferBeforeDepth.ReleaseTemporaryRT(unitDepthTextureID);
+
+ MainCamera.Instance.camera.RemoveCommandBuffer(CameraEvent.BeforeDepthTexture, m_CommandBufferBeforeDepth); } }
\ No newline at end of file diff --git a/Assets/Scripts/Unit/Components/UnitState/PCState.cs b/Assets/Scripts/Unit/Components/UnitState/PCState.cs index 7e766455..1bdd355f 100644 --- a/Assets/Scripts/Unit/Components/UnitState/PCState.cs +++ b/Assets/Scripts/Unit/Components/UnitState/PCState.cs @@ -144,7 +144,7 @@ public partial class PCState : UnitState UnitSnapshotInfo info = owner.TakeSnapshot();
Vector2 dir = TestErika.Instance.monster.owner.center + new Vector3(offset, -0.5f, 0) - owner.center;
- LensEffect_Dash dash = new LensEffect_Dash(Color.white, 0.05f, Mathf.Atan2(dir.y, dir.x), info);
+ LensEffect_Dash dash = new LensEffect_Dash(Color.white, 0.1f, Mathf.Atan2(dir.y, dir.x), info);
owner.unitLensEffect.AddEffect(dash);
owner.center = TestErika.Instance.monster.owner.center + new Vector3(offset, -0.5f, 0);
|