Update README.md to include project description, developer documentation links, and license information.
CI / build-test (push) Successful in 1m6s

This commit is contained in:
Leonid Pershin
2026-06-11 04:03:07 +03:00
parent 31aba3aeee
commit ff2231a8ab
72 changed files with 4113 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
namespace MrGameEng.Graphics;
/// <summary>
/// Builds the 64-bit sort key the batcher orders sprites by:
/// layer (8 bits) → depth (32 bits) → texture (24 bits).
/// Texture bits only group equal textures for batching; collisions are harmless.
/// </summary>
public static class SpriteSortKey
{
/// <summary>Composes a sort key from layer, depth and texture grouping key.</summary>
public static ulong Make(byte layer, float depth, int textureKey) =>
((ulong)layer << 56) | ((ulong)DepthToSortableBits(depth) << 24) | ((uint)textureKey & 0xFF_FFFF);
/// <summary>
/// Maps a float to bits whose unsigned order matches the float order
/// (negative depths sort before positive ones).
/// </summary>
public static uint DepthToSortableBits(float depth)
{
var bits = BitConverter.SingleToUInt32Bits(depth);
return (bits & 0x8000_0000) != 0 ? ~bits : bits | 0x8000_0000;
}
}