Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sweep path issue that led to incorrect trail opacity #74

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions Source/1.5/AnimationMod/AnimRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,13 @@ private void InitSweepMeshes()
sweeps = new PartWithSweep[Data.SweepDataCount];
foreach (var part in Data.PartsWithSweepData)
{
var overrideData = GetOverride(part);
var paths = Data.GetSweepPaths(part);
foreach (var path in paths)
{
sweeps[j++] = new PartWithSweep(this, part, path, new SweepMesh<PartWithSweep.Data>(), BasicSweepProvider.DefaultInstance);
float upDst = overrideData?.TweakData?.BladeEnd ?? 0.4f;
float downDst = overrideData?.TweakData?.BladeStart ?? 0.05f;
sweeps[j++] = new PartWithSweep(this, part, path, new SweepMesh<PartWithSweep.Data>(), BasicSweepProvider.DefaultInstance, upDst, downDst);
}
}
}
Expand Down Expand Up @@ -1429,16 +1432,6 @@ public bool AddPawn(Pawn pawn, int index, bool register)
if (ov.CustomRenderer != null)
ov.CustomRenderer.Item = weapon;

InitSweepMeshes();
foreach (var path in sweeps)
{
if (path.Part == itemPart)
{
path.DownDst = tweak.BladeStart;
path.UpDst = tweak.BladeEnd;
}
}

return true;
}

Expand Down
4 changes: 2 additions & 2 deletions Source/1.5/AnimationMod/Sweep/BasicSweepProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class BasicSweepProvider : ISweepProvider

public Color color = Color.white;
public float length = 0.15f;
public float minVel = 1f;
public float maxVel = 2f;
public float minVel = 3.5f;
public float maxVel = 7f;

public (Color low, Color high) GetTrailColors(in SweepProviderArgs args)
{
Expand Down
10 changes: 6 additions & 4 deletions Source/1.5/AnimationMod/Sweep/PartWithSweep.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using AM.Data.Model;
using UnityEngine;

Expand All @@ -10,7 +10,7 @@ public class PartWithSweep
public readonly SweepPointCollection PointCollection;
public readonly SweepMesh<Data> Mesh;
public readonly AnimRenderer Renderer;
public float DownDst, UpDst;
public readonly float DownDst, UpDst;
public bool MirrorHorizontal;
public ISweepProvider ColorProvider;

Expand All @@ -25,14 +25,16 @@ public struct Data
public float UpVel;
}

public PartWithSweep(AnimRenderer renderer, AnimPartData part, SweepPointCollection pointCollection, SweepMesh<Data> mesh, ISweepProvider colorProvider)
public PartWithSweep(AnimRenderer renderer, AnimPartData part, SweepPointCollection pointCollection, SweepMesh<Data> mesh, ISweepProvider colorProvider, float upDst, float downDst)
{
Renderer = renderer;
Part = part;
PointCollection = pointCollection;
Mesh = mesh;
points = pointCollection.CloneWithVelocities(DownDst, UpDst);
ColorProvider = colorProvider;
UpDst = upDst;
DownDst = downDst;
points = pointCollection.CloneWithVelocities(DownDst, UpDst);
}

public void Draw(float time)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"r": 0.0,
"g": 0.0,
"b": 0.0,
"a": 0.8306667
"a": 0.6977777
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
"ScaleY": 1.1,
"BladeStart": 0.15659982,
"BladeEnd": 0.800895154,
"MeleeWeaponType": 6
"MeleeWeaponType": 6,
"TrailTint": {
"r": 0.966666639,
"g": 0.6717687,
"b": 0.0451110676,
"a": 0.98
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,11 @@
"ScaleY": 1.1,
"BladeStart": 0.15659982,
"BladeEnd": 0.800895154,
"MeleeWeaponType": 6
"MeleeWeaponType": 6,
"TrailTint": {
"r": 0.966666639,
"g": 0.6717687,
"b": 0.0451110676,
"a": 0.98
}
}
Loading