Initial commit: Client Doc docs Server Tools

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ud18010
2026-07-10 10:24:29 +08:00
co-authored by Cursor
commit 7e35d8da31
3374 changed files with 680813 additions and 0 deletions
@@ -0,0 +1,39 @@
#ifndef BLENDMODES_NORMAL_PASS_INCLUDED
#define BLENDMODES_NORMAL_PASS_INCLUDED
#include "UnityCG.cginc"
#include "../CGIncludes/Spine-Common.cginc"
uniform sampler2D _MainTex;
uniform float4 _Color;
struct VertexInput {
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
float4 vertexColor : COLOR;
};
VertexOutput vert(VertexInput v) {
VertexOutput o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.uv;
o.vertexColor = PMAGammaToTargetSpace(v.vertexColor) * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
return o;
}
float4 frag(VertexOutput i) : SV_Target{
float4 texColor = tex2D(_MainTex, i.uv);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
return (texColor * i.vertexColor);
}
#endif
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6e28a50646b0e9542a1c93c2d9d993d0
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
#ifndef BLENDMODES_SHADOWCASTER_PASS_INCLUDED
#define BLENDMODES_SHADOWCASTER_PASS_INCLUDED
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float4 uvAndAlpha : TEXCOORD1;
};
uniform float4 _MainTex_ST;
v2f vert(appdata_base v, float4 vertexColor : COLOR) {
v2f o;
TRANSFER_SHADOW_CASTER(o)
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uvAndAlpha.z = 0;
o.uvAndAlpha.a = vertexColor.a;
return o;
}
uniform sampler2D _MainTex;
uniform fixed _Cutoff;
float4 frag(v2f i) : SV_Target{
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
clip(texcol.a* i.uvAndAlpha.a - _Cutoff);
SHADOW_CASTER_FRAGMENT(i)
}
#endif
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 76beace455f83a8488bf044605212b2c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,56 @@
#ifndef SPINE_COMMON_INCLUDED
#define SPINE_COMMON_INCLUDED
#if defined(USE_LWRP)
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#define GammaToLinearSpace SRGBToLinear
#define LinearToGammaSpace LinearToSRGB
#elif defined(USE_URP)
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
#define GammaToLinearSpace SRGBToLinear
#define LinearToGammaSpace LinearToSRGB
#else
#include "UnityCG.cginc"
#endif
inline half3 GammaToTargetSpace(half3 gammaColor) {
#if UNITY_COLORSPACE_GAMMA
return gammaColor;
#else
return GammaToLinearSpace(gammaColor);
#endif
}
inline half3 TargetToGammaSpace(half3 targetColor) {
#if UNITY_COLORSPACE_GAMMA
return targetColor;
#else
return LinearToGammaSpace(targetColor);
#endif
}
inline half4 PMAGammaToTargetSpace(half4 gammaPMAColor) {
#if UNITY_COLORSPACE_GAMMA
return gammaPMAColor;
#else
return gammaPMAColor.a == 0 ?
half4(GammaToLinearSpace(gammaPMAColor.rgb), gammaPMAColor.a) :
half4(GammaToLinearSpace(gammaPMAColor.rgb / gammaPMAColor.a) * gammaPMAColor.a, gammaPMAColor.a);
#endif
}
// Saturated version to prevent numerical issues that occur at CanvasRenderer
// shader during linear-space PMA vertex color correction (countering automatic Unity conversion).
// Note: Only use this method when the original color.rgb values lie within [0,1] range and
// it's not an HDR color. This method is usually suitable for vertex color.
inline half4 PMAGammaToTargetSpaceSaturated(half4 gammaPMAColor) {
#if UNITY_COLORSPACE_GAMMA
return gammaPMAColor;
#else
return gammaPMAColor.a == 0 ?
half4(GammaToLinearSpace(gammaPMAColor.rgb), gammaPMAColor.a) :
half4(saturate(GammaToLinearSpace(gammaPMAColor.rgb / gammaPMAColor.a)) * gammaPMAColor.a, gammaPMAColor.a);
#endif
}
#endif
@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: f0c09e980440e7f4f8db4f9f146d320c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,41 @@
#ifndef SPRITES_DEPTH_ONLY_PASS_INCLUDED
#define SPRITES_DEPTH_ONLY_PASS_INCLUDED
#include "UnityCG.cginc"
sampler2D _MainTex;
float _Cutoff;
float _ZWriteOffset;
struct VertexInput {
float4 positionOS : POSITION;
float2 texcoord : TEXCOORD0;
float4 vertexColor : COLOR;
};
struct VertexOutput {
float4 positionCS : SV_POSITION;
float4 texcoordAndAlpha: TEXCOORD0;
};
VertexOutput DepthOnlyVertex (VertexInput v) {
VertexOutput o;
o.positionCS = UnityObjectToClipPos(v.positionOS - float4(0, 0, _ZWriteOffset, 0));
o.texcoordAndAlpha.xy = v.texcoord;
o.texcoordAndAlpha.z = 0;
o.texcoordAndAlpha.a = v.vertexColor.a;
return o;
}
float4 DepthOnlyFragment (VertexOutput input) : SV_Target{
float4 texColor = tex2D(_MainTex, input.texcoordAndAlpha.rg);
#if defined(_STRAIGHT_ALPHA_INPUT)
texColor.rgb *= texColor.a;
#endif
clip(texColor.a * input.texcoordAndAlpha.a - _Cutoff);
return 0;
}
#endif
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 27351ce55d3beb643ae8d9385db21941
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,69 @@
#ifndef SPINE_OUTLINE_COMMON_INCLUDED
#define SPINE_OUTLINE_COMMON_INCLUDED
float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize,
float2 uv, float vertexColorAlpha,
float OutlineWidth, float OutlineReferenceTexWidth, float OutlineMipLevel,
float OutlineSmoothness, float ThresholdEnd, float OutlineOpaqueAlpha, float4 OutlineColor) {
float4 texColor = fixed4(0, 0, 0, 0);
#if !_USE_SCREENSPACE_OUTLINE_WIDTH
// constant width in texture space
float outlineWidthCompensated = OutlineWidth / (OutlineReferenceTexWidth * mainTextureTexelSize.x);
float xOffset = mainTextureTexelSize.x * outlineWidthCompensated;
float yOffset = mainTextureTexelSize.y * outlineWidthCompensated;
#else
float2 ddxUV = ddx(uv);
float2 ddyUV = ddy(uv);
float2 ddu = float2(ddxUV.x, ddyUV.x);
float2 ddv = float2(ddxUV.y, ddyUV.y);
float widthScale = OutlineWidth * _ScreenParams.x / OutlineReferenceTexWidth;
float xOffset = length(ddu) * widthScale;
float yOffset = length(ddv) * widthScale;
#endif
float xOffsetDiagonal = xOffset * 0.7;
float yOffsetDiagonal = yOffset * 0.7;
float pixelCenter = tex2D(mainTexture, uv).a;
float4 uvCenterWithLod = float4(uv, 0, OutlineMipLevel);
float pixelTop = tex2Dlod(mainTexture, uvCenterWithLod + float4(0, yOffset, 0, 0)).a;
float pixelBottom = tex2Dlod(mainTexture, uvCenterWithLod + float4(0, -yOffset, 0, 0)).a;
float pixelLeft = tex2Dlod(mainTexture, uvCenterWithLod + float4(-xOffset, 0, 0, 0)).a;
float pixelRight = tex2Dlod(mainTexture, uvCenterWithLod + float4(xOffset, 0, 0, 0)).a;
#if _USE8NEIGHBOURHOOD_ON
float numSamples = 8;
float pixelTopLeft = tex2Dlod(mainTexture, uvCenterWithLod + float4(-xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a;
float pixelTopRight = tex2Dlod(mainTexture, uvCenterWithLod + float4(xOffsetDiagonal, yOffsetDiagonal, 0, 0)).a;
float pixelBottomLeft = tex2Dlod(mainTexture, uvCenterWithLod + float4(-xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a;
float pixelBottomRight = tex2Dlod(mainTexture, uvCenterWithLod + float4(xOffsetDiagonal, -yOffsetDiagonal, 0, 0)).a;
float average = (pixelTop + pixelBottom + pixelLeft + pixelRight +
pixelTopLeft + pixelTopRight + pixelBottomLeft + pixelBottomRight)
* vertexColorAlpha / numSamples;
#else // 4 neighbourhood
float numSamples = 4;
float average = (pixelTop + pixelBottom + pixelLeft + pixelRight) * vertexColorAlpha / numSamples;
#endif
float thresholdStart = ThresholdEnd * (1.0 - OutlineSmoothness);
float outlineAlpha = saturate((average - thresholdStart) / (ThresholdEnd - thresholdStart));
#if !_OUTLINE_FILL_INSIDE
outlineAlpha = saturate(outlineAlpha - pixelCenter);
outlineAlpha = pixelCenter > OutlineOpaqueAlpha ? 0.0 : outlineAlpha;
#else
outlineAlpha = pixelCenter > OutlineOpaqueAlpha ? 1.0 : outlineAlpha;
#endif
return lerp(texColor, OutlineColor, outlineAlpha);
}
float4 computeOutlinePixel(sampler2D mainTexture, float2 mainTextureTexelSize,
float2 uv, float vertexColorAlpha,
float OutlineWidth, float OutlineReferenceTexWidth, float OutlineMipLevel,
float OutlineSmoothness, float ThresholdEnd, float4 OutlineColor) {
return computeOutlinePixel(mainTexture, mainTextureTexelSize,
uv, vertexColorAlpha, OutlineWidth, OutlineReferenceTexWidth, OutlineMipLevel,
OutlineSmoothness, ThresholdEnd, 1.0, OutlineColor);
}
#endif
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a8d610b87be4e82409e18a63a930d335
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,30 @@
#ifndef SKELETON_LIT_COMMON_SHADOW_INCLUDED
#define SKELETON_LIT_COMMON_SHADOW_INCLUDED
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float4 uvAndAlpha : TEXCOORD1;
};
uniform float4 _MainTex_ST;
v2f vertShadow(appdata_base v, float4 vertexColor : COLOR) {
v2f o;
TRANSFER_SHADOW_CASTER(o)
o.uvAndAlpha.xy = TRANSFORM_TEX(v.texcoord, _MainTex);
o.uvAndAlpha.z = 0;
o.uvAndAlpha.a = vertexColor.a;
return o;
}
uniform sampler2D _MainTex;
uniform fixed SHADOW_CUTOFF;
float4 fragShadow (v2f i) : SV_Target {
fixed4 texcol = tex2D(_MainTex, i.uvAndAlpha.xy);
clip(texcol.a * i.uvAndAlpha.a - SHADOW_CUTOFF);
SHADOW_CASTER_FRAGMENT(i)
}
#endif
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c7297b25c81d2494e8e73b742e3c7345
timeCreated: 1564083752
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,133 @@
#ifndef SKELETON_LIT_COMMON_INCLUDED
#define SKELETON_LIT_COMMON_INCLUDED
#include "UnityCG.cginc"
#include "CGIncludes/Spine-Common.cginc"
// ES2.0/WebGL/3DS can not do loops with non-constant-expression iteration counts :(
#if defined(SHADER_API_GLES)
#define LIGHT_LOOP_LIMIT 8
#elif defined(SHADER_API_N3DS)
#define LIGHT_LOOP_LIMIT 4
#else
#define LIGHT_LOOP_LIMIT unity_VertexLightParams.x
#endif
////////////////////////////////////////
// Alpha Clipping
//
#if defined(_ALPHA_CLIP)
uniform fixed _Cutoff;
#define ALPHA_CLIP(pixel, color) clip((pixel.a * color.a) - _Cutoff);
#else
#define ALPHA_CLIP(pixel, color)
#endif
half3 computeLighting (int idx, half3 dirToLight, half3 eyeNormal, half4 diffuseColor, half atten) {
half NdotL = max(dot(eyeNormal, dirToLight), 0.0);
// diffuse
half3 color = NdotL * diffuseColor.rgb * unity_LightColor[idx].rgb;
return color * atten;
}
half3 computeOneLight (int idx, float3 eyePosition, half3 eyeNormal, half4 diffuseColor) {
float3 dirToLight = unity_LightPosition[idx].xyz;
half att = 1.0;
#if defined(POINT) || defined(SPOT)
dirToLight -= eyePosition * unity_LightPosition[idx].w;
// distance attenuation
float distSqr = dot(dirToLight, dirToLight);
att /= (1.0 + unity_LightAtten[idx].z * distSqr);
if (unity_LightPosition[idx].w != 0 && distSqr > unity_LightAtten[idx].w) att = 0.0; // set to 0 if outside of range
distSqr = max(distSqr, 0.000001); // don't produce NaNs if some vertex position overlaps with the light
dirToLight *= rsqrt(distSqr);
#if defined(SPOT)
// spot angle attenuation
half rho = max(dot(dirToLight, unity_SpotDirection[idx].xyz), 0.0);
half spotAtt = (rho - unity_LightAtten[idx].x) * unity_LightAtten[idx].y;
att *= saturate(spotAtt);
#endif
#endif
att *= 0.5; // passed in light colors are 2x brighter than what used to be in FFP
return min (computeLighting (idx, dirToLight, eyeNormal, diffuseColor, att), 1.0);
}
int4 unity_VertexLightParams; // x: light count, y: zero, z: one (y/z needed by d3d9 vs loop instruction)
struct appdata {
float3 pos : POSITION;
float3 normal : NORMAL;
half4 color : COLOR;
float2 uv0 : TEXCOORD0;
#if defined(_TINT_BLACK_ON)
float2 tintBlackRG : TEXCOORD1;
float2 tintBlackB : TEXCOORD2;
#endif
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct VertexOutput {
fixed4 color : COLOR0;
float2 uv0 : TEXCOORD0;
float4 pos : SV_POSITION;
UNITY_VERTEX_OUTPUT_STEREO
};
VertexOutput vert (appdata v) {
VertexOutput o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
half4 color = PMAGammaToTargetSpace(v.color);
float3 eyePos = UnityObjectToViewPos(float4(v.pos, 1)).xyz; //mul(UNITY_MATRIX_MV, float4(v.pos,1)).xyz;
half3 fixedNormal = half3(0,0,-1);
half3 eyeNormal = normalize(mul((float3x3)UNITY_MATRIX_IT_MV, fixedNormal));
o.uv0 = v.uv0;
o.pos = UnityObjectToClipPos(v.pos);
#ifdef _DOUBLE_SIDED_LIGHTING
// unfortunately we have to compute the sign here in the vertex shader
// instead of using VFACE in fragment shader stage.
half faceSign = sign(eyeNormal.z);
eyeNormal *= faceSign;
#endif
half3 shadowedColor;
#if !defined(_LIGHT_AFFECTS_ADDITIVE)
if (color.a == 0) {
o.color = color;
return o;
}
#endif // !defined(_LIGHT_AFFECTS_ADDITIVE)
// Lights
half3 lcolor = half4(0,0,0,1).rgb + color.rgb * glstate_lightmodel_ambient.rgb;
for (int il = 0; il < LIGHT_LOOP_LIMIT; ++il) {
lcolor += computeOneLight(il, eyePos, eyeNormal, color);
}
color.rgb = lcolor.rgb;
o.color = saturate(color);
return o;
}
sampler2D _MainTex;
fixed4 frag (VertexOutput i) : SV_Target {
fixed4 tex = tex2D(_MainTex, i.uv0);
ALPHA_CLIP(tex, i.color);
#if defined(_STRAIGHT_ALPHA_INPUT)
tex.rgb *= tex.a;
#endif
fixed4 col = tex * i.color;
col.rgb *= 2;
return col;
}
#endif
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 70c77c02aabd5e44f94aab48dd0be7b2
timeCreated: 1564083752
licenseType: Free
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,27 @@
#ifndef SKELETON_TINT_COMMON_INCLUDED
#define SKELETON_TINT_COMMON_INCLUDED
float4 fragTintedColor(float4 texColor, float3 darkTintColor, float4 lightTintColorPMA, float lightColorAlpha, float darkColorAlpha) {
float a = texColor.a * lightTintColorPMA.a;
#if !defined(_STRAIGHT_ALPHA_INPUT)
float3 texDarkColor = texColor.a - texColor.rgb;
#else
float3 texDarkColor = (1 - texColor.rgb);
#endif
float3 darkColor = texDarkColor * darkTintColor.rgb * lightColorAlpha;
float3 lightColor = texColor.rgb * lightTintColorPMA.rgb;
float4 fragColor = float4(darkColor + lightColor, a);
#if defined(_STRAIGHT_ALPHA_INPUT)
fragColor.rgb *= texColor.a;
#endif
#if defined(_DARK_COLOR_ALPHA_ADDITIVE)
fragColor.a = a * (1 - darkColorAlpha);
#endif
return fragColor;
}
#endif
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: cc9439c8e75fb7e4c82ad725b649b047
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant: