long ids but not long enough!

- Object and prefab file id loading
- Generate grid update
- Switched uint to long but should probably be ulong!
This commit is contained in:
max
2023-06-30 03:28:44 +02:00
parent 1556f95485
commit d225f897ba
7 changed files with 152 additions and 63 deletions

View File

@ -14,16 +14,16 @@ namespace VertexColor.ScenePartition.Editor
public SceneGridDictionary Grid => grid;
public void Insert(uint id, Vector3 point)
public void Insert(long scenePartitionId, Vector3 point)
{
int gridId = CalculateGridPosition(point, cellSize);
if (grid.TryGetValue(gridId, out List<uint> ids))
if (grid.TryGetValue(gridId, out List<long> ids))
{
ids.Add(id);
ids.Add(scenePartitionId);
}
else
{
grid.Add(gridId, new List<uint> { id });
grid.Add(gridId, new List<long> { scenePartitionId });
}
}
@ -49,5 +49,20 @@ namespace VertexColor.ScenePartition.Editor
return (x, y);
}
public static long LongPairToLong(long x, long y)
{
// Combine x and y components into a single long
return (x << 32) | (uint)y;
}
public static (long, long) LongToLongPair(long value)
{
// Extract x and y components from the combined long
long x = value >> 32;
long y = (uint)value;
return (x, y);
}
}
}