From 72e9f3ecb9bd12056d6992d87d3511546486df72 Mon Sep 17 00:00:00 2001 From: Marco Di Benedetto Date: Sat, 24 Feb 2018 18:47:43 +0100 Subject: [PATCH] fixed embedded texture reading. --- code/glTF2Asset.inl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index cf43d67f1..8f2b14e1a 100644 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -691,8 +691,9 @@ inline void Image::Read(Value& obj, Asset& r) Ref 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();