From ef1d54c2b0781f60184be58e31dbd80dbc71377c Mon Sep 17 00:00:00 2001 From: Masataka SUMI Date: Wed, 25 Aug 2021 19:00:52 +0900 Subject: [PATCH] Define GlbBinaryParser --- .../UniGLTF/IO/Parser/GlbBinaryParser.cs | 29 +++++++++++++++++++ .../UniGLTF/IO/Parser/GlbBinaryParser.cs.meta | 3 ++ 2 files changed, 32 insertions(+) create mode 100644 Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs create mode 100644 Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs.meta diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs new file mode 100644 index 000000000..e14fe83d8 --- /dev/null +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs @@ -0,0 +1,29 @@ +using System; + +namespace UniGLTF +{ + public sealed class GlbBinaryParser + { + private readonly byte[] _data; + private readonly string _name; + + public GlbBinaryParser(byte[] data, string uniqueName) + { + _data = data; + + if (string.IsNullOrWhiteSpace(uniqueName)) + { + _name = Guid.NewGuid().ToString(); + } + else + { + _name = uniqueName; + } + } + + public GltfData Parse() + { + return new GlbLowLevelParser(_name, _data).Parse(); + } + } +} \ No newline at end of file diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs.meta b/Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs.meta new file mode 100644 index 000000000..436942160 --- /dev/null +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/Parser/GlbBinaryParser.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: ba0fe1be89e041138d2937dc07e9fdca +timeCreated: 1629885479 \ No newline at end of file