mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-15 05:04:15 +01:00
Merge branch 'master' of github.com:xivDev/Penumbra
This commit is contained in:
commit
afdffa4f2c
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