Removed multiline variable declarations

このコミットが含まれているのは:
Sergio Pedri committed 2021-11-06 23:05:49 +01:00
1 親 6fa7464f84
コミット ee0d3a7b68
31ファイル変更
+182 -194

検索条件に一致するファイルはありません

+9 -1
ファイルの表示
@@ -88,6 +88,7 @@ public sealed partial class HlslBokehBlurProcessor
// Initialize the complex kernels and parameters with the current arguments
(KernelParameters, KernelsScale) = GetParameters();
Kernels = CreateComplexKernels();
NormalizeKernels();
// Store them in the cache for future use
@@ -161,6 +162,7 @@ public sealed partial class HlslBokehBlurProcessor
{
// Prepare the kernel components
int index = Math.Max(0, Math.Min(ComponentsCount - 1, KernelComponents.Count));
return (KernelComponents[index], KernelScales[index]);
}
@@ -171,9 +173,11 @@ public sealed partial class HlslBokehBlurProcessor
{
var kernels = new Complex64[KernelParameters.Length][];
ref Vector4 baseRef = ref MemoryMarshal.GetReference(KernelParameters.AsSpan());
for (int i = 0; i < KernelParameters.Length; i++)
{
ref Vector4 paramsRef = ref Unsafe.Add(ref baseRef, i);
kernels[i] = CreateComplex1DKernel(paramsRef.X, paramsRef.Y);
}
@@ -189,12 +193,14 @@ public sealed partial class HlslBokehBlurProcessor
{
var kernel = new Complex64[KernelSize];
ref Complex64 baseRef = ref MemoryMarshal.GetReference(kernel.AsSpan());
int r = Radius, n = -r;
int r = Radius;
int n = -r;
for (int i = 0; i < KernelSize; i++, n++)
{
// Incrementally compute the range values
float value = n * KernelsScale * (1f / r);
value *= value;
// Fill in the complex kernel values
@@ -230,6 +236,7 @@ public sealed partial class HlslBokehBlurProcessor
{
ref Complex64 jRef = ref Unsafe.Add(ref valueRef, j);
ref Complex64 kRef = ref Unsafe.Add(ref valueRef, k);
total +=
paramsRef.Z * (jRef.Real * kRef.Real - jRef.Imaginary * kRef.Imaginary)
+ paramsRef.W * (jRef.Real * kRef.Imaginary + jRef.Imaginary * kRef.Real);
@@ -239,6 +246,7 @@ public sealed partial class HlslBokehBlurProcessor
// Normalize the kernels
float scalar = 1f / MathF.Sqrt(total);
for (int i = 0; i < kernelsSpan.Length; i++)
{
ref Complex64[] kernelsRef = ref Unsafe.Add(ref baseKernelsRef, i);
+8 -11
ファイルの表示
@@ -75,9 +75,8 @@ internal unsafe static class Win32ApplicationRunner
// Set the target window size
_ = Windows.AdjustWindowRect((RECT*)&windowRect, Windows.WS_OVERLAPPEDWINDOW, Windows.FALSE);
uint
height = (uint)(windowRect.Bottom - windowRect.Top),
width = (uint)(windowRect.Right - windowRect.Left);
uint height = (uint)(windowRect.Bottom - windowRect.Top);
uint width = (uint)(windowRect.Right - windowRect.Left);
// Create the window and store a handle to it
hwnd = Windows.CreateWindowExW(
@@ -117,9 +116,8 @@ internal unsafe static class Win32ApplicationRunner
{
(Win32Application application, CancellationToken token) = ((Win32Application, CancellationToken))args!;
Stopwatch
startStopwatch = Stopwatch.StartNew(),
frameStopwatch = Stopwatch.StartNew();
Stopwatch startStopwatch = Stopwatch.StartNew();
Stopwatch frameStopwatch = Stopwatch.StartNew();
const long targetFrameTimeInTicksFor60fps = 166666;
@@ -251,11 +249,10 @@ internal unsafe static class Win32ApplicationRunner
_ = Windows.GetCursorPos(&point);
_ = Windows.GetWindowRect(hwnd, &rect);
bool
isAtTop = Math.Abs(point.y - rect.top) < 12,
isAtRight = Math.Abs(point.x - rect.right) < 12,
isAtBottom = Math.Abs(point.y - rect.bottom) < 12,
isAtLeft = Math.Abs(point.x - rect.left) < 12;
bool isAtTop = Math.Abs(point.y - rect.top) < 12;
bool isAtRight = Math.Abs(point.x - rect.right) < 12;
bool isAtBottom = Math.Abs(point.y - rect.bottom) < 12;
bool isAtLeft = Math.Abs(point.x - rect.left) < 12;
if (isAtTop)
{
+13 -8
ファイルの表示
@@ -26,7 +26,8 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
// Standard 2D rotation formula.
private static float2x2 Rotate2x2(float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, -s, s, c);
}
@@ -148,12 +149,14 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
// Anyway, I like this one. I'm assuHlsl.Ming it's based on IQ's original.
private float CalculateAO(in float3 p, in float3 n)
{
float sca = 2.0f, occ = 0.0f;
float sca = 2.0f;
float occ = 0.0f;
for (int i = (int)Hlsl.Min(time, 0f); i < 5; i++)
{
float hr = (i + 1f) * 0.15f / 5.0f;
float d = M(p + n * hr);
occ += (hr - d) * sca;
sca *= 0.7f;
@@ -179,16 +182,17 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
{
int2 coords = new(ThreadIds.X, DispatchSize.Y - ThreadIds.Y);
float2 u = (coords - (float2)DispatchSize.XY * 0.5f) / DispatchSize.Y;
float3
r = Hlsl.Normalize(new float3(u, 1)),
o = new(0, time / 2.0f, -3),
l = o + new float3(0.25f, 0.25f, 2.0f);
float3 r = Hlsl.Normalize(new float3(u, 1));
float3 o = new(0, time / 2.0f, -3);
float3 l = o + new float3(0.25f, 0.25f, 2.0f);
r.YZ = Hlsl.Mul(Rotate2x2(0.15f), r.YZ);
r.XZ = Hlsl.Mul(Rotate2x2(-Hlsl.Cos(time * 3.14159f / 32.0f) / 8.0f), r.XZ);
r.XY = Hlsl.Mul(Rotate2x2(Hlsl.Sin(time * 3.14159f / 32.0f) / 8.0f), r.XY);
float d, t = Hash21(r.XY * 57.0f + Hlsl.Frac(time)) * 0.5f, glow = 0;
float d;
float t = Hash21(r.XY * 57.0f + Hlsl.Frac(time)) * 0.5f;
float glow = 0;
for (int i = 0; i < 96; i++)
{
@@ -201,7 +205,8 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
}
int gObjID = objID;
float3 p = o + r * t, n = Normal(p);
float3 p = o + r * t;
float3 n = Normal(p);
float2 uv = p.XY;
float sc = 0.5f;
float2 iuv = Hlsl.Floor(uv / sc) + 0.5f;
+2 -1
ファイルの表示
@@ -15,7 +15,8 @@ internal readonly partial struct Octagrams : IPixelShader<float4>
private static float2x2 Rotate(float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, s, -s, c);
}
+2 -1
ファイルの表示
@@ -18,7 +18,8 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
private static float2x2 Rotate(in float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, s, -s, c);
}
+4 -4
ファイルの表示
@@ -17,7 +17,8 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
// Standard 2D rotation formula.
private static float2x2 Rotate2x2(in float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, -s, s, c);
}
@@ -141,9 +142,8 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
float2 oP = p;
float m = BMap(p);
float3 n = new(0, 0, -1);
float
edge = 0.0f,
bumpFactor = 0.25f;
float edge = 0.0f;
float bumpFactor = 0.25f;
n = DoBumpMap(p, n, bumpFactor, ref edge);
+14 -15
ファイルの表示
@@ -16,7 +16,8 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
// Standard 2D rotation formula.
private static float2x2 Rotate2x2(in float a)
{
float c = Hlsl.Cos(a), s = Hlsl.Sin(a);
float c = Hlsl.Cos(a);
float s = Hlsl.Sin(a);
return new(c, -s, s, c);
}
@@ -157,12 +158,11 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
p -= s - (s.X + s.Y) * 0.211324865f;
float i = p.X < p.Y ? 1.0f : 0.0f;
float2
ioffs = new(1.0f - i, i),
ip0 = 0,
ip1 = ioffs - 0.2113248654f,
ip2 = 0.577350269f,
ctr = (ip0 + ip1 + ip2) / 3.0f;
float2 ioffs = new(1.0f - i, i);
float2 ip0 = 0;
float2 ip1 = ioffs - 0.2113248654f;
float2 ip2 = 0.577350269f;
float2 ctr = (ip0 + ip1 + ip2) / 3.0f;
ip0 -= ctr;
ip1 -= ctr;
@@ -175,15 +175,14 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
n3.Y = IsoFunction(s + ioffs);
n3.Z = IsoFunction(s + 1.0f);
float
d = 1e5f,
d2 = 1e5f,
d3 = 1e5f,
d4 = 1e5f,
d5 = 1e5f;
float d = 1e5f;
float d2 = 1e5f;
float d3 = 1e5f;
float d4 = 1e5f;
float d5 = 1e5f;
float isovalue = 0;
float2 p0 = default, p1 = default;
float2 p0 = default;
float2 p1 = default;
int iTh = IsoLine(n3, ip0, ip1, ip2, isovalue, i, ref p0, ref p1);
d = Hlsl.Min(d, distEdge(p - p0, p - p1));