Closed CeSun closed 1 year ago
var model = SharpGLTF.Schema2.ModelRoot.ReadGLB(stream);
var model = SharpGLTF.Schema2.ModelRoot.ReadGLB(stream);
It will throw exception:
System.NotSupportedException: 'Specified method is not supported.'
at Android.Runtime.InputStreamInvoker.get_Length() in /Users/runner/work/1/s/xamarin-android/src/Mono.Android/Android.Runtime/InputStreamInvoker.cs:line 137
at SharpGLTF.Schema2._BinarySerialization._ReadBinaryHeader(BinaryReader binaryReader)
at SharpGLTF.Schema2._BinarySerialization.ReadBinaryFile(Stream stream)
at SharpGLTF.Schema2.ReadContext._ReadGLB(Stream stream)
at SharpGLTF.Schema2.ReadContext.ReadBinarySchema2(Stream stream)
at SharpGLTF.Schema2.ModelRoot.ReadGLB(Stream stream, ReadSettings settings)
I guess you're opening a stream from a network? the opened stream needs to be seekable, so it must be opened from a file or from memory.
It's android platform's stream, open file from assets. It looks like I have to copy from the file stream to the memory stream first...
the library needs to know the length of the stream; it's weird that being a local asset, the stream fails to give that information... anyway, I'll take a look to see if I can improve binary reading for these cases.
I use the SharpGLTF library in Android. The glb file is stored in the asstes directory of the apk. It needs to use the android API to open the stream, so the following code cannot work:
I need an api for parsing glb files from a stream, does SharpGLTF support it?
The expected code is as follows: