Merge branch 'master' into scenepreprocessor-memoryleak

pull/3505/head
Kim Kulling 2020-12-03 10:08:05 +01:00 committed by GitHub
commit c5f45e26bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 41 deletions

View File

@ -1715,14 +1715,14 @@ aiString FBXConverter::GetTexturePath(const Texture *tex) {
bool textureReady = false; //tells if our texture is ready (if it was loaded or if it was found)
unsigned int index=0;
VideoMap::const_iterator it = textures_converted.find(*media);
VideoMap::const_iterator it = textures_converted.find(media);
if (it != textures_converted.end()) {
index = (*it).second;
textureReady = true;
} else {
if (media->ContentLength() > 0) {
index = ConvertVideo(*media);
textures_converted[*media] = index;
textures_converted[media] = index;
textureReady = true;
}
}
@ -2221,12 +2221,12 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial *out_mat, const PropertyTa
if (media != nullptr && media->ContentLength() > 0) {
unsigned int index;
VideoMap::const_iterator videoIt = textures_converted.find(*media);
VideoMap::const_iterator videoIt = textures_converted.find(media);
if (videoIt != textures_converted.end()) {
index = videoIt->second;
} else {
index = ConvertVideo(*media);
textures_converted[*media] = index;
textures_converted[media] = index;
}
// setup texture reference string (copied from ColladaLoader::FindFilenameForEffectTexture)
@ -3493,7 +3493,7 @@ void FBXConverter::ConvertOrphanedEmbeddedTextures() {
if (realTexture) {
const Video *media = realTexture->Media();
unsigned int index = ConvertVideo(*media);
textures_converted[*media] = index;
textures_converted[media] = index;
}
}
}

View File

@ -428,7 +428,7 @@ private:
using MaterialMap = std::fbx_unordered_map<const Material*, unsigned int>;
MaterialMap materials_converted;
using VideoMap = std::fbx_unordered_map<const Video, unsigned int>;
using VideoMap = std::fbx_unordered_map<const Video*, unsigned int>;
VideoMap textures_converted;
using MeshMap = std::fbx_unordered_map<const Geometry*, std::vector<unsigned int> >;

View File

@ -638,20 +638,6 @@ public:
return ptr;
}
bool operator==(const Video& other) const
{
return (
type == other.type
&& relativeFileName == other.relativeFileName
&& fileName == other.fileName
);
}
bool operator<(const Video& other) const
{
return std::tie(type, relativeFileName, fileName) < std::tie(other.type, other.relativeFileName, other.fileName);
}
private:
std::string type;
std::string relativeFileName;
@ -1192,25 +1178,4 @@ private:
} // Namespace FBX
} // Namespace Assimp
namespace std
{
template <>
struct hash<const Assimp::FBX::Video>
{
std::size_t operator()(const Assimp::FBX::Video& video) const
{
using std::size_t;
using std::hash;
using std::string;
size_t res = 17;
res = res * 31 + hash<string>()(video.Name());
res = res * 31 + hash<string>()(video.RelativeFilename());
res = res * 31 + hash<string>()(video.Type());
return res;
}
};
}
#endif // INCLUDED_AI_FBX_DOCUMENT_H

View File

@ -14,6 +14,11 @@ To use this module please provide following cmake defines:
"SOME_PATH" is a path to your cmake android toolchain script.
The build script for this port is based on [android-cmake](https://github.com/taka-no-me/android-cmake).
See its documentation for more Android-specific cmake options (e.g. -DANDROID_ABI for the target ABI).
Check [Asset-Importer-Docs](https://assimp-docs.readthedocs.io/en/latest/) for more information.
### Code ###
A small example how to wrap assimp for Android:
```cpp