Skip to content

Commit 3aab75b

Browse files
committed
Rename to convert functions to JaggedList
1 parent ae87250 commit 3aab75b

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/SharpGLTF.Ext.3DTiles/Memory/BinaryTable.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ namespace SharpGLTF.Memory
1414
/// </summary>
1515
public static class BinaryTable
1616
{
17-
public static List<byte> GetBytesForArray<T>(List<List<T>> values)
17+
public static List<byte> ConvertJaggedListToBytes<T>(List<List<T>> values)
1818
{
1919
var type = typeof(T);
2020
if(type == typeof(bool))
2121
{
22-
var booleanBytes = GetBytesBooleans(values.Cast<List<bool>>().ToList());
22+
var booleanBytes = ConvertJaggedListOfBooleansToBytes(values.Cast<List<bool>>().ToList());
2323
return booleanBytes;
2424
}
2525
var bytes = new List<byte>();
@@ -86,7 +86,7 @@ public static byte[] GetBytes<T>(IReadOnlyList<T> values)
8686
}
8787
}
8888

89-
private static List<byte> GetBytesBooleans(List<List<bool>> values)
89+
private static List<byte> ConvertJaggedListOfBooleansToBytes(List<List<bool>> values)
9090
{
9191
var bits = new BitArray(values.SelectMany(x => x).ToArray());
9292
var boolBytes = new byte[(bits.Length - 1) / 8 + 1];

src/SharpGLTF.Ext.3DTiles/Schema2/Ext.StructuralMetadataRoot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ private static int GetBufferView<T>(ModelRoot model, IReadOnlyList<T> values)
874874

875875
private static int GetBufferView<T>(ModelRoot model, List<List<T>> values)
876876
{
877-
List<byte> bytes = BinaryTable.GetBytesForArray(values);
877+
List<byte> bytes = BinaryTable.ConvertJaggedListToBytes(values);
878878
var bufferView = model.UseBufferView(bytes.ToArray());
879879
int logicalIndex = bufferView.LogicalIndex;
880880
return logicalIndex;

tests/SharpGLTF.Ext.3DTiles.Tests/Memory/BinaryTableTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ namespace SharpGLTF.Memory
88
public class BinaryTableTests
99
{
1010
[Test]
11-
public void ConvertListofListofBoolsToBytes()
11+
public void ConvertJaggedListOfBoolsToBytes()
1212
{
1313
var values = new List<List<bool>>();
1414
values.Add(new List<bool>() { true, false });
1515
values.Add(new List<bool>() { false, true });
16-
var bytes = BinaryTable.GetBytesForArray(values);
16+
var bytes = BinaryTable.ConvertJaggedListToBytes(values);
1717
// Check size, should be 1 byte for 4 bits
1818
Assert.That(bytes.Count, Is.EqualTo(1));
1919

@@ -31,7 +31,7 @@ public void ConvertListofListofIntToBytes()
3131
var values = new List<List<int>>();
3232
values.Add(new List<int>() { 0, 1 });
3333
values.Add(new List<int>() { 2, 3 });
34-
var bytes = BinaryTable.GetBytesForArray(values);
34+
var bytes = BinaryTable.ConvertJaggedListToBytes(values);
3535
Assert.That(bytes.Count, Is.EqualTo(BinaryTable.GetSize<int>() * 4));
3636
}
3737

0 commit comments

Comments
 (0)