Merge branch 'master' into fix-msvc-emplace-warnings
commit
b31c04e37c
|
@ -1,6 +1,6 @@
|
|||
# Open Asset Import Library (assimp)
|
||||
# ----------------------------------------------------------------------
|
||||
# Copyright (c) 2006-2022, assimp team
|
||||
# Copyright (c) 2006-2023, assimp team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
|
@ -277,13 +277,15 @@ ELSEIF(MSVC)
|
|||
ELSE() # msvc
|
||||
ADD_COMPILE_OPTIONS(/MP /bigobj /W4 /WX)
|
||||
ENDIF()
|
||||
|
||||
# disable "elements of array '' will be default initialized" warning on MSVC2013
|
||||
IF(MSVC12)
|
||||
ADD_COMPILE_OPTIONS(/wd4351)
|
||||
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_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")
|
||||
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||
IF(NOT ASSIMP_HUNTER_ENABLED)
|
||||
|
|
|
@ -322,7 +322,6 @@ struct Texture {
|
|||
//! Default constructor
|
||||
Texture() AI_NO_EXCEPT
|
||||
: mTextureBlend(0.0f),
|
||||
mMapName(),
|
||||
mOffsetU(0.0),
|
||||
mOffsetV(0.0),
|
||||
mScaleU(1.0),
|
||||
|
@ -334,51 +333,11 @@ struct Texture {
|
|||
mTextureBlend = get_qnan();
|
||||
}
|
||||
|
||||
Texture(const Texture &other) :
|
||||
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(const Texture &other) = default;
|
||||
|
||||
Texture(Texture &&other) AI_NO_EXCEPT : 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) {
|
||||
// empty
|
||||
}
|
||||
Texture(Texture &&other) AI_NO_EXCEPT = default;
|
||||
|
||||
Texture &operator=(Texture &&other) AI_NO_EXCEPT {
|
||||
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;
|
||||
}
|
||||
Texture &operator=(Texture &&other) AI_NO_EXCEPT = default;
|
||||
|
||||
//! Specifies the blend factor for the texture
|
||||
ai_real mTextureBlend;
|
||||
|
@ -436,83 +395,13 @@ struct Material {
|
|||
// empty
|
||||
}
|
||||
|
||||
Material(const Material &other) :
|
||||
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
|
||||
}
|
||||
Material(const Material &other) = default;
|
||||
|
||||
//! Move constructor. This is explicitly written because MSVC doesn't support defaulting it
|
||||
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(Material &&other) AI_NO_EXCEPT = default;
|
||||
|
||||
Material &operator=(Material &&other) AI_NO_EXCEPT {
|
||||
if (this == &other) {
|
||||
return *this;
|
||||
}
|
||||
Material &operator=(Material &&other) AI_NO_EXCEPT = default;
|
||||
|
||||
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;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
virtual ~Material() {
|
||||
// empty
|
||||
}
|
||||
virtual ~Material() = default;
|
||||
|
||||
//! Name of the material
|
||||
std::string mName;
|
||||
|
|
|
@ -69,9 +69,7 @@ public:
|
|||
// empty
|
||||
}
|
||||
|
||||
virtual ~Resource() {
|
||||
// empty
|
||||
}
|
||||
virtual ~Resource() = default;
|
||||
|
||||
virtual ResourceType getType() const {
|
||||
return ResourceType::RT_Unknown;
|
||||
|
|
|
@ -83,7 +83,7 @@ void ExportScene3MF(const char *pFile, IOSystem *pIOSystem, const aiScene *pScen
|
|||
namespace D3MF {
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
@ -83,11 +83,7 @@ void AMFImporter::Clear() {
|
|||
|
||||
AMFImporter::AMFImporter() AI_NO_EXCEPT :
|
||||
mNodeElement_Cur(nullptr),
|
||||
mXmlParser(nullptr),
|
||||
mUnit(),
|
||||
mVersion(),
|
||||
mMaterial_Converted(),
|
||||
mTexture_Converted() {
|
||||
mXmlParser(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -88,9 +88,7 @@ public:
|
|||
std::list<AMFNodeElementBase *> Child; ///< Child elements.
|
||||
|
||||
public: /// Destructor, virtual..
|
||||
virtual ~AMFNodeElementBase() {
|
||||
// empty
|
||||
}
|
||||
virtual ~AMFNodeElementBase() = default;
|
||||
|
||||
/// Disabled copy constructor and co.
|
||||
AMFNodeElementBase(const AMFNodeElementBase &pNodeElement) = delete;
|
||||
|
@ -103,7 +101,7 @@ protected:
|
|||
/// \param [in] pType - element type.
|
||||
/// \param [in] pParent - parent element.
|
||||
AMFNodeElementBase(const EType pType, AMFNodeElementBase *pParent) :
|
||||
Type(pType), ID(), Parent(pParent), Child() {
|
||||
Type(pType), Parent(pParent) {
|
||||
// empty
|
||||
}
|
||||
}; // class IAMFImporter_NodeElement
|
||||
|
@ -174,7 +172,7 @@ struct AMFColor : public AMFNodeElementBase {
|
|||
/// @brief Constructor.
|
||||
/// @param [in] pParent - pointer to parent node.
|
||||
AMFColor(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color(), Profile() {
|
||||
AMFNodeElementBase(ENET_Color, pParent), Composed(false), Color() {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
@ -270,7 +268,7 @@ struct AMFTexMap : public AMFNodeElementBase {
|
|||
/// Constructor.
|
||||
/// \param [in] pParent - pointer to parent node.
|
||||
AMFTexMap(AMFNodeElementBase *pParent) :
|
||||
AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{}, TextureID_R(), TextureID_G(), TextureID_B(), TextureID_A() {
|
||||
AMFNodeElementBase(ENET_TexMap, pParent), TextureCoordinate{} {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
|
|
@ -52,8 +52,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace Assimp {
|
||||
template <>
|
||||
const char *LogFunctions<BlenderBMeshConverter>::Prefix() {
|
||||
static auto prefix = "BLEND_BMESH: ";
|
||||
return prefix;
|
||||
return "BLEND_BMESH: ";
|
||||
}
|
||||
} // namespace Assimp
|
||||
|
||||
|
|
|
@ -106,9 +106,7 @@ struct ElemBase {
|
|||
// empty
|
||||
}
|
||||
|
||||
virtual ~ElemBase() {
|
||||
// empty
|
||||
}
|
||||
virtual ~ElemBase() = default;
|
||||
|
||||
/** Type name of the element. The type
|
||||
* string points is the `c_str` of the `name` attribute of the
|
||||
|
|
|
@ -80,8 +80,7 @@ namespace Assimp {
|
|||
|
||||
template <>
|
||||
const char *LogFunctions<BlenderImporter>::Prefix() {
|
||||
static auto prefix = "BLEND: ";
|
||||
return prefix;
|
||||
return "BLEND: ";
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
|
|
@ -62,9 +62,7 @@ public:
|
|||
/**
|
||||
* The class destructor, virtual.
|
||||
*/
|
||||
virtual ~BlenderModifier() {
|
||||
// empty
|
||||
}
|
||||
virtual ~BlenderModifier() = default;
|
||||
|
||||
// --------------------
|
||||
/**
|
||||
|
|
|
@ -182,7 +182,7 @@ struct MVert : ElemBase {
|
|||
int bweight;
|
||||
|
||||
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
|
||||
|
||||
CustomDataLayer() :
|
||||
ElemBase(),
|
||||
type(0),
|
||||
offset(0),
|
||||
flag(0),
|
||||
|
@ -729,7 +728,7 @@ struct Object : ElemBase {
|
|||
ListBase modifiers;
|
||||
|
||||
Object() :
|
||||
ElemBase(), type(Type_EMPTY), parent(nullptr), track(), proxy(), proxy_from(), data() {
|
||||
type(Type_EMPTY), parent(nullptr) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
@ -741,8 +740,7 @@ struct Base : ElemBase {
|
|||
std::shared_ptr<Object> object WARN;
|
||||
|
||||
Base() :
|
||||
ElemBase(), prev(nullptr), next(), object() {
|
||||
// empty
|
||||
prev(nullptr) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
@ -758,10 +756,7 @@ struct Scene : ElemBase {
|
|||
|
||||
ListBase base;
|
||||
|
||||
Scene() :
|
||||
ElemBase(), camera(), world(), basact(), master_collection() {
|
||||
// empty
|
||||
}
|
||||
Scene() = default;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
@ -791,10 +786,7 @@ struct Image : ElemBase {
|
|||
|
||||
short gen_x, gen_y, gen_type;
|
||||
|
||||
Image() :
|
||||
ElemBase() {
|
||||
// empty
|
||||
}
|
||||
Image() = default;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
|
@ -884,7 +876,7 @@ struct Tex : ElemBase {
|
|||
//char use_nodes;
|
||||
|
||||
Tex() :
|
||||
ElemBase(), imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS), ima() {
|
||||
imaflag(ImageFlags_INTERPOL), type(Type_CLOUDS) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
@ -976,10 +968,7 @@ struct MTex : ElemBase {
|
|||
//float shadowfac;
|
||||
//float zenupfac, zendownfac, blendfac;
|
||||
|
||||
MTex() :
|
||||
ElemBase() {
|
||||
// empty
|
||||
}
|
||||
MTex() = default;
|
||||
};
|
||||
|
||||
} // namespace Blender
|
||||
|
|
|
@ -62,8 +62,7 @@ namspace Assimp
|
|||
{
|
||||
template< > const char* LogFunctions< BlenderTessellatorGL >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_TESS_GL: ";
|
||||
return prefix;
|
||||
return "BLEND_TESS_GL: ";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
|
@ -259,8 +256,7 @@ namespace Assimp
|
|||
{
|
||||
template< > const char* LogFunctions< BlenderTessellatorP2T >::Prefix()
|
||||
{
|
||||
static auto prefix = "BLEND_TESS_P2T: ";
|
||||
return prefix;
|
||||
return "BLEND_TESS_P2T: ";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,8 +86,7 @@ void GetWriterInfo(int &id, String &appname) {
|
|||
|
||||
namespace Assimp {
|
||||
template<> const char* LogFunctions<C4DImporter>::Prefix() {
|
||||
static auto prefix = "C4D: ";
|
||||
return prefix;
|
||||
return "C4D: ";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,15 +105,10 @@ static const aiImporterDesc desc = {
|
|||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
C4DImporter::C4DImporter()
|
||||
: BaseImporter() {
|
||||
// empty
|
||||
}
|
||||
C4DImporter::C4DImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
C4DImporter::~C4DImporter() {
|
||||
// empty
|
||||
}
|
||||
C4DImporter::~C4DImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool C4DImporter::CanRead( const std::string& pFile, IOSystem* /*pIOHandler*/, bool /*checkSig*/) const {
|
||||
|
|
|
@ -92,15 +92,6 @@ inline void AddNodeMetaData(aiNode *node, const std::string &key, const T &value
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
ColladaLoader::ColladaLoader() :
|
||||
mFileName(),
|
||||
mMeshIndexByID(),
|
||||
mMaterialIndexByName(),
|
||||
mMeshes(),
|
||||
newMats(),
|
||||
mCameras(),
|
||||
mLights(),
|
||||
mTextures(),
|
||||
mAnims(),
|
||||
noSkeletonMesh(false),
|
||||
removeEmptyBones(false),
|
||||
ignoreUpDirection(false),
|
||||
|
|
|
@ -762,6 +762,7 @@ void ColladaParser::ReadControllerWeights(XmlNode &node, Collada::Controller &pC
|
|||
if (text == nullptr) {
|
||||
throw DeadlyImportError("Out of data while reading <vertex_weights>");
|
||||
}
|
||||
SkipSpacesAndLineEnd(&text);
|
||||
it->first = strtoul10(text, &text);
|
||||
SkipSpacesAndLineEnd(&text);
|
||||
if (*text == 0) {
|
||||
|
|
|
@ -65,7 +65,6 @@ public:
|
|||
LineReader(StreamReaderLE& reader)
|
||||
: splitter(reader,false,true)
|
||||
, groupcode( 0 )
|
||||
, value()
|
||||
, end() {
|
||||
// empty
|
||||
}
|
||||
|
@ -186,8 +185,7 @@ struct InsertBlock {
|
|||
InsertBlock()
|
||||
: pos()
|
||||
, scale(1.f,1.f,1.f)
|
||||
, angle()
|
||||
, name() {
|
||||
, angle() {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,6 @@ public: // constructors
|
|||
/// The class constructor with the name.
|
||||
Node(const std::string& n)
|
||||
: name(n)
|
||||
, properties()
|
||||
, children()
|
||||
, force_has_children( false ) {
|
||||
// empty
|
||||
}
|
||||
|
@ -87,8 +85,6 @@ public: // constructors
|
|||
template <typename... More>
|
||||
Node(const std::string& n, More&&... more)
|
||||
: name(n)
|
||||
, properties()
|
||||
, children()
|
||||
, force_has_children(false) {
|
||||
AddProperties(std::forward<More>(more)...);
|
||||
}
|
||||
|
|
|
@ -62,8 +62,7 @@ namespace Assimp {
|
|||
|
||||
template <>
|
||||
const char *LogFunctions<FBXImporter>::Prefix() {
|
||||
static auto prefix = "FBX: ";
|
||||
return prefix;
|
||||
return "FBX: ";
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
@ -90,10 +89,7 @@ static const aiImporterDesc desc = {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by #Importer
|
||||
FBXImporter::FBXImporter() :
|
||||
mSettings() {
|
||||
// empty
|
||||
}
|
||||
FBXImporter::FBXImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2023, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
|
@ -53,22 +52,26 @@ namespace Assimp {
|
|||
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 {
|
||||
public:
|
||||
/// @brief The class constructor with all parameters.
|
||||
/// @param id The id.
|
||||
/// @param element
|
||||
/// @param name
|
||||
/// @param doc
|
||||
/// @param element The element instance
|
||||
/// @param name The name instance
|
||||
/// @param doc The document instance
|
||||
Geometry( uint64_t id, const Element& element, const std::string& name, const Document& doc );
|
||||
|
||||
/// @brief The class destructor, 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;
|
||||
|
||||
/// 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;
|
||||
|
||||
private:
|
||||
|
@ -78,59 +81,71 @@ private:
|
|||
|
||||
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 {
|
||||
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 );
|
||||
|
||||
/** The class destructor */
|
||||
/// @brief The class destructor, 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;
|
||||
|
||||
/** Get a list of all vertex normals or an empty array if
|
||||
* no normals are specified. */
|
||||
/// @brief Get a vector of all vertex normals or an empty array if no normals are specified.
|
||||
/// @return The normal vector.
|
||||
const std::vector<aiVector3D>& GetNormals() const;
|
||||
|
||||
/** Get a list of all vertex tangents or an empty array
|
||||
* if no tangents are specified */
|
||||
/// @brief Get a vector of all vertex tangents or an empty array if no tangents are specified.
|
||||
/// @return The vertex tangents vector.
|
||||
const std::vector<aiVector3D>& GetTangents() const;
|
||||
|
||||
/** Get a list of all vertex bi-normals or an empty array
|
||||
* if no bi-normals are specified */
|
||||
/// @brief Get a vector of all vertex bi-normals or an empty array if no bi-normals are specified.
|
||||
/// @return The binomal vector.
|
||||
const std::vector<aiVector3D>& GetBinormals() const;
|
||||
|
||||
/** Return list of faces - each entry denotes a face and specifies
|
||||
* how many vertices it has. Vertices are taken from the
|
||||
* vertex data arrays in sequential order. */
|
||||
/// @brief Return list of faces - each entry denotes a face and specifies how many vertices it has.
|
||||
/// Vertices are taken from the vertex data arrays in sequential order.
|
||||
/// @return The face indices vector.
|
||||
const std::vector<unsigned int>& GetFaceIndexCounts() const;
|
||||
|
||||
/** Get a UV coordinate slot, returns an empty array if
|
||||
* the requested slot does not exist. */
|
||||
/// @brief Get a UV coordinate slot, returns an empty array if 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;
|
||||
|
||||
/** Get a UV coordinate slot, returns an empty array if
|
||||
* the requested slot does not exist. */
|
||||
/// @brief Get a UV coordinate slot, returns an empty array if 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;
|
||||
|
||||
/** Get a vertex color coordinate slot, returns an empty array if
|
||||
* the requested slot does not exist. */
|
||||
/// @brief Get a vertex color coordinate slot, returns an empty array if 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;
|
||||
|
||||
/** Get per-face-vertex material assignments */
|
||||
/// @brief Get per-face-vertex material assignments.
|
||||
/// @return The Material indices Array.
|
||||
const MatIndexArray& GetMaterialIndices() const;
|
||||
|
||||
/** Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr
|
||||
* if the vertex index is not valid. */
|
||||
/// @brief Convert from a fbx file vertex index (for example from a #Cluster weight) or nullptr 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;
|
||||
|
||||
/** Determine the face to which a particular output vertex index belongs.
|
||||
* This mapping is always unique. */
|
||||
/// @brief Determine the face to which a particular output vertex index belongs.
|
||||
/// 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;
|
||||
|
||||
private:
|
||||
|
|
|
@ -73,8 +73,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
namespace Assimp {
|
||||
template <>
|
||||
const char *LogFunctions<IFCImporter>::Prefix() {
|
||||
static auto prefix = "IFC: ";
|
||||
return prefix;
|
||||
return "IFC: ";
|
||||
}
|
||||
} // namespace Assimp
|
||||
|
||||
|
|
|
@ -71,11 +71,7 @@ static const aiImporterDesc desc = {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
IRRMeshImporter::IRRMeshImporter() :
|
||||
BaseImporter(),
|
||||
IrrlichtBase() {
|
||||
// empty
|
||||
}
|
||||
IRRMeshImporter::IRRMeshImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
|
|
|
@ -63,9 +63,7 @@ protected:
|
|||
// empty
|
||||
}
|
||||
|
||||
~IrrlichtBase() {
|
||||
// empty
|
||||
}
|
||||
~IrrlichtBase() = default;
|
||||
|
||||
/** @brief Data structure for a simple name-value property
|
||||
*/
|
||||
|
|
|
@ -65,7 +65,7 @@ class M3DImporter : public BaseImporter {
|
|||
public:
|
||||
/// \brief Default constructor
|
||||
M3DImporter();
|
||||
~M3DImporter() override {}
|
||||
~M3DImporter() override = default;
|
||||
|
||||
/// \brief Returns whether the class can handle the format of the given file.
|
||||
/// \remark See BaseImporter::CanRead() for details.
|
||||
|
|
|
@ -39,8 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
|
||||
#if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER)
|
||||
#if !defined ASSIMP_BUILD_NO_M3D_IMPORTER || !(defined ASSIMP_BUILD_NO_EXPORT || defined ASSIMP_BUILD_NO_M3D_EXPORTER)
|
||||
|
||||
#include "M3DWrapper.h"
|
||||
|
||||
|
@ -149,4 +148,3 @@ void M3DWrapper::ClearSave() {
|
|||
} // namespace Assimp
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -47,8 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#ifndef AI_M3DWRAPPER_H_INC
|
||||
#define AI_M3DWRAPPER_H_INC
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_M3D_IMPORTER
|
||||
#if !(ASSIMP_BUILD_NO_EXPORT || ASSIMP_BUILD_NO_M3D_EXPORTER)
|
||||
#if !defined ASSIMP_BUILD_NO_M3D_IMPORTER || !(defined ASSIMP_BUILD_NO_EXPORT || defined ASSIMP_BUILD_NO_M3D_EXPORTER)
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
@ -126,7 +125,6 @@ inline m3d_t *M3DWrapper::M3D() const {
|
|||
|
||||
} // namespace Assimp
|
||||
|
||||
#endif
|
||||
#endif // ASSIMP_BUILD_NO_M3D_IMPORTER
|
||||
|
||||
#endif // AI_M3DWRAPPER_H_INC
|
||||
|
|
|
@ -60,17 +60,17 @@ namespace Ogre {
|
|||
class OgreImporter : public BaseImporter {
|
||||
public:
|
||||
/// 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:
|
||||
/// 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.
|
||||
virtual const aiImporterDesc *GetInfo() const override;
|
||||
const aiImporterDesc *GetInfo() const override;
|
||||
|
||||
/// BaseImporter override.
|
||||
virtual void SetupProperties(const Importer *pImp) override;
|
||||
void SetupProperties(const Importer *pImp) override;
|
||||
|
||||
private:
|
||||
/// Read materials referenced by the @c mesh to @c pScene.
|
||||
|
|
|
@ -261,7 +261,6 @@ OpenGEXImporter::RefInfo::RefInfo(aiNode *node, Type type, std::vector<std::stri
|
|||
OpenGEXImporter::OpenGEXImporter() :
|
||||
m_root(nullptr),
|
||||
m_nodeChildMap(),
|
||||
m_meshCache(),
|
||||
m_mesh2refMap(),
|
||||
m_material2refMap(),
|
||||
m_ctx(nullptr),
|
||||
|
|
|
@ -296,9 +296,7 @@ class PropertyInstance
|
|||
public:
|
||||
|
||||
//! Default constructor
|
||||
PropertyInstance() AI_NO_EXCEPT {
|
||||
// empty
|
||||
}
|
||||
PropertyInstance() AI_NO_EXCEPT = default;
|
||||
|
||||
union ValueUnion
|
||||
{
|
||||
|
@ -359,10 +357,7 @@ public:
|
|||
class ElementInstance {
|
||||
public:
|
||||
//! Default constructor
|
||||
ElementInstance() AI_NO_EXCEPT
|
||||
: alProperties() {
|
||||
// empty
|
||||
}
|
||||
ElementInstance() AI_NO_EXCEPT = default;
|
||||
|
||||
//! List of all parsed properties
|
||||
std::vector< PropertyInstance > alProperties;
|
||||
|
@ -386,10 +381,7 @@ class ElementInstanceList
|
|||
public:
|
||||
|
||||
//! Default constructor
|
||||
ElementInstanceList() AI_NO_EXCEPT
|
||||
: alInstances() {
|
||||
// empty
|
||||
}
|
||||
ElementInstanceList() AI_NO_EXCEPT = default;
|
||||
|
||||
//! List of all element instances
|
||||
std::vector< ElementInstance > alInstances;
|
||||
|
@ -413,11 +405,7 @@ class DOM
|
|||
public:
|
||||
|
||||
//! Default constructor
|
||||
DOM() AI_NO_EXCEPT
|
||||
: alElements()
|
||||
, alElementData() {
|
||||
|
||||
}
|
||||
DOM() AI_NO_EXCEPT = default;
|
||||
|
||||
|
||||
//! Contains all elements of the file format
|
||||
|
|
|
@ -169,19 +169,7 @@ struct Q3BSPModel {
|
|||
std::vector<char> m_EntityData;
|
||||
std::string m_ModelName;
|
||||
|
||||
Q3BSPModel() :
|
||||
m_Data(),
|
||||
m_Lumps(),
|
||||
m_Vertices(),
|
||||
m_Faces(),
|
||||
m_Indices(),
|
||||
m_Textures(),
|
||||
m_Lightmaps(),
|
||||
m_EntityData(),
|
||||
m_ModelName()
|
||||
{
|
||||
// empty
|
||||
}
|
||||
Q3BSPModel() = default;
|
||||
|
||||
~Q3BSPModel() {
|
||||
for ( unsigned int i=0; i<m_Lumps.size(); i++ ) {
|
||||
|
|
|
@ -139,7 +139,7 @@ static void normalizePathName(const std::string &rPath, std::string &normalizedP
|
|||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor.
|
||||
Q3BSPFileImporter::Q3BSPFileImporter() :
|
||||
m_pCurrentMesh(nullptr), m_pCurrentFace(nullptr), m_MaterialLookupMap(), mTextures() {
|
||||
m_pCurrentMesh(nullptr), m_pCurrentFace(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ static const aiImporterDesc desc = {
|
|||
// Constructor to be privately used by Importer
|
||||
SMDImporter::SMDImporter() :
|
||||
configFrameID(),
|
||||
mBuffer(),
|
||||
pScene( nullptr ),
|
||||
iFileSize( 0 ),
|
||||
iSmallestFrame( INT_MAX ),
|
||||
|
|
|
@ -87,7 +87,7 @@ struct Vertex {
|
|||
*/
|
||||
struct Face {
|
||||
Face() AI_NO_EXCEPT :
|
||||
iTexture(0x0), avVertices{} {
|
||||
iTexture(0x0) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,6 @@ struct TexEntry {
|
|||
bool mIsNormalMap; // true if the texname was specified in a NormalmapFilename tag
|
||||
|
||||
TexEntry() AI_NO_EXCEPT :
|
||||
mName(),
|
||||
mIsNormalMap(false) {
|
||||
// empty
|
||||
}
|
||||
|
@ -128,17 +127,8 @@ struct Mesh {
|
|||
|
||||
explicit Mesh(const std::string &pName = std::string()) AI_NO_EXCEPT
|
||||
: mName(pName),
|
||||
mPositions(),
|
||||
mPosFaces(),
|
||||
mNormals(),
|
||||
mNormFaces(),
|
||||
mNumTextures(0),
|
||||
mTexCoords{},
|
||||
mNumColorSets(0),
|
||||
mColors{},
|
||||
mFaceMaterials(),
|
||||
mMaterials(),
|
||||
mBones() {
|
||||
mNumColorSets(0) {
|
||||
// empty
|
||||
}
|
||||
};
|
||||
|
@ -152,15 +142,12 @@ struct Node {
|
|||
std::vector<Mesh *> mMeshes;
|
||||
|
||||
Node() AI_NO_EXCEPT
|
||||
: mName(),
|
||||
mTrafoMatrix(),
|
||||
mParent(nullptr),
|
||||
mChildren(),
|
||||
mMeshes() {
|
||||
: mTrafoMatrix(),
|
||||
mParent(nullptr) {
|
||||
// empty
|
||||
}
|
||||
explicit Node(Node *pParent) :
|
||||
mName(), mTrafoMatrix(), mParent(pParent), mChildren(), mMeshes() {
|
||||
mTrafoMatrix(), mParent(pParent) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
@ -211,8 +198,6 @@ struct Scene {
|
|||
|
||||
Scene() AI_NO_EXCEPT
|
||||
: mRootNode(nullptr),
|
||||
mGlobalMeshes(),
|
||||
mGlobalMaterials(),
|
||||
mAnimTicksPerSecond(0) {
|
||||
// empty
|
||||
}
|
||||
|
|
|
@ -75,9 +75,7 @@ static const aiImporterDesc desc = {
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
XFileImporter::XFileImporter() : mBuffer() {
|
||||
// empty
|
||||
}
|
||||
XFileImporter::XFileImporter() = default;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
|
|
|
@ -52,22 +52,14 @@ class X3DExporter {
|
|||
struct SAttribute {
|
||||
const std::string Name;
|
||||
const std::string Value;
|
||||
SAttribute() :
|
||||
Name(),
|
||||
Value() {
|
||||
// empty
|
||||
}
|
||||
SAttribute() = default;
|
||||
SAttribute(const std::string &name, const std::string &value) :
|
||||
Name(name),
|
||||
Value(value) {
|
||||
// empty
|
||||
}
|
||||
|
||||
SAttribute(SAttribute &&rhs) AI_NO_EXCEPT :
|
||||
Name(rhs.Name),
|
||||
Value(rhs.Value) {
|
||||
// empty
|
||||
}
|
||||
SAttribute(SAttribute &&rhs) AI_NO_EXCEPT = default;
|
||||
};
|
||||
|
||||
/***********************************************/
|
||||
|
|
|
@ -108,9 +108,7 @@ struct X3DNodeElementBase {
|
|||
std::list<X3DNodeElementBase *> Children;
|
||||
X3DElemType Type;
|
||||
|
||||
virtual ~X3DNodeElementBase() {
|
||||
// empty
|
||||
}
|
||||
virtual ~X3DNodeElementBase() = default;
|
||||
|
||||
protected:
|
||||
X3DNodeElementBase(X3DElemType type, X3DNodeElementBase *pParent) :
|
||||
|
@ -367,9 +365,7 @@ struct X3DNodeElementMeta : X3DNodeElementBase {
|
|||
std::string Name; ///< Name of metadata object.
|
||||
std::string Reference;
|
||||
|
||||
virtual ~X3DNodeElementMeta() {
|
||||
// empty
|
||||
}
|
||||
virtual ~X3DNodeElementMeta() = default;
|
||||
|
||||
protected:
|
||||
X3DNodeElementMeta(X3DElemType type, X3DNodeElementBase *parent) :
|
||||
|
|
|
@ -65,8 +65,7 @@ namespace Assimp { // this has to be in here because LogFunctions is in ::Assimp
|
|||
|
||||
template <>
|
||||
const char *LogFunctions<XGLImporter>::Prefix() {
|
||||
static auto prefix = "XGL: ";
|
||||
return prefix;
|
||||
return "XGL: ";
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
|
|
@ -629,9 +629,7 @@ struct Mesh : public Object {
|
|||
SExtension(const EType pType) :
|
||||
Type(pType) {}
|
||||
|
||||
virtual ~SExtension() {
|
||||
// empty
|
||||
}
|
||||
virtual ~SExtension() = default;
|
||||
};
|
||||
|
||||
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
|
||||
|
@ -657,9 +655,7 @@ struct Mesh : public Object {
|
|||
// empty
|
||||
}
|
||||
|
||||
virtual ~SCompression_Open3DGC() {
|
||||
// empty
|
||||
}
|
||||
virtual ~SCompression_Open3DGC() = default;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ static const aiImporterDesc desc = {
|
|||
};
|
||||
|
||||
glTFImporter::glTFImporter() :
|
||||
BaseImporter(), meshOffsets(), embeddedTexIdxs(), mScene(nullptr) {
|
||||
mScene(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
||||
|
|
|
@ -365,16 +365,7 @@ struct CustomExtension {
|
|||
|
||||
~CustomExtension() = default;
|
||||
|
||||
CustomExtension(const CustomExtension &other) :
|
||||
name(other.name),
|
||||
mStringValue(other.mStringValue),
|
||||
mDoubleValue(other.mDoubleValue),
|
||||
mUint64Value(other.mUint64Value),
|
||||
mInt64Value(other.mInt64Value),
|
||||
mBoolValue(other.mBoolValue),
|
||||
mValues(other.mValues) {
|
||||
// empty
|
||||
}
|
||||
CustomExtension(const CustomExtension &other) = default;
|
||||
|
||||
CustomExtension& operator=(const CustomExtension&) = default;
|
||||
};
|
||||
|
@ -1086,8 +1077,7 @@ struct AssetMetadata {
|
|||
|
||||
void Read(Document &doc);
|
||||
|
||||
AssetMetadata() :
|
||||
version() {}
|
||||
AssetMetadata() = default;
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -96,9 +96,6 @@ static const aiImporterDesc desc = {
|
|||
};
|
||||
|
||||
glTF2Importer::glTF2Importer() :
|
||||
BaseImporter(),
|
||||
meshOffsets(),
|
||||
mEmbeddedTexIdxs(),
|
||||
mScene(nullptr) {
|
||||
// empty
|
||||
}
|
||||
|
@ -185,7 +182,6 @@ static void SetMaterialTextureProperty(std::vector<int> &embeddedTexIdxs, Asset
|
|||
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.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);
|
||||
}
|
||||
|
@ -853,7 +849,7 @@ void glTF2Importer::ImportCameras(glTF2::Asset &r) {
|
|||
|
||||
if (cam.type == Camera::Perspective) {
|
||||
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->mClipPlaneNear = cam.cameraProperties.perspective.znear;
|
||||
} else {
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
protected:
|
||||
const aiImporterDesc *GetInfo() const 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:
|
||||
void ImportEmbeddedTextures(glTF2::Asset &a);
|
||||
|
|
|
@ -93,9 +93,7 @@ public:
|
|||
}
|
||||
|
||||
/** Destructor. */
|
||||
~FileSystemFilter() {
|
||||
// empty
|
||||
}
|
||||
~FileSystemFilter() = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Tests for the existence of a file at the given path. */
|
||||
|
|
|
@ -105,7 +105,11 @@ void JoinVerticesProcess::Execute( aiScene* pScene) {
|
|||
|
||||
namespace {
|
||||
|
||||
bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) {
|
||||
bool areVerticesEqual(
|
||||
const Vertex &lhs,
|
||||
const Vertex &rhs,
|
||||
unsigned numUVChannels,
|
||||
unsigned numColorChannels) {
|
||||
// A little helper to find locally close vertices faster.
|
||||
// Try to reuse the lookup table from the last step.
|
||||
const static float epsilon = 1e-5f;
|
||||
|
@ -124,10 +128,6 @@ bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if ((lhs.texcoords[0] - rhs.texcoords[0]).SquareLength() > squareEpsilon) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((lhs.tangent - rhs.tangent).SquareLength() > squareEpsilon) {
|
||||
return false;
|
||||
}
|
||||
|
@ -136,19 +136,18 @@ bool areVerticesEqual(const Vertex &lhs, const Vertex &rhs, bool complex) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Usually we won't have vertex colors or multiple UVs, so we can skip from here
|
||||
// Actually this increases runtime performance slightly, at least if branch
|
||||
// prediction is on our side.
|
||||
if (complex) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (i > 0 && (lhs.texcoords[i] - rhs.texcoords[i]).SquareLength() > squareEpsilon) {
|
||||
for (unsigned i = 0; i < numUVChannels; i++) {
|
||||
if ((lhs.texcoords[i] - rhs.texcoords[i]).SquareLength() > squareEpsilon) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < numColorChannels; i++) {
|
||||
if (GetColorDifference(lhs.colors[i], rhs.colors[i]) > squareEpsilon) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -241,9 +240,16 @@ struct std::hash<Vertex> {
|
|||
//template specialization for std::equal_to for Vertex
|
||||
template<>
|
||||
struct std::equal_to<Vertex> {
|
||||
equal_to(unsigned numUVChannels, unsigned numColorChannels) :
|
||||
mNumUVChannels(numUVChannels),
|
||||
mNumColorChannels(numColorChannels) {}
|
||||
bool operator()(const Vertex &lhs, const Vertex &rhs) const {
|
||||
return areVerticesEqual(lhs, rhs, false);
|
||||
return areVerticesEqual(lhs, rhs, mNumUVChannels, mNumColorChannels);
|
||||
}
|
||||
|
||||
private:
|
||||
unsigned mNumUVChannels;
|
||||
unsigned mNumColorChannels;
|
||||
};
|
||||
// now start the JoinVerticesProcess
|
||||
int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
||||
|
@ -316,8 +322,13 @@ int JoinVerticesProcess::ProcessMesh( aiMesh* pMesh, unsigned int meshIndex) {
|
|||
uniqueAnimatedVertices[animMeshIndex].reserve(pMesh->mNumVertices);
|
||||
}
|
||||
}
|
||||
// a map that maps a vertix to its new index
|
||||
std::unordered_map<Vertex,int> vertex2Index;
|
||||
// a map that maps a vertex to its new index
|
||||
const auto numBuckets = pMesh->mNumVertices;
|
||||
const auto hasher = std::hash<Vertex>();
|
||||
const auto comparator = std::equal_to<Vertex>(
|
||||
pMesh->GetNumUVChannels(),
|
||||
pMesh->GetNumColorChannels());
|
||||
std::unordered_map<Vertex, int> vertex2Index(numBuckets, hasher, comparator);
|
||||
// we can not end up with more vertices than we started with
|
||||
vertex2Index.reserve(pMesh->mNumVertices);
|
||||
// Now check each vertex if it brings something new to the table
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2022, assimp team
|
||||
|
||||
Copyright (c) 2006-2023, assimp team
|
||||
|
||||
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
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** Implementation of the LimitBoneWeightsProcess post processing step */
|
||||
|
||||
|
||||
---------------------------------------------------------------------- */
|
||||
#include "LimitBoneWeightsProcess.h"
|
||||
#include <assimp/SmallVector.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 <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
|
||||
LimitBoneWeightsProcess::LimitBoneWeightsProcess()
|
||||
{
|
||||
mMaxWeights = AI_LMW_MAX_WEIGHTS;
|
||||
}
|
||||
LimitBoneWeightsProcess::LimitBoneWeightsProcess() : mMaxWeights(AI_LMW_MAX_WEIGHTS) {}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
|
@ -66,15 +61,15 @@ LimitBoneWeightsProcess::~LimitBoneWeightsProcess() = default;
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// 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;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// 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");
|
||||
|
||||
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.
|
||||
void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp)
|
||||
{
|
||||
// get the current value of the property
|
||||
void LimitBoneWeightsProcess::SetupProperties(const Importer* pImp) {
|
||||
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
|
||||
void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
|
||||
{
|
||||
void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh) {
|
||||
if (!pMesh->HasBones())
|
||||
return;
|
||||
|
||||
|
@ -105,11 +114,9 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
|
|||
WeightsPerVertex vertexWeights(pMesh->mNumVertices);
|
||||
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];
|
||||
for (unsigned int w = 0; w < bone->mNumWeights; ++w)
|
||||
{
|
||||
for (unsigned int w = 0; w < bone->mNumWeights; ++w) {
|
||||
const aiVertexWeight& vw = bone->mWeights[w];
|
||||
|
||||
if (vertexWeights.size() <= vw.mVertexId)
|
||||
|
@ -126,8 +133,7 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
|
|||
unsigned int removed = 0, old_bones = pMesh->mNumBones;
|
||||
|
||||
// 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)
|
||||
continue;
|
||||
|
||||
|
@ -154,40 +160,27 @@ void LimitBoneWeightsProcess::ProcessMesh(aiMesh* pMesh)
|
|||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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];
|
||||
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];
|
||||
bone->mWeights[bone->mNumWeights++] = aiVertexWeight(a, it->mWeight);
|
||||
}
|
||||
}
|
||||
|
||||
// remove empty bones
|
||||
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;
|
||||
}
|
||||
}
|
||||
pMesh->mNumBones = writeBone;
|
||||
#ifdef AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES
|
||||
pMesh->mNumBones = removeEmptyBones(pMesh);
|
||||
#endif // AI_CONFIG_IMPORT_REMOVE_EMPTY_BONES
|
||||
|
||||
if (!DefaultLogger::isNullLogger()) {
|
||||
ASSIMP_LOG_INFO("Removed ", removed, " weights. Input bones: ", old_bones, ". Output bones: ", pMesh->mNumBones);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Assimp
|
||||
|
|
|
@ -128,9 +128,7 @@ public:
|
|||
|
||||
// ----------------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE
|
||||
IOStream::IOStream() AI_NO_EXCEPT {
|
||||
// empty
|
||||
}
|
||||
IOStream::IOStream() AI_NO_EXCEPT = default;
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE
|
||||
|
|
|
@ -141,9 +141,7 @@ AI_FORCE_INLINE IOStreamBuffer<T>::IOStreamBuffer(size_t cache) :
|
|||
}
|
||||
|
||||
template <class T>
|
||||
AI_FORCE_INLINE IOStreamBuffer<T>::~IOStreamBuffer() {
|
||||
// empty
|
||||
}
|
||||
AI_FORCE_INLINE IOStreamBuffer<T>::~IOStreamBuffer() = default;
|
||||
|
||||
template <class T>
|
||||
AI_FORCE_INLINE bool IOStreamBuffer<T>::open(IOStream *stream) {
|
||||
|
|
|
@ -237,10 +237,7 @@ private:
|
|||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT :
|
||||
m_pathStack() {
|
||||
// empty
|
||||
}
|
||||
AI_FORCE_INLINE IOSystem::IOSystem() AI_NO_EXCEPT = default;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
AI_FORCE_INLINE IOSystem::~IOSystem() = default;
|
||||
|
|
|
@ -145,7 +145,6 @@ private:
|
|||
|
||||
AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_empty_lines, bool trim ) :
|
||||
mIdx(0),
|
||||
mCur(),
|
||||
mStream(stream),
|
||||
mSwallow(),
|
||||
mSkip_empty_lines(skip_empty_lines),
|
||||
|
@ -155,9 +154,7 @@ AI_FORCE_INLINE LineSplitter::LineSplitter(StreamReaderLE& stream, bool skip_emp
|
|||
mIdx = 0;
|
||||
}
|
||||
|
||||
AI_FORCE_INLINE LineSplitter::~LineSplitter() {
|
||||
// empty
|
||||
}
|
||||
AI_FORCE_INLINE LineSplitter::~LineSplitter() = default;
|
||||
|
||||
AI_FORCE_INLINE LineSplitter& LineSplitter::operator++() {
|
||||
if (mSwallow) {
|
||||
|
|
|
@ -162,8 +162,7 @@ public:
|
|||
}
|
||||
|
||||
/** Destructor. */
|
||||
~MemoryIOSystem() {
|
||||
}
|
||||
~MemoryIOSystem() = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Tests for the existence of a file at the given path. */
|
||||
|
|
|
@ -68,9 +68,7 @@ using namespace Formatter;
|
|||
*/
|
||||
class Profiler {
|
||||
public:
|
||||
Profiler() {
|
||||
// empty
|
||||
}
|
||||
Profiler() = default;
|
||||
|
||||
|
||||
/** Start a named timer */
|
||||
|
|
|
@ -67,15 +67,11 @@ class ASSIMP_API ProgressHandler
|
|||
{
|
||||
protected:
|
||||
/// @brief Default constructor
|
||||
ProgressHandler () AI_NO_EXCEPT {
|
||||
// empty
|
||||
}
|
||||
ProgressHandler () AI_NO_EXCEPT = default;
|
||||
|
||||
public:
|
||||
/// @brief Virtual destructor.
|
||||
virtual ~ProgressHandler () {
|
||||
// empty
|
||||
}
|
||||
virtual ~ProgressHandler () = default;
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @brief Progress callback.
|
||||
|
|
|
@ -191,13 +191,9 @@ struct SceneHelper {
|
|||
*/
|
||||
class ASSIMP_API SceneCombiner {
|
||||
// class cannot be instanced
|
||||
SceneCombiner() {
|
||||
// empty
|
||||
}
|
||||
SceneCombiner() = delete;
|
||||
|
||||
~SceneCombiner() {
|
||||
// empty
|
||||
}
|
||||
~SceneCombiner() = delete;
|
||||
|
||||
public:
|
||||
// -------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue