mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Fix blend weight adjustment getting stuck on near-bounds values
This commit is contained in:
parent
b63935e81e
commit
87fec7783e
1 changed files with 6 additions and 0 deletions
|
|
@ -150,6 +150,12 @@ public class VertexAttribute
|
|||
{
|
||||
var convertedValues = byteValues.Select(value => value * (1f / 255f)).ToArray();
|
||||
var closestIndex = Enumerable.Range(0, 4)
|
||||
.Where(index => {
|
||||
var byteValue = byteValues[index];
|
||||
if (adjustment < 0) return byteValue > 0;
|
||||
if (adjustment > 0) return byteValue < 255;
|
||||
return true;
|
||||
})
|
||||
.Select(index => (index, delta: Math.Abs(originalValues[index] - convertedValues[index])))
|
||||
.MinBy(x => x.delta)
|
||||
.index;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue