Skip to content

Commit

Permalink
Merge pull request #96 from sourpuh/linethiccfix
Browse files Browse the repository at this point in the history
Fix line thickness and arrows not displaying in DX11
  • Loading branch information
Limiana authored Jul 28, 2024
2 parents 0bfbaa4 + a2cb686 commit 00aee20
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 59 deletions.
63 changes: 50 additions & 13 deletions Splatoon/RenderEngines/DirectX11/DirectX11Scene.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Pictomancy;
using Splatoon.Serializables;
using static Splatoon.RenderEngines.DirectX11.DirectX11DisplayObjects;


Expand Down Expand Up @@ -140,19 +141,7 @@ void Draw(PctTexture? texture)
}
else if (element is DisplayObjectLine elementLine)
{
if (elementLine.style.filled)
drawList.AddLineFilled(
elementLine.start,
elementLine.stop,
elementLine.radius,
elementLine.style.originFillColor,
elementLine.style.endFillColor);
if (elementLine.style.IsStrokeVisible())
drawList.AddLine(
elementLine.start,
elementLine.stop,
elementLine.radius,
elementLine.style.strokeColor);
DrawLine(elementLine, drawList);
}
}
foreach (var zone in P.Config.ClipZones)
Expand Down Expand Up @@ -180,6 +169,54 @@ void Draw(PctTexture? texture)
return texture;
}

public void DrawLine(DisplayObjectLine line, PctDrawList drawList)
{
if (line.radius == 0)
{
drawList.PathLineTo(line.start);
drawList.PathLineTo(line.stop);
drawList.PathStroke(line.style.strokeColor, PctStrokeFlags.None, line.style.strokeThickness);

float arrowScale = MathF.Max(1, line.style.strokeThickness / 7f);
if (line.startStyle == LineEnd.Arrow)
{
var arrowStart = line.start + arrowScale * 0.4f * line.Direction;
var offset = arrowScale * 0.3f * line.Perpendicular;
drawList.PathLineTo(arrowStart + offset);
drawList.PathLineTo(line.start);
drawList.PathLineTo(arrowStart - offset);
drawList.PathStroke(line.style.strokeColor, PctStrokeFlags.None, line.style.strokeThickness);
}

if (line.endStyle == LineEnd.Arrow)
{
var arrowStart = line.stop - arrowScale * 0.4f * line.Direction;
var offset = arrowScale * 0.3f * line.Perpendicular;
drawList.PathLineTo(arrowStart + offset);
drawList.PathLineTo(line.stop);
drawList.PathLineTo(arrowStart - offset);
drawList.PathStroke(line.style.strokeColor, PctStrokeFlags.None, line.style.strokeThickness);
}
}
else
{
if (line.style.filled)
drawList.AddLineFilled(
line.start,
line.stop,
line.radius,
line.style.originFillColor,
line.style.endFillColor);
if (line.style.IsStrokeVisible())
drawList.AddLine(
line.start,
line.stop,
line.radius,
line.style.strokeColor,
thickness: line.style.strokeThickness);
}
}

public void DrawTextWorld(DisplayObjectText e)
{
if (Svc.GameGui.WorldToScreen(
Expand Down
45 changes: 0 additions & 45 deletions SplatoonScripts/update.csv

This file was deleted.

2 changes: 1 addition & 1 deletion ffxiv_pictomancy

0 comments on commit 00aee20

Please sign in to comment.