mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-29 00:15:42 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50d5281424 | ||
|
|
87327fdfb4 |
+2
-2
@@ -165,8 +165,8 @@ Shader "Eagle/ProvinceWeatherMap"
|
||||
// Sample appropriate effect texture based on weather type
|
||||
// Types: 0.5=flood, 0.75=drought
|
||||
// Note: Blizzard and Epidemic use 3D particle effects only
|
||||
float4 effect;
|
||||
float4 tint;
|
||||
float4 effect = float4(0, 0, 0, 0);
|
||||
float4 tint = float4(0, 0, 0, 0);
|
||||
if (weatherType > 0.4 && weatherType < 0.6)
|
||||
{
|
||||
// Flood (rain)
|
||||
|
||||
+18
-10
@@ -29,6 +29,7 @@ Shader "Eagle/ProvinceWeather"
|
||||
"RenderType"="Transparent"
|
||||
"PreviewType"="Plane"
|
||||
"CanUseSpriteAtlas"="True"
|
||||
"RenderPipeline"="UniversalPipeline"
|
||||
}
|
||||
|
||||
Stencil
|
||||
@@ -49,19 +50,20 @@ Shader "Eagle/ProvinceWeather"
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
HLSLPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 2.0
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityUI.cginc"
|
||||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
|
||||
|
||||
#pragma multi_compile_local _ UNITY_UI_CLIP_RECT
|
||||
#pragma multi_compile_local _ UNITY_UI_ALPHACLIP
|
||||
|
||||
sampler2D _Mask;
|
||||
sampler2D _MainTex;
|
||||
TEXTURE2D(_Mask);
|
||||
SAMPLER(sampler_Mask);
|
||||
TEXTURE2D(_MainTex);
|
||||
SAMPLER(sampler_MainTex);
|
||||
float4 _MainTex_ST;
|
||||
float4 _TintColor;
|
||||
float _Cutoff;
|
||||
@@ -71,6 +73,12 @@ Shader "Eagle/ProvinceWeather"
|
||||
float4 _ClipRect;
|
||||
float4 _PopupClipRect;
|
||||
|
||||
float EagleGet2DClipping(float2 position, float4 clipRect)
|
||||
{
|
||||
float2 inside = step(clipRect.xy, position.xy) * step(position.xy, clipRect.zw);
|
||||
return inside.x * inside.y;
|
||||
}
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
@@ -94,7 +102,7 @@ Shader "Eagle/ProvinceWeather"
|
||||
UNITY_SETUP_INSTANCE_ID(v);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
|
||||
o.worldPosition = v.vertex;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.pos = TransformObjectToHClip(v.vertex.xyz);
|
||||
o.uv = v.uv;
|
||||
o.effectUV = TRANSFORM_TEX(v.uv, _MainTex);
|
||||
o.screenPos = ComputeScreenPos(o.pos);
|
||||
@@ -115,7 +123,7 @@ Shader "Eagle/ProvinceWeather"
|
||||
}
|
||||
|
||||
// Sample mask
|
||||
float mask = tex2D(_Mask, i.uv).a;
|
||||
float mask = SAMPLE_TEXTURE2D(_Mask, sampler_Mask, i.uv).a;
|
||||
if (mask < _Cutoff)
|
||||
discard;
|
||||
|
||||
@@ -130,13 +138,13 @@ Shader "Eagle/ProvinceWeather"
|
||||
uv.y += cos(i.uv.x * 20 + _Time.y * _DistortionSpeed) * _DistortionStrength;
|
||||
}
|
||||
|
||||
float4 effect = tex2D(_MainTex, uv);
|
||||
float4 effect = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, uv);
|
||||
float4 result = effect * _TintColor;
|
||||
result.a *= mask;
|
||||
|
||||
// RectMask2D clipping
|
||||
#ifdef UNITY_UI_CLIP_RECT
|
||||
result.a *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);
|
||||
result.a *= EagleGet2DClipping(i.worldPosition.xy, _ClipRect);
|
||||
#endif
|
||||
|
||||
#ifdef UNITY_UI_ALPHACLIP
|
||||
@@ -145,7 +153,7 @@ Shader "Eagle/ProvinceWeather"
|
||||
|
||||
return result;
|
||||
}
|
||||
ENDCG
|
||||
ENDHLSL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ GraphicsSettings:
|
||||
- {fileID: 10720, guid: 0000000000000000f000000000000000, type: 0}
|
||||
- {fileID: 4800000, guid: a60360570f7264533a1146b26d028b00, type: 3}
|
||||
- {fileID: 4800000, guid: ccd58ed8b9624c54a8bbd9554a4a8777, type: 3}
|
||||
- {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
- {fileID: 4800000, guid: 650dd9526735d5b46b79224bc6e94025, type: 3}
|
||||
- {fileID: 4800000, guid: 0406db5a14f94604a8c57ccfbc9f3b46, type: 3}
|
||||
m_PreloadedShaders: []
|
||||
m_PreloadShadersBatchTimeLimit: -1
|
||||
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
|
||||
|
||||
Reference in New Issue
Block a user