parent
089375bd63
commit
a8c75c34a1
|
@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
|
||||||
|
|
||||||
Copyright (c) 2006-2021, assimp team
|
Copyright (c) 2006-2021, assimp team
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use of this software in source and binary forms,
|
Redistribution and use of this software in source and binary forms,
|
||||||
|
@ -402,15 +400,23 @@ struct aiScene
|
||||||
|
|
||||||
//! Returns an embedded texture and its index
|
//! Returns an embedded texture and its index
|
||||||
std::pair<const aiTexture*, int> GetEmbeddedTextureAndIndex(const char* filename) const {
|
std::pair<const aiTexture*, int> GetEmbeddedTextureAndIndex(const char* filename) const {
|
||||||
|
if(nullptr==filename) {
|
||||||
|
return std::make_pair(nullptr, -1);
|
||||||
|
}
|
||||||
// lookup using texture ID (if referenced like: "*1", "*2", etc.)
|
// lookup using texture ID (if referenced like: "*1", "*2", etc.)
|
||||||
if ('*' == *filename) {
|
if ('*' == *filename) {
|
||||||
int index = std::atoi(filename + 1);
|
int index = std::atoi(filename + 1);
|
||||||
if (0 > index || mNumTextures <= static_cast<unsigned>(index))
|
if (0 > index || mNumTextures <= static_cast<unsigned>(index)) {
|
||||||
return std::make_pair(nullptr, -1);
|
return std::make_pair(nullptr, -1);
|
||||||
|
}
|
||||||
return std::make_pair(mTextures[index], index);
|
return std::make_pair(mTextures[index], index);
|
||||||
}
|
}
|
||||||
// lookup using filename
|
// lookup using filename
|
||||||
const char* shortFilename = GetShortFilename(filename);
|
const char* shortFilename = GetShortFilename(filename);
|
||||||
|
if (nullptr == shortFilename) {
|
||||||
|
return std::make_pair(nullptr, -1);
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < mNumTextures; i++) {
|
for (unsigned int i = 0; i < mNumTextures; i++) {
|
||||||
const char* shortTextureFilename = GetShortFilename(mTextures[i]->mFilename.C_Str());
|
const char* shortTextureFilename = GetShortFilename(mTextures[i]->mFilename.C_Str());
|
||||||
if (strcmp(shortTextureFilename, shortFilename) == 0) {
|
if (strcmp(shortTextureFilename, shortFilename) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue