Update Assimp from 5.2.3 to 5.2.5

This commit is contained in:
Bloodknight 2022-10-02 19:02:49 +01:00
parent ea7ca63301
commit 16f3710058
379 changed files with 14469 additions and 47175 deletions

View file

@ -314,7 +314,7 @@ struct Object {
virtual bool IsSpecial() const { return false; }
Object() = default;
virtual ~Object() {}
virtual ~Object() = default;
//! Maps special IDs to another ID, where needed. Subclasses may override it (statically)
static const char *TranslateId(Asset & /*r*/, const char *id) { return id; }
@ -666,7 +666,7 @@ struct Mesh : public Object {
std::vector<Primitive> primitives;
std::list<SExtension *> Extension; ///< List of extensions used in mesh.
Mesh() {}
Mesh() = default;
/// Destructor.
~Mesh() {
@ -706,12 +706,12 @@ struct Node : public Object {
Ref<Node> parent; //!< This is not part of the glTF specification. Used as a helper.
Node() {}
Node() = default;
void Read(Value &obj, Asset &r);
};
struct Program : public Object {
Program() {}
Program() = default;
void Read(Value &obj, Asset &r);
};
@ -830,7 +830,7 @@ struct Animation : public Object {
//! Base class for LazyDict that acts as an interface
class LazyDictBase {
public:
virtual ~LazyDictBase() {}
virtual ~LazyDictBase() = default;
virtual void AttachToDocument(Document &doc) = 0;
virtual void DetachFromDocument() = 0;
@ -903,8 +903,10 @@ struct AssetMetadata {
void Read(Document &doc);
AssetMetadata() :
premultipliedAlpha(false), version() {
premultipliedAlpha(false) {
}
operator bool() const { return version.size() && version[0] == '1'; }
};
//

View file

@ -53,9 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#endif
using namespace Assimp;
using namespace glTFCommon;
namespace glTF {
using namespace glTFCommon;
#if _MSC_VER
#pragma warning(push)
@ -891,12 +891,12 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG
auto get_buf_offset = [](Ref<Accessor> &pAccessor) -> size_t { return pAccessor->byteOffset + pAccessor->bufferView->byteOffset; };
// Indices
ifs.SetCoordIndex((IndicesType *const)(decoded_data + get_buf_offset(primitives[0].indices)));
ifs.SetCoordIndex((IndicesType *)(decoded_data + get_buf_offset(primitives[0].indices)));
// Coordinates
ifs.SetCoord((o3dgc::Real *const)(decoded_data + get_buf_offset(primitives[0].attributes.position[0])));
ifs.SetCoord((o3dgc::Real *)(decoded_data + get_buf_offset(primitives[0].attributes.position[0])));
// Normals
if (size_normal) {
ifs.SetNormal((o3dgc::Real *const)(decoded_data + get_buf_offset(primitives[0].attributes.normal[0])));
ifs.SetNormal((o3dgc::Real *)(decoded_data + get_buf_offset(primitives[0].attributes.normal[0])));
}
for (size_t idx = 0, idx_end = size_floatattr.size(), idx_texcoord = 0; idx < idx_end; idx++) {
@ -904,7 +904,7 @@ inline void Mesh::Decode_O3DGC(const SCompression_Open3DGC &pCompression_Open3DG
case o3dgc::O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD:
if (idx_texcoord < primitives[0].attributes.texcoord.size()) {
// See above about absent attributes.
ifs.SetFloatAttribute(static_cast<unsigned long>(idx), (o3dgc::Real *const)(decoded_data + get_buf_offset(primitives[0].attributes.texcoord[idx])));
ifs.SetFloatAttribute(static_cast<unsigned long>(idx), (o3dgc::Real *)(decoded_data + get_buf_offset(primitives[0].attributes.texcoord[idx])));
idx_texcoord++;
}
@ -1114,10 +1114,6 @@ inline void AssetMetadata::Read(Document &doc) {
ReadMember(*curProfile, "version", this->profile.version);
}
}
if (version.empty() || version[0] != '1') {
throw DeadlyImportError("GLTF: Unsupported glTF version: ", version);
}
}
//
@ -1222,6 +1218,10 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) {
// Load the metadata
asset.Read(doc);
if (!asset) {
return;
}
ReadExtensionsUsed(doc);
// Prepare the dictionaries

View file

@ -84,9 +84,7 @@ glTFImporter::glTFImporter() :
// empty
}
glTFImporter::~glTFImporter() {
// empty
}
glTFImporter::~glTFImporter() = default;
const aiImporterDesc *glTFImporter::GetInfo() const {
return &desc;
@ -96,8 +94,7 @@ bool glTFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool
glTF::Asset asset(pIOHandler);
try {
asset.Load(pFile, GetExtension(pFile) == "glb");
std::string version = asset.asset.version;
return !version.empty() && version[0] == '1';
return asset.asset;
} catch (...) {
return false;
}