mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 10:37:37 +02:00
Timekeeping Improvements and Small Optimizations (#544)
* make BeatActions coroutines instead of componentrs * pooled scheduled sounds implement S' entity seek * remove debug prints from last two changes * implement absolute time tracking implement DSP time resyncing * optimize GameManager * update TMPro * update IDE packages * fix dsp sync making the drift worse * fix issue with the JSL dll * relocate debug print * make scheduled pitch setter functional * any cpu
This commit is contained in:
@ -1,20 +1,22 @@
|
||||
struct vertex_t {
|
||||
struct vertex_t
|
||||
{
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
float4 position : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
float4 color : COLOR;
|
||||
float2 texcoord0 : TEXCOORD0;
|
||||
float4 texcoord0 : TEXCOORD0;
|
||||
float2 texcoord1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
struct pixel_t {
|
||||
struct pixel_t
|
||||
{
|
||||
UNITY_VERTEX_INPUT_INSTANCE_ID
|
||||
UNITY_VERTEX_OUTPUT_STEREO
|
||||
float4 position : SV_POSITION;
|
||||
float4 faceColor : COLOR;
|
||||
float4 outlineColor : COLOR1;
|
||||
float4 texcoord0 : TEXCOORD0;
|
||||
float4 param : TEXCOORD1; // weight, scaleRatio
|
||||
float4 param : TEXCOORD1; // x = weight, y = no longer used
|
||||
float2 mask : TEXCOORD2;
|
||||
#if (UNDERLAY_ON || UNDERLAY_INNER)
|
||||
float4 texcoord2 : TEXCOORD3;
|
||||
@ -22,10 +24,14 @@ struct pixel_t {
|
||||
#endif
|
||||
};
|
||||
|
||||
float4 SRGBToLinear(float4 rgba) {
|
||||
float4 SRGBToLinear(float4 rgba)
|
||||
{
|
||||
return float4(lerp(rgba.rgb / 12.92f, pow((rgba.rgb + 0.055f) / 1.055f, 2.4f), step(0.04045f, rgba.rgb)), rgba.a);
|
||||
}
|
||||
|
||||
float _UIMaskSoftnessX;
|
||||
float _UIMaskSoftnessY;
|
||||
|
||||
pixel_t VertShader(vertex_t input)
|
||||
{
|
||||
pixel_t output;
|
||||
@ -35,7 +41,7 @@ pixel_t VertShader(vertex_t input)
|
||||
UNITY_TRANSFER_INSTANCE_ID(input, output);
|
||||
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(output);
|
||||
|
||||
float bold = step(input.texcoord1.y, 0);
|
||||
float bold = step(input.texcoord0.w, 0);
|
||||
|
||||
float4 vert = input.position;
|
||||
vert.x += _VertexOffsetX;
|
||||
@ -71,7 +77,7 @@ pixel_t VertShader(vertex_t input)
|
||||
output.faceColor = faceColor;
|
||||
output.outlineColor = outlineColor;
|
||||
output.texcoord0 = float4(input.texcoord0.xy, maskUV.xy);
|
||||
output.param = float4(0.5 - weight, 1.3333 * _GradientScale * (_Sharpness + 1) / _TextureWidth, _OutlineWidth * _ScaleRatioA * 0.5, 0);
|
||||
output.param = float4(0.5 - weight, 0, _OutlineWidth * _ScaleRatioA * 0.5, 0);
|
||||
|
||||
float2 mask = float2(0, 0);
|
||||
#if UNITY_UI_CLIP_RECT
|
||||
@ -99,8 +105,9 @@ float4 PixShader(pixel_t input) : SV_Target
|
||||
|
||||
float d = tex2D(_MainTex, input.texcoord0.xy).a;
|
||||
|
||||
float2 UV = input.texcoord0.xy;
|
||||
float scale = rsqrt(abs(ddx(UV.x) * ddy(UV.y) - ddy(UV.x) * ddx(UV.y))) * input.param.y;
|
||||
float pixelSize = abs(ddx(input.texcoord0.y)) + abs(ddy(input.texcoord0.y));
|
||||
pixelSize *= _TextureHeight * 0.75;
|
||||
float scale = 1 / pixelSize * _GradientScale * (_Sharpness + 1);
|
||||
|
||||
#if (UNDERLAY_ON | UNDERLAY_INNER)
|
||||
float layerScale = scale;
|
||||
@ -112,7 +119,7 @@ float4 PixShader(pixel_t input) : SV_Target
|
||||
|
||||
float4 faceColor = input.faceColor * saturate((d - input.param.x) * scale + 0.5);
|
||||
|
||||
#ifdef OUTLINE_ON
|
||||
#if OUTLINE_ON
|
||||
float4 outlineColor = lerp(input.faceColor, input.outlineColor, sqrt(min(1.0, input.param.z * scale * 2)));
|
||||
faceColor = lerp(outlineColor, input.faceColor, saturate((d - input.param.x - input.param.z) * scale + 0.5));
|
||||
faceColor *= saturate((d - input.param.x + input.param.z) * scale + 0.5);
|
||||
@ -130,7 +137,7 @@ float4 PixShader(pixel_t input) : SV_Target
|
||||
faceColor += float4(_UnderlayColor.rgb * _UnderlayColor.a, _UnderlayColor.a) * (1 - saturate(d - layerBias)) * sd * (1 - faceColor.a);
|
||||
#endif
|
||||
|
||||
#ifdef MASKING
|
||||
#if MASKING
|
||||
float a = abs(_MaskInverse - tex2D(_MaskTex, input.texcoord0.zw).a);
|
||||
float t = a + (1 - _MaskWipeControl) * _MaskEdgeSoftness - _MaskWipeControl;
|
||||
a = saturate(t / _MaskEdgeSoftness);
|
||||
@ -140,7 +147,8 @@ float4 PixShader(pixel_t input) : SV_Target
|
||||
|
||||
// Alternative implementation to UnityGet2DClipping with support for softness
|
||||
#if UNITY_UI_CLIP_RECT
|
||||
float2 maskZW = 0.25 / (0.25 * half2(_MaskSoftnessX, _MaskSoftnessY) + (1 / scale));
|
||||
half2 maskSoftness = half2(max(_UIMaskSoftnessX, _MaskSoftnessX), max(_UIMaskSoftnessY, _MaskSoftnessY));
|
||||
float2 maskZW = 0.25 / (0.25 * maskSoftness + 1 / scale);
|
||||
float2 m = saturate((_ClipRect.zw - _ClipRect.xy - abs(input.mask.xy)) * maskZW);
|
||||
faceColor *= m.x * m.y;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user