三国卡牌客户端基础资源仓库
hch
1 天以前 7087e88c414b237cb782bf40da6694c40bddee5b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef SPINE_OUTLINE_PASS_INCLUDED
#define SPINE_OUTLINE_PASS_INCLUDED
 
#include "UnityCG.cginc"
 
#ifdef SKELETON_GRAPHIC
#include "UnityUI.cginc"
#endif
 
#include "../../CGIncludes/Spine-Outline-Common.cginc"
 
sampler2D _MainTex;
 
float _OutlineWidth;
float4 _OutlineColor;
float4 _MainTex_TexelSize;
float _ThresholdEnd;
float _OutlineSmoothness;
float _OutlineOpaqueAlpha;
float _OutlineMipLevel;
int _OutlineReferenceTexWidth;
 
#ifdef SKELETON_GRAPHIC
float4 _ClipRect;
#endif
 
struct VertexInput {
    float4 vertex : POSITION;
    float2 uv : TEXCOORD0;
    float4 vertexColor : COLOR;
    UNITY_VERTEX_INPUT_INSTANCE_ID
};
 
struct VertexOutput {
    float4 pos : SV_POSITION;
    float2 uv : TEXCOORD0;
    float vertexColorAlpha : COLOR;
#ifdef SKELETON_GRAPHIC
    float4 worldPosition : TEXCOORD1;
#endif
    UNITY_VERTEX_OUTPUT_STEREO
};
 
 
#ifdef SKELETON_GRAPHIC
 
VertexOutput vertOutlineGraphic(VertexInput v) {
    VertexOutput o;
 
    UNITY_SETUP_INSTANCE_ID(v);
    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
 
    o.worldPosition = v.vertex;
    o.pos = UnityObjectToClipPos(o.worldPosition);
    o.uv = v.uv;
 
#ifdef UNITY_HALF_TEXEL_OFFSET
    o.pos.xy += (_ScreenParams.zw - 1.0) * float2(-1, 1);
#endif
 
    o.vertexColorAlpha = v.vertexColor.a;
    return o;
}
 
#else // !SKELETON_GRAPHIC
 
VertexOutput vertOutline(VertexInput v) {
    VertexOutput o;
 
    UNITY_SETUP_INSTANCE_ID(v);
    UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
 
    o.pos = UnityObjectToClipPos(v.vertex);
    o.uv = v.uv;
    o.vertexColorAlpha = v.vertexColor.a;
    return o;
}
#endif
 
float4 fragOutline(VertexOutput i) : SV_Target {
 
    float4 texColor = computeOutlinePixel(_MainTex, _MainTex_TexelSize.xy, i.uv, i.vertexColorAlpha,
        _OutlineWidth, _OutlineReferenceTexWidth, _OutlineMipLevel,
        _OutlineSmoothness, _ThresholdEnd, _OutlineOpaqueAlpha, _OutlineColor);
 
#ifdef SKELETON_GRAPHIC
    texColor *= UnityGet2DClipping(i.worldPosition.xy, _ClipRect);
#endif
 
    return texColor;
}
 
#endif // SPINE_OUTLINE_PASS_INCLUDED