Merge pull request #1681 from wanadev/1674-buffer-relative-uri

[glTF2] Using relative buffers URI
pull/1677/head^2
Kim Kulling 2018-01-06 21:30:57 +01:00 committed by GitHub
commit e8fffb7815
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -156,7 +156,10 @@ namespace glTF2 {
inline void Write(Value& obj, Buffer& b, AssetWriter& w) inline void Write(Value& obj, Buffer& b, AssetWriter& w)
{ {
obj.AddMember("byteLength", static_cast<uint64_t>(b.byteLength), w.mAl); obj.AddMember("byteLength", static_cast<uint64_t>(b.byteLength), w.mAl);
obj.AddMember("uri", Value(b.GetURI(), w.mAl).Move(), w.mAl);
const auto uri = b.GetURI();
const auto relativeUri = uri.substr(uri.find_last_of("/\\") + 1u);
obj.AddMember("uri", Value(relativeUri, w.mAl).Move(), w.mAl);
} }
inline void Write(Value& obj, BufferView& bv, AssetWriter& w) inline void Write(Value& obj, BufferView& bv, AssetWriter& w)