remove ArraySegmentByteBuffer

This commit is contained in:
ousttrue 2022-02-10 20:39:50 +09:00
parent 505e174f59
commit 293a49fd31
3 changed files with 4 additions and 52 deletions

View File

@ -1,36 +0,0 @@
using System;
namespace UniGLTF
{
/// <summary>
/// for glb chunk buffer read
/// </summary>
public class ArraySegmentByteBuffer
{
ArraySegment<Byte> m_bytes;
public ArraySegmentByteBuffer(ArraySegment<Byte> bytes)
{
m_bytes = bytes;
}
public string Uri
{
get;
private set;
}
public glTFBufferView Extend<T>(ArraySegment<T> array, glBufferTarget target) where T : struct
{
throw new NotImplementedException();
}
public void ExtendCapacity(int capacity)
{
throw new NotImplementedException();
}
public ArraySegment<byte> Bytes => m_bytes;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: f857b8b7ca45b1746af90c7fb86b2398
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -33,7 +33,7 @@ namespace UniVRM10
public UniGLTF.Extensions.VRMC_springBone.VRMC_springBone gltfVrmSpringBone;
ArraySegmentByteBuffer _buffer;
byte[] _bin;
/// <summary>
/// for import
@ -56,7 +56,7 @@ namespace UniVRM10
gltfVrmSpringBone = springBone;
}
_buffer = new ArraySegmentByteBuffer(new ArraySegment<byte>(data.Bin.ToArray()));
_bin = m_data.Bin.ToArray();
}
public ArraySegment<byte> GetBufferBytes(UniGLTF.glTFBufferView bufferView)
@ -75,7 +75,7 @@ namespace UniVRM10
{
throw new NotImplementedException();
}
return _buffer.Bytes;
return new ArraySegment<byte>(_bin);
}
static ArraySegment<byte> RestoreSparseAccessorUInt16<T>(ArraySegment<byte> bytes, int accessorCount, ArraySegment<byte> indicesBytes, ArraySegment<byte> valuesBytes)
@ -137,9 +137,8 @@ namespace UniVRM10
if (view.buffer.TryGetValidIndex(Gltf.buffers.Count, out int bufferIndex))
{
var buffer = m_data.Bin;
var bin = _buffer.Bytes;
var byteSize = accessor.CalcByteSize();
bytes = bin.Slice(view.byteOffset, view.byteLength).Slice(accessor.byteOffset, byteSize);
bytes = new ArraySegment<byte>(_bin).Slice(view.byteOffset, view.byteLength).Slice(accessor.byteOffset, byteSize);
}
}