Skip to content

Commit

Permalink
Fixed NormalizedByte4 and Short2 packing
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Sep 17, 2024
1 parent c61a2a4 commit e808b22
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions MonoGame.Framework/Graphics/PackedVector/NormalizedByte4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,6 @@ public override string ToString()
return _packed.ToString("X");
}

private static int PackComponent(float value)
{
// Clamp the value to the range [-1, 1] before converting
value = Math.Clamp(value, -1.0f, 1.0f);
// Convert from normalized [-1, 1] to signed byte [-128, 127]
return (int)Math.Round(value * 127.0f);
}

private static uint Pack(float x, float y, float z, float w)
{
var byte4 = (uint)(((int) MathF.Round(MathHelper.Clamp(x, -1.0f, 1.0f) * 127.0f)) & 0xff) << 0;
Expand Down

0 comments on commit e808b22

Please sign in to comment.