From f0ae9393da021fe16af32f7ae1a3245f27050f92 Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 1 Oct 2021 10:04:00 +0800 Subject: *misc --- Assets/Art/Models/Characters/Default.meta | 8 - Assets/Art/Models/Characters/Erika2.meta | 8 - .../AbstractWiresEffect/Scripts.meta | 8 - Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta | 8 - Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta | 8 - Assets/Bundle/Materials/Unit/Common.meta | 8 + Assets/Bundle/Materials/Unit/Effect.meta | 8 - Assets/Bundle/Models.meta | 8 - Assets/Bundle/Prefabs.meta | 8 - .../Bundle/Shaders/Common/Image/ImageEffect.cginc | 17 +- .../Common/Image/common_img_motionblur.shader | 4 +- Assets/Bundle/Shaders/Common/common_gbuffer.shader | 175 +++++++++++++-------- Assets/Bundle/Shaders/Include.meta | 8 - Assets/Bundle/Shaders/Unit/Effect.meta | 8 - Assets/Bundle/UI.meta | 8 - .../Unit/Monster/Robots_Prowler/ActionData.meta | 8 - .../Unit/Monster/Robots_Prowler/UnitData.meta | 8 - Assets/Bundle/Unit/NPC.meta | 8 - Assets/Bundle/Unit/PC/Erika/Materials/Effect.meta | 8 + Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta | 8 - Assets/Bundle/Unit/PC/Erika/Models.meta | 8 - Assets/Bundle/Unit/PC/Erika/UnitData.meta | 8 - Assets/Bundle/Unit/PC/Erika/Weapons/Materials.meta | 8 + Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta | 8 - .../Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta | 8 - .../Bundle/Unit/PC/ErikaCyborg/AnimationData.meta | 8 - .../Unit/PC/ErikaCyborg/Materials/AfterImage.meta | 8 - .../Unit/PC/ErikaCyborg/Materials/Normal.meta | 8 - Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta | 8 - Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta | 8 - Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta | 8 - Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta | 8 - Assets/Bundle/Unit/Prop.meta | 8 - Assets/Data/RootMotionData.meta | 8 + Assets/Scripts/Curve3D.meta | 8 - Assets/Scripts/Drone.meta | 8 - Assets/Scripts/Editor/MainCameraEditor.cs | 5 +- Assets/Scripts/Managers/Physics.meta | 8 - Assets/Scripts/Props.meta | 8 - Assets/Scripts/Rendering/CustomLight.cs | 46 ++++++ Assets/Scripts/Rendering/CustomLight.cs.meta | 11 ++ .../Scripts/Rendering/CustomRenderingPipeline.cs | 19 +-- Assets/Scripts/Robot.meta | 8 - Assets/Scripts/Scene.meta | 8 + Assets/Scripts/Unit/AI/Actions.meta | 8 - Assets/Scripts/Unit/AI/Conditionals.meta | 8 - .../Scripts/Unit/Components/UnitPreprocessing.cs | 77 ++++----- .../Scripts/Unit/Components/UnitState/PCState.cs | 2 +- Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs | 6 +- Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs | 96 +++++------ 50 files changed, 324 insertions(+), 446 deletions(-) delete mode 100644 Assets/Art/Models/Characters/Default.meta delete mode 100644 Assets/Art/Models/Characters/Erika2.meta delete mode 100644 Assets/Art/Vfx/GrabSquaresEffect/AbstractWiresEffect/Scripts.meta delete mode 100644 Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta delete mode 100644 Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta create mode 100644 Assets/Bundle/Materials/Unit/Common.meta delete mode 100644 Assets/Bundle/Materials/Unit/Effect.meta delete mode 100644 Assets/Bundle/Models.meta delete mode 100644 Assets/Bundle/Prefabs.meta delete mode 100644 Assets/Bundle/Shaders/Include.meta delete mode 100644 Assets/Bundle/Shaders/Unit/Effect.meta delete mode 100644 Assets/Bundle/UI.meta delete mode 100644 Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta delete mode 100644 Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta delete mode 100644 Assets/Bundle/Unit/NPC.meta create mode 100644 Assets/Bundle/Unit/PC/Erika/Materials/Effect.meta delete mode 100644 Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta delete mode 100644 Assets/Bundle/Unit/PC/Erika/Models.meta delete mode 100644 Assets/Bundle/Unit/PC/Erika/UnitData.meta create mode 100644 Assets/Bundle/Unit/PC/Erika/Weapons/Materials.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta delete mode 100644 Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta delete mode 100644 Assets/Bundle/Unit/Prop.meta create mode 100644 Assets/Data/RootMotionData.meta delete mode 100644 Assets/Scripts/Curve3D.meta delete mode 100644 Assets/Scripts/Drone.meta delete mode 100644 Assets/Scripts/Managers/Physics.meta delete mode 100644 Assets/Scripts/Props.meta create mode 100644 Assets/Scripts/Rendering/CustomLight.cs create mode 100644 Assets/Scripts/Rendering/CustomLight.cs.meta delete mode 100644 Assets/Scripts/Robot.meta create mode 100644 Assets/Scripts/Scene.meta delete mode 100644 Assets/Scripts/Unit/AI/Actions.meta delete mode 100644 Assets/Scripts/Unit/AI/Conditionals.meta (limited to 'Assets') diff --git a/Assets/Art/Models/Characters/Default.meta b/Assets/Art/Models/Characters/Default.meta deleted file mode 100644 index 43499fc7..00000000 --- a/Assets/Art/Models/Characters/Default.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e8a40298dd4efd14c9f90a63734ca39b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Models/Characters/Erika2.meta b/Assets/Art/Models/Characters/Erika2.meta deleted file mode 100644 index fd7369d9..00000000 --- a/Assets/Art/Models/Characters/Erika2.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 077f81003f9fc564791cce182048c2b0 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Vfx/GrabSquaresEffect/AbstractWiresEffect/Scripts.meta b/Assets/Art/Vfx/GrabSquaresEffect/AbstractWiresEffect/Scripts.meta deleted file mode 100644 index b76e98a5..00000000 --- a/Assets/Art/Vfx/GrabSquaresEffect/AbstractWiresEffect/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 20381b3eecfbfe34a9d9222868969d29 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta b/Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta deleted file mode 100644 index 41200932..00000000 --- a/Assets/Art/Vfx/GrabSquaresEffect/Scripts.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: abff7cb61c760094f8ab9437379e0f2c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta b/Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta deleted file mode 100644 index fa9e76cd..00000000 --- a/Assets/Art/Vfx/GrabSquaresEffect/Shaders.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e38cb65072bb4a64cbe162792de9bec2 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Materials/Unit/Common.meta b/Assets/Bundle/Materials/Unit/Common.meta new file mode 100644 index 00000000..c93b1f88 --- /dev/null +++ b/Assets/Bundle/Materials/Unit/Common.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f56fd8c608849b44b9364a3469655444 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Materials/Unit/Effect.meta b/Assets/Bundle/Materials/Unit/Effect.meta deleted file mode 100644 index fdf8c1db..00000000 --- a/Assets/Bundle/Materials/Unit/Effect.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0525fec1eb7cc94458170e9e106955d5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Models.meta b/Assets/Bundle/Models.meta deleted file mode 100644 index c9b5bf44..00000000 --- a/Assets/Bundle/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: adab1ca5f61452c4c90f19e7c11adf0e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Prefabs.meta b/Assets/Bundle/Prefabs.meta deleted file mode 100644 index 82588fb1..00000000 --- a/Assets/Bundle/Prefabs.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dac6442cad7539149a7527510665d510 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc b/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc index 04334ee4..7f657e59 100644 --- a/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc +++ b/Assets/Bundle/Shaders/Common/Image/ImageEffect.cginc @@ -1,4 +1,4 @@ -// UnitLensEffect效果 +// UnitLensEffect效果相关 sampler2D _MainTex; float4 _MainTex_ST; @@ -16,3 +16,18 @@ sampler2D _UnitMotionVectorTexture; float4 _UnitMotionVectorTexture_ST; float4 _UnitTileOffset; + +// functions + +// 只对一小部分进行后处理 +float4 CalculateUnitTillOfssetVertex(float4 vert) +{ + float4 v = float4(vert.xy * _UnitTileOffset.xy + _UnitTileOffset.zw, 0, 1); + v.xy = v.xy * 2 - float2(1,1); + return v; +} + +fixed2 CalculateUnitTillOfssetUV(fixed2 uv0) +{ + return uv0 * _UnitTileOffset.xy + _UnitTileOffset.zw; +} diff --git a/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader b/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader index 2246fda2..16ec6fe7 100644 --- a/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader +++ b/Assets/Bundle/Shaders/Common/Image/common_img_motionblur.shader @@ -48,8 +48,8 @@ Shader "Erika/Common/Image/MotionBlur" v2f vert(appdata_img v) { v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.uv = TRANSFORM_TEX(v.texcoord, _MainTex); + o.vertex = CalculateUnitTillOfssetVertex(v.vertex); + o.uv = CalculateUnitTillOfssetUV(TRANSFORM_TEX(v.texcoord, _MainTex)); return o; } diff --git a/Assets/Bundle/Shaders/Common/common_gbuffer.shader b/Assets/Bundle/Shaders/Common/common_gbuffer.shader index 485a52c1..c682d8fa 100644 --- a/Assets/Bundle/Shaders/Common/common_gbuffer.shader +++ b/Assets/Bundle/Shaders/Common/common_gbuffer.shader @@ -1,68 +1,113 @@ 锘縎hader "Erika/Common/GBuffer" { - Properties - { - _MainTex ("Texture", 2D) = "white" {} - } - SubShader - { - Tags { "RenderType"="Opaque" } - LOD 100 - - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - - #include "UnityCG.cginc" - - struct appdata - { - float3 vertex : POSITION; - float3 normal : NORMAL; - float3 tangent : TANGENT; - float2 uv : TEXCOORD0; - }; - - struct v2f - { - float2 uv : TEXCOORD0; - float3 normal : TEXCOORD1; - float3 worldPos : TEXCOORD2; - float4 vertex : SV_POSITION; - }; - - struct Output - { - float4 diffuse : SV_Target0; - float4 normal : SV_Target1; - float4 position : SV_Target2; - float4 texCoord : SV_Target3; - }; - - sampler2D _MainTex; - float4 _MainTex_ST; - - v2f vert (appdata v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.uv = TRANSFORM_TEX(v.uv, _MainTex); - o.worldPos = mul(unity_ObjectToWorld, float4(v.vertex, 1)).xyz; - return o; - } - - Output frag (v2f i) - { - Output o; - fixed4 col = tex2D(_MainTex, i.uv); - o.diffuse = fixed4(1,0,0,1); - o.normal = fixed4(1,1,0,1); - o.position = fixed4(i.worldPos, 1); - return o; - } - ENDCG - } - } + //unity鍙傛暟鍏ュ彛 + Properties + { + _MainTex("璐村浘",2D) = "white"{} + _Diffuse("婕弽灏",Color) = (1,1,1,1) + _Specular("楂樺厜鑹",Color) = (1,1,1,1) + _Gloss("骞虫粦搴",Range(1,100)) = 50 + } + + SubShader + { + //闈為忔槑闃熷垪 + Tags { "RenderType" = "Opaque" } + LOD 100 + //寤惰繜娓叉煋 + Pass + { + //璁剧疆 鍏夌収妯″紡涓哄欢杩熸覆鏌 + Tags{"LightMode" = "Deferred"} + CGPROGRAM + // 澹版槑椤剁偣鐫鑹插櫒銆佺墖鍏冪潃鑹插櫒鍜岃緭鍑虹洰鏍 + #pragma target 3.0 + #pragma vertex vert + #pragma fragment frag + //鎺掗櫎涓嶆敮鎸丮RT鐨勭‖浠 + //#pragma exclude_renderers norm + // unity 鍑芥暟搴 + #include"UnityCG.cginc" + //瀹氫箟UNITY_HDR_ON鍏抽敭瀛 + //鍦╟# 涓 Shader.EnableKeyword("UNITY_HDR_ON"); Shader.DisableKeyword("UNITY_HDR_ON"); + // 璁惧畾hdr鏄惁寮鍚 + #pragma multi_compile __ UNITY_HDR_ON + // 璐村浘 + sampler2D _MainTex; + // 棰樺浘uv澶勭悊 + float4 _MainTex_ST; + // 婕弽灏勫厜 + float4 _Diffuse; + // 楂樺厜 + float4 _Specular; + // 骞虫粦搴 + float _Gloss; + // 椤剁偣娓叉煋鍣ㄦ墍浼犲叆鐨勫弬鏁扮粨鏋勶紝鍒嗗埆鏄《鐐逛綅缃佹硶绾夸俊鎭乽v鍧愭爣 + struct a2v + { + float4 pos:POSITION; + float3 normal:NORMAL; + float2 uv:TEXCOORD0; + }; + // 鐗囧厓娓叉煋鍣ㄦ墍闇鐨勪紶鍏ュ弬鏁扮粨鏋勶紝鍒嗗埆鏄儚绱犱綅缃乽v鍧愭爣銆佸儚绱犱笘鐣屼綅缃佸儚绱犱笘鐣屾硶绾 + struct v2f + { + float4 pos:SV_POSITION; + float2 uv : TEXCOORD0; + float3 worldPos:TEXCOORD1; + float3 worldNormal:TEXCOORD2; + }; + // 寤惰繜娓叉煋鎵闇鐨勮緭鍑虹粨鏋勩傛鍚戞覆鏌撳彧闇瑕佽緭鍑1涓猅arget锛岃屽欢杩熸覆鏌撶殑鐗囧厓闇瑕佽緭鍑4涓猅arget + struct DeferredOutput + { + //// RGB瀛樺偍婕弽灏勯鑹诧紝A閫氶亾瀛樺偍閬僵 + //float4 gBuffer0:SV_TARGET0; + //// RGB瀛樺偍楂樺厜锛堥暅闈級鍙嶅皠棰滆壊锛孉閫氶亾瀛樺偍楂樺厜鍙嶅皠鐨勬寚鏁伴儴鍒嗭紝涔熷氨鏄钩婊戝害 + //float4 gBuffer1:SV_TARGET1; + //// RGB閫氶亾瀛樺偍涓栫晫绌洪棿娉曠嚎锛孉閫氶亾娌$敤 + //float4 gBuffer2:SV_TARGET2; + //// Emission + lighting + lightmaps + reflection probes (楂樺姩鎬佸厜鐓ф覆鏌/浣庡姩鎬佸厜鐓ф覆鏌)鐢ㄤ簬瀛樺偍鑷彂鍏+lightmap+鍙嶅皠鎺㈤拡娣卞害缂撳啿鍜屾ā鏉跨紦鍐 + //float4 gBuffer3:SV_TARGET3; + float4 normal : SV_TARGET0; + float4 position : SV_TARGET1; + }; + // 椤剁偣娓叉煋鍣 + v2f vert(a2v v) + { + v2f o; + // 鑾峰彇瑁佸壀绌洪棿涓嬬殑椤剁偣鍧愭爣 + o.pos = UnityObjectToClipPos(v.pos); + // 搴旂敤uv璁剧疆锛岃幏鍙栨纭殑uv + o.uv = TRANSFORM_TEX(v.uv, _MainTex); + // 鑾峰彇椤剁偣鐨勪笘鐣屽潗鏍 + o.worldPos = mul(unity_ObjectToWorld, v.pos).xyz; + // 鑾峰彇涓栫晫鍧愭爣涓嬬殑娉曠嚎 + o.worldNormal = UnityObjectToWorldNormal(v.normal); + return o; + } + // 鐗囧厓鐫鑹插櫒 + DeferredOutput frag(v2f i) + { + DeferredOutput o; + //// 鍍忕礌棰滆壊 = 璐村浘棰滆壊 * 婕弽灏勯鑹 + //fixed3 color = tex2D(_MainTex, i.uv).rgb * _Diffuse.rgb; + //// 榛樿浣跨敤楂樺厜鍙嶅皠杈撳嚭锛侊紒 + //o.gBuffer0.rgb = color; // RGB瀛樺偍婕弽灏勯鑹诧紝A閫氶亾瀛樺偍閬僵 + //o.gBuffer0.a = 1; // 婕弽灏勭殑閫忔槑搴 + //o.gBuffer1.rgb = _Specular.rgb; // RGB瀛樺偍楂樺厜锛堥暅闈級鍙嶅皠棰滆壊锛 + //o.gBuffer1.a = _Gloss / 100; // 楂樺厜锛堥暅闈級鍙嶅皠棰滆壊 鐨 + //o.gBuffer2 = float4(i.worldNormal * 0.5 + 0.5, 1); // RGB閫氶亾瀛樺偍涓栫晫绌洪棿娉曠嚎锛孉閫氶亾娌$敤 + //// 濡傛灉娌″紑鍚疕DR锛岃缁欓鑹茬紪鐮佽浆鎹竴涓嬫暟鎹甧xp2锛屽悗闈㈠湪lightpass2閲屽垯鏄繘琛岃В鐮乴og2 + //#if !defined(UNITY_HDR_ON) + // color.rgb = exp2(-color.rgb); + //#endif + //// Emission + lighting + lightmaps + reflection probes (楂樺姩鎬佸厜鐓ф覆鏌/浣庡姩鎬佸厜鐓ф覆鏌)鐢ㄤ簬瀛樺偍鑷彂鍏+lightmap+鍙嶅皠鎺㈤拡娣卞害缂撳啿鍜屾ā鏉跨紦鍐 + //o.gBuffer3 = fixed4(color, 1); + o.normal = float4(i.worldNormal * 0.5 + 0.5, 1); + o.position = float4(i.worldPos, 1); + return o; + } + ENDCG + } + } } diff --git a/Assets/Bundle/Shaders/Include.meta b/Assets/Bundle/Shaders/Include.meta deleted file mode 100644 index 2666365a..00000000 --- a/Assets/Bundle/Shaders/Include.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dc32af12c5122994d8791378227adeb6 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Shaders/Unit/Effect.meta b/Assets/Bundle/Shaders/Unit/Effect.meta deleted file mode 100644 index 7df9a033..00000000 --- a/Assets/Bundle/Shaders/Unit/Effect.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9cc4684b9f432f149b16a51f148c9490 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/UI.meta b/Assets/Bundle/UI.meta deleted file mode 100644 index 0914914c..00000000 --- a/Assets/Bundle/UI.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4392471259b05a74a82a4bc72b510eb1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta b/Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta deleted file mode 100644 index ca7266b0..00000000 --- a/Assets/Bundle/Unit/Monster/Robots_Prowler/ActionData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a1d7b6e0d8fb1a642a65011fb6cd7d89 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta b/Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta deleted file mode 100644 index 142f5872..00000000 --- a/Assets/Bundle/Unit/Monster/Robots_Prowler/UnitData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6ad7401709700f34db2b795830937d76 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/NPC.meta b/Assets/Bundle/Unit/NPC.meta deleted file mode 100644 index eeea13e1..00000000 --- a/Assets/Bundle/Unit/NPC.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8ced034d375cdfa488814663ea17a79b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/Erika/Materials/Effect.meta b/Assets/Bundle/Unit/PC/Erika/Materials/Effect.meta new file mode 100644 index 00000000..855459bb --- /dev/null +++ b/Assets/Bundle/Unit/PC/Erika/Materials/Effect.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3ab09dc0a18f20b4ea29507887e11428 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta b/Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta deleted file mode 100644 index 8c41a6b2..00000000 --- a/Assets/Bundle/Unit/PC/Erika/Materials/Normal.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5dc1b71affc68b54594096a1b96a5c00 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/Erika/Models.meta b/Assets/Bundle/Unit/PC/Erika/Models.meta deleted file mode 100644 index 11148d17..00000000 --- a/Assets/Bundle/Unit/PC/Erika/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 0d712421d808a43438a43d8a5d34effe -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/Erika/UnitData.meta b/Assets/Bundle/Unit/PC/Erika/UnitData.meta deleted file mode 100644 index 7d4b13eb..00000000 --- a/Assets/Bundle/Unit/PC/Erika/UnitData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 922befa8a94692845b88500a23229d7f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/Erika/Weapons/Materials.meta b/Assets/Bundle/Unit/PC/Erika/Weapons/Materials.meta new file mode 100644 index 00000000..be6badd6 --- /dev/null +++ b/Assets/Bundle/Unit/PC/Erika/Weapons/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2c46a5a23283c7d428ae8bb13663ab6a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta deleted file mode 100644 index f5434a00..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/ActionData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 07c3b2bf6cb8cc2498422bbb105cbad8 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta deleted file mode 100644 index 4ed2c938..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationClip.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 827d77abe87680a47ae2d71a9e953a18 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta deleted file mode 100644 index 43a52cd1..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/AnimationData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7a2b72fbb41383047ac45e6c22ea9663 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta deleted file mode 100644 index 85d58a8c..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/AfterImage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b2b0838fb0603964e99904eefe81ad7f -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta deleted file mode 100644 index dd867045..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/Materials/Normal.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1c8a678ea9e801f439a1003d04f33cf5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta deleted file mode 100644 index dc530723..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/Models.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ebf636c7cf7b1934b885298ce1f5f42e -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta deleted file mode 100644 index b28b6f04..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/RootMotion.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2022e8298d3a8624992143eb57c0f8ac -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta deleted file mode 100644 index eeca0d3b..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/UnitData.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f6aa859c834c51f498ef0b3c3b83a0f5 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta b/Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta deleted file mode 100644 index 7f91da28..00000000 --- a/Assets/Bundle/Unit/PC/ErikaCyborg/Weapons.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: df69962f5b01e444a8bea87e31c7d0a4 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Bundle/Unit/Prop.meta b/Assets/Bundle/Unit/Prop.meta deleted file mode 100644 index affd6eed..00000000 --- a/Assets/Bundle/Unit/Prop.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dafc173db1ebeab4c80641cc3d4fa528 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Data/RootMotionData.meta b/Assets/Data/RootMotionData.meta new file mode 100644 index 00000000..14abf402 --- /dev/null +++ b/Assets/Data/RootMotionData.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5cfee9bde9754254f83510f88dd2a19b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Curve3D.meta b/Assets/Scripts/Curve3D.meta deleted file mode 100644 index fef1c5e7..00000000 --- a/Assets/Scripts/Curve3D.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ad8b718b6b700d8419838dad07158567 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Drone.meta b/Assets/Scripts/Drone.meta deleted file mode 100644 index 694cff70..00000000 --- a/Assets/Scripts/Drone.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ec3412151f8a72a41b2ed21316763399 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Editor/MainCameraEditor.cs b/Assets/Scripts/Editor/MainCameraEditor.cs index 437303a0..f2ad9479 100644 --- a/Assets/Scripts/Editor/MainCameraEditor.cs +++ b/Assets/Scripts/Editor/MainCameraEditor.cs @@ -1,7 +1,4 @@ -锘縰sing System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; +锘縰sing UnityEditor; [CustomEditor(typeof(MainCamera))] public class MainCameraEditor : Editor diff --git a/Assets/Scripts/Managers/Physics.meta b/Assets/Scripts/Managers/Physics.meta deleted file mode 100644 index 2296b3f8..00000000 --- a/Assets/Scripts/Managers/Physics.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 603d4624aaedd794cb89497954a83f4a -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Props.meta b/Assets/Scripts/Props.meta deleted file mode 100644 index bb96602e..00000000 --- a/Assets/Scripts/Props.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f299520ed9fcf4a45858ad4ef5a8d5d1 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Rendering/CustomLight.cs b/Assets/Scripts/Rendering/CustomLight.cs new file mode 100644 index 00000000..404dee12 --- /dev/null +++ b/Assets/Scripts/Rendering/CustomLight.cs @@ -0,0 +1,46 @@ +锘縰sing System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class CustomLight : MonoBehaviour +{ + // Start is called before the first frame update + void OnEnable() + { + CustomLightRegistry.Instance.Register(this); + } + + // Update is called once per frame + void OnDisable() + { + CustomLightRegistry.Instance.Unregister(this); + } +} + +public class CustomLightRegistry : Singleton +{ + private List m_Lights; + public List lights + { + get + { + if (m_Lights == null) + m_Lights = new List(); + return m_Lights; + } + } + + public void Register(CustomLight renderer) + { + if (!lights.Contains(renderer)) + { + lights.Add(renderer); + } + } + + public void Unregister(CustomLight renderer) + { + lights.Remove(renderer); + } + +} \ No newline at end of file diff --git a/Assets/Scripts/Rendering/CustomLight.cs.meta b/Assets/Scripts/Rendering/CustomLight.cs.meta new file mode 100644 index 00000000..51106c9d --- /dev/null +++ b/Assets/Scripts/Rendering/CustomLight.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d07937a2b7582554e9ec6ba1fcf41504 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Rendering/CustomRenderingPipeline.cs b/Assets/Scripts/Rendering/CustomRenderingPipeline.cs index 9387cf52..befeed87 100644 --- a/Assets/Scripts/Rendering/CustomRenderingPipeline.cs +++ b/Assets/Scripts/Rendering/CustomRenderingPipeline.cs @@ -5,6 +5,7 @@ using UnityEngine; using UnityEngine.Rendering; // 鐩告満鐨勮嚜瀹氫箟绠$嚎 +// 娣峰悎寤惰繜娓叉煋鍜屽墠鍚戞覆鏌 [RequireComponent(typeof(MainCamera))] public class CustomRenderingPipeline : MonoBehaviour { @@ -22,12 +23,10 @@ public class CustomRenderingPipeline : MonoBehaviour // command buffers CommandBuffer m_CommandBufferAfterDepth; - RenderTargetIdentifier[] m_GBuffer = new RenderTargetIdentifier[4]; + RenderTargetIdentifier[] m_GBuffer = new RenderTargetIdentifier[2]; RenderTargetIdentifier m_DepthBuffer; - RenderTexture m_GBufferTextureDiffuse; RenderTexture m_GBufferTextureNormal; RenderTexture m_GBufferTexturePosition; - RenderTexture m_GBufferTextureTexCoord; void OnEnable() { @@ -35,20 +34,16 @@ public class CustomRenderingPipeline : MonoBehaviour // command buffers m_CommandBufferAfterDepth = new CommandBuffer(); - m_Camera.AddCommandBuffer(CameraEvent.AfterDepthTexture, m_CommandBufferAfterDepth); + m_CommandBufferAfterDepth.name = "Custom RenderPipeline GBuffer"; + m_Camera.AddCommandBuffer(CameraEvent.AfterDepthTexture, m_CommandBufferAfterDepth); // render targets int width = m_Camera.pixelWidth, height = m_Camera.pixelHeight; - m_GBufferTextureDiffuse = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); m_GBufferTextureNormal = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); m_GBufferTexturePosition = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear); - m_GBufferTextureTexCoord = RenderTexture.GetTemporary(width, height, 24, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); - m_GBuffer[0] = m_GBufferTextureDiffuse.colorBuffer; - m_GBuffer[1] = m_GBufferTextureNormal.colorBuffer; - m_GBuffer[2] = m_GBufferTexturePosition.colorBuffer; - m_GBuffer[3] = m_GBufferTextureTexCoord.colorBuffer; - m_DepthBuffer = m_GBufferTextureDiffuse.depthBuffer; - + m_GBuffer[0] = m_GBufferTextureNormal.colorBuffer; + m_GBuffer[1] = m_GBufferTexturePosition.colorBuffer; + m_DepthBuffer = m_GBufferTextureNormal.depthBuffer; } void OnDisable() diff --git a/Assets/Scripts/Robot.meta b/Assets/Scripts/Robot.meta deleted file mode 100644 index 0b5a087e..00000000 --- a/Assets/Scripts/Robot.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7c09ca1609552d24bbe697d1516f8aa9 -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Scene.meta b/Assets/Scripts/Scene.meta new file mode 100644 index 00000000..eb7a8716 --- /dev/null +++ b/Assets/Scripts/Scene.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: eaee2d0f48cff9b40baf0686a8105600 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Unit/AI/Actions.meta b/Assets/Scripts/Unit/AI/Actions.meta deleted file mode 100644 index 9b4ad463..00000000 --- a/Assets/Scripts/Unit/AI/Actions.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 971e9d55b8bc0894eb6a110fb962000b -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/Unit/AI/Conditionals.meta b/Assets/Scripts/Unit/AI/Conditionals.meta deleted file mode 100644 index 70a86da5..00000000 --- a/Assets/Scripts/Unit/AI/Conditionals.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 85b7e0c7ed1d12f42a5178bfbf3d934c -folderAsset: yes -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: 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); diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs index 55e8c772..6aa06d01 100644 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs +++ b/Assets/Scripts/Unit/LensEffect/LensEffect_Buzz.cs @@ -15,11 +15,11 @@ public class LensEffect_Buzz : LensEffectBase public override void AfterForwardAlpha(EStage stage, CommandBuffer cb) { - if(stage == EStage.Before) + if (stage == EStage.Before) { Before(cb); } - else if(stage == EStage.After) + else if (stage == EStage.After) { After(cb); } @@ -28,7 +28,7 @@ public class LensEffect_Buzz : LensEffectBase void Before(CommandBuffer cb) { MaterialEntry buzz = ClaimMaterial(StaticDefine.shaders[EShader.Buzz].name); - + cb.SetGlobalTexture("_UnitDepthTexture", owner.unitPreprocessing.unitDepthTexture); cb.Blit(BuiltinRenderTextureType.CameraTarget, BuiltinRenderTextureType.CameraTarget, buzz.material); } diff --git a/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs b/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs index 6cce6b4c..dc14cf09 100644 --- a/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs +++ b/Assets/Scripts/Unit/LensEffect/LensEffect_Dash.cs @@ -9,22 +9,22 @@ public class LensEffect_Dash : LensEffectBase Color rimColor; int tempID; - float lifeTime; - UnitSnapshot snapshot; - TRS trs; - float angle; + float lifeTime; + UnitSnapshot snapshot; + TRS trs; + float angle; - float curTime = 0; + float curTime = 0; - public LensEffect_Dash(Color color, float lifeTime, float angle, UnitSnapshotInfo snapshot) : base() + public LensEffect_Dash(Color color, float lifeTime, float angle, UnitSnapshotInfo snapshot) : base() { rimColor = color; tempID = Shader.PropertyToID("RT_Dash"); - this.lifeTime = lifeTime; - trs = snapshot.trs; - this.snapshot = UnitManager.Instance.ClaimSnapshotSolo(snapshot); - this.angle = angle; - } + this.lifeTime = lifeTime; + trs = snapshot.trs; + this.snapshot = UnitManager.Instance.ClaimSnapshotSolo(snapshot); + this.angle = angle; + } public override void AfterForwardOpaque(EStage stage, CommandBuffer cb) { @@ -42,53 +42,53 @@ public class LensEffect_Dash : LensEffectBase } void Before(CommandBuffer cb) - { - cb.GetTemporaryRT(tempID, -1, -1, 24, FilterMode.Bilinear); + { + cb.GetTemporaryRT(tempID, -1, -1, 24, FilterMode.Bilinear); cb.SetRenderTarget(tempID); - cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0)); - - // renderer - snapshot.transform.position = trs.position; - snapshot.transform.rotation = trs.rotation; - snapshot.transform.localScale = trs.scale; + cb.ClearRenderTarget(true, true, new Color(0, 0, 0, 0)); - Matrix4x4 obj2Wod = Matrix4x4.identity; - SkinnedMeshRenderer smr = snapshot.renderers[0] as SkinnedMeshRenderer; - Vector3 pos = smr.rootBone.transform.position; - Quaternion rot = smr.rootBone.transform.rotation; - obj2Wod = MatrixUtility.RotateAndTranslate(pos, rot); + // renderer + snapshot.transform.position = trs.position; + snapshot.transform.rotation = trs.rotation; + snapshot.transform.localScale = trs.scale; - MaterialEntry mat = ClaimMaterial(StaticDefine.shaders[EShader.SolidColor].name); - mat.material.SetColor("_Color", rimColor); - mat.material.SetMatrix("_ObjectToWorld", obj2Wod); - mat.material.SetTexture("_MainTex", snapshot.renderers[0].sharedMaterial.GetTexture("_MainTex")); + Matrix4x4 obj2Wod = Matrix4x4.identity; + SkinnedMeshRenderer smr = snapshot.renderers[0] as SkinnedMeshRenderer; + Vector3 pos = smr.rootBone.transform.position; + Quaternion rot = smr.rootBone.transform.rotation; + obj2Wod = MatrixUtility.RotateAndTranslate(pos, rot); - cb.DrawRenderer(snapshot.renderers[0], mat.material); - } + MaterialEntry mat = ClaimMaterial(StaticDefine.shaders[EShader.SolidColor].name); + mat.material.SetColor("_Color", rimColor); + mat.material.SetMatrix("_ObjectToWorld", obj2Wod); + mat.material.SetTexture("_MainTex", snapshot.renderers[0].sharedMaterial.GetTexture("_MainTex")); + + cb.DrawRenderer(snapshot.renderers[0], mat.material); + } void After(CommandBuffer cb) { - curTime += Time.deltaTime; + curTime += Time.deltaTime; - MaterialEntry blur = ClaimMaterial(StaticDefine.shaders[EShader.MotionBlur].name); + MaterialEntry blur = ClaimMaterial(StaticDefine.shaders[EShader.MotionBlur].name); - Vector4 tileOffset = RenderingUtility.GetTillingOffset(MainCamera.Instance.camera, owner.center, owner.unitDetail.snapshotBound); - blur.material.SetVector("_UnitTileOffset", tileOffset); - blur.material.SetFloat("_Angle", Mathf.Rad2Deg * angle); - blur.material.SetFloat("_AlphaMultiplier", Mathf.Clamp(1 - curTime / lifeTime, 0, 1)); + Vector4 tileOffset = RenderingUtility.GetTillingOffset(MainCamera.Instance.camera, trs.position, owner.unitDetail.snapshotBound); + blur.material.SetVector("_UnitTileOffset", tileOffset); + blur.material.SetFloat("_Angle", Mathf.Rad2Deg * angle); + blur.material.SetFloat("_AlphaMultiplier", Mathf.Clamp(1 - curTime / lifeTime, 0, 1)); - cb.Blit(tempID, BuiltinRenderTextureType.CameraTarget, blur.material); + cb.Blit(tempID, BuiltinRenderTextureType.CameraTarget, blur.material); cb.ReleaseTemporaryRT(tempID); - } - - public override bool CanDestroy() - { - return curTime > lifeTime; - } - - public override void OnDestroy() - { - UnitManager.Instance.ReleaseSnapshot(ref snapshot); - } + } + + public override bool CanDestroy() + { + return curTime > lifeTime; + } + + public override void OnDestroy() + { + UnitManager.Instance.ReleaseSnapshot(ref snapshot); + } } \ No newline at end of file -- cgit v1.1-26-g67d0