Use source stroke ids for Bokusho tuft replay
This commit is contained in:
parent
94474fcd3e
commit
5d550f4ade
5 changed files with 81 additions and 1 deletions
|
|
@ -622,6 +622,8 @@ public sealed class AquariumBokushoBrushStroke
|
|||
|
||||
public float SegmentEnd { get; init; } = 1.0f;
|
||||
|
||||
public int SourceStrokeId { get; init; } = -1;
|
||||
|
||||
public AquariumBokushoBrushStroke Normalized() => new()
|
||||
{
|
||||
StrokeP0 = StrokeP0,
|
||||
|
|
@ -642,6 +644,7 @@ public sealed class AquariumBokushoBrushStroke
|
|||
SplitScale = Math.Clamp(SplitScale, 0.0f, 4.0f),
|
||||
SegmentStart = Math.Clamp(SegmentStart, 0.0f, 1.0f),
|
||||
SegmentEnd = Math.Clamp(SegmentEnd, 0.0f, 1.0f),
|
||||
SourceStrokeId = SourceStrokeId,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -286,6 +286,7 @@ public static class BokushoBrushSimulation
|
|||
SplitScale = 1.0f,
|
||||
SegmentStart = 0.0f,
|
||||
SegmentEnd = 1.0f,
|
||||
SourceStrokeId = 0,
|
||||
}.Normalized()
|
||||
];
|
||||
}
|
||||
|
|
@ -293,10 +294,16 @@ public static class BokushoBrushSimulation
|
|||
private static int ChainStart(IReadOnlyList<AquariumBokushoBrushStroke> strokes, int strokeIndex)
|
||||
{
|
||||
var chainStart = strokeIndex;
|
||||
var sourceStrokeId = strokes[strokeIndex].SourceStrokeId;
|
||||
var expectedStart = Math.Clamp(strokes[strokeIndex].SegmentStart, 0.0f, 1.0f);
|
||||
while (chainStart > 0 && expectedStart > 0.0001f)
|
||||
{
|
||||
var previous = strokes[chainStart - 1];
|
||||
if (sourceStrokeId >= 0 && previous.SourceStrokeId != sourceStrokeId)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
var previousEnd = Math.Clamp(previous.SegmentEnd, 0.0f, 1.0f);
|
||||
if (MathF.Abs(previousEnd - expectedStart) > 0.001f)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4815,7 +4815,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
|
|||
new Vector4(stroke.StrokeP0.X, stroke.StrokeP0.Y, stroke.SegmentStart, stroke.SegmentEnd),
|
||||
stroke.StrokeP1,
|
||||
stroke.StrokeP2,
|
||||
stroke.StrokeP3);
|
||||
new Vector4(stroke.StrokeP3.X, stroke.StrokeP3.Y, stroke.StrokeP3.Z, stroke.SourceStrokeId));
|
||||
}
|
||||
|
||||
private void AppendFieldEvidenceGpuSensorInputs()
|
||||
|
|
|
|||
|
|
@ -156,9 +156,15 @@ uint StrokeChainStart(uint strokeIndex)
|
|||
{
|
||||
uint chainStart = strokeIndex;
|
||||
float expectedStart = saturate(BokushoBrushStrokes[strokeIndex].p0.z);
|
||||
float sourceStrokeId = BokushoBrushStrokes[strokeIndex].p3.w;
|
||||
[loop]
|
||||
while (chainStart > 0u && expectedStart > 0.0001)
|
||||
{
|
||||
if (sourceStrokeId >= 0.0 && abs(BokushoBrushStrokes[chainStart - 1u].p3.w - sourceStrokeId) > 0.5)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
float previousEnd = saturate(BokushoBrushStrokes[chainStart - 1u].p0.w);
|
||||
if (abs(previousEnd - expectedStart) > 0.001)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue