Use blocks for all if statements
このコミットが含まれているのは:
1 親
7a7f6be038
コミット
d910922ef5
28ファイル変更
+239
-59
検索条件に一致するファイルはありません
@@ -131,7 +131,10 @@ internal readonly partial struct ContouredLayers : IPixelShader<float4>
|
||||
float hatch = Hlsl.Clamp((Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f) + 0.5f, 0.0f, 1.0f);
|
||||
|
||||
float hRnd = Hash21(Hlsl.Floor(p * 6.0f) + 0.73f);
|
||||
if (hRnd > 0.66f) hatch = hRnd;
|
||||
if (hRnd > 0.66f)
|
||||
{
|
||||
hatch = hRnd;
|
||||
}
|
||||
|
||||
hatch = (hatch * 0.75f) + 0.5f;
|
||||
|
||||
|
||||
@@ -48,7 +48,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
{
|
||||
return Hlsl.Length(p);
|
||||
}
|
||||
else p = Hlsl.Abs(p);
|
||||
else
|
||||
{
|
||||
p = Hlsl.Abs(p);
|
||||
}
|
||||
|
||||
switch (SHAPE)
|
||||
{
|
||||
@@ -77,7 +80,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
|
||||
float rnd = Hlsl.Frac(Hlsl.Sin(Hlsl.Dot(ip, new float2(1, 113))) * 45758.5453f);
|
||||
|
||||
if (rnd < 0.5f) p.Y = -p.Y;
|
||||
if (rnd < 0.5f)
|
||||
{
|
||||
p.Y = -p.Y;
|
||||
}
|
||||
|
||||
float d = Hlsl.Min(Distance(p - (0.5f * sc)), Distance(p + (0.5f * sc))) - (0.5f * sc);
|
||||
|
||||
@@ -86,8 +92,15 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
d += (0.5f - (0.5f / Hlsl.Sqrt(2.0f))) * sc;
|
||||
}
|
||||
|
||||
if (rnd < 0.5f) d = -d;
|
||||
if (Mod(ip.X + ip.Y, 2.0f) < 0.5f) d = -d;
|
||||
if (rnd < 0.5f)
|
||||
{
|
||||
d = -d;
|
||||
}
|
||||
|
||||
if (Mod(ip.X + ip.Y, 2.0f) < 0.5f)
|
||||
{
|
||||
d = -d;
|
||||
}
|
||||
|
||||
return d - 0.03f;
|
||||
}
|
||||
@@ -141,7 +154,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
shade = Hlsl.Min(shade, k * d / t);
|
||||
t += Hlsl.Clamp(d, 0.01f, 0.25f);
|
||||
|
||||
if (d < 0.0f || t > end) break;
|
||||
if (d < 0.0f || t > end)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Hlsl.Max(shade, 0.0f);
|
||||
@@ -163,7 +179,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
occ += (hr - d) * sca;
|
||||
sca *= 0.7f;
|
||||
|
||||
if (sca > 1e5f) break;
|
||||
if (sca > 1e5f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Hlsl.Clamp(1.0f - occ, 0.0f, 1.0f);
|
||||
@@ -201,7 +220,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
{
|
||||
d = M(o + (r * t));
|
||||
|
||||
if (Hlsl.Abs(d) < 0.001f) break;
|
||||
if (Hlsl.Abs(d) < 0.001f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
t += d * 0.7f;
|
||||
glow += 0.2f / (1.0f + (Hlsl.Abs(d) * 5.0f));
|
||||
@@ -244,7 +266,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
oCol = Hlsl.Lerp(col2, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, pat2)) * 0.35f);
|
||||
oCol = Hlsl.Lerp(oCol, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, bord)) * 0.8f);
|
||||
|
||||
if (Mod(iuv.X + iuv.Y, 2.0f) > 0.5f) oCol *= 0.8f;
|
||||
if (Mod(iuv.X + iuv.Y, 2.0f) > 0.5f)
|
||||
{
|
||||
oCol *= 0.8f;
|
||||
}
|
||||
|
||||
oCol = Hlsl.Lerp(oCol, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, d - 0.015f)) * 0.8f);
|
||||
}
|
||||
@@ -254,7 +279,10 @@ internal readonly partial struct ExtrudedTruchetPattern : IPixelShader<float4>
|
||||
float4 fCol = Hlsl.Lerp(col1, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, pat)) * 0.35f);
|
||||
fCol = Hlsl.Lerp(fCol, 0, (1.0f - Hlsl.SmoothStep(0, 0.01f, bord)) * 0.8f);
|
||||
|
||||
if (Mod(iuv.X + iuv.Y, 2.0f) < 0.5f) fCol *= 0.8f;
|
||||
if (Mod(iuv.X + iuv.Y, 2.0f) < 0.5f)
|
||||
{
|
||||
fCol *= 0.8f;
|
||||
}
|
||||
|
||||
oCol = Hlsl.Lerp(oCol, fCol, 1 - Hlsl.SmoothStep(0, 0.01f, d + 0.08f));
|
||||
oCol = Hlsl.Lerp(oCol, 0, (1 - Hlsl.SmoothStep(0, 0.01f, Hlsl.Length(uv2) - 0.08f)) * 0.8f);
|
||||
|
||||
@@ -134,7 +134,10 @@ internal readonly partial struct MengerJourney : IPixelShader<float4>
|
||||
distance = DE(pos) * FudgeFactor;
|
||||
totalDistance += distance;
|
||||
|
||||
if (distance < MinimumDistance) break;
|
||||
if (distance < MinimumDistance)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
steps = i;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,10 @@ internal readonly partial struct ProteanClouds : IPixelShader<float4>
|
||||
|
||||
for (int i = 0; i < 130; i++)
|
||||
{
|
||||
if (rez.A > 0.99f) break;
|
||||
if (rez.A > 0.99f)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
float3 pos = ro + (t * rd);
|
||||
float2 mpv = Map(pos, prm1, bsMo);
|
||||
|
||||
@@ -88,11 +88,23 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
|
||||
|
||||
float2 offs = new float2(Hlsl.Cos(ang), Hlsl.Sin(ang)) * 0.35f;
|
||||
|
||||
if (p.X < offs.X) p.X = 1.0f - ((p.X + 0.5f) / Hlsl.Abs(offs.X + 0.5f));
|
||||
else p.X = (p.X - offs.X) / (0.5f - offs.X);
|
||||
if (p.X < offs.X)
|
||||
{
|
||||
p.X = 1.0f - ((p.X + 0.5f) / Hlsl.Abs(offs.X + 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
p.X = (p.X - offs.X) / (0.5f - offs.X);
|
||||
}
|
||||
|
||||
if (p.Y < offs.Y) p.Y = 1.0f - ((p.Y + 0.5f) / Hlsl.Abs(offs.Y + 0.5f));
|
||||
else p.Y = (p.Y - offs.Y) / (0.5f - offs.Y);
|
||||
if (p.Y < offs.Y)
|
||||
{
|
||||
p.Y = 1.0f - ((p.Y + 0.5f) / Hlsl.Abs(offs.Y + 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
p.Y = (p.Y - offs.Y) / (0.5f - offs.Y);
|
||||
}
|
||||
|
||||
return 1.0f - Hlsl.Max(p.X, p.Y);
|
||||
}
|
||||
@@ -128,7 +140,10 @@ internal readonly partial struct PyramidPattern : IPixelShader<float4>
|
||||
float hatch = Hlsl.Clamp((Hlsl.Sin((p.X - p.Y) * 3.14159f * 200.0f) * 2.0f) + 0.5f, 0.0f, 1.0f);
|
||||
|
||||
float hRnd = Hash21(Hlsl.Floor(p * 6.0f) + 0.73f);
|
||||
if (hRnd > 0.66f) hatch = hRnd;
|
||||
if (hRnd > 0.66f)
|
||||
{
|
||||
hatch = hRnd;
|
||||
}
|
||||
|
||||
return hatch;
|
||||
}
|
||||
|
||||
@@ -104,9 +104,20 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
|
||||
int iTh = 0;
|
||||
|
||||
if (n3.X > isovalue) iTh += 4;
|
||||
if (n3.Y > isovalue) iTh += 2;
|
||||
if (n3.Z > isovalue) iTh += 1;
|
||||
if (n3.X > isovalue)
|
||||
{
|
||||
iTh += 4;
|
||||
}
|
||||
|
||||
if (n3.Y > isovalue)
|
||||
{
|
||||
iTh += 2;
|
||||
}
|
||||
|
||||
if (n3.Z > isovalue)
|
||||
{
|
||||
iTh += 1;
|
||||
}
|
||||
|
||||
if (iTh == 1 || iTh == 6)
|
||||
{
|
||||
@@ -207,8 +218,15 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
|
||||
d2 = Hlsl.Min(d2, DistEdge(p - p0, p - p1));
|
||||
|
||||
if (iTh2 == 7) d2 = 0.0f;
|
||||
if (iTh == 7) d2 = 1e5f;
|
||||
if (iTh2 == 7)
|
||||
{
|
||||
d2 = 0.0f;
|
||||
}
|
||||
|
||||
if (iTh == 7)
|
||||
{
|
||||
d2 = 1e5f;
|
||||
}
|
||||
|
||||
d2 = Hlsl.Max(d2, -d);
|
||||
d3 = Hlsl.Min(d3, DistLine((p - p0), (p - p1)));
|
||||
@@ -224,15 +242,28 @@ internal readonly partial struct TriangleGridContouring : IPixelShader<float4>
|
||||
float3 col = new(1, 0.85f, 0.6f);
|
||||
float sf = 0.004f;
|
||||
|
||||
if (d > 0.0f && d2 > 0.0f) col = new float3(1, 1.8f, 3) * 0.45f;
|
||||
if (d > 0.0f) col = Hlsl.Lerp(col, new float3(1, 1.85f, 3) * 0.3f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d2 - 0.012f)));
|
||||
if (d > 0.0f && d2 > 0.0f)
|
||||
{
|
||||
col = new float3(1, 1.8f, 3) * 0.45f;
|
||||
}
|
||||
|
||||
if (d > 0.0f)
|
||||
{
|
||||
col = Hlsl.Lerp(col, new float3(1, 1.85f, 3) * 0.3f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d2 - 0.012f)));
|
||||
}
|
||||
|
||||
col = Hlsl.Lerp(col, new float3(1.1f, 0.85f, 0.6f), (1.0f - Hlsl.SmoothStep(0.0f, sf, d2)));
|
||||
col = Hlsl.Lerp(col, new float3(1.5f, 0.9f, 0.6f) * 0.6f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d - 0.012f)));
|
||||
col = Hlsl.Lerp(col, new float3(1, 0.8f, 0.6f) * new float3(0.7f, 1.0f, 0.75f) * 0.95f, (1.0f - Hlsl.SmoothStep(0.0f, sf, d)));
|
||||
|
||||
if (d2 > 0.0f) col *= ((Hlsl.Abs(Hlsl.Dot(n3, float3.One)) * 1.25f) + 1.25f) / 2.0f;
|
||||
else col *= Hlsl.Max(2.0f - ((Hlsl.Dot(n3, float3.One) + 1.45f) / 1.25f), 0.0f);
|
||||
if (d2 > 0.0f)
|
||||
{
|
||||
col *= ((Hlsl.Abs(Hlsl.Dot(n3, float3.One)) * 1.25f) + 1.25f) / 2.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
col *= Hlsl.Max(2.0f - ((Hlsl.Dot(n3, float3.One) + 1.45f) / 1.25f), 0.0f);
|
||||
}
|
||||
|
||||
float pat = Hlsl.Abs(Hlsl.Frac((tri * 12.5f) + 0.4f) - 0.5f) * 2.0f;
|
||||
|
||||
|
||||
@@ -259,29 +259,61 @@ internal static unsafe class Win32ApplicationRunner
|
||||
|
||||
if (isAtTop)
|
||||
{
|
||||
if (isAtRight) return Windows.HTTOPRIGHT;
|
||||
if (isAtLeft) return Windows.HTTOPLEFT;
|
||||
if (isAtRight)
|
||||
{
|
||||
return Windows.HTTOPRIGHT;
|
||||
}
|
||||
|
||||
if (isAtLeft)
|
||||
{
|
||||
return Windows.HTTOPLEFT;
|
||||
}
|
||||
|
||||
return Windows.HTTOP;
|
||||
}
|
||||
|
||||
if (isAtRight)
|
||||
{
|
||||
if (isAtTop) return Windows.HTTOPRIGHT;
|
||||
if (isAtBottom) return Windows.HTBOTTOMRIGHT;
|
||||
if (isAtTop)
|
||||
{
|
||||
return Windows.HTTOPRIGHT;
|
||||
}
|
||||
|
||||
if (isAtBottom)
|
||||
{
|
||||
return Windows.HTBOTTOMRIGHT;
|
||||
}
|
||||
|
||||
return Windows.HTRIGHT;
|
||||
}
|
||||
|
||||
if (isAtBottom)
|
||||
{
|
||||
if (isAtRight) return Windows.HTBOTTOMRIGHT;
|
||||
if (isAtLeft) return Windows.HTBOTTOMLEFT;
|
||||
if (isAtRight)
|
||||
{
|
||||
return Windows.HTBOTTOMRIGHT;
|
||||
}
|
||||
|
||||
if (isAtLeft)
|
||||
{
|
||||
return Windows.HTBOTTOMLEFT;
|
||||
}
|
||||
|
||||
return Windows.HTBOTTOM;
|
||||
}
|
||||
|
||||
if (isAtLeft)
|
||||
{
|
||||
if (isAtTop) return Windows.HTTOPLEFT;
|
||||
if (isAtBottom) return Windows.HTBOTTOMLEFT;
|
||||
if (isAtTop)
|
||||
{
|
||||
return Windows.HTTOPLEFT;
|
||||
}
|
||||
|
||||
if (isAtBottom)
|
||||
{
|
||||
return Windows.HTBOTTOMLEFT;
|
||||
}
|
||||
|
||||
return Windows.HTLEFT;
|
||||
}
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする