Merge branch 'master' into fix-build-without-armaturepopulate-post-process

pull/4880/head
krishty 2023-01-29 01:14:33 +01:00 committed by GitHub
commit df28e7830f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
110 changed files with 354 additions and 590 deletions

View File

@ -1,6 +1,6 @@
# Open Asset Import Library (assimp) # Open Asset Import Library (assimp)
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# Copyright (c) 2006-2022, assimp team # Copyright (c) 2006-2023, assimp team
# #
# All rights reserved. # All rights reserved.
# #
@ -262,13 +262,13 @@ IF ((CMAKE_C_COMPILER_ID MATCHES "GNU") AND NOT MINGW)
ENDIF() ENDIF()
# hide all not-exported symbols # hide all not-exported symbols
IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" ) IF(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "mips64" )
SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "-mxgot -fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
SET(LIBSTDC++_LIBRARIES -lstdc++) SET(LIBSTDC++_LIBRARIES -lstdc++)
ELSE() ELSE()
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -fno-strict-aliasing -Wall ${CMAKE_CXX_FLAGS}")
SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}") SET(CMAKE_C_FLAGS "-fno-strict-aliasing ${CMAKE_C_FLAGS}")
SET(LIBSTDC++_LIBRARIES -lstdc++) SET(LIBSTDC++_LIBRARIES -lstdc++)
ENDIF() ENDIF()
ELSEIF(MSVC) ELSEIF(MSVC)
# enable multi-core compilation with MSVC # enable multi-core compilation with MSVC
@ -277,13 +277,15 @@ ELSEIF(MSVC)
ELSE() # msvc ELSE() # msvc
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX) ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)
ENDIF() ENDIF()
# disable "elements of array '' will be default initialized" warning on MSVC2013 # disable "elements of array '' will be default initialized" warning on MSVC2013
IF(MSVC12) IF(MSVC12)
ADD_COMPILE_OPTIONS(/wd4351) ADD_COMPILE_OPTIONS(/wd4351)
ENDIF() ENDIF()
ADD_COMPILE_OPTIONS(/wd4244) #supress warning for double to float conversion if Double precission is activated # supress warning for double to float conversion if Double precission is activated
ADD_COMPILE_OPTIONS(/wd4244)
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od") SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_DEBUG /Zi /Od")
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi") SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF") SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG:FULL /PDBALTPATH:%_PDB% /OPT:REF /OPT:ICF")
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
IF(NOT ASSIMP_HUNTER_ENABLED) IF(NOT ASSIMP_HUNTER_ENABLED)

View File

@ -322,7 +322,6 @@ struct Texture {
//! Default constructor //! Default constructor
Texture() AI_NO_EXCEPT Texture() AI_NO_EXCEPT
: mTextureBlend(0.0f), : mTextureBlend(0.0f),
mMapName(),
mOffsetU(0.0), mOffsetU(0.0),
mOffsetV(0.0), mOffsetV(0.0),
mScaleU(1.0), mScaleU(1.0),
@ -334,51 +333,11 @@ struct Texture {
mTextureBlend = get_qnan(); mTextureBlend = get_qnan();
} }
Texture(const Texture &other) : Texture(const Texture &other) = default;
mTextureBlend(other.mTextureBlend),
mMapName(other.mMapName),
mOffsetU(other.mOffsetU),
mOffsetV(other.mOffsetV),
mScaleU(other.mScaleU),
mScaleV(other.mScaleV),
mRotation(other.mRotation),
mMapMode(other.mMapMode),
bPrivate(other.bPrivate),
iUVSrc(other.iUVSrc) {
// empty
}
Texture(Texture &&other) AI_NO_EXCEPT : mTextureBlend(other.mTextureBlend), Texture(Texture &&other) AI_NO_EXCEPT = default;
mMapName(std::move(other.mMapName)),
mOffsetU(other.mOffsetU),
mOffsetV(other.mOffsetV),
mScaleU(other.mScaleU),
mScaleV(other.mScaleV),
mRotation(other.mRotation),
mMapMode(other.mMapMode),
bPrivate(other.bPrivate),
iUVSrc(other.iUVSrc) {
// empty
}
Texture &operator=(Texture &&other) AI_NO_EXCEPT { Texture &operator=(Texture &&other) AI_NO_EXCEPT = default;
if (this == &other) {
return *this;
}
mTextureBlend = other.mTextureBlend;
mMapName = std::move(other.mMapName);
mOffsetU = other.mOffsetU;
mOffsetV = other.mOffsetV;
mScaleU = other.mScaleU;
mScaleV = other.mScaleV;
mRotation = other.mRotation;
mMapMode = other.mMapMode;
bPrivate = other.bPrivate;
iUVSrc = other.iUVSrc;
return *this;
}
//! Specifies the blend factor for the texture //! Specifies the blend factor for the texture
ai_real mTextureBlend; ai_real mTextureBlend;
@ -436,83 +395,13 @@ struct Material {
// empty // empty
} }
Material(const Material &other) : Material(const Material &other) = default;
mName(other.mName),
mDiffuse(other.mDiffuse),
mSpecularExponent(other.mSpecularExponent),
mShininessStrength(other.mShininessStrength),
mSpecular(other.mSpecular),
mAmbient(other.mAmbient),
mShading(other.mShading),
mTransparency(other.mTransparency),
sTexDiffuse(other.sTexDiffuse),
sTexOpacity(other.sTexOpacity),
sTexSpecular(other.sTexSpecular),
sTexReflective(other.sTexReflective),
sTexBump(other.sTexBump),
sTexEmissive(other.sTexEmissive),
sTexShininess(other.sTexShininess),
mBumpHeight(other.mBumpHeight),
mEmissive(other.mEmissive),
sTexAmbient(other.sTexAmbient),
mTwoSided(other.mTwoSided) {
// empty
}
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it Material(Material &&other) AI_NO_EXCEPT = default;
Material(Material &&other) AI_NO_EXCEPT : mName(std::move(other.mName)),
mDiffuse(other.mDiffuse),
mSpecularExponent(other.mSpecularExponent),
mShininessStrength(other.mShininessStrength),
mSpecular(other.mSpecular),
mAmbient(other.mAmbient),
mShading(other.mShading),
mTransparency(other.mTransparency),
sTexDiffuse(std::move(other.sTexDiffuse)),
sTexOpacity(std::move(other.sTexOpacity)),
sTexSpecular(std::move(other.sTexSpecular)),
sTexReflective(std::move(other.sTexReflective)),
sTexBump(std::move(other.sTexBump)),
sTexEmissive(std::move(other.sTexEmissive)),
sTexShininess(std::move(other.sTexShininess)),
mBumpHeight(other.mBumpHeight),
mEmissive(other.mEmissive),
sTexAmbient(std::move(other.sTexAmbient)),
mTwoSided(other.mTwoSided) {
// empty
}
Material &operator=(Material &&other) AI_NO_EXCEPT { Material &operator=(Material &&other) AI_NO_EXCEPT = default;
if (this == &other) {
return *this;
}
mName = std::move(other.mName); virtual ~Material() = default;
mDiffuse = other.mDiffuse;
mSpecularExponent = other.mSpecularExponent;
mShininessStrength = other.mShininessStrength,
mSpecular = other.mSpecular;
mAmbient = other.mAmbient;
mShading = other.mShading;
mTransparency = other.mTransparency;
sTexDiffuse = std::move(other.sTexDiffuse);
sTexOpacity = std::move(other.sTexOpacity);
sTexSpecular = std::move(other.sTexSpecular);
sTexReflective = std::move(other.sTexReflective);
sTexBump = std::move(other.sTexBump);
sTexEmissive = std::move(other.sTexEmissive);
sTexShininess = std::move(other.sTexShininess);
mBumpHeight = other.mBumpHeight;
mEmissive = other.mEmissive;
sTexAmbient = std::move(other.sTexAmbient);
mTwoSided = other.mTwoSided;
return *this;
}
virtual ~Material() {
// empty
}
//! Name of the material //! Name of the material
std::string mName; std::string mName;

View File

@ -69,9 +69,7 @@ public:
// empty // empty
} }
virtual ~Resource() { virtual ~Resource() = default;
// empty
}
virtual ResourceType getType() const { virtual ResourceType getType() const {
return ResourceType::RT_Unknown; return ResourceType::RT_Unknown;

View File

@ -83,7 +83,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen
namespace D3MF { namespace D3MF {
D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) : D3MFExporter::D3MFExporter(const char *pFile, const aiScene *pScene) :
mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene), mModelOutput(), mRelOutput(), mContentOutput(), mBuildItems(), mRelations() { mArchiveName(pFile), m_zipArchive(nullptr), mScene(pScene) {
// empty // empty
} }

View File

@ -160,7 +160,7 @@ D3MFOpcPackage::D3MFOpcPackage(IOSystem *pIOHandler, const std::string &rFile) :
// deal with zip-bug // deal with zip-bug
rootFile = rootFile.substr(1); rootFile = rootFile.substr(1);
} }
} }
ASSIMP_LOG_VERBOSE_DEBUG(rootFile); ASSIMP_LOG_VERBOSE_DEBUG(rootFile);

View File

@ -216,7 +216,7 @@ void XmlSerializer::ImportXml(aiScene *scene) {
if (nullptr == scene) { if (nullptr == scene) {
return; return;
} }
scene->mRootNode = new aiNode(XmlTag::RootTag); scene->mRootNode = new aiNode(XmlTag::RootTag);
XmlNode node = mXmlParser->getRootNode().child(XmlTag::model); XmlNode node = mXmlParser->getRootNode().child(XmlTag::model);
if (node.empty()) { if (node.empty()) {
@ -444,7 +444,7 @@ void XmlSerializer::ImportTriangles(XmlNode &node, aiMesh *mesh) {
} }
mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
} }
} }
} }
} }

View File

@ -83,11 +83,7 @@ void AMFImporter::Clear() {
AMFImporter::AMFImporter() AI_NO_EXCEPT : AMFImporter::AMFImporter() AI_NO_EXCEPT :
mNodeElement_Cur(nullptr), mNodeElement_Cur(nullptr),
mXmlParser(nullptr), mXmlParser(nullptr) {
mUnit(),
mVersion(),
mMaterial_Converted(),
mTexture_Converted() {
// empty // empty
} }

View File

@ -88,9 +88,7 @@ public:
std::list<AMFNodeElementBase *> Child; ///< Child elements. std::list<AMFNodeElementBase *> Child; ///< Child elements.
public: /// Destructor, virtual.. public: /// Destructor, virtual..
virtual ~AMFNodeElementBase() { virtual ~AMFNodeElementBase() = default;
// empty
}
/// Disabled copy constructor and co. /// Disabled copy constructor and co.
AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete; AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete;
@ -103,7 +101,7 @@ protected:
/// \param [in] pType - element type. /// \param [in] pType - element type.
/// \param [in] pParent - parent element. /// \param [in] pParent - parent element.
AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) : AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) :
Type(pType), ID(), Parent(pParent), Child() { Type(pType), Parent(pParent) {
// empty // empty
} }
}; // class IAMFImporter_NodeElement }; // class IAMFImporter_NodeElement
@ -174,7 +172,7 @@ struct AMFColor : public AMFNodeElementBase {
/// @brief Constructor. /// @brief Constructor.
/// @param [in] pParent - pointer to parent node. /// @param [in] pParent - pointer to parent node.
AMFColor(AMFNodeElementBase *pParent) : AMFColor(AMFNodeElementBase *pParent) :
AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() { AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() {
// empty // empty
} }
}; };
@ -270,7 +268,7 @@ struct AMFTexMap : public AMFNodeElementBase {
/// Constructor. /// Constructor.
/// \param [in] pParent - pointer to parent node. /// \param [in] pParent - pointer to parent node.
AMFTexMap(AMFNodeElementBase *pParent) : AMFTexMap(AMFNodeElementBase *pParent) :
AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() { AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} {
// empty // empty
} }
}; };

View File

@ -56,5 +56,5 @@ namespace Assimp {
void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/); void ASSIMP_API ExportSceneAssbin(const char* pFile, IOSystem* pIOSystem, const aiScene* pScene, const ExportProperties* /*pProperties*/);
} }
#endif #endif
#endif // AI_ASSBINEXPORTER_H_INC #endif // AI_ASSBINEXPORTER_H_INC

View File

@ -291,15 +291,15 @@ public:
size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override { size_t Read(void * /*pvBuffer*/, size_t /*pSize*/, size_t /*pCount*/) override {
return 0; return 0;
} }
aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override { aiReturn Seek(size_t /*pOffset*/, aiOrigin /*pOrigin*/) override {
return aiReturn_FAILURE; return aiReturn_FAILURE;
} }
size_t Tell() const override { size_t Tell() const override {
return cursor; return cursor;
} }
void Flush() override { void Flush() override {
// not implemented // not implemented
} }

View File

@ -43,7 +43,7 @@ public:
Flag_WriteSpecialFloats = 0x2, Flag_WriteSpecialFloats = 0x2,
Flag_SkipWhitespaces = 0x4 Flag_SkipWhitespaces = 0x4
}; };
JSONWriter(Assimp::IOStream &out, unsigned int flags = 0u) : JSONWriter(Assimp::IOStream &out, unsigned int flags = 0u) :
out(out), indent (""), newline("\n"), space(" "), buff (), first(false), flags(flags) { out(out), indent (""), newline("\n"), space(" "), buff (), first(false), flags(flags) {
// make sure that all formatting happens using the standard, C locale and not the user's current locale // make sure that all formatting happens using the standard, C locale and not the user's current locale
@ -499,18 +499,18 @@ static void Write(JSONWriter &out, const aiMaterial &ai, bool is_elem = true) {
} }
break; break;
case aiPTI_String: case aiPTI_String:
{ {
aiString s; aiString s;
aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s); aiGetMaterialString(&ai, prop->mKey.data, prop->mSemantic, prop->mIndex, &s);
out.SimpleValue(s); out.SimpleValue(s);
} }
break; break;
case aiPTI_Buffer: case aiPTI_Buffer:
{ {
// binary data is written as series of hex-encoded octets // binary data is written as series of hex-encoded octets
out.SimpleValue(prop->mData, prop->mDataLength); out.SimpleValue(prop->mData, prop->mDataLength);
} }
break; break;
default: default:
ai_assert(false); ai_assert(false);

View File

@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
template <> template <>
const char *LogFunctions<BlenderBMeshConverter>::Prefix() { const char *LogFunctions<BlenderBMeshConverter>::Prefix() {
static auto prefix = "BLEND_BMESH: "; return "BLEND_BMESH: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp

View File

@ -106,9 +106,7 @@ struct ElemBase {
// empty // empty
} }
virtual ~ElemBase() { virtual ~ElemBase() = default;
// empty
}
/** Type name of the element. The type /** Type name of the element. The type
* string points is the `c_str` of the `name` attribute of the * string points is the `c_str` of the `name` attribute of the

View File

@ -80,8 +80,7 @@ namespace Assimp {
template <> template <>
const char *LogFunctions<BlenderImporter>::Prefix() { const char *LogFunctions<BlenderImporter>::Prefix() {
static auto prefix = "BLEND: "; return "BLEND: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp

View File

@ -62,9 +62,7 @@ public:
/** /**
* The class destructor, virtual. * The class destructor, virtual.
*/ */
virtual ~BlenderModifier() { virtual ~BlenderModifier() = default;
// empty
}
// -------------------- // --------------------
/** /**

View File

@ -182,7 +182,7 @@ struct MVert : ElemBase {
int bweight; int bweight;
MVert() : MVert() :
ElemBase(), flag(0), mat_nr(0), bweight(0) {} flag(0), mat_nr(0), bweight(0) {}
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -417,7 +417,6 @@ struct CustomDataLayer : ElemBase {
std::shared_ptr<ElemBase> data; // must be converted to real type according type member std::shared_ptr<ElemBase> data; // must be converted to real type according type member
CustomDataLayer() : CustomDataLayer() :
ElemBase(),
type(0), type(0),
offset(0), offset(0),
flag(0), flag(0),
@ -729,7 +728,7 @@ struct Object : ElemBase {
ListBase modifiers; ListBase modifiers;
Object() : Object() :
ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() { type(Type_EMPTY), parent(nullptr) {
// empty // empty
} }
}; };
@ -741,8 +740,7 @@ struct Base : ElemBase {
std::shared_ptr<Object> object WARN; std::shared_ptr<Object> object WARN;
Base() : Base() :
ElemBase(), prev(nullptr), next(), object() { prev(nullptr) {
// empty
// empty // empty
} }
}; };
@ -758,10 +756,7 @@ struct Scene : ElemBase {
ListBase base; ListBase base;
Scene() : Scene() = default;
ElemBase(), camera(), world(), basact(), master_collection() {
// empty
}
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -791,10 +786,7 @@ struct Image : ElemBase {
short gen_x, gen_y, gen_type; short gen_x, gen_y, gen_type;
Image() : Image() = default;
ElemBase() {
// empty
}
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
@ -884,7 +876,7 @@ struct Tex : ElemBase {
//char use_nodes; //char use_nodes;
Tex() : Tex() :
ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() { imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) {
// empty // empty
} }
}; };
@ -976,10 +968,7 @@ struct MTex : ElemBase {
//float shadowfac; //float shadowfac;
//float zenupfac, zendownfac, blendfac; //float zenupfac, zendownfac, blendfac;
MTex() : MTex() = default;
ElemBase() {
// empty
}
}; };
} // namespace Blender } // namespace Blender

View File

@ -62,8 +62,7 @@ namspace Assimp
{ {
template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix() template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix()
{ {
static auto prefix = "BLEND_TESS_GL: "; return "BLEND_TESS_GL: ";
return prefix;
} }
} }
@ -81,9 +80,7 @@ BlenderTessellatorGL::BlenderTessellatorGL( BlenderBMeshConverter& converter ):
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
BlenderTessellatorGL::~BlenderTessellatorGL( ) BlenderTessellatorGL::~BlenderTessellatorGL() = default;
{
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices ) void BlenderTessellatorGL::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )
@ -259,8 +256,7 @@ namespace Assimp
{ {
template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix() template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix()
{ {
static auto prefix = "BLEND_TESS_P2T: "; return "BLEND_TESS_P2T: ";
return prefix;
} }
} }

View File

@ -86,8 +86,7 @@ void GetWriterInfo(int &id, String &appname) {
namespace Assimp { namespace Assimp {
template<> const char* LogFunctions<C4DImporter>::Prefix() { template<> const char* LogFunctions<C4DImporter>::Prefix() {
static auto prefix = "C4D: "; return "C4D: ";
return prefix;
} }
} }
@ -106,15 +105,10 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
C4DImporter::C4DImporter() C4DImporter::C4DImporter() = default;
: BaseImporter() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
C4DImporter::~C4DImporter() { C4DImporter::~C4DImporter() = default;
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const { bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const {
@ -124,7 +118,7 @@ bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, b
} else if ((!extension.length() || checkSig) && pIOHandler) { } else if ((!extension.length() || checkSig) && pIOHandler) {
// TODO // TODO
} }
return false; return false;
} }

View File

@ -92,15 +92,6 @@ inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
ColladaLoader::ColladaLoader() : ColladaLoader::ColladaLoader() :
mFileName(),
mMeshIndexByID(),
mMaterialIndexByName(),
mMeshes(),
newMats(),
mCameras(),
mLights(),
mTextures(),
mAnims(),
noSkeletonMesh(false), noSkeletonMesh(false),
removeEmptyBones(false), removeEmptyBones(false),
ignoreUpDirection(false), ignoreUpDirection(false),
@ -1523,7 +1514,7 @@ void ColladaLoader::AddTexture(aiMaterial &mat,
map = -1; map = -1;
for (std::string::const_iterator it = sampler.mUVChannel.begin(); it != sampler.mUVChannel.end(); ++it) { for (std::string::const_iterator it = sampler.mUVChannel.begin(); it != sampler.mUVChannel.end(); ++it) {
if (IsNumeric(*it)) { if (IsNumeric(*it)) {
map = strtoul10(&(*it)); map = strtoul10(&(*it));
break; break;
} }
} }

View File

@ -65,7 +65,6 @@ public:
LineReader(StreamReaderLE& reader) LineReader(StreamReaderLE& reader)
: splitter(reader,false,true) : splitter(reader,false,true)
, groupcode( 0 ) , groupcode( 0 )
, value()
, end() { , end() {
// empty // empty
} }
@ -186,8 +185,7 @@ struct InsertBlock {
InsertBlock() InsertBlock()
: pos() : pos()
, scale(1.f,1.f,1.f) , scale(1.f,1.f,1.f)
, angle() , angle() {
, name() {
// empty // empty
} }

View File

@ -371,7 +371,7 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping."); ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping.");
continue; continue;
} }
std::shared_ptr<DXF::PolyLine> pl_out = std::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in)); std::shared_ptr<DXF::PolyLine> pl_out = std::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in));
if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) { if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {

View File

@ -1565,7 +1565,7 @@ void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo, const ai
out->mBones = nullptr; out->mBones = nullptr;
out->mNumBones = 0; out->mNumBones = 0;
return; return;
} }
out->mBones = new aiBone *[bones.size()](); out->mBones = new aiBone *[bones.size()]();
out->mNumBones = static_cast<unsigned int>(bones.size()); out->mNumBones = static_cast<unsigned int>(bones.size());
@ -3230,7 +3230,7 @@ aiNodeAnim* FBXConverter::GenerateSimpleNodeAnim(const std::string& name,
} }
bool ok = false; bool ok = false;
const auto zero_epsilon = ai_epsilon; const auto zero_epsilon = ai_epsilon;
const aiVector3D& preRotation = PropertyGet<aiVector3D>(props, "PreRotation", ok); const aiVector3D& preRotation = PropertyGet<aiVector3D>(props, "PreRotation", ok);

View File

@ -77,8 +77,6 @@ public: // constructors
/// The class constructor with the name. /// The class constructor with the name.
Node(const std::string& n) Node(const std::string& n)
: name(n) : name(n)
, properties()
, children()
, force_has_children( false ) { , force_has_children( false ) {
// empty // empty
} }
@ -87,8 +85,6 @@ public: // constructors
template <typename... More> template <typename... More>
Node(const std::string& n, More&&... more) Node(const std::string& n, More&&... more)
: name(n) : name(n)
, properties()
, children()
, force_has_children(false) { , force_has_children(false) {
AddProperties(std::forward<More>(more)...); AddProperties(std::forward<More>(more)...);
} }

View File

@ -62,8 +62,7 @@ namespace Assimp {
template <> template <>
const char *LogFunctions<FBXImporter>::Prefix() { const char *LogFunctions<FBXImporter>::Prefix() {
static auto prefix = "FBX: "; return "FBX: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp
@ -90,10 +89,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by #Importer // Constructor to be privately used by #Importer
FBXImporter::FBXImporter() : FBXImporter::FBXImporter() = default;
mSettings() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team Copyright (c) 2006-2023, assimp team
All rights reserved. All rights reserved.
@ -53,22 +52,26 @@ namespace Assimp {
namespace FBX { namespace FBX {
/** /**
* DOM base class for all kinds of FBX geometry * @brief DOM base class for all kinds of FBX geometry
*/ */
class Geometry : public Object { class Geometry : public Object {
public: public:
/// @brief The class constructor with all parameters. /// @brief The class constructor with all parameters.
/// @param id The id. /// @param id The id.
/// @param element /// @param element The element instance
/// @param name /// @param name The name instance
/// @param doc /// @param doc The document instance
Geometry( uint64_t id, const Element& element, const std::string& name, const Document& doc ); Geometry( uint64_t id, const Element& element, const std::string& name, const Document& doc );
/// @brief The class destructor, default.
virtual ~Geometry() = default; virtual ~Geometry() = default;
/// Get the Skin attached to this geometry or nullptr /// @brief Get the Skin attached to this geometry or nullptr.
/// @return The deformer skip instance as a pointer, nullptr if none.
const Skin* DeformerSkin() const; const Skin* DeformerSkin() const;
/// Get the BlendShape attached to this geometry or nullptr /// @brief Get the BlendShape attached to this geometry or nullptr
/// @return The blendshape arrays.
const std::vector<const BlendShape*>& GetBlendShapes() const; const std::vector<const BlendShape*>& GetBlendShapes() const;
private: private:
@ -78,59 +81,71 @@ private:
typedef std::vector<int> MatIndexArray; typedef std::vector<int> MatIndexArray;
/** /**
* DOM class for FBX geometry of type "Mesh" * @brief DOM class for FBX geometry of type "Mesh"
*/ */
class MeshGeometry : public Geometry { class MeshGeometry : public Geometry {
public: public:
/** The class constructor */ /// @brief The class constructor
/// @param id The id.
/// @param element The element instance
/// @param name The name instance
/// @param doc The document instance
MeshGeometry( uint64_t id, const Element& element, const std::string& name, const Document& doc ); MeshGeometry( uint64_t id, const Element& element, const std::string& name, const Document& doc );
/** The class destructor */ /// @brief The class destructor, default.
virtual ~MeshGeometry() = default; virtual ~MeshGeometry() = default;
/** Get a list of all vertex points, non-unique*/ /// brief Get a vector of all vertex points, non-unique.
/// @return The vertices vector.
const std::vector<aiVector3D>& GetVertices() const; const std::vector<aiVector3D>& GetVertices() const;
/** Get a list of all vertex normals or an empty array if /// @brief Get a vector of all vertex normals or an empty array if no normals are specified.
* no normals are specified. */ /// @return The normal vector.
const std::vector<aiVector3D>& GetNormals() const; const std::vector<aiVector3D>& GetNormals() const;
/** Get a list of all vertex tangents or an empty array /// @brief Get a vector of all vertex tangents or an empty array if no tangents are specified.
* if no tangents are specified */ /// @return The vertex tangents vector.
const std::vector<aiVector3D>& GetTangents() const; const std::vector<aiVector3D>& GetTangents() const;
/** Get a list of all vertex bi-normals or an empty array /// @brief Get a vector of all vertex bi-normals or an empty array if no bi-normals are specified.
* if no bi-normals are specified */ /// @return The binomal vector.
const std::vector<aiVector3D>& GetBinormals() const; const std::vector<aiVector3D>& GetBinormals() const;
/** Return list of faces - each entry denotes a face and specifies /// @brief Return list of faces - each entry denotes a face and specifies how many vertices it has.
* how many vertices it has. Vertices are taken from the /// Vertices are taken from the vertex data arrays in sequential order.
* vertex data arrays in sequential order. */ /// @return The face indices vector.
const std::vector<unsigned int>& GetFaceIndexCounts() const; const std::vector<unsigned int>& GetFaceIndexCounts() const;
/** Get a UV coordinate slot, returns an empty array if /// @brief Get a UV coordinate slot, returns an empty array if the requested slot does not exist.
* the requested slot does not exist. */ /// @param index The requested texture coordinate slot.
/// @return The texture coordinates.
const std::vector<aiVector2D>& GetTextureCoords( unsigned int index ) const; const std::vector<aiVector2D>& GetTextureCoords( unsigned int index ) const;
/** Get a UV coordinate slot, returns an empty array if /// @brief Get a UV coordinate slot, returns an empty array if the requested slot does not exist.
* the requested slot does not exist. */ /// @param index The requested texture coordinate slot.
/// @return The texture coordinate channel name.
std::string GetTextureCoordChannelName( unsigned int index ) const; std::string GetTextureCoordChannelName( unsigned int index ) const;
/** Get a vertex color coordinate slot, returns an empty array if /// @brief Get a vertex color coordinate slot, returns an empty array if the requested slot does not exist.
* the requested slot does not exist. */ /// @param index The requested texture coordinate slot.
/// @return The vertex color vector.
const std::vector<aiColor4D>& GetVertexColors( unsigned int index ) const; const std::vector<aiColor4D>& GetVertexColors( unsigned int index ) const;
/** Get per-face-vertex material assignments */ /// @brief Get per-face-vertex material assignments.
/// @return The Material indices Array.
const MatIndexArray& GetMaterialIndices() const; const MatIndexArray& GetMaterialIndices() const;
/** Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr /// @brief Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr if the vertex index is not valid.
* if the vertex index is not valid. */ /// @param in_index The requested input index.
/// @param count The number of indices.
/// @return The indices.
const unsigned int* ToOutputVertexIndex( unsigned int in_index, unsigned int& count ) const; const unsigned int* ToOutputVertexIndex( unsigned int in_index, unsigned int& count ) const;
/** Determine the face to which a particular output vertex index belongs. /// @brief Determine the face to which a particular output vertex index belongs.
* This mapping is always unique. */ /// This mapping is always unique.
/// @param in_index The requested input index.
/// @return The face-to-vertex index.
unsigned int FaceForVertexIndex( unsigned int in_index ) const; unsigned int FaceForVertexIndex( unsigned int in_index ) const;
private: private:

View File

@ -187,7 +187,7 @@ Scope::Scope(Parser& parser,bool topLevel)
if (str.empty()) { if (str.empty()) {
ParseError("unexpected content: empty string."); ParseError("unexpected content: empty string.");
} }
elements.insert(ElementMap::value_type(str,new_Element(*n,parser))); elements.insert(ElementMap::value_type(str,new_Element(*n,parser)));
// Element() should stop at the next Key token (or right after a Close token) // Element() should stop at the next Key token (or right after a Close token)

View File

@ -327,7 +327,7 @@ void HMPImporter::CreateMaterial(const unsigned char *szCurrent,
ReadFirstSkin(pcHeader->numskins, szCurrent, &szCurrent); ReadFirstSkin(pcHeader->numskins, szCurrent, &szCurrent);
*szCurrentOut = szCurrent; *szCurrentOut = szCurrent;
return; return;
} }
// generate a default material // generate a default material
const int iMode = (int)aiShadingMode_Gouraud; const int iMode = (int)aiShadingMode_Gouraud;
@ -484,11 +484,11 @@ void HMPImporter::GenerateTextureCoords(const unsigned int width, const unsigned
if (uv == nullptr) { if (uv == nullptr) {
return; return;
} }
if (height == 0.0f || width == 0.0) { if (height == 0.0f || width == 0.0) {
return; return;
} }
const float fY = (1.0f / height) + (1.0f / height) / height; const float fY = (1.0f / height) + (1.0f / height) / height;
const float fX = (1.0f / width) + (1.0f / width) / width; const float fX = (1.0f / width) + (1.0f / width) / width;

View File

@ -73,8 +73,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
template <> template <>
const char *LogFunctions<IFCImporter>::Prefix() { const char *LogFunctions<IFCImporter>::Prefix() {
static auto prefix = "IFC: "; return "IFC: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp

View File

@ -71,11 +71,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
IRRMeshImporter::IRRMeshImporter() : IRRMeshImporter::IRRMeshImporter() = default;
BaseImporter(),
IrrlichtBase() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well

View File

@ -63,9 +63,7 @@ protected:
// empty // empty
} }
~IrrlichtBase() { ~IrrlichtBase() = default;
// empty
}
/** @brief Data structure for a simple name-value property /** @brief Data structure for a simple name-value property
*/ */

View File

@ -165,7 +165,7 @@ void AnimResolver::UpdateAnimRangeSetup() {
if (delta == 0.0) { if (delta == 0.0) {
continue; continue;
} }
const size_t old_size = (*it).keys.size(); const size_t old_size = (*it).keys.size();
const float value_delta = (*it).keys.back().value - (*it).keys.front().value; const float value_delta = (*it).keys.back().value - (*it).keys.front().value;

View File

@ -215,7 +215,7 @@ void LWOImporter::InternReadFile(const std::string &pFile,
} else { } else {
mIsLWO2 = true; mIsLWO2 = true;
} }
LoadLWO2File(); LoadLWO2File();
// The newer lightwave format allows the user to configure the // The newer lightwave format allows the user to configure the

View File

@ -65,7 +65,7 @@ class M3DImporter : public BaseImporter {
public: public:
/// \brief Default constructor /// \brief Default constructor
M3DImporter(); M3DImporter();
~M3DImporter() override {} ~M3DImporter() override = default;
/// \brief Returns whether the class can handle the format of the given file. /// \brief Returns whether the class can handle the format of the given file.
/// \remark See BaseImporter::CanRead() for details. /// \remark See BaseImporter::CanRead() for details.

View File

@ -394,7 +394,7 @@ private:
bool SkipLine(const char* in, const char** out); bool SkipLine(const char* in, const char** out);
bool SkipLine( ); bool SkipLine( );
bool SkipSpacesAndLineEnd( const char* in, const char** out); bool SkipSpacesAndLineEnd( const char* in, const char** out);
bool SkipSpacesAndLineEnd(); bool SkipSpacesAndLineEnd();
bool SkipSpaces(); bool SkipSpaces();

View File

@ -470,7 +470,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
ASSIMP_LOG_ERROR("Found a reference to an embedded DDS texture, but texture width is zero, aborting import."); ASSIMP_LOG_ERROR("Found a reference to an embedded DDS texture, but texture width is zero, aborting import.");
return; return;
} }
pcNew.reset(new aiTexture); pcNew.reset(new aiTexture);
pcNew->mHeight = 0; pcNew->mHeight = 0;
pcNew->mWidth = iWidth; pcNew->mWidth = iWidth;

View File

@ -269,7 +269,7 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel,
dynamic_cast<pmx::PmxVertexSkinningSDEF *>(v->skinning.get()); dynamic_cast<pmx::PmxVertexSkinningSDEF *>(v->skinning.get());
switch (v->skinning_type) { switch (v->skinning_type) {
case pmx::PmxVertexSkinningType::BDEF1: case pmx::PmxVertexSkinningType::BDEF1:
bone_vertex_map[vsBDEF1_ptr->bone_index].emplace_back(index, 1.0); bone_vertex_map[vsBDEF1_ptr->bone_index].emplace_back(index, static_cast<ai_real>(1));
break; break;
case pmx::PmxVertexSkinningType::BDEF2: case pmx::PmxVertexSkinningType::BDEF2:
bone_vertex_map[vsBDEF2_ptr->bone_index1].emplace_back(index, vsBDEF2_ptr->bone_weight); bone_vertex_map[vsBDEF2_ptr->bone_index1].emplace_back(index, vsBDEF2_ptr->bone_weight);

View File

@ -107,7 +107,7 @@ private:
aiColor3D color, diffuse, specular, ambient, emissive; aiColor3D color, diffuse, specular, ambient, emissive;
ai_real refracti; ai_real refracti;
std::string texFile; std::string texFile;
bool twoSided; // For NFF2 bool twoSided; // For NFF2
bool shaded; bool shaded;
ai_real opacity, shininess; ai_real opacity, shininess;

View File

@ -514,16 +514,16 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString
DataArrayIt it = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd); DataArrayIt it = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
getFloat(it, m_DataItEnd, m_pModel->mCurrentMaterial->bump_multiplier); getFloat(it, m_DataItEnd, m_pModel->mCurrentMaterial->bump_multiplier);
skipToken = 2; skipToken = 2;
} else if (!ASSIMP_strincmp(pPtr, BlendUOption, static_cast<unsigned int>(strlen(BlendUOption))) || } else if (!ASSIMP_strincmp(pPtr, BlendUOption, static_cast<unsigned int>(strlen(BlendUOption))) ||
!ASSIMP_strincmp(pPtr, BlendVOption, static_cast<unsigned int>(strlen(BlendVOption))) || !ASSIMP_strincmp(pPtr, BlendVOption, static_cast<unsigned int>(strlen(BlendVOption))) ||
!ASSIMP_strincmp(pPtr, BoostOption, static_cast<unsigned int>(strlen(BoostOption))) || !ASSIMP_strincmp(pPtr, BoostOption, static_cast<unsigned int>(strlen(BoostOption))) ||
!ASSIMP_strincmp(pPtr, ResolutionOption, static_cast<unsigned int>(strlen(ResolutionOption))) || !ASSIMP_strincmp(pPtr, ResolutionOption, static_cast<unsigned int>(strlen(ResolutionOption))) ||
!ASSIMP_strincmp(pPtr, ChannelOption, static_cast<unsigned int>(strlen(ChannelOption)))) { !ASSIMP_strincmp(pPtr, ChannelOption, static_cast<unsigned int>(strlen(ChannelOption)))) {
skipToken = 2; skipToken = 2;
} else if (!ASSIMP_strincmp(pPtr, ModifyMapOption, static_cast<unsigned int>(strlen(ModifyMapOption)))) { } else if (!ASSIMP_strincmp(pPtr, ModifyMapOption, static_cast<unsigned int>(strlen(ModifyMapOption)))) {
skipToken = 3; skipToken = 3;
} else if (!ASSIMP_strincmp(pPtr, OffsetOption, static_cast<unsigned int>(strlen(OffsetOption))) || } else if (!ASSIMP_strincmp(pPtr, OffsetOption, static_cast<unsigned int>(strlen(OffsetOption))) ||
!ASSIMP_strincmp(pPtr, ScaleOption, static_cast<unsigned int>(strlen(ScaleOption))) || !ASSIMP_strincmp(pPtr, ScaleOption, static_cast<unsigned int>(strlen(ScaleOption))) ||
!ASSIMP_strincmp(pPtr, TurbulenceOption, static_cast<unsigned int>(strlen(TurbulenceOption)))) { !ASSIMP_strincmp(pPtr, TurbulenceOption, static_cast<unsigned int>(strlen(TurbulenceOption)))) {
skipToken = 4; skipToken = 4;
} }

View File

@ -458,7 +458,7 @@ void ObjFileParser::getFace(aiPrimitiveType type) {
//OBJ USES 1 Base ARRAYS!!!! //OBJ USES 1 Base ARRAYS!!!!
const char *token = &(*m_DataIt); const char *token = &(*m_DataIt);
const int iVal = ::atoi(token); const int iVal = ::atoi(token);
// increment iStep position based off of the sign and # of digits // increment iStep position based off of the sign and # of digits
int tmp = iVal; int tmp = iVal;
if (iVal < 0) { if (iVal < 0) {

View File

@ -51,7 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
/** /**
* @brief Returns true, if the last entry of the buffer is reached. * @brief Returns true, if the last entry of the buffer is reached.
* @param[in] it Iterator of current position. * @param[in] it Iterator of current position.
* @param[in] end Iterator with end of buffer. * @param[in] end Iterator with end of buffer.
@ -67,7 +67,7 @@ inline bool isEndOfBuffer(char_t it, char_t end) {
return (it == end); return (it == end);
} }
/** /**
* @brief Returns next word separated by a space * @brief Returns next word separated by a space
* @param[in] pBuffer Pointer to data buffer * @param[in] pBuffer Pointer to data buffer
* @param[in] pEnd Pointer to end of buffer * @param[in] pEnd Pointer to end of buffer
@ -85,7 +85,7 @@ inline Char_T getNextWord(Char_T pBuffer, Char_T pEnd) {
return pBuffer; return pBuffer;
} }
/** /**
* @brief Returns pointer a next token * @brief Returns pointer a next token
* @param[in] pBuffer Pointer to data buffer * @param[in] pBuffer Pointer to data buffer
* @param[in] pEnd Pointer to end of buffer * @param[in] pEnd Pointer to end of buffer
@ -102,7 +102,7 @@ inline Char_T getNextToken(Char_T pBuffer, Char_T pEnd) {
return getNextWord(pBuffer, pEnd); return getNextWord(pBuffer, pEnd);
} }
/** /**
* @brief Skips a line * @brief Skips a line
* @param[in] it Iterator set to current position * @param[in] it Iterator set to current position
* @param[in] end Iterator set to end of scratch buffer for readout * @param[in] end Iterator set to end of scratch buffer for readout
@ -131,7 +131,7 @@ inline char_t skipLine(char_t it, char_t end, unsigned int &uiLine) {
return it; return it;
} }
/** /**
* @brief Get a name from the current line. Preserve space in the middle, * @brief Get a name from the current line. Preserve space in the middle,
* but trim it at the end. * but trim it at the end.
* @param[in] it set to current position * @param[in] it set to current position
@ -162,13 +162,13 @@ inline char_t getName(char_t it, char_t end, std::string &name) {
std::string strName(pStart, &(*it)); std::string strName(pStart, &(*it));
if (!strName.empty()) { if (!strName.empty()) {
name = strName; name = strName;
} }
return it; return it;
} }
/** /**
* @brief Get a name from the current line. Do not preserve space * @brief Get a name from the current line. Do not preserve space
* in the middle, but trim it at the end. * in the middle, but trim it at the end.
* @param it set to current position * @param it set to current position
@ -202,11 +202,11 @@ inline char_t getNameNoSpace(char_t it, char_t end, std::string &name) {
if (!strName.empty()) { if (!strName.empty()) {
name = strName; name = strName;
} }
return it; return it;
} }
/** /**
* @brief Get next word from given line * @brief Get next word from given line
* @param[in] it set to current position * @param[in] it set to current position
* @param[in] end set to end of scratch buffer for readout * @param[in] end set to end of scratch buffer for readout
@ -230,7 +230,7 @@ inline char_t CopyNextWord(char_t it, char_t end, char *pBuffer, size_t length)
return it; return it;
} }
/** /**
* @brief Get next float from given line * @brief Get next float from given line
* @param[in] it set to current position * @param[in] it set to current position
* @param[in] end set to end of scratch buffer for readout * @param[in] end set to end of scratch buffer for readout

View File

@ -60,17 +60,17 @@ namespace Ogre {
class OgreImporter : public BaseImporter { class OgreImporter : public BaseImporter {
public: public:
/// BaseImporter override. /// BaseImporter override.
virtual bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override; bool CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const override;
protected: protected:
/// BaseImporter override. /// BaseImporter override.
virtual void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
/// BaseImporter override. /// BaseImporter override.
virtual const aiImporterDesc *GetInfo() const override; const aiImporterDesc *GetInfo() const override;
/// BaseImporter override. /// BaseImporter override.
virtual void SetupProperties(const Importer *pImp) override; void SetupProperties(const Importer *pImp) override;
private: private:
/// Read materials referenced by the @c mesh to @c pScene. /// Read materials referenced by the @c mesh to @c pScene.

View File

@ -261,7 +261,6 @@ OpenGEXImporter::RefInfo::RefInfo(aiNode *node, Type type, std::vector<std::stri
OpenGEXImporter::OpenGEXImporter() : OpenGEXImporter::OpenGEXImporter() :
m_root(nullptr), m_root(nullptr),
m_nodeChildMap(), m_nodeChildMap(),
m_meshCache(),
m_mesh2refMap(), m_mesh2refMap(),
m_material2refMap(), m_material2refMap(),
m_ctx(nullptr), m_ctx(nullptr),

View File

@ -296,9 +296,7 @@ class PropertyInstance
public: public:
//! Default constructor //! Default constructor
PropertyInstance() AI_NO_EXCEPT { PropertyInstance() AI_NO_EXCEPT = default;
// empty
}
union ValueUnion union ValueUnion
{ {
@ -359,10 +357,7 @@ public:
class ElementInstance { class ElementInstance {
public: public:
//! Default constructor //! Default constructor
ElementInstance() AI_NO_EXCEPT ElementInstance() AI_NO_EXCEPT = default;
: alProperties() {
// empty
}
//! List of all parsed properties //! List of all parsed properties
std::vector< PropertyInstance > alProperties; std::vector< PropertyInstance > alProperties;
@ -386,10 +381,7 @@ class ElementInstanceList
public: public:
//! Default constructor //! Default constructor
ElementInstanceList() AI_NO_EXCEPT ElementInstanceList() AI_NO_EXCEPT = default;
: alInstances() {
// empty
}
//! List of all element instances //! List of all element instances
std::vector< ElementInstance > alInstances; std::vector< ElementInstance > alInstances;
@ -413,11 +405,7 @@ class DOM
public: public:
//! Default constructor //! Default constructor
DOM() AI_NO_EXCEPT DOM() AI_NO_EXCEPT = default;
: alElements()
, alElementData() {
}
//! Contains all elements of the file format //! Contains all elements of the file format

View File

@ -169,19 +169,7 @@ struct Q3BSPModel {
std::vector<char> m_EntityData; std::vector<char> m_EntityData;
std::string m_ModelName; std::string m_ModelName;
Q3BSPModel() : Q3BSPModel() = default;
m_Data(),
m_Lumps(),
m_Vertices(),
m_Faces(),
m_Indices(),
m_Textures(),
m_Lightmaps(),
m_EntityData(),
m_ModelName()
{
// empty
}
~Q3BSPModel() { ~Q3BSPModel() {
for ( unsigned int i=0; i<m_Lumps.size(); i++ ) { for ( unsigned int i=0; i<m_Lumps.size(); i++ ) {

View File

@ -139,7 +139,7 @@ static void normalizePathName(const std::string &rPath, std::string &normalizedP
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor. // Constructor.
Q3BSPFileImporter::Q3BSPFileImporter() : Q3BSPFileImporter::Q3BSPFileImporter() :
m_pCurrentMesh(nullptr), m_pCurrentFace(nullptr), m_MaterialLookupMap(), mTextures() { m_pCurrentMesh(nullptr), m_pCurrentFace(nullptr) {
// empty // empty
} }

View File

@ -83,12 +83,11 @@ static const aiImporterDesc desc = {
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
SMDImporter::SMDImporter() : SMDImporter::SMDImporter() :
configFrameID(), configFrameID(),
mBuffer(),
pScene( nullptr ), pScene( nullptr ),
iFileSize( 0 ), iFileSize( 0 ),
iSmallestFrame( INT_MAX ), iSmallestFrame( INT_MAX ),
dLengthOfAnim( 0.0 ), dLengthOfAnim( 0.0 ),
bHasUVs(false ), bHasUVs(false ),
iLineNumber((unsigned int)-1) { iLineNumber((unsigned int)-1) {
// empty // empty
} }

View File

@ -87,10 +87,10 @@ struct Vertex {
*/ */
struct Face { struct Face {
Face() AI_NO_EXCEPT : Face() AI_NO_EXCEPT :
iTexture(0x0), avVertices{} { iTexture(0x0) {
// empty // empty
} }
//! Texture index for the face //! Texture index for the face
unsigned int iTexture; unsigned int iTexture;

View File

@ -121,7 +121,7 @@ namespace STEP {
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Exception class used by the STEP loading & parsing code. It is typically /** Exception class used by the STEP loading & parsing code. It is typically
* coupled with a line number. * coupled with a line number.
*/ */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct SyntaxError : DeadlyImportError { struct SyntaxError : DeadlyImportError {
@ -230,7 +230,7 @@ private:
}; };
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** Shared implementation for some of the primitive data type, i.e. int, float /** Shared implementation for some of the primitive data type, i.e. int, float
*/ */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
template <typename T> template <typename T>
@ -278,7 +278,7 @@ public:
typedef ENUMERATION BOOLEAN; typedef ENUMERATION BOOLEAN;
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/** This is just a reference to an entity/object somewhere else /** This is just a reference to an entity/object somewhere else
*/ */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class ENTITY : public PrimitiveDataType<uint64_t> { class ENTITY : public PrimitiveDataType<uint64_t> {
@ -302,7 +302,7 @@ public:
} }
public: public:
/** @see DaraType::Parse /** @see DaraType::Parse
*/ */
static std::shared_ptr<const EXPRESS::LIST> Parse(const char *&inout, static std::shared_ptr<const EXPRESS::LIST> Parse(const char *&inout,
uint64_t line = SyntaxError::LINE_NOT_SPECIFIED, uint64_t line = SyntaxError::LINE_NOT_SPECIFIED,
@ -322,7 +322,7 @@ public:
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
/* Not exactly a full EXPRESS schema but rather a list of conversion functions /* Not exactly a full EXPRESS schema but rather a list of conversion functions
* to extract valid C++ objects out of a STEP file. Those conversion functions * to extract valid C++ objects out of a STEP file. Those conversion functions
* may, however, perform further schema validations. * may, however, perform further schema validations.
*/ */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class ConversionSchema { class ConversionSchema {
@ -384,7 +384,7 @@ struct HeaderInfo {
}; };
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
/** Base class for all concrete object instances /** Base class for all concrete object instances
*/ */
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
class Object { class Object {
@ -511,7 +511,7 @@ private:
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
/** A LazyObject is created when needed. Before this happens, we just keep /** A LazyObject is created when needed. Before this happens, we just keep
* the text line that contains the object definition. * the text line that contains the object definition.
*/ */
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
class LazyObject { class LazyObject {

View File

@ -67,7 +67,6 @@ struct TexEntry {
bool mIsNormalMap; // true if the texname was specified in a NormalmapFilename tag bool mIsNormalMap; // true if the texname was specified in a NormalmapFilename tag
TexEntry() AI_NO_EXCEPT : TexEntry() AI_NO_EXCEPT :
mName(),
mIsNormalMap(false) { mIsNormalMap(false) {
// empty // empty
} }
@ -128,17 +127,8 @@ struct Mesh {
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
: mName(pName), : mName(pName),
mPositions(),
mPosFaces(),
mNormals(),
mNormFaces(),
mNumTextures(0), mNumTextures(0),
mTexCoords{}, mNumColorSets(0) {
mNumColorSets(0),
mColors{},
mFaceMaterials(),
mMaterials(),
mBones() {
// empty // empty
} }
}; };
@ -152,15 +142,12 @@ struct Node {
std::vector<Mesh *> mMeshes; std::vector<Mesh *> mMeshes;
Node() AI_NO_EXCEPT Node() AI_NO_EXCEPT
: mName(), : mTrafoMatrix(),
mTrafoMatrix(), mParent(nullptr) {
mParent(nullptr),
mChildren(),
mMeshes() {
// empty // empty
} }
explicit Node(Node *pParent) : explicit Node(Node *pParent) :
mName(), mTrafoMatrix(), mParent(pParent), mChildren(), mMeshes() { mTrafoMatrix(), mParent(pParent) {
// empty // empty
} }
@ -211,8 +198,6 @@ struct Scene {
Scene() AI_NO_EXCEPT Scene() AI_NO_EXCEPT
: mRootNode(nullptr), : mRootNode(nullptr),
mGlobalMeshes(),
mGlobalMaterials(),
mAnimTicksPerSecond(0) { mAnimTicksPerSecond(0) {
// empty // empty
} }

View File

@ -75,9 +75,7 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
XFileImporter::XFileImporter() : mBuffer() { XFileImporter::XFileImporter() = default;
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file. // Returns whether the class can handle the format of the given file.

View File

@ -183,7 +183,7 @@ XFileParser::XFileParser(const std::vector<char> &pBuffer) :
P1 += ofs; P1 += ofs;
est_out += MSZIP_BLOCK; // one decompressed block is 327861 in size est_out += MSZIP_BLOCK; // one decompressed block is 327861 in size
} }
// Allocate storage and terminating zero and do the actual uncompressing // Allocate storage and terminating zero and do the actual uncompressing
Compression compression; Compression compression;
uncompressed.resize(est_out + 1); uncompressed.resize(est_out + 1);

View File

@ -52,22 +52,14 @@ class X3DExporter {
struct SAttribute { struct SAttribute {
const std::string Name; const std::string Name;
const std::string Value; const std::string Value;
SAttribute() : SAttribute() = default;
Name(),
Value() {
// empty
}
SAttribute(const std::string &name, const std::string &value) : SAttribute(const std::string &name, const std::string &value) :
Name(name), Name(name),
Value(value) { Value(value) {
// empty // empty
} }
SAttribute(SAttribute &&rhs) AI_NO_EXCEPT : SAttribute(SAttribute &&rhs) AI_NO_EXCEPT = default;
Name(rhs.Name),
Value(rhs.Value) {
// empty
}
}; };
/***********************************************/ /***********************************************/

View File

@ -193,7 +193,7 @@ void X3DGeoHelper::add_color(aiMesh &pMesh, const std::list<aiColor3D> &pColors,
// create RGBA array from RGB. // create RGBA array from RGB.
for (std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); ++it) for (std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); ++it)
tcol.emplace_back((*it).r, (*it).g, (*it).b, 1); tcol.emplace_back((*it).r, (*it).g, (*it).b, static_cast<ai_real>(1));
// call existing function for adding RGBA colors // call existing function for adding RGBA colors
add_color(pMesh, tcol, pColorPerVertex); add_color(pMesh, tcol, pColorPerVertex);
@ -238,7 +238,7 @@ void X3DGeoHelper::add_color(aiMesh &pMesh, const std::vector<int32_t> &pCoordId
// create RGBA array from RGB. // create RGBA array from RGB.
for (std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); ++it) { for (std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); ++it) {
tcol.emplace_back((*it).r, (*it).g, (*it).b, 1); tcol.emplace_back((*it).r, (*it).g, (*it).b, static_cast<ai_real>(1));
} }
// call existing function for adding RGBA colors // call existing function for adding RGBA colors
@ -440,7 +440,7 @@ void X3DGeoHelper::add_tex_coord(aiMesh &pMesh, const std::vector<int32_t> &pCoo
// copy list to array because we are need indexed access to normals. // copy list to array because we are need indexed access to normals.
texcoord_arr_copy.reserve(pTexCoords.size()); texcoord_arr_copy.reserve(pTexCoords.size());
for (std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); ++it) { for (std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); ++it) {
texcoord_arr_copy.emplace_back((*it).x, (*it).y, 0); texcoord_arr_copy.emplace_back((*it).x, (*it).y, static_cast<ai_real>(0));
} }
if (pTexCoordIdx.size() > 0) { if (pTexCoordIdx.size() > 0) {
@ -480,7 +480,7 @@ void X3DGeoHelper::add_tex_coord(aiMesh &pMesh, const std::list<aiVector2D> &pTe
// copy list to array because we are need convert aiVector2D to aiVector3D and also get indexed access as a bonus. // copy list to array because we are need convert aiVector2D to aiVector3D and also get indexed access as a bonus.
tc_arr_copy.reserve(pTexCoords.size()); tc_arr_copy.reserve(pTexCoords.size());
for (std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); ++it) { for (std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); ++it) {
tc_arr_copy.emplace_back((*it).x, (*it).y, 0); tc_arr_copy.emplace_back((*it).x, (*it).y, static_cast<ai_real>(0));
} }
// copy texture coordinates to mesh // copy texture coordinates to mesh

View File

@ -471,7 +471,7 @@ void X3DImporter::ParseHelper_Node_Enter(X3DNodeElementBase *pNode) {
mNodeElementCur->Children.push_back(pNode); // add new element to current element child list. mNodeElementCur->Children.push_back(pNode); // add new element to current element child list.
mNodeElementCur = pNode; // switch current element to new one. mNodeElementCur = pNode; // switch current element to new one.
} }
void X3DImporter::ParseHelper_Node_Exit() { void X3DImporter::ParseHelper_Node_Exit() {
// check if we can walk up. // check if we can walk up.

View File

@ -151,7 +151,7 @@ void X3DImporter::readArcClose2D(XmlNode &node) {
std::list<aiVector3D> &vlist = ((X3DNodeElementGeometry2D *)ne)->Vertices; // just short alias. std::list<aiVector3D> &vlist = ((X3DNodeElementGeometry2D *)ne)->Vertices; // just short alias.
if ((closureType == "PIE") || (closureType == "\"PIE\"")) if ((closureType == "PIE") || (closureType == "\"PIE\""))
vlist.emplace_back(0, 0, 0); // center point - first radial line vlist.emplace_back(static_cast<ai_real>(0), static_cast<ai_real>(0), static_cast<ai_real>(0)); // center point - first radial line
else if ((closureType != "CHORD") && (closureType != "\"CHORD\"")) else if ((closureType != "CHORD") && (closureType != "\"CHORD\""))
Throw_IncorrectAttrValue("ArcClose2D", "closureType"); Throw_IncorrectAttrValue("ArcClose2D", "closureType");
@ -263,7 +263,7 @@ void X3DImporter::readDisk2D(XmlNode &node) {
// //
if (tlist_i.size() < 2) { if (tlist_i.size() < 2) {
// tlist_i and tlist_o has equal size. // tlist_i and tlist_o has equal size.
throw DeadlyImportError("Disk2D. Not enough points for creating quad list."); throw DeadlyImportError("Disk2D. Not enough points for creating quad list.");
} }
// add all quads except last // add all quads except last
@ -323,7 +323,7 @@ void X3DImporter::readPolyline2D(XmlNode &node) {
// convert vec2 to vec3 // convert vec2 to vec3
for (std::list<aiVector2D>::iterator it2 = lineSegments.begin(); it2 != lineSegments.end(); ++it2) for (std::list<aiVector2D>::iterator it2 = lineSegments.begin(); it2 != lineSegments.end(); ++it2)
tlist.emplace_back(it2->x, it2->y, 0); tlist.emplace_back(it2->x, it2->y, static_cast<ai_real>(0));
// convert point set to line set // convert point set to line set
X3DGeoHelper::extend_point_to_line(tlist, ((X3DNodeElementGeometry2D *)ne)->Vertices); X3DGeoHelper::extend_point_to_line(tlist, ((X3DNodeElementGeometry2D *)ne)->Vertices);
@ -361,7 +361,7 @@ void X3DImporter::readPolypoint2D(XmlNode &node) {
// convert vec2 to vec3 // convert vec2 to vec3
for (std::list<aiVector2D>::iterator it2 = point.begin(); it2 != point.end(); ++it2) { for (std::list<aiVector2D>::iterator it2 = point.begin(); it2 != point.end(); ++it2) {
((X3DNodeElementGeometry2D *)ne)->Vertices.emplace_back(it2->x, it2->y, 0); ((X3DNodeElementGeometry2D *)ne)->Vertices.emplace_back(it2->x, it2->y, static_cast<ai_real>(0));
} }
((X3DNodeElementGeometry2D *)ne)->NumIndices = 1; ((X3DNodeElementGeometry2D *)ne)->NumIndices = 1;
@ -405,10 +405,10 @@ void X3DImporter::readRectangle2D(XmlNode &node) {
float y2 = size.y / 2.0f; float y2 = size.y / 2.0f;
std::list<aiVector3D> &vlist = ((X3DNodeElementGeometry2D *)ne)->Vertices; // just short alias. std::list<aiVector3D> &vlist = ((X3DNodeElementGeometry2D *)ne)->Vertices; // just short alias.
vlist.emplace_back(x2, y1, 0); // 1st point vlist.emplace_back(x2, y1, static_cast<ai_real>(0)); // 1st point
vlist.emplace_back(x2, y2, 0); // 2nd point vlist.emplace_back(x2, y2, static_cast<ai_real>(0)); // 2nd point
vlist.emplace_back(x1, y2, 0); // 3rd point vlist.emplace_back(x1, y2, static_cast<ai_real>(0)); // 3rd point
vlist.emplace_back(x1, y1, 0); // 4th point vlist.emplace_back(x1, y1, static_cast<ai_real>(0)); // 4th point
((X3DNodeElementGeometry2D *)ne)->Solid = solid; ((X3DNodeElementGeometry2D *)ne)->Solid = solid;
((X3DNodeElementGeometry2D *)ne)->NumIndices = 4; ((X3DNodeElementGeometry2D *)ne)->NumIndices = 4;
// check for X3DMetadataObject childs. // check for X3DMetadataObject childs.
@ -449,7 +449,7 @@ void X3DImporter::readTriangleSet2D(XmlNode &node) {
// convert vec2 to vec3 // convert vec2 to vec3
for (std::list<aiVector2D>::iterator it2 = vertices.begin(); it2 != vertices.end(); ++it2) { for (std::list<aiVector2D>::iterator it2 = vertices.begin(); it2 != vertices.end(); ++it2) {
((X3DNodeElementGeometry2D *)ne)->Vertices.emplace_back(it2->x, it2->y, 0); ((X3DNodeElementGeometry2D *)ne)->Vertices.emplace_back(it2->x, it2->y, static_cast<ai_real>(0));
} }
((X3DNodeElementGeometry2D *)ne)->Solid = solid; ((X3DNodeElementGeometry2D *)ne)->Solid = solid;

View File

@ -108,9 +108,7 @@ struct X3DNodeElementBase {
std::list<X3DNodeElementBase *> Children; std::list<X3DNodeElementBase *> Children;
X3DElemType Type; X3DElemType Type;
virtual ~X3DNodeElementBase() { virtual ~X3DNodeElementBase() = default;
// empty
}
protected: protected:
X3DNodeElementBase(X3DElemType type, X3DNodeElementBase *pParent) : X3DNodeElementBase(X3DElemType type, X3DNodeElementBase *pParent) :
@ -367,9 +365,7 @@ struct X3DNodeElementMeta : X3DNodeElementBase {
std::string Name; ///< Name of metadata object. std::string Name; ///< Name of metadata object.
std::string Reference; std::string Reference;
virtual ~X3DNodeElementMeta() { virtual ~X3DNodeElementMeta() = default;
// empty
}
protected: protected:
X3DNodeElementMeta(X3DElemType type, X3DNodeElementBase *parent) : X3DNodeElementMeta(X3DElemType type, X3DNodeElementBase *parent) :

View File

@ -65,8 +65,7 @@ namespace Assimp { // this has to be in here because LogFunctions is in ::Assimp
template <> template <>
const char *LogFunctions<XGLImporter>::Prefix() { const char *LogFunctions<XGLImporter>::Prefix() {
static auto prefix = "XGL: "; return "XGL: ";
return prefix;
} }
} // namespace Assimp } // namespace Assimp

View File

@ -260,7 +260,7 @@ public:
VEC4, VEC4,
MAT2, MAT2,
MAT3, MAT3,
MAT4 MAT4
}; };
inline static Value FromString(const char *str) { inline static Value FromString(const char *str) {
@ -288,8 +288,8 @@ private:
}; };
template <int N> template <int N>
struct data { struct data {
static const Info infos[NUM_VALUES]; static const Info infos[NUM_VALUES];
}; };
}; };
@ -297,11 +297,11 @@ private:
template <int N> template <int N>
const AttribType::Info AttribType::data<N>::infos[AttribType::NUM_VALUES] = { const AttribType::Info AttribType::data<N>::infos[AttribType::NUM_VALUES] = {
{ "SCALAR", 1 }, { "SCALAR", 1 },
{ "VEC2", 2 }, { "VEC2", 2 },
{ "VEC3", 3 }, { "VEC3", 3 },
{ "VEC4", 4 }, { "VEC4", 4 },
{ "MAT2", 4 }, { "MAT2", 4 },
{ "MAT3", 9 }, { "MAT3", 9 },
{ "MAT4", 16 } { "MAT4", 16 }
}; };
@ -629,9 +629,7 @@ struct Mesh : public Object {
SExtension(const EType pType) : SExtension(const EType pType) :
Type(pType) {} Type(pType) {}
virtual ~SExtension() { virtual ~SExtension() = default;
// empty
}
}; };
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC #ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
@ -657,9 +655,7 @@ struct Mesh : public Object {
// empty // empty
} }
virtual ~SCompression_Open3DGC() { virtual ~SCompression_Open3DGC() = default;
// empty
}
}; };
#endif #endif

View File

@ -322,7 +322,7 @@ void glTFExporter::GetTexSampler(const aiMaterial* mat, glTF::TexProperty& prop)
prop.texture->sampler->minFilter = SamplerMinFilter_Linear; prop.texture->sampler->minFilter = SamplerMinFilter_Linear;
} }
void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop, void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& prop,
const char* propName, int type, int idx, aiTextureType tt) { const char* propName, int type, int idx, aiTextureType tt) {
aiString tex; aiString tex;
aiColor4D col; aiColor4D col;
@ -370,9 +370,9 @@ void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& pr
} }
if (mat->Get(propName, type, idx, col) == AI_SUCCESS) { if (mat->Get(propName, type, idx, col) == AI_SUCCESS) {
prop.color[0] = col.r; prop.color[0] = col.r;
prop.color[1] = col.g; prop.color[1] = col.g;
prop.color[2] = col.b; prop.color[2] = col.b;
prop.color[3] = col.a; prop.color[3] = col.a;
} }
} }

View File

@ -80,7 +80,7 @@ static const aiImporterDesc desc = {
}; };
glTFImporter::glTFImporter() : glTFImporter::glTFImporter() :
BaseImporter(), meshOffsets(), embeddedTexIdxs(), mScene(nullptr) { mScene(nullptr) {
// empty // empty
} }

View File

@ -365,16 +365,7 @@ struct CustomExtension {
~CustomExtension() = default; ~CustomExtension() = default;
CustomExtension(const CustomExtension &other) : CustomExtension(const CustomExtension &other) = default;
name(other.name),
mStringValue(other.mStringValue),
mDoubleValue(other.mDoubleValue),
mUint64Value(other.mUint64Value),
mInt64Value(other.mInt64Value),
mBoolValue(other.mBoolValue),
mValues(other.mValues) {
// empty
}
CustomExtension& operator=(const CustomExtension&) = default; CustomExtension& operator=(const CustomExtension&) = default;
}; };
@ -1086,8 +1077,7 @@ struct AssetMetadata {
void Read(Document &doc); void Read(Document &doc);
AssetMetadata() : AssetMetadata() = default;
version() {}
}; };
// //
@ -1123,13 +1113,13 @@ public:
bool KHR_texture_basisu; bool KHR_texture_basisu;
Extensions() : Extensions() :
KHR_materials_pbrSpecularGlossiness(false), KHR_materials_pbrSpecularGlossiness(false),
KHR_materials_unlit(false), KHR_materials_unlit(false),
KHR_lights_punctual(false), KHR_lights_punctual(false),
KHR_texture_transform(false), KHR_texture_transform(false),
KHR_materials_sheen(false), KHR_materials_sheen(false),
KHR_materials_clearcoat(false), KHR_materials_clearcoat(false),
KHR_materials_transmission(false), KHR_materials_transmission(false),
KHR_materials_volume(false), KHR_materials_volume(false),
KHR_materials_ior(false), KHR_materials_ior(false),
KHR_materials_emissive_strength(false), KHR_materials_emissive_strength(false),

View File

@ -1903,7 +1903,7 @@ inline void Asset::Load(const std::string &pFile, bool isBinary)
std::vector<char> sceneData; std::vector<char> sceneData;
rapidjson::Document doc = ReadDocument(*stream, isBinary, sceneData); rapidjson::Document doc = ReadDocument(*stream, isBinary, sceneData);
// If a schemaDocumentProvider is available, see if the glTF schema is present. // If a schemaDocumentProvider is available, see if the glTF schema is present.
// If so, use it to validate the document. // If so, use it to validate the document.
if (mSchemaDocumentProvider) { if (mSchemaDocumentProvider) {
if (const rapidjson::SchemaDocument *gltfSchema = mSchemaDocumentProvider->GetRemoteDocument("glTF.schema.json", 16)) { if (const rapidjson::SchemaDocument *gltfSchema = mSchemaDocumentProvider->GetRemoteDocument("glTF.schema.json", 16)) {

View File

@ -516,7 +516,7 @@ void glTF2Exporter::GetMatTex(const aiMaterial &mat, Ref<Texture> &texture, unsi
if (mat.GetTextureCount(tt) == 0) { if (mat.GetTextureCount(tt) == 0) {
return; return;
} }
aiString tex; aiString tex;
// Read texcoord (UV map index) // Read texcoord (UV map index)
@ -855,13 +855,13 @@ void glTF2Exporter::ExportMaterials() {
mAsset->extensionsUsed.KHR_materials_transmission = true; mAsset->extensionsUsed.KHR_materials_transmission = true;
m->materialTransmission = Nullable<MaterialTransmission>(transmission); m->materialTransmission = Nullable<MaterialTransmission>(transmission);
} }
MaterialVolume volume; MaterialVolume volume;
if (GetMatVolume(mat, volume)) { if (GetMatVolume(mat, volume)) {
mAsset->extensionsUsed.KHR_materials_volume = true; mAsset->extensionsUsed.KHR_materials_volume = true;
m->materialVolume = Nullable<MaterialVolume>(volume); m->materialVolume = Nullable<MaterialVolume>(volume);
} }
MaterialIOR ior; MaterialIOR ior;
if (GetMatIOR(mat, ior)) { if (GetMatIOR(mat, ior)) {
mAsset->extensionsUsed.KHR_materials_ior = true; mAsset->extensionsUsed.KHR_materials_ior = true;
@ -921,7 +921,7 @@ Ref<Node> FindSkeletonRootJoint(Ref<Skin> &skinRef) {
return parentNodeRef; return parentNodeRef;
} }
void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref<Mesh> &meshRef, Ref<Buffer> &bufferRef, Ref<Skin> &skinRef, void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref<Mesh> &meshRef, Ref<Buffer> &bufferRef, Ref<Skin> &skinRef,
std::vector<aiMatrix4x4> &inverseBindMatricesData) { std::vector<aiMatrix4x4> &inverseBindMatricesData) {
if (aimesh->mNumBones < 1) { if (aimesh->mNumBones < 1) {
return; return;
@ -985,14 +985,14 @@ void ExportSkin(Asset &mAsset, const aiMesh *aimesh, Ref<Mesh> &meshRef, Ref<Buf
vertexJointData[vertexId][jointsPerVertex[vertexId]] = static_cast<float>(jointNamesIndex); vertexJointData[vertexId][jointsPerVertex[vertexId]] = static_cast<float>(jointNamesIndex);
vertexWeightData[vertexId][jointsPerVertex[vertexId]] = vertWeight; vertexWeightData[vertexId][jointsPerVertex[vertexId]] = vertWeight;
jointsPerVertex[vertexId] += 1; jointsPerVertex[vertexId] += 1;
} }
} }
} // End: for-loop mNumMeshes } // End: for-loop mNumMeshes
Mesh::Primitive &p = meshRef->primitives.back(); Mesh::Primitive &p = meshRef->primitives.back();
Ref<Accessor> vertexJointAccessor = ExportData(mAsset, skinRef->id, bufferRef, aimesh->mNumVertices, Ref<Accessor> vertexJointAccessor = ExportData(mAsset, skinRef->id, bufferRef, aimesh->mNumVertices,
vertexJointData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT); vertexJointData, AttribType::VEC4, AttribType::VEC4, ComponentType_FLOAT);
if (vertexJointAccessor) { if (vertexJointAccessor) {
size_t offset = vertexJointAccessor->bufferView->byteOffset; size_t offset = vertexJointAccessor->bufferView->byteOffset;
@ -1090,7 +1090,7 @@ void glTF2Exporter::ExportMeshes() {
} }
} }
Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3, Ref<Accessor> n = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mNormals, AttribType::VEC3,
AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); AttribType::VEC3, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER);
if (n) { if (n) {
p.attributes.normal.push_back(n); p.attributes.normal.push_back(n);
@ -1112,7 +1112,7 @@ void glTF2Exporter::ExportMeshes() {
if (aim->mNumUVComponents[i] > 0) { if (aim->mNumUVComponents[i] > 0) {
AttribType::Value type = (aim->mNumUVComponents[i] == 2) ? AttribType::VEC2 : AttribType::VEC3; AttribType::Value type = (aim->mNumUVComponents[i] == 2) ? AttribType::VEC2 : AttribType::VEC3;
Ref<Accessor> tc = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mTextureCoords[i], Ref<Accessor> tc = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mTextureCoords[i],
AttribType::VEC3, type, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER); AttribType::VEC3, type, ComponentType_FLOAT, BufferViewTarget_ARRAY_BUFFER);
if (tc) { if (tc) {
p.attributes.texcoord.push_back(tc); p.attributes.texcoord.push_back(tc);
@ -1140,7 +1140,7 @@ void glTF2Exporter::ExportMeshes() {
} }
} }
p.indices = ExportData(*mAsset, meshId, b, indices.size(), &indices[0], AttribType::SCALAR, AttribType::SCALAR, p.indices = ExportData(*mAsset, meshId, b, indices.size(), &indices[0], AttribType::SCALAR, AttribType::SCALAR,
ComponentType_UNSIGNED_INT, BufferViewTarget_ELEMENT_ARRAY_BUFFER); ComponentType_UNSIGNED_INT, BufferViewTarget_ELEMENT_ARRAY_BUFFER);
} }

View File

@ -96,9 +96,6 @@ static const aiImporterDesc desc = {
}; };
glTF2Importer::glTF2Importer() : glTF2Importer::glTF2Importer() :
BaseImporter(),
meshOffsets(),
mEmbeddedTexIdxs(),
mScene(nullptr) { mScene(nullptr) {
// empty // empty
} }
@ -185,7 +182,6 @@ static void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
const ai_real rsin(sin(-transform.mRotation)); const ai_real rsin(sin(-transform.mRotation));
transform.mTranslation.x = (static_cast<ai_real>(0.5) * transform.mScaling.x) * (-rcos + rsin + 1) + prop.TextureTransformExt_t.offset[0]; transform.mTranslation.x = (static_cast<ai_real>(0.5) * transform.mScaling.x) * (-rcos + rsin + 1) + prop.TextureTransformExt_t.offset[0];
transform.mTranslation.y = ((static_cast<ai_real>(0.5) * transform.mScaling.y) * (rsin + rcos - 1)) + 1 - transform.mScaling.y - prop.TextureTransformExt_t.offset[1]; transform.mTranslation.y = ((static_cast<ai_real>(0.5) * transform.mScaling.y) * (rsin + rcos - 1)) + 1 - transform.mScaling.y - prop.TextureTransformExt_t.offset[1];
;
mat->AddProperty(&transform, 1, _AI_MATKEY_UVTRANSFORM_BASE, texType, texSlot); mat->AddProperty(&transform, 1, _AI_MATKEY_UVTRANSFORM_BASE, texType, texSlot);
} }
@ -853,7 +849,7 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) {
if (cam.type == Camera::Perspective) { if (cam.type == Camera::Perspective) {
aicam->mAspect = cam.cameraProperties.perspective.aspectRatio; aicam->mAspect = cam.cameraProperties.perspective.aspectRatio;
aicam->mHorizontalFOV = cam.cameraProperties.perspective.yfov * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect); aicam->mHorizontalFOV = 2.0f * std::atan(std::tan(cam.cameraProperties.perspective.yfov * 0.5f) * ((aicam->mAspect == 0.f) ? 1.f : aicam->mAspect));
aicam->mClipPlaneFar = cam.cameraProperties.perspective.zfar; aicam->mClipPlaneFar = cam.cameraProperties.perspective.zfar;
aicam->mClipPlaneNear = cam.cameraProperties.perspective.znear; aicam->mClipPlaneNear = cam.cameraProperties.perspective.znear;
} else { } else {

View File

@ -65,7 +65,7 @@ public:
protected: protected:
const aiImporterDesc *GetInfo() const override; const aiImporterDesc *GetInfo() const override;
void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override; void InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler) override;
virtual void SetupProperties(const Importer *pImp) override; void SetupProperties(const Importer *pImp) override;
private: private:
void ImportEmbeddedTextures(glTF2::Asset &a); void ImportEmbeddedTextures(glTF2::Asset &a);

View File

@ -247,7 +247,7 @@ void BaseImporter::GetExtensionList(std::set<std::string> &extensions) {
} }
if (ext2 && !ASSIMP_stricmp(ext_real, ext2)) { if (ext2 && !ASSIMP_stricmp(ext_real, ext2)) {
return true; return true;
} }
return false; return false;

View File

@ -93,9 +93,7 @@ public:
} }
/** Destructor. */ /** Destructor. */
~FileSystemFilter() { ~FileSystemFilter() = default;
// empty
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Tests for the existence of a file at the given path. */ /** Tests for the existence of a file at the given path. */

View File

@ -1118,7 +1118,7 @@ bool Importer::SetPropertyMatrix(const char* szName, const aiMatrix4x4& value) {
// Set a configuration property // Set a configuration property
bool Importer::SetPropertyPointer(const char* szName, void* value) { bool Importer::SetPropertyPointer(const char* szName, void* value) {
ai_assert(nullptr != pimpl); ai_assert(nullptr != pimpl);
bool existing; bool existing;
ASSIMP_BEGIN_EXCEPTION_REGION(); ASSIMP_BEGIN_EXCEPTION_REGION();
existing = SetGenericProperty<void*>(pimpl->mPointerProperties, szName,value); existing = SetGenericProperty<void*>(pimpl->mPointerProperties, szName,value);
@ -1162,7 +1162,7 @@ aiMatrix4x4 Importer::GetPropertyMatrix(const char* szName, const aiMatrix4x4& i
// Get a configuration property // Get a configuration property
void* Importer::GetPropertyPointer(const char* szName, void* iErrorReturn /*= nullptr*/) const { void* Importer::GetPropertyPointer(const char* szName, void* iErrorReturn /*= nullptr*/) const {
ai_assert(nullptr != pimpl); ai_assert(nullptr != pimpl);
return GetGenericProperty<void*>(pimpl->mPointerProperties,szName,iErrorReturn); return GetGenericProperty<void*>(pimpl->mPointerProperties,szName,iErrorReturn);
} }

View File

@ -88,7 +88,7 @@ inline bool PointInTriangle2D(const T& p0, const T& p1,const T& p2, const T& pp)
if (denom == 0.0) { if (denom == 0.0) {
return false; return false;
} }
const double invDenom = 1.0 / denom; const double invDenom = 1.0 / denom;
dot11 = (dot11 * dot02 - dot01 * dot12) * invDenom; dot11 = (dot11 * dot02 - dot01 * dot12) * invDenom;
dot00 = (dot00 * dot12 - dot01 * dot02) * invDenom; dot00 = (dot00 * dot12 - dot01 * dot02) * invDenom;

View File

@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- ----------------------------------------------------------------------
*/ */
/** /**
* @file RemoveComments.cpp * @file RemoveComments.cpp
* @brief Defines the CommentRemover utility class * @brief Defines the CommentRemover utility class
*/ */

View File

@ -106,7 +106,7 @@ void ScenePreprocessor::ProcessMesh(aiMesh *mesh) {
if (!mesh->mTextureCoords[i]) { if (!mesh->mTextureCoords[i]) {
mesh->mNumUVComponents[i] = 0; mesh->mNumUVComponents[i] = 0;
continue; continue;
} }
if (!mesh->mNumUVComponents[i]) { if (!mesh->mNumUVComponents[i]) {
mesh->mNumUVComponents[i] = 2; mesh->mNumUVComponents[i] = 2;

View File

@ -94,7 +94,7 @@ ai_real SpatialSort::CalculateDistance(const aiVector3D &pPosition) const {
void SpatialSort::Finalize() { void SpatialSort::Finalize() {
const ai_real scale = 1.0f / mPositions.size(); const ai_real scale = 1.0f / mPositions.size();
for (unsigned int i = 0; i < mPositions.size(); i++) { for (unsigned int i = 0; i < mPositions.size(); i++) {
mCentroid += scale * mPositions[i].mPosition; mCentroid += scale * mPositions[i].mPosition;
} }
for (unsigned int i = 0; i < mPositions.size(); i++) { for (unsigned int i = 0; i < mPositions.size(); i++) {
mPositions[i].mDistance = CalculateDistance(mPositions[i].mPosition); mPositions[i].mDistance = CalculateDistance(mPositions[i].mPosition);

View File

@ -185,6 +185,6 @@ ASSIMP_API aiScene::~aiScene() {
aiMetadata::Dealloc(mMetaData); aiMetadata::Dealloc(mMetaData);
delete[] mSkeletons; delete[] mSkeletons;
delete static_cast<Assimp::ScenePrivateData *>(mPrivate); delete static_cast<Assimp::ScenePrivateData *>(mPrivate);
} }

View File

@ -67,6 +67,7 @@ GenFaceNormalsProcess::~GenFaceNormalsProcess() = default;
bool GenFaceNormalsProcess::IsActive(unsigned int pFlags) const { bool GenFaceNormalsProcess::IsActive(unsigned int pFlags) const {
force_ = (pFlags & aiProcess_ForceGenNormals) != 0; force_ = (pFlags & aiProcess_ForceGenNormals) != 0;
flippedWindingOrder_ = (pFlags & aiProcess_FlipWindingOrder) != 0; flippedWindingOrder_ = (pFlags & aiProcess_FlipWindingOrder) != 0;
leftHanded_ = (pFlags & aiProcess_MakeLeftHanded) != 0;
return (pFlags & aiProcess_GenNormals) != 0; return (pFlags & aiProcess_GenNormals) != 0;
} }
@ -131,8 +132,10 @@ bool GenFaceNormalsProcess::GenMeshFaceNormals(aiMesh *pMesh) {
const aiVector3D *pV1 = &pMesh->mVertices[face.mIndices[0]]; const aiVector3D *pV1 = &pMesh->mVertices[face.mIndices[0]];
const aiVector3D *pV2 = &pMesh->mVertices[face.mIndices[1]]; const aiVector3D *pV2 = &pMesh->mVertices[face.mIndices[1]];
const aiVector3D *pV3 = &pMesh->mVertices[face.mIndices[face.mNumIndices - 1]]; const aiVector3D *pV3 = &pMesh->mVertices[face.mIndices[face.mNumIndices - 1]];
if (flippedWindingOrder_) // Boolean XOR - if either but not both of these flags is set, then the winding order has
std::swap( pV2, pV3 ); // changed and the cross product to calculate the normal needs to be reversed
if (flippedWindingOrder_ != leftHanded_)
std::swap(pV2, pV3);
const aiVector3D vNor = ((*pV2 - *pV1) ^ (*pV3 - *pV1)).NormalizeSafe(); const aiVector3D vNor = ((*pV2 - *pV1) ^ (*pV3 - *pV1)).NormalizeSafe();
for (unsigned int i = 0; i < face.mNumIndices; ++i) { for (unsigned int i = 0; i < face.mNumIndices; ++i) {

View File

@ -81,6 +81,7 @@ private:
bool GenMeshFaceNormals(aiMesh* pcMesh); bool GenMeshFaceNormals(aiMesh* pcMesh);
mutable bool force_ = false; mutable bool force_ = false;
mutable bool flippedWindingOrder_ = false; mutable bool flippedWindingOrder_ = false;
mutable bool leftHanded_ = false;
}; };
} // end of namespace Assimp } // end of namespace Assimp

View File

@ -69,6 +69,7 @@ GenVertexNormalsProcess::~GenVertexNormalsProcess() = default;
bool GenVertexNormalsProcess::IsActive(unsigned int pFlags) const { bool GenVertexNormalsProcess::IsActive(unsigned int pFlags) const {
force_ = (pFlags & aiProcess_ForceGenNormals) != 0; force_ = (pFlags & aiProcess_ForceGenNormals) != 0;
flippedWindingOrder_ = (pFlags & aiProcess_FlipWindingOrder) != 0; flippedWindingOrder_ = (pFlags & aiProcess_FlipWindingOrder) != 0;
leftHanded_ = (pFlags & aiProcess_MakeLeftHanded) != 0;
return (pFlags & aiProcess_GenSmoothNormals) != 0; return (pFlags & aiProcess_GenSmoothNormals) != 0;
} }
@ -141,8 +142,10 @@ bool GenVertexNormalsProcess::GenMeshVertexNormals(aiMesh *pMesh, unsigned int m
const aiVector3D *pV1 = &pMesh->mVertices[face.mIndices[0]]; const aiVector3D *pV1 = &pMesh->mVertices[face.mIndices[0]];
const aiVector3D *pV2 = &pMesh->mVertices[face.mIndices[1]]; const aiVector3D *pV2 = &pMesh->mVertices[face.mIndices[1]];
const aiVector3D *pV3 = &pMesh->mVertices[face.mIndices[face.mNumIndices - 1]]; const aiVector3D *pV3 = &pMesh->mVertices[face.mIndices[face.mNumIndices - 1]];
if (flippedWindingOrder_) // Boolean XOR - if either but not both of these flags is set, then the winding order has
std::swap( pV2, pV3 ); // changed and the cross product to calculate the normal needs to be reversed
if (flippedWindingOrder_ != leftHanded_)
std::swap(pV2, pV3);
const aiVector3D vNor = ((*pV2 - *pV1) ^ (*pV3 - *pV1)).NormalizeSafe(); const aiVector3D vNor = ((*pV2 - *pV1) ^ (*pV3 - *pV1)).NormalizeSafe();
for (unsigned int i = 0; i < face.mNumIndices; ++i) { for (unsigned int i = 0; i < face.mNumIndices; ++i) {

View File

@ -105,6 +105,7 @@ private:
ai_real configMaxAngle; ai_real configMaxAngle;
mutable bool force_ = false; mutable bool force_ = false;
mutable bool flippedWindingOrder_ = false; mutable bool flippedWindingOrder_ = false;
mutable bool leftHanded_ = false;
}; };
} // end of namespace Assimp } // end of namespace Assimp

View File

@ -95,7 +95,7 @@ void JoinVerticesProcess::Execute( aiScene* pScene) {
ASSIMP_LOG_DEBUG("JoinVerticesProcess finished "); ASSIMP_LOG_DEBUG("JoinVerticesProcess finished ");
return; return;
} }
// Show statistics // Show statistics
ASSIMP_LOG_INFO("JoinVerticesProcess finished | Verts in: ", iNumOldVertices, ASSIMP_LOG_INFO("JoinVerticesProcess finished | Verts in: ", iNumOldVertices,
" out: ", iNumVertices, " | ~", " out: ", iNumVertices, " | ~",
@ -234,7 +234,7 @@ struct std::hash<Vertex> {
std::size_t operator()(Vertex const& v) const noexcept { std::size_t operator()(Vertex const& v) const noexcept {
size_t seed = 0; size_t seed = 0;
hash_combine(seed, v.position.x ,v.position.y,v.position.z); hash_combine(seed, v.position.x ,v.position.y,v.position.z);
return seed; return seed;
} }
}; };
//template specialization for std::equal_to for Vertex //template specialization for std::equal_to for Vertex
@ -410,7 +410,7 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
} }
if (weightAlreadyExists) { if (weightAlreadyExists) {
continue; continue;
} }
aiVertexWeight nw; aiVertexWeight nw;
nw.mVertexId = replaceIndex[ ow.mVertexId ]; nw.mVertexId = replaceIndex[ ow.mVertexId ];
nw.mWeight = ow.mWeight; nw.mWeight = ow.mWeight;

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
Copyright (c) 2006-2022, assimp team Copyright (c) 2006-2023, assimp team
All rights reserved. All rights reserved.
@ -36,13 +35,7 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------- */
----------------------------------------------------------------------
*/
/** Implementation of the LimitBoneWeightsProcess post processing step */
#include "LimitBoneWeightsProcess.h" #include "LimitBoneWeightsProcess.h"
#include <assimp/SmallVector.h> #include <assimp/SmallVector.h>
#include <assimp/StringUtils.h> #include <assimp/StringUtils.h>
@ -51,14 +44,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/scene.h> #include <assimp/scene.h>
#include <stdio.h> #include <stdio.h>
using namespace Assimp; namespace Assimp {
// Make sure this value is set.
#ifndef AI_LMW_MAX_WEIGHTS
# define AI_LMW_MAX_WEIGHTS 16
#endif
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer // Constructor to be privately used by Importer
LimitBoneWeightsProcess::LimitBoneWeightsProcess() LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {}
{
mMaxWeights = AI_LMW_MAX_WEIGHTS;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Destructor, private as well // Destructor, private as well
@ -66,15 +61,15 @@ LimitBoneWeightsProcess::~LimitBoneWeightsProcess() = default;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Returns whether the processing step is present in the given flag field. // Returns whether the processing step is present in the given flag field.
bool LimitBoneWeightsProcess::IsActive( unsigned int pFlags) const bool LimitBoneWeightsProcess::IsActive( unsigned int pFlags) const {
{
return (pFlags & aiProcess_LimitBoneWeights) != 0; return (pFlags & aiProcess_LimitBoneWeights) != 0;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void LimitBoneWeightsProcess::Execute( aiScene* pScene) void LimitBoneWeightsProcess::Execute( aiScene* pScene) {
{ ai_assert(pScene != nullptr);
ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess begin"); ASSIMP_LOG_DEBUG("LimitBoneWeightsProcess begin");
for (unsigned int m = 0; m < pScene->mNumMeshes; ++m) { for (unsigned int m = 0; m < pScene->mNumMeshes; ++m) {
@ -86,16 +81,30 @@ void LimitBoneWeightsProcess::Execute( aiScene* pScene)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Executes the post processing step on the given imported data. // Executes the post processing step on the given imported data.
void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) {
{
// get the current value of the property
this->mMaxWeights = pImp->GetPropertyInteger(AI_CONFIG_PP_LBW_MAX_WEIGHTS,AI_LMW_MAX_WEIGHTS); this->mMaxWeights = pImp->GetPropertyInteger(AI_CONFIG_PP_LBW_MAX_WEIGHTS,AI_LMW_MAX_WEIGHTS);
} }
// ------------------------------------------------------------------------------------------------
static unsigned int removeEmptyBones(aiMesh *pMesh) {
ai_assert(pMesh != nullptr);
unsigned int writeBone = 0;
for (unsigned int readBone = 0; readBone< pMesh->mNumBones; ++readBone) {
aiBone* bone = pMesh->mBones[readBone];
if (bone->mNumWeights > 0) {
pMesh->mBones[writeBone++] = bone;
} else {
delete bone;
}
}
return writeBone;
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Unites identical vertices in the given mesh // Unites identical vertices in the given mesh
void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) {
{
if (!pMesh->HasBones()) if (!pMesh->HasBones())
return; return;
@ -105,11 +114,9 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
WeightsPerVertex vertexWeights(pMesh->mNumVertices); WeightsPerVertex vertexWeights(pMesh->mNumVertices);
size_t maxVertexWeights = 0; size_t maxVertexWeights = 0;
for (unsigned int b = 0; b < pMesh->mNumBones; ++b) for (unsigned int b = 0; b < pMesh->mNumBones; ++b) {
{
const aiBone* bone = pMesh->mBones[b]; const aiBone* bone = pMesh->mBones[b];
for (unsigned int w = 0; w < bone->mNumWeights; ++w) for (unsigned int w = 0; w < bone->mNumWeights; ++w) {
{
const aiVertexWeight& vw = bone->mWeights[w]; const aiVertexWeight& vw = bone->mWeights[w];
if (vertexWeights.size() <= vw.mVertexId) if (vertexWeights.size() <= vw.mVertexId)
@ -126,8 +133,7 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
unsigned int removed = 0, old_bones = pMesh->mNumBones; unsigned int removed = 0, old_bones = pMesh->mNumBones;
// now cut the weight count if it exceeds the maximum // now cut the weight count if it exceeds the maximum
for (WeightsPerVertex::iterator vit = vertexWeights.begin(); vit != vertexWeights.end(); ++vit) for (WeightsPerVertex::iterator vit = vertexWeights.begin(); vit != vertexWeights.end(); ++vit) {
{
if (vit->size() <= mMaxWeights) if (vit->size() <= mMaxWeights)
continue; continue;
@ -154,40 +160,27 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
} }
// clear weight count for all bone // clear weight count for all bone
for (unsigned int a = 0; a < pMesh->mNumBones; ++a) for (unsigned int a = 0; a < pMesh->mNumBones; ++a) {
{
pMesh->mBones[a]->mNumWeights = 0; pMesh->mBones[a]->mNumWeights = 0;
} }
// rebuild the vertex weight array for all bones // rebuild the vertex weight array for all bones
for (unsigned int a = 0; a < vertexWeights.size(); ++a) for (unsigned int a = 0; a < vertexWeights.size(); ++a) {
{
const VertexWeightArray& vw = vertexWeights[a]; const VertexWeightArray& vw = vertexWeights[a];
for (const Weight* it = vw.begin(); it != vw.end(); ++it) for (const Weight* it = vw.begin(); it != vw.end(); ++it) {
{
aiBone* bone = pMesh->mBones[it->mBone]; aiBone* bone = pMesh->mBones[it->mBone];
bone->mWeights[bone->mNumWeights++] = aiVertexWeight(a, it->mWeight); bone->mWeights[bone->mNumWeights++] = aiVertexWeight(a, it->mWeight);
} }
} }
// remove empty bones // remove empty bones
unsigned int writeBone = 0; #ifdef AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES
pMesh->mNumBones = removeEmptyBones(pMesh);
for (unsigned int readBone = 0; readBone< pMesh->mNumBones; ++readBone) #endif // AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES
{
aiBone* bone = pMesh->mBones[readBone];
if (bone->mNumWeights > 0)
{
pMesh->mBones[writeBone++] = bone;
}
else
{
delete bone;
}
}
pMesh->mNumBones = writeBone;
if (!DefaultLogger::isNullLogger()) { if (!DefaultLogger::isNullLogger()) {
ASSIMP_LOG_INFO("Removed ", removed, " weights. Input bones: ", old_bones, ". Output bones: ", pMesh->mNumBones); ASSIMP_LOG_INFO("Removed ", removed, " weights. Input bones: ", old_bones, ". Output bones: ", pMesh->mNumBones);
} }
} }
} // namespace Assimp

View File

@ -63,7 +63,7 @@ namespace Assimp {
class IOStream; class IOStream;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** /**
* This class is used to store and write bitmap information. * This class is used to store and write bitmap information.
*/ */
class ASSIMP_API Bitmap { class ASSIMP_API Bitmap {

View File

@ -74,7 +74,7 @@ class ASSIMP_API DefaultIOStream : public IOStream {
#endif // __ANDROID__ #endif // __ANDROID__
protected: protected:
/// @brief /// @brief
DefaultIOStream() AI_NO_EXCEPT; DefaultIOStream() AI_NO_EXCEPT;
/// @brief The class constructor with the file name and the stream. /// @brief The class constructor with the file name and the stream.

View File

@ -77,7 +77,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
inline uint32_t SuperFastHash (const char * data, uint32_t len = 0, uint32_t hash = 0) { inline uint32_t SuperFastHash (const char * data, uint32_t len = 0, uint32_t hash = 0) {
uint32_t tmp; uint32_t tmp;
int rem; int rem;
if (data == NULL) return 0; if (data == NULL) return 0;
if (len == 0)len = (uint32_t)::strlen(data); if (len == 0)len = (uint32_t)::strlen(data);

View File

@ -128,9 +128,7 @@ public:
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
AI_FORCE_INLINE AI_FORCE_INLINE
IOStream::IOStream() AI_NO_EXCEPT { IOStream::IOStream() AI_NO_EXCEPT = default;
// empty
}
// ---------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------
AI_FORCE_INLINE AI_FORCE_INLINE

View File

@ -141,9 +141,7 @@ AI_FORCE_INLINE IOStreamBuffer<T>::IOStreamBuffer(size_t cache) :
} }
template <class T> template <class T>
AI_FORCE_INLINE IOStreamBuffer<T>::~IOStreamBuffer() { AI_FORCE_INLINE IOStreamBuffer<T>::~IOStreamBuffer() = default;
// empty
}
template <class T> template <class T>
AI_FORCE_INLINE bool IOStreamBuffer<T>::open(IOStream *stream) { AI_FORCE_INLINE bool IOStreamBuffer<T>::open(IOStream *stream) {

View File

@ -237,10 +237,7 @@ private:
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT : AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT = default;
m_pathStack() {
// empty
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
AI_FORCE_INLINE IOSystem::~IOSystem() = default; AI_FORCE_INLINE IOSystem::~IOSystem() = default;

View File

@ -145,7 +145,6 @@ private:
AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_empty_lines, bool trim ) : AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_empty_lines, bool trim ) :
mIdx(0), mIdx(0),
mCur(),
mStream(stream), mStream(stream),
mSwallow(), mSwallow(),
mSkip_empty_lines(skip_empty_lines), mSkip_empty_lines(skip_empty_lines),
@ -155,9 +154,7 @@ AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_emp
mIdx = 0; mIdx = 0;
} }
AI_FORCE_INLINE LineSplitter::~LineSplitter() { AI_FORCE_INLINE LineSplitter::~LineSplitter() = default;
// empty
}
AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() { AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() {
if (mSwallow) { if (mSwallow) {

View File

@ -57,7 +57,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
/// @brief Logger class, which will extend the class by log-functions. /// @brief Logger class, which will extend the class by log-functions.
/// @tparam TDeriving /// @tparam TDeriving
template<class TDeriving> template<class TDeriving>
class LogFunctions { class LogFunctions {
public: public:

View File

@ -162,8 +162,7 @@ public:
} }
/** Destructor. */ /** Destructor. */
~MemoryIOSystem() { ~MemoryIOSystem() = default;
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** Tests for the existence of a file at the given path. */ /** Tests for the existence of a file at the given path. */

View File

@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
/** @file OBJMATERIAL.h /** @file OBJMATERIAL.h
* @brief Obj-specific material macros * @brief Obj-specific material macros
* *
*/ */
#ifndef AI_OBJMATERIAL_H_INC #ifndef AI_OBJMATERIAL_H_INC
@ -64,7 +64,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Pure key names for all obj texture-related properties // Pure key names for all obj texture-related properties
//! @cond MATS_DOC_FULL //! @cond MATS_DOC_FULL
// support for bump -bm // support for bump -bm
#define _AI_MATKEY_OBJ_BUMPMULT_BASE "$tex.bumpmult" #define _AI_MATKEY_OBJ_BUMPMULT_BASE "$tex.bumpmult"
//! @endcond //! @endcond

View File

@ -68,9 +68,7 @@ using namespace Formatter;
*/ */
class Profiler { class Profiler {
public: public:
Profiler() { Profiler() = default;
// empty
}
/** Start a named timer */ /** Start a named timer */

View File

@ -67,15 +67,11 @@ class ASSIMP_API ProgressHandler
{ {
protected: protected:
/// @brief Default constructor /// @brief Default constructor
ProgressHandler () AI_NO_EXCEPT { ProgressHandler () AI_NO_EXCEPT = default;
// empty
}
public: public:
/// @brief Virtual destructor. /// @brief Virtual destructor.
virtual ~ProgressHandler () { virtual ~ProgressHandler () = default;
// empty
}
// ------------------------------------------------------------------- // -------------------------------------------------------------------
/** @brief Progress callback. /** @brief Progress callback.

View File

@ -191,13 +191,9 @@ struct SceneHelper {
*/ */
class ASSIMP_API SceneCombiner { class ASSIMP_API SceneCombiner {
// class cannot be instanced // class cannot be instanced
SceneCombiner() { SceneCombiner() = delete;
// empty
}
~SceneCombiner() { ~SceneCombiner() = delete;
// empty
}
public: public:
// ------------------------------------------------------------------- // -------------------------------------------------------------------

View File

@ -162,7 +162,7 @@ protected:
unsigned int mIndex; ///< The vertex referred by this entry unsigned int mIndex; ///< The vertex referred by this entry
aiVector3D mPosition; ///< Position aiVector3D mPosition; ///< Position
/// Distance of this vertex to the sorting plane. This is set by Finalize. /// Distance of this vertex to the sorting plane. This is set by Finalize.
ai_real mDistance; ai_real mDistance;
Entry() AI_NO_EXCEPT Entry() AI_NO_EXCEPT
: mIndex(std::numeric_limits<unsigned int>::max()), : mIndex(std::numeric_limits<unsigned int>::max()),

View File

@ -58,8 +58,8 @@ namespace Assimp {
struct find_node_by_name_predicate { struct find_node_by_name_predicate {
/// @brief The default constructor. /// @brief The default constructor.
find_node_by_name_predicate() = default; find_node_by_name_predicate() = default;
std::string mName; ///< The name to find. std::string mName; ///< The name to find.
find_node_by_name_predicate(const std::string &name) : find_node_by_name_predicate(const std::string &name) :
mName(name) { mName(name) {

View File

@ -50,8 +50,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/vector3.h> #include <assimp/vector3.h>
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
/** /**
* An axis-aligned bounding box. * An axis-aligned bounding box.
*/ */
struct aiAABB { struct aiAABB {
C_STRUCT aiVector3D mMin; C_STRUCT aiVector3D mMin;

View File

@ -55,7 +55,7 @@ namespace Assimp {
/// @brief Assert violation behavior can be customized: see AssertHandler.h. /// @brief Assert violation behavior can be customized: see AssertHandler.h.
/// @param failedExpression The expression to validate. /// @param failedExpression The expression to validate.
/// @param file The file location /// @param file The file location
/// @param line The line number /// @param line The line number
ASSIMP_API void aiAssertViolation(const char* failedExpression, const char* file, int line); ASSIMP_API void aiAssertViolation(const char* failedExpression, const char* file, int line);

View File

@ -98,7 +98,7 @@ struct aiVectorKey {
bool operator<(const aiVectorKey &rhs) const { bool operator<(const aiVectorKey &rhs) const {
return mTime < rhs.mTime; return mTime < rhs.mTime;
} }
bool operator>(const aiVectorKey &rhs) const { bool operator>(const aiVectorKey &rhs) const {
return mTime > rhs.mTime; return mTime > rhs.mTime;
} }
@ -132,7 +132,7 @@ struct aiQuatKey {
bool operator==(const aiQuatKey &rhs) const { bool operator==(const aiQuatKey &rhs) const {
return rhs.mValue == this->mValue; return rhs.mValue == this->mValue;
} }
bool operator!=(const aiQuatKey &rhs) const { bool operator!=(const aiQuatKey &rhs) const {
return rhs.mValue != this->mValue; return rhs.mValue != this->mValue;
} }
@ -141,7 +141,7 @@ struct aiQuatKey {
bool operator<(const aiQuatKey &rhs) const { bool operator<(const aiQuatKey &rhs) const {
return mTime < rhs.mTime; return mTime < rhs.mTime;
} }
bool operator>(const aiQuatKey &rhs) const { bool operator>(const aiQuatKey &rhs) const {
return mTime > rhs.mTime; return mTime > rhs.mTime;
} }
@ -198,7 +198,10 @@ struct aiMeshMorphKey {
/** The time of this key */ /** The time of this key */
double mTime; double mTime;
/** The values and weights at the time of this key */ /** The values and weights at the time of this key
* - mValues: index of attachment mesh to apply weight at the same position in mWeights
* - mWeights: weight to apply to the blend shape index at the same position in mValues
*/
unsigned int *mValues; unsigned int *mValues;
double *mWeights; double *mWeights;

View File

@ -190,7 +190,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef __cplusplus #ifdef __cplusplus
/* No explicit 'struct' and 'enum' tags for C++, this keeps showing up /* No explicit 'struct' and 'enum' tags for C++, this keeps showing up
* in doxydocs. * in doxydocs.
*/ */
#define C_STRUCT #define C_STRUCT
#define C_ENUM #define C_ENUM

View File

@ -100,7 +100,7 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
// std::min has in some cases a conflict with a defined min // std::min has in some cases a conflict with a defined min
#ifdef min #ifdef min
# undef min # undef min
#endif #endif
iNum = static_cast<unsigned int>(std::min(static_cast<size_t>(iNum),prop->mDataLength / sizeof(Type))); iNum = static_cast<unsigned int>(std::min(static_cast<size_t>(iNum),prop->mDataLength / sizeof(Type)));
std::memcpy(pOut,prop->mData,iNum * sizeof(Type)); std::memcpy(pOut,prop->mData,iNum * sizeof(Type));
if (pMax) { if (pMax) {
@ -227,8 +227,8 @@ AI_FORCE_INLINE aiReturn aiMaterial::Get(const char* pKey,unsigned int type,
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
template<class TYPE> template<class TYPE>
aiReturn aiMaterial::AddProperty (const TYPE* pInput, aiReturn aiMaterial::AddProperty (const TYPE* pInput,
const unsigned int pNumValues, const char* pKey, unsigned int type, const unsigned int pNumValues, const char* pKey, unsigned int type,
unsigned int index) { unsigned int index) {
return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(TYPE), return AddBinaryProperty((const void*)pInput, pNumValues * sizeof(TYPE),
pKey,type,index,aiPTI_Buffer); pKey,type,index,aiPTI_Buffer);

View File

@ -737,13 +737,20 @@ struct aiMesh {
**/ **/
C_STRUCT aiString mName; C_STRUCT aiString mName;
/** The number of attachment meshes. Note! Currently only works with Collada loader. */ /** The number of attachment meshes.
* Currently known to work with loaders:
* - Collada
* - gltf
*/
unsigned int mNumAnimMeshes; unsigned int mNumAnimMeshes;
/** Attachment meshes for this mesh, for vertex-based animation. /** Attachment meshes for this mesh, for vertex-based animation.
* Attachment meshes carry replacement data for some of the * Attachment meshes carry replacement data for some of the
* mesh'es vertex components (usually positions, normals). * mesh'es vertex components (usually positions, normals).
* Note! Currently only works with Collada loader.*/ * Currently known to work with loaders:
* - Collada
* - gltf
*/
C_STRUCT aiAnimMesh **mAnimMeshes; C_STRUCT aiAnimMesh **mAnimMeshes;
/** /**

Some files were not shown because too many files have changed in this diff Show More