more shaders and updates/changes
This commit is contained in:
@@ -28,8 +28,42 @@ float2 applyEdgeMode(float2 uv, out bool inside)
|
||||
return uv;
|
||||
}
|
||||
|
||||
float selectedCropAspect()
|
||||
{
|
||||
if (cropAspect == 1)
|
||||
return 4.0 / 3.0;
|
||||
if (cropAspect == 2)
|
||||
return 3.0 / 2.0;
|
||||
if (cropAspect == 3)
|
||||
return 1.0;
|
||||
if (cropAspect == 4)
|
||||
return 9.0 / 16.0;
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
bool insideCropWindow(float2 uv, float2 resolution)
|
||||
{
|
||||
float targetAspect = selectedCropAspect();
|
||||
if (targetAspect <= 0.0)
|
||||
return true;
|
||||
|
||||
float outputAspect = resolution.x / max(resolution.y, 1.0);
|
||||
float2 cropSize = float2(1.0, 1.0);
|
||||
if (outputAspect > targetAspect)
|
||||
cropSize.x = targetAspect / outputAspect;
|
||||
else
|
||||
cropSize.y = outputAspect / targetAspect;
|
||||
|
||||
float2 cropMin = (1.0 - cropSize) * 0.5;
|
||||
float2 cropMax = cropMin + cropSize;
|
||||
return uv.x >= cropMin.x && uv.x <= cropMax.x && uv.y >= cropMin.y && uv.y <= cropMax.y;
|
||||
}
|
||||
|
||||
float4 shadeVideo(ShaderContext context)
|
||||
{
|
||||
if (!insideCropWindow(context.uv, max(context.outputResolution, float2(1.0, 1.0))))
|
||||
return outsideColor;
|
||||
|
||||
float safeZoom = max(zoom, 0.001);
|
||||
float2 sourceUv = (context.uv - 0.5) / safeZoom + 0.5;
|
||||
sourceUv -= pan;
|
||||
|
||||
Reference in New Issue
Block a user