update assimp to 6.0.5

This commit is contained in:
AzaezelX 2026-06-09 12:46:56 -05:00
parent 2d2eb57e2e
commit f5cf21cfeb
941 changed files with 22718 additions and 12240 deletions

View file

@ -2,7 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2024, assimp team
Copyright (c) 2006-2026, assimp team
All rights reserved.
@ -53,17 +53,18 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* KHR_materials_volume full
* KHR_materials_ior full
* KHR_materials_emissive_strength full
* KHR_materials_anisotropy full
*/
#ifndef GLTF2ASSET_H_INC
#define GLTF2ASSET_H_INC
#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
//#if !defined(ASSIMP_BUILD_NO_GLTF_IMPORTER) && !defined(ASSIMP_BUILD_NO_GLTF2_IMPORTER)
#include <assimp/Exceptional.h>
#include <algorithm>
#include <list>
#include <map>
#include <unordered_map>
#include <set>
#include <stdexcept>
#include <string>
@ -94,7 +95,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# define ai_assert
#endif
#if _MSC_VER > 1500 || (defined __GNUC___)
#if _MSC_VER > 1500 || (defined __GNUC__)
# define ASSIMP_GLTF_USE_UNORDERED_MULTIMAP
#else
# define gltf_unordered_map map
@ -118,7 +119,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h>
#include <assimp/GltfMaterial.h>
#include "AssetLib/glTF/glTFCommon.h"
#include "AssetLib/glTFCommon/glTFCommon.h"
namespace glTF2 {
@ -363,11 +364,8 @@ struct CustomExtension {
}
CustomExtension() = default;
~CustomExtension() = default;
CustomExtension(const CustomExtension &other) = default;
CustomExtension& operator=(const CustomExtension&) = default;
};
@ -422,7 +420,6 @@ public:
Type_text
};
/// \struct SEncodedRegion
/// Descriptor of encoded region in "bufferView".
struct SEncodedRegion {
const size_t Offset; ///< Offset from begin of "bufferView" to encoded region, in bytes.
@ -431,7 +428,6 @@ public:
const size_t DecodedData_Length; ///< Size of decoded region, in bytes.
const std::string ID; ///< ID of the region.
/// \fn SEncodedRegion(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string pID)
/// Constructor.
/// \param [in] pOffset - offset from begin of "bufferView" to encoded region, in bytes.
/// \param [in] pEncodedData_Length - size of encoded region, in bytes.
@ -445,7 +441,6 @@ public:
DecodedData_Length(pDecodedData_Length),
ID(pID) {}
/// \fn ~SEncodedRegion()
/// Destructor.
~SEncodedRegion() { delete[] DecodedData; }
};
@ -459,7 +454,6 @@ public:
Type type;
/// \var EncodedRegion_Current
/// Pointer to currently active encoded region.
/// Why not decoding all regions at once and not to set one buffer with decoded data?
/// Yes, why not? Even "accessor" point to decoded data. I mean that fields "byteOffset", "byteStride" and "count" has values which describes decoded
@ -499,7 +493,6 @@ public:
bool LoadFromStream(IOStream &stream, size_t length = 0, size_t baseOffset = 0);
/// \fn void EncodedRegion_Mark(const size_t pOffset, const size_t pEncodedData_Length, uint8_t* pDecodedData, const size_t pDecodedData_Length, const std::string& pID)
/// Mark region of "bufferView" as encoded. When data is request from such region then "bufferView" use decoded data.
/// \param [in] pOffset - offset from begin of "bufferView" to encoded region, in bytes.
/// \param [in] pEncodedData_Length - size of encoded region, in bytes.
@ -508,12 +501,10 @@ public:
/// \param [in] pID - ID of the region.
void EncodedRegion_Mark(const size_t pOffset, const size_t pEncodedData_Length, uint8_t *pDecodedData, const size_t pDecodedData_Length, const std::string &pID);
/// \fn void EncodedRegion_SetCurrent(const std::string& pID)
/// Select current encoded region by ID. \sa EncodedRegion_Current.
/// \param [in] pID - ID of the region.
void EncodedRegion_SetCurrent(const std::string &pID);
/// \fn bool ReplaceData(const size_t pBufferData_Offset, const size_t pBufferData_Count, const uint8_t* pReplace_Data, const size_t pReplace_Count)
/// Replace part of buffer data. Pay attention that function work with original array of data (\ref mData) not with encoded regions.
/// \param [in] pBufferData_Offset - index of first element in buffer from which new data will be placed.
/// \param [in] pBufferData_Count - count of bytes in buffer which will be replaced.
@ -821,6 +812,15 @@ struct MaterialEmissiveStrength {
void SetDefaults();
};
struct MaterialAnisotropy {
float anisotropyStrength = 0.f;
float anisotropyRotation = 0.f;
TextureInfo anisotropyTexture;
MaterialAnisotropy() { SetDefaults(); }
void SetDefaults();
};
//! The material appearance of a primitive.
struct Material : public Object {
//PBR metallic roughness properties
@ -859,6 +859,9 @@ struct Material : public Object {
//extension: KHR_materials_emissive_strength
Nullable<MaterialEmissiveStrength> materialEmissiveStrength;
//extension: KHR_materials_anisotropy
Nullable<MaterialAnisotropy> materialAnisotropy;
//extension: KHR_materials_unlit
bool unlit;
@ -989,27 +992,24 @@ struct Texture : public Object {
struct Animation : public Object {
struct Sampler {
Sampler() :
interpolation(Interpolation_LINEAR) {}
Sampler() = default;
Ref<Accessor> input; //!< Accessor reference to the buffer storing the key-frame times.
Ref<Accessor> output; //!< Accessor reference to the buffer storing the key-frame values.
Interpolation interpolation; //!< Type of interpolation algorithm to use between key-frames.
Interpolation interpolation{Interpolation_LINEAR}; //!< Type of interpolation algorithm to use between key-frames.
};
struct Target {
Target() :
path(AnimationPath_TRANSLATION) {}
Target() = default;
Ref<Node> node; //!< The node to animate.
AnimationPath path; //!< The property of the node to animate.
AnimationPath path{AnimationPath_TRANSLATION}; //!< The property of the node to animate.
};
struct Channel {
Channel() :
sampler(-1) {}
Channel() = default;
int sampler; //!< The sampler index containing the animation data.
int sampler{-1}; //!< The sampler index containing the animation data.
Target target; //!< The node and property to animate.
};
@ -1122,48 +1122,34 @@ class Asset {
public:
//! Keeps info about the enabled extensions
struct Extensions {
bool KHR_materials_pbrSpecularGlossiness;
bool KHR_materials_specular;
bool KHR_materials_unlit;
bool KHR_lights_punctual;
bool KHR_texture_transform;
bool KHR_materials_sheen;
bool KHR_materials_clearcoat;
bool KHR_materials_transmission;
bool KHR_materials_volume;
bool KHR_materials_ior;
bool KHR_materials_emissive_strength;
bool KHR_draco_mesh_compression;
bool FB_ngon_encoding;
bool KHR_texture_basisu;
bool KHR_materials_pbrSpecularGlossiness{false};
bool KHR_materials_specular{false};
bool KHR_materials_unlit{false};
bool KHR_lights_punctual{false};
bool KHR_texture_transform{false};
bool KHR_materials_sheen{false};
bool KHR_materials_clearcoat{false};
bool KHR_materials_transmission{false};
bool KHR_materials_volume{false};
bool KHR_materials_ior{false};
bool KHR_materials_emissive_strength{false};
bool KHR_materials_anisotropy{false};
bool KHR_draco_mesh_compression{false};
bool FB_ngon_encoding{false};
bool KHR_texture_basisu{false};
bool EXT_texture_webp{false};
Extensions() :
KHR_materials_pbrSpecularGlossiness(false),
KHR_materials_specular(false),
KHR_materials_unlit(false),
KHR_lights_punctual(false),
KHR_texture_transform(false),
KHR_materials_sheen(false),
KHR_materials_clearcoat(false),
KHR_materials_transmission(false),
KHR_materials_volume(false),
KHR_materials_ior(false),
KHR_materials_emissive_strength(false),
KHR_draco_mesh_compression(false),
FB_ngon_encoding(false),
KHR_texture_basisu(false) {
// empty
}
Extensions() = default;
~Extensions() = default;
} extensionsUsed;
//! Keeps info about the required extensions
struct RequiredExtensions {
bool KHR_draco_mesh_compression;
bool KHR_texture_basisu;
bool KHR_draco_mesh_compression{false};
bool KHR_texture_basisu{false};
bool EXT_texture_webp{false};
RequiredExtensions() : KHR_draco_mesh_compression(false), KHR_texture_basisu(false) {
// empty
}
RequiredExtensions() = default;
} extensionsRequired;
AssetMetadata asset;
@ -1251,8 +1237,8 @@ private:
size_t mSceneLength;
size_t mBodyOffset;
size_t mBodyLength;
IdMap mUsedIds;
Ref<Buffer> mBodyBuffer;
std::unordered_map<std::string, int> lastUsedID;
};
inline std::string getContextForErrorMessages(const std::string &id, const std::string &name) {
@ -1268,6 +1254,6 @@ inline std::string getContextForErrorMessages(const std::string &id, const std::
// Include the implementation of the methods
#include "glTF2Asset.inl"
#endif // ASSIMP_BUILD_NO_GLTF_IMPORTER
//#endif // ASSIMP_BUILD_NO_GLTF_IMPORTER
#endif // GLTF2ASSET_H_INC