fixed embedded texture reading.

pull/1811/head
Marco Di Benedetto 2018-02-24 18:47:43 +01:00
parent 138b990d0a
commit 72e9f3ecb9
1 changed files with 2 additions and 1 deletions

View File

@ -691,8 +691,9 @@ inline void Image::Read(Value& obj, Asset& r)
Ref<Buffer> buffer = this->bufferView->buffer;
this->mDataLength = this->bufferView->byteLength;
// maybe this memcpy could be avoided if aiTexture does not delete[] pcData at destruction.
this->mData = new uint8_t [this->mDataLength];
memcpy(this->mData, buffer->GetPointer(), this->mDataLength);
memcpy(this->mData, buffer->GetPointer() + this->bufferView->byteOffset, this->mDataLength);
if (Value* mtype = FindString(obj, "mimeType")) {
this->mimeType = mtype->GetString();