Import/export of embedded texture names for the glTF/glTF2 format

This commit is contained in:
Loïc
2020-01-29 14:04:41 +01:00
parent 26179cd4d2
commit 194d31002d
4 changed files with 6 additions and 0 deletions

View File

@@ -351,6 +351,8 @@ void glTF2Exporter::GetMatTex(const aiMaterial* mat, Ref<Texture>& texture, aiTe
if (path[0] == '*') { // embedded
aiTexture* tex = mScene->mTextures[atoi(&path[1])];
texture->source->name = tex->mFilename.C_Str();
// The asset has its own buffer, see Image::SetData
texture->source->SetData(reinterpret_cast<uint8_t*> (tex->pcData), tex->mWidth, *mAsset);