added support for embedded textures defined with buffer views.
parent
b0ac2d9daf
commit
4b7cd97fea
|
@ -669,7 +669,7 @@ inline Image::Image()
|
|||
|
||||
}
|
||||
|
||||
inline void Image::Read(Value& obj, Asset& /*r*/)
|
||||
inline void Image::Read(Value& obj, Asset& r)
|
||||
{
|
||||
if (!mDataLength) {
|
||||
if (Value* uri = FindString(obj, "uri")) {
|
||||
|
@ -686,6 +686,18 @@ inline void Image::Read(Value& obj, Asset& /*r*/)
|
|||
this->uri = uristr;
|
||||
}
|
||||
}
|
||||
else if (Value* bufferViewVal = FindUInt(obj, "bufferView")) {
|
||||
this->bufferView = r.bufferViews.Retrieve(bufferViewVal->GetUint());
|
||||
Ref<Buffer> buffer = this->bufferView->buffer;
|
||||
|
||||
this->mDataLength = this->bufferView->byteLength;
|
||||
this->mData = new uint8_t [this->mDataLength];
|
||||
memcpy(this->mData, buffer->GetPointer(), this->mDataLength);
|
||||
|
||||
if (Value* mtype = FindString(obj, "mimeType")) {
|
||||
this->mimeType = mtype->GetString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue