Merge branch 'master' into kimkulling/use_float_for_material_parameters_issue-4685

kimkulling/use_float_for_material_parameters_issue-4685
Kim Kulling 2022-09-06 20:56:46 +02:00 committed by GitHub
commit 06c1f60e2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
168 changed files with 1471 additions and 1577 deletions

View File

@ -209,9 +209,7 @@ Discreet3DSExporter::Discreet3DSExporter(std::shared_ptr<IOStream> &outfile, con
}
// ------------------------------------------------------------------------------------------------
Discreet3DSExporter::~Discreet3DSExporter() {
// empty
}
Discreet3DSExporter::~Discreet3DSExporter() = default;
// ------------------------------------------------------------------------------------------------
int Discreet3DSExporter::WriteHierarchy(const aiNode &node, int seq, int sibling_level) {

View File

@ -105,9 +105,7 @@ Discreet3DSImporter::Discreet3DSImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
Discreet3DSImporter::~Discreet3DSImporter() {
// empty
}
Discreet3DSImporter::~Discreet3DSImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -319,7 +317,7 @@ void Discreet3DSImporter::ParseObjectChunk() {
case Discreet3DS::CHUNK_MAT_MATERIAL:
// Add a new material to the list
mScene->mMaterials.push_back(D3DS::Material(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size()))));
mScene->mMaterials.emplace_back(std::string("UNNAMED_" + ai_to_string(mScene->mMaterials.size())));
ParseMaterialChunk();
break;
@ -370,7 +368,7 @@ void Discreet3DSImporter::ParseChunk(const char *name, unsigned int num) {
switch (chunk.Flag) {
case Discreet3DS::CHUNK_TRIMESH: {
// this starts a new triangle mesh
mScene->mMeshes.push_back(D3DS::Mesh(std::string(name, num)));
mScene->mMeshes.emplace_back(std::string(name, num));
// Read mesh chunks
ParseMeshChunk();
@ -999,7 +997,7 @@ void Discreet3DSImporter::ParseMeshChunk() {
mMesh.mFaces.reserve(num);
while (num-- > 0) {
// 3DS faces are ALWAYS triangles
mMesh.mFaces.push_back(D3DS::Face());
mMesh.mFaces.emplace_back();
D3DS::Face &sFace = mMesh.mFaces.back();
sFace.mIndices[0] = (uint16_t)stream->GetI2();

View File

@ -81,14 +81,9 @@ static const aiImporterDesc desc = {
"3mf"
};
D3MFImporter::D3MFImporter() :
BaseImporter() {
// empty
}
D3MFImporter::D3MFImporter() = default;
D3MFImporter::~D3MFImporter() {
// empty
}
D3MFImporter::~D3MFImporter() = default;
bool D3MFImporter::CanRead(const std::string &filename, IOSystem *pIOHandler, bool /*checkSig*/) const {
if (!ZipArchiveIOSystem::isZipArchive(pIOHandler, filename)) {

View File

@ -146,9 +146,7 @@ AC3DImporter::AC3DImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
AC3DImporter::~AC3DImporter() {
// nothing to be done here
}
AC3DImporter::~AC3DImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -180,7 +178,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
++mNumMeshes;
objects.push_back(Object());
objects.emplace_back();
Object &obj = objects.back();
aiLight *light = nullptr;
@ -267,7 +265,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
--buffer; // make sure the line is processed a second time
break;
}
obj.vertices.push_back(aiVector3D());
obj.vertices.emplace_back();
aiVector3D &v = obj.vertices.back();
buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 3, &v.x);
}
@ -293,7 +291,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
Q3DWorkAround = true;
}
SkipSpaces(&buffer);
obj.surfaces.push_back(Surface());
obj.surfaces.emplace_back();
Surface &surf = obj.surfaces.back();
surf.flags = strtoul_cppstyle(buffer);
@ -324,7 +322,7 @@ void AC3DImporter::LoadObjectSection(std::vector<Object> &objects) {
ASSIMP_LOG_ERROR("AC3D: Unexpected EOF: surface references are incomplete");
break;
}
surf.entries.push_back(Surface::SurfaceEntry());
surf.entries.emplace_back();
Surface::SurfaceEntry &entry = surf.entries.back();
entry.first = strtoul10(buffer, &buffer);
@ -786,7 +784,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
while (GetNextLine()) {
if (TokenMatch(buffer, "MATERIAL", 8)) {
materials.push_back(Material());
materials.emplace_back();
Material &mat = materials.back();
// manually parse the material ... sscanf would use the buldin atof ...
@ -813,7 +811,7 @@ void AC3DImporter::InternReadFile(const std::string &pFile,
}
if (materials.empty()) {
ASSIMP_LOG_WARN("AC3D: No material has been found");
materials.push_back(Material());
materials.emplace_back();
}
mNumMeshes += (mNumMeshes >> 2u) + 1;

View File

@ -89,9 +89,7 @@ ASEImporter::ASEImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
ASEImporter::~ASEImporter() {
// empty
}
ASEImporter::~ASEImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -265,7 +263,7 @@ void ASEImporter::GenerateDefaultMaterial() {
}
if (bHas || mParser->m_vMaterials.empty()) {
// add a simple material without submaterials to the parser's list
mParser->m_vMaterials.push_back(ASE::Material(AI_DEFAULT_MATERIAL_NAME));
mParser->m_vMaterials.emplace_back(AI_DEFAULT_MATERIAL_NAME);
ASE::Material &mat = mParser->m_vMaterials.back();
mat.mDiffuse = aiColor3D(0.6f, 0.6f, 0.6f);
@ -1005,8 +1003,8 @@ void ASEImporter::ConvertMeshes(ASE::Mesh &mesh, std::vector<aiMesh *> &avOutMes
blubb != mesh.mBoneVertices[iIndex2].mBoneWeights.end(); ++blubb) {
// NOTE: illegal cases have already been filtered out
avOutputBones[(*blubb).first].push_back(std::pair<unsigned int, float>(
iBase, (*blubb).second));
avOutputBones[(*blubb).first].emplace_back(
iBase, (*blubb).second);
}
}
}

View File

@ -264,7 +264,7 @@ void Parser::Parse() {
if (TokenMatch(filePtr, "GEOMOBJECT", 10))
{
m_vMeshes.push_back(Mesh("UNNAMED"));
m_vMeshes.emplace_back("UNNAMED");
ParseLV1ObjectBlock(m_vMeshes.back());
continue;
}
@ -272,7 +272,7 @@ void Parser::Parse() {
if (TokenMatch(filePtr, "HELPEROBJECT", 12))
{
m_vDummies.push_back(Dummy());
m_vDummies.emplace_back();
ParseLV1ObjectBlock(m_vDummies.back());
continue;
}
@ -280,13 +280,13 @@ void Parser::Parse() {
if (TokenMatch(filePtr, "LIGHTOBJECT", 11))
{
m_vLights.push_back(Light("UNNAMED"));
m_vLights.emplace_back("UNNAMED");
ParseLV1ObjectBlock(m_vLights.back());
continue;
}
// camera object
if (TokenMatch(filePtr, "CAMERAOBJECT", 12)) {
m_vCameras.push_back(Camera("UNNAMED"));
m_vCameras.emplace_back("UNNAMED");
ParseLV1ObjectBlock(m_vCameras.back());
continue;
}
@ -385,7 +385,7 @@ void Parser::ParseLV1SoftSkinBlock() {
unsigned int numWeights;
ParseLV4MeshLong(numWeights);
curMesh->mBoneVertices.push_back(ASE::BoneVertex());
curMesh->mBoneVertices.emplace_back();
ASE::BoneVertex &vert = curMesh->mBoneVertices.back();
// Reserve enough storage
@ -409,7 +409,7 @@ void Parser::ParseLV1SoftSkinBlock() {
if (-1 == me.first) {
// We don't have this bone yet, so add it to the list
me.first = static_cast<int>(curMesh->mBones.size());
curMesh->mBones.push_back(ASE::Bone(bone));
curMesh->mBones.emplace_back(bone);
}
ParseLV4MeshFloat(me.second);
@ -1011,7 +1011,7 @@ void Parser::ParseLV3ScaleAnimationBlock(ASE::Animation &anim) {
anim.mScalingType = ASE::Animation::TCB;
}
if (b) {
anim.akeyScaling.push_back(aiVectorKey());
anim.akeyScaling.emplace_back();
aiVectorKey &key = anim.akeyScaling.back();
ParseLV4MeshFloatTriple(&key.mValue.x, iIndex);
key.mTime = (double)iIndex;
@ -1050,7 +1050,7 @@ void Parser::ParseLV3PosAnimationBlock(ASE::Animation &anim) {
anim.mPositionType = ASE::Animation::TCB;
}
if (b) {
anim.akeyPositions.push_back(aiVectorKey());
anim.akeyPositions.emplace_back();
aiVectorKey &key = anim.akeyPositions.back();
ParseLV4MeshFloatTriple(&key.mValue.x, iIndex);
key.mTime = (double)iIndex;
@ -1089,7 +1089,7 @@ void Parser::ParseLV3RotAnimationBlock(ASE::Animation &anim) {
anim.mRotationType = ASE::Animation::TCB;
}
if (b) {
anim.akeyRotations.push_back(aiQuatKey());
anim.akeyRotations.emplace_back();
aiQuatKey &key = anim.akeyRotations.back();
aiVector3D v;
ai_real f;

View File

@ -116,7 +116,7 @@ struct Material : public D3DS::Material {
return *this;
}
~Material() {}
~Material() = default;
//! Contains all sub materials of this material
std::vector<Material> avSubMaterials;

View File

@ -130,7 +130,7 @@ inline size_t Write<double>(IOStream *stream, const double &f) {
// Serialize a vec3
template <>
inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
size_t t = Write<float>(stream, v.x);
size_t t = Write<ai_real>(stream, v.x);
t += Write<float>(stream, v.y);
t += Write<float>(stream, v.z);
@ -141,7 +141,7 @@ inline size_t Write<aiVector3D>(IOStream *stream, const aiVector3D &v) {
// Serialize a color value
template <>
inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
size_t t = Write<float>(stream, v.r);
size_t t = Write<ai_real>(stream, v.r);
t += Write<float>(stream, v.g);
t += Write<float>(stream, v.b);
@ -152,7 +152,7 @@ inline size_t Write<aiColor3D>(IOStream *stream, const aiColor3D &v) {
// Serialize a color value
template <>
inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
size_t t = Write<float>(stream, v.r);
size_t t = Write<ai_real>(stream, v.r);
t += Write<float>(stream, v.g);
t += Write<float>(stream, v.b);
t += Write<float>(stream, v.a);
@ -164,7 +164,7 @@ inline size_t Write<aiColor4D>(IOStream *stream, const aiColor4D &v) {
// Serialize a quaternion
template <>
inline size_t Write<aiQuaternion>(IOStream *stream, const aiQuaternion &v) {
size_t t = Write<float>(stream, v.w);
size_t t = Write<ai_real>(stream, v.w);
t += Write<float>(stream, v.x);
t += Write<float>(stream, v.y);
t += Write<float>(stream, v.z);
@ -190,7 +190,7 @@ template <>
inline size_t Write<aiMatrix4x4>(IOStream *stream, const aiMatrix4x4 &m) {
for (unsigned int i = 0; i < 4; ++i) {
for (unsigned int i2 = 0; i2 < 4; ++i2) {
Write<float>(stream, m[i][i2]);
Write<ai_real>(stream, m[i][i2]);
}
}
@ -642,6 +642,10 @@ protected:
Write<aiString>(&chunk, l->mName);
Write<unsigned int>(&chunk, l->mType);
Write<aiVector3D>(&chunk, l->mPosition);
Write<aiVector3D>(&chunk, l->mDirection);
Write<aiVector3D>(&chunk, l->mUp);
if (l->mType != aiLightSource_DIRECTIONAL) {
Write<float>(&chunk, l->mAttenuationConstant);
Write<float>(&chunk, l->mAttenuationLinear);

View File

@ -556,6 +556,10 @@ void AssbinImporter::ReadBinaryLight(IOStream *stream, aiLight *l) {
l->mName = Read<aiString>(stream);
l->mType = (aiLightSourceType)Read<unsigned int>(stream);
l->mPosition = Read<aiVector3D>(stream);
l->mDirection = Read<aiVector3D>(stream);
l->mUp = Read<aiVector3D>(stream);
if (l->mType != aiLightSource_DIRECTIONAL) {
l->mAttenuationConstant = Read<float>(stream);
l->mAttenuationLinear = Read<float>(stream);

View File

@ -304,7 +304,7 @@ void MeshSplitter :: SplitMesh(unsigned int a, aiMesh* in_mesh, std::vector<std:
}
// add the newly created mesh to the list
source_mesh_map.push_back(std::make_pair(out_mesh,a));
source_mesh_map.emplace_back(out_mesh,a);
if (base == in_mesh->mNumFaces) {
break;

View File

@ -88,9 +88,7 @@ void DeleteAllBarePointers(std::vector<T> &x) {
}
}
B3DImporter::~B3DImporter() {
// empty
}
B3DImporter::~B3DImporter() = default;
// ------------------------------------------------------------------------------------------------
bool B3DImporter::CanRead(const std::string &pFile, IOSystem * /*pIOHandler*/, bool /*checkSig*/) const {
@ -479,13 +477,13 @@ void B3DImporter::ReadKEYS(aiNodeAnim *nodeAnim) {
while (ChunkSize()) {
int frame = ReadInt();
if (flags & 1) {
trans.push_back(aiVectorKey(frame, ReadVec3()));
trans.emplace_back(frame, ReadVec3());
}
if (flags & 2) {
scale.push_back(aiVectorKey(frame, ReadVec3()));
scale.emplace_back(frame, ReadVec3());
}
if (flags & 4) {
rot.push_back(aiQuatKey(frame, ReadQuat()));
rot.emplace_back(frame, ReadQuat());
}
}
@ -673,7 +671,7 @@ void B3DImporter::ReadBB3D(aiScene *scene) {
int bone = v.bones[k];
float weight = v.weights[k];
vweights[bone].push_back(aiVertexWeight(vertIdx + faceIndex, weight));
vweights[bone].emplace_back(vertIdx + faceIndex, weight);
}
}
++face;

View File

@ -88,7 +88,7 @@ BVHLoader::BVHLoader() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
BVHLoader::~BVHLoader() {}
BVHLoader::~BVHLoader() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -186,7 +186,7 @@ aiNode *BVHLoader::ReadNode() {
std::vector<aiNode *> childNodes;
// and create an bone entry for it
mNodes.push_back(Node(node));
mNodes.emplace_back(node);
Node &internNode = mNodes.back();
// now read the node's contents

View File

@ -416,10 +416,10 @@ template <>
struct Structure::_defaultInitializer<ErrorPolicy_Fail> {
template <typename T>
void operator()(T & /*out*/, const char * = "") {
void operator()(T & /*out*/, const char *message = "") {
// obviously, it is crucial that _DefaultInitializer is used
// only from within a catch clause.
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error");
throw DeadlyImportError("Constructing BlenderDNA Structure encountered an error: ", message);
}
};

View File

@ -65,8 +65,7 @@ namespace Blender {
struct TempArray {
typedef TCLASS< T*,std::allocator<T*> > mywrap;
TempArray() {
}
TempArray() = default;
~TempArray () {
for(T* elem : arr) {

View File

@ -71,10 +71,6 @@ static const fpCreateModifier creators[] = {
nullptr // sentinel
};
// ------------------------------------------------------------------------------------------------
struct SharedModifierData : ElemBase {
ModifierData modifier;
};
// ------------------------------------------------------------------------------------------------
void BlenderModifierShowcase::ApplyModifiers(aiNode &out, ConversionData &conv_data, const Scene &in, const Object &orig_object) {
@ -157,6 +153,7 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
// hijacking the ABI, see the big note in BlenderModifierShowcase::ApplyModifiers()
const MirrorModifierData &mir = static_cast<const MirrorModifierData &>(orig_modifier);
ai_assert(mir.modifier.type == ModifierData::eModifierType_Mirror);
std::shared_ptr<Object> mirror_ob = mir.mirror_ob.lock();
conv_data.meshes->reserve(conv_data.meshes->size() + out.mNumMeshes);
@ -171,8 +168,8 @@ void BlenderModifier_Mirror ::DoIt(aiNode &out, ConversionData &conv_data, const
const float ys = mir.flag & MirrorModifierData::Flags_AXIS_Y ? -1.f : 1.f;
const float zs = mir.flag & MirrorModifierData::Flags_AXIS_Z ? -1.f : 1.f;
if (mir.mirror_ob) {
const aiVector3D center(mir.mirror_ob->obmat[3][0], mir.mirror_ob->obmat[3][1], mir.mirror_ob->obmat[3][2]);
if (mirror_ob) {
const aiVector3D center(mirror_ob->obmat[3][0], mirror_ob->obmat[3][1], mirror_ob->obmat[3][2]);
for (unsigned int j = 0; j < mesh->mNumVertices; ++j) {
aiVector3D &v = mesh->mVertices[j];

View File

@ -624,7 +624,9 @@ void Structure ::Convert<ListBase>(
const FileDatabase &db) const {
ReadFieldPtr<ErrorPolicy_Igno>(dest.first, "*first", db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.last, "*last", db);
std::shared_ptr<ElemBase> last;
ReadFieldPtr<ErrorPolicy_Igno>(last, "*last", db);
dest.last = last;
db.reader->IncPtr(size);
}
@ -648,7 +650,9 @@ void Structure ::Convert<ModifierData>(
const FileDatabase &db) const {
ReadFieldPtr<ErrorPolicy_Warn>(dest.next, "*next", db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.prev, "*prev", db);
std::shared_ptr<ElemBase> prev;
ReadFieldPtr<ErrorPolicy_Warn>(prev, "*prev", db);
dest.prev = prev;
ReadField<ErrorPolicy_Igno>(dest.type, "type", db);
ReadField<ErrorPolicy_Igno>(dest.mode, "mode", db);
ReadFieldArray<ErrorPolicy_Igno>(dest.name, "name", db);
@ -772,7 +776,9 @@ void Structure ::Convert<MirrorModifierData>(
ReadField<ErrorPolicy_Igno>(dest.axis, "axis", db);
ReadField<ErrorPolicy_Igno>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Igno>(dest.tolerance, "tolerance", db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mirror_ob, "*mirror_ob", db);
std::shared_ptr<Object> mirror_ob;
ReadFieldPtr<ErrorPolicy_Igno>(mirror_ob, "*mirror_ob", db);
dest.mirror_ob = mirror_ob;
db.reader->IncPtr(size);
}
@ -833,9 +839,9 @@ void Structure::Convert<CustomDataLayer>(
ReadField<ErrorPolicy_Fail>(dest.flag, "flag", db);
ReadField<ErrorPolicy_Fail>(dest.active, "active", db);
ReadField<ErrorPolicy_Fail>(dest.active_rnd, "active_rnd", db);
ReadField<ErrorPolicy_Fail>(dest.active_clone, "active_clone", db);
ReadField<ErrorPolicy_Fail>(dest.active_mask, "active_mask", db);
ReadField<ErrorPolicy_Fail>(dest.uid, "uid", db);
ReadField<ErrorPolicy_Warn>(dest.active_clone, "active_clone", db);
ReadField<ErrorPolicy_Warn>(dest.active_mask, "active_mask", db);
ReadField<ErrorPolicy_Warn>(dest.uid, "uid", db);
ReadFieldArray<ErrorPolicy_Warn>(dest.name, "name", db);
ReadCustomDataPtr<ErrorPolicy_Fail>(dest.data, dest.type, "*data", db);

View File

@ -124,7 +124,7 @@ struct ID : ElemBase {
// -------------------------------------------------------------------------------
struct ListBase : ElemBase {
std::shared_ptr<ElemBase> first;
std::shared_ptr<ElemBase> last;
std::weak_ptr<ElemBase> last;
};
// -------------------------------------------------------------------------------
@ -642,14 +642,21 @@ struct ModifierData : ElemBase {
};
std::shared_ptr<ElemBase> next WARN;
std::shared_ptr<ElemBase> prev WARN;
std::weak_ptr<ElemBase> prev WARN;
int type, mode;
char name[32];
};
// ------------------------------------------------------------------------------------------------
struct SharedModifierData : ElemBase {
ModifierData modifier;
};
// -------------------------------------------------------------------------------
struct SubsurfModifierData : ElemBase {
struct SubsurfModifierData : SharedModifierData {
enum Type {
@ -662,7 +669,6 @@ struct SubsurfModifierData : ElemBase {
FLAGS_SubsurfUV = 1 << 3
};
ModifierData modifier FAIL;
short subdivType WARN;
short levels FAIL;
short renderLevels;
@ -670,7 +676,7 @@ struct SubsurfModifierData : ElemBase {
};
// -------------------------------------------------------------------------------
struct MirrorModifierData : ElemBase {
struct MirrorModifierData : SharedModifierData {
enum Flags {
Flags_CLIPPING = 1 << 0,
@ -682,11 +688,9 @@ struct MirrorModifierData : ElemBase {
Flags_VGROUP = 1 << 6
};
ModifierData modifier FAIL;
short axis, flag;
float tolerance;
std::shared_ptr<Object> mirror_ob;
std::weak_ptr<Object> mirror_ob;
};
// -------------------------------------------------------------------------------

View File

@ -274,9 +274,7 @@ BlenderTessellatorP2T::BlenderTessellatorP2T( BlenderBMeshConverter& converter )
}
// ------------------------------------------------------------------------------------------------
BlenderTessellatorP2T::~BlenderTessellatorP2T( )
{
}
// ------------------------------------------------------------------------------------------------
void BlenderTessellatorP2T::Tessellate( const MLoop* polyLoop, int vertexCount, const std::vector< MVert >& vertices )

View File

@ -186,7 +186,7 @@ namespace Assimp
{
public:
BlenderTessellatorP2T( BlenderBMeshConverter& converter );
~BlenderTessellatorP2T( );
~BlenderTessellatorP2T( ) = default;
void Tessellate( const Blender::MLoop* polyLoop, int vertexCount, const std::vector< Blender::MVert >& vertices );

View File

@ -91,15 +91,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
COBImporter::COBImporter() {
// empty
}
COBImporter::COBImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
COBImporter::~COBImporter() {
// empty
}
COBImporter::~COBImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -522,7 +518,7 @@ void COBImporter::ReadMat1_Ascii(Scene &out, LineSplitter &splitter, const Chunk
return;
}
out.materials.push_back(Material());
out.materials.emplace_back();
Material &mat = out.materials.back();
mat = nfo;
@ -753,7 +749,7 @@ void COBImporter::ReadPolH_Ascii(Scene &out, LineSplitter &splitter, const Chunk
ThrowException("Expected Face line");
}
msh.faces.push_back(Face());
msh.faces.emplace_back();
Face &face = msh.faces.back();
face.indices.resize(strtoul10(splitter[2]));
@ -956,7 +952,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const
ThrowException(format("A hole is the first entity in the `PolH` chunk with id ") << nfo.id);
}
} else
msh.faces.push_back(Face());
msh.faces.emplace_back();
Face &f = msh.faces.back();
const size_t num = reader.GetI2();
@ -968,7 +964,7 @@ void COBImporter::ReadPolH_Binary(COB::Scene &out, StreamReaderLE &reader, const
}
for (size_t x = 0; x < num; ++x) {
f.indices.push_back(VertexIndex());
f.indices.emplace_back();
VertexIndex &v = f.indices.back();
v.pos_idx = reader.GetI4();
@ -1008,7 +1004,7 @@ void COBImporter::ReadMat1_Binary(COB::Scene &out, StreamReaderLE &reader, const
const chunk_guard cn(nfo, reader);
out.materials.push_back(Material());
out.materials.emplace_back();
Material &mat = out.materials.back();
mat = nfo;

View File

@ -107,7 +107,7 @@ struct Node : public ChunkInfo
TYPE_MESH,TYPE_GROUP,TYPE_LIGHT,TYPE_CAMERA,TYPE_BONE
};
virtual ~Node() {}
virtual ~Node() = default;
Node(Type type) : type(type), unit_scale(1.f){}
Type type;

View File

@ -85,8 +85,7 @@ CSMImporter::CSMImporter()
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
CSMImporter::~CSMImporter()
{}
CSMImporter::~CSMImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -154,8 +154,7 @@ ColladaExporter::ColladaExporter(const aiScene *pScene, IOSystem *pIOSystem, con
// ------------------------------------------------------------------------------------------------
// Destructor
ColladaExporter::~ColladaExporter() {
}
ColladaExporter::~ColladaExporter() = default;
// ------------------------------------------------------------------------------------------------
// Starts writing the contents
@ -1330,9 +1329,9 @@ void ColladaExporter::WriteAnimationLibrary(size_t pIndex) {
std::vector<std::string> names;
for (size_t i = 0; i < nodeAnim->mNumPositionKeys; ++i) {
if (nodeAnim->mPreState == aiAnimBehaviour_DEFAULT || nodeAnim->mPreState == aiAnimBehaviour_LINEAR || nodeAnim->mPreState == aiAnimBehaviour_REPEAT) {
names.push_back("LINEAR");
names.emplace_back("LINEAR");
} else if (nodeAnim->mPostState == aiAnimBehaviour_CONSTANT) {
names.push_back("STEP");
names.emplace_back("STEP");
}
}

View File

@ -233,7 +233,7 @@ public:
Surface ambient, diffuse, specular, emissive, reflective, transparent, normal;
Property shininess, transparency, index_refraction;
Material() {}
Material() = default;
};
std::map<unsigned int, std::string> textures;

View File

@ -111,9 +111,7 @@ ColladaLoader::ColladaLoader() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
ColladaLoader::~ColladaLoader() {
// empty
}
ColladaLoader::~ColladaLoader() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -1929,7 +1929,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
switch (pInput.mType) {
case IT_Position: // ignore all position streams except 0 - there can be only one position
if (pInput.mIndex == 0) {
pMesh.mPositions.push_back(aiVector3D(obj[0], obj[1], obj[2]));
pMesh.mPositions.emplace_back(obj[0], obj[1], obj[2]);
} else {
ASSIMP_LOG_ERROR("Collada: just one vertex position stream supported");
}
@ -1941,7 +1941,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// ignore all normal streams except 0 - there can be only one normal
if (pInput.mIndex == 0) {
pMesh.mNormals.push_back(aiVector3D(obj[0], obj[1], obj[2]));
pMesh.mNormals.emplace_back(obj[0], obj[1], obj[2]);
} else {
ASSIMP_LOG_ERROR("Collada: just one vertex normal stream supported");
}
@ -1953,7 +1953,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// ignore all tangent streams except 0 - there can be only one tangent
if (pInput.mIndex == 0) {
pMesh.mTangents.push_back(aiVector3D(obj[0], obj[1], obj[2]));
pMesh.mTangents.emplace_back(obj[0], obj[1], obj[2]);
} else {
ASSIMP_LOG_ERROR("Collada: just one vertex tangent stream supported");
}
@ -1966,7 +1966,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
// ignore all bitangent streams except 0 - there can be only one bitangent
if (pInput.mIndex == 0) {
pMesh.mBitangents.push_back(aiVector3D(obj[0], obj[1], obj[2]));
pMesh.mBitangents.emplace_back(obj[0], obj[1], obj[2]);
} else {
ASSIMP_LOG_ERROR("Collada: just one vertex bitangent stream supported");
}
@ -1979,7 +1979,7 @@ void ColladaParser::ExtractDataObjectFromChannel(const InputChannel &pInput, siz
pMesh.mTexCoords[pInput.mIndex].insert(pMesh.mTexCoords[pInput.mIndex].end(),
pMesh.mPositions.size() - pMesh.mTexCoords[pInput.mIndex].size() - 1, aiVector3D(0, 0, 0));
pMesh.mTexCoords[pInput.mIndex].push_back(aiVector3D(obj[0], obj[1], obj[2]));
pMesh.mTexCoords[pInput.mIndex].emplace_back(obj[0], obj[1], obj[2]);
if (0 != acc.mSubOffset[2] || 0 != acc.mSubOffset[3]) {
pMesh.mNumUVComponents[pInput.mIndex] = 3;
}
@ -2113,7 +2113,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
if (s[0] != '#') {
ASSIMP_LOG_ERROR("Collada: Unresolved reference format of node");
} else {
pNode->mNodeInstances.push_back(NodeInstance());
pNode->mNodeInstances.emplace_back();
pNode->mNodeInstances.back().mNode = s.c_str() + 1;
}
}
@ -2129,7 +2129,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
throw DeadlyImportError("Unknown reference format in <instance_light> element");
}
pNode->mLights.push_back(LightInstance());
pNode->mLights.emplace_back();
pNode->mLights.back().mLight = url.c_str() + 1;
}
} else if (currentName == "instance_camera") {
@ -2140,7 +2140,7 @@ void ColladaParser::ReadSceneNode(XmlNode &node, Node *pNode) {
if (url[0] != '#') {
throw DeadlyImportError("Unknown reference format in <instance_camera> element");
}
pNode->mCameras.push_back(CameraInstance());
pNode->mCameras.emplace_back();
pNode->mCameras.back().mCamera = url.c_str() + 1;
}
}

View File

@ -110,16 +110,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
DXFImporter::DXFImporter()
: BaseImporter() {
// empty
}
DXFImporter::DXFImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
DXFImporter::~DXFImporter() {
// empty
}
DXFImporter::~DXFImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -475,7 +470,7 @@ void DXFImporter::ParseBlocks(DXF::LineReader& reader, DXF::FileData& output) {
// ------------------------------------------------------------------------------------------------
void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output) {
// push a new block onto the stack.
output.blocks.push_back( DXF::Block() );
output.blocks.emplace_back();
DXF::Block& block = output.blocks.back();
while( !reader.End() && !reader.Is(0,"ENDBLK")) {
@ -520,7 +515,7 @@ void DXFImporter::ParseBlock(DXF::LineReader& reader, DXF::FileData& output) {
// ------------------------------------------------------------------------------------------------
void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output) {
// Push a new block onto the stack.
output.blocks.push_back( DXF::Block() );
output.blocks.emplace_back();
DXF::Block& block = output.blocks.back();
block.name = AI_DXF_ENTITIES_MAGIC_BLOCK;
@ -550,7 +545,7 @@ void DXFImporter::ParseEntities(DXF::LineReader& reader, DXF::FileData& output)
}
void DXFImporter::ParseInsertion(DXF::LineReader& reader, DXF::FileData& output) {
output.blocks.back().insertions.push_back( DXF::InsertBlock() );
output.blocks.back().insertions.emplace_back();
DXF::InsertBlock& bl = output.blocks.back().insertions.back();
while( !reader.End() && !reader.Is(0)) {

View File

@ -242,7 +242,7 @@ void FBXConverter::ConvertNodes(uint64_t id, aiNode *parent, aiNode *root_node)
ai_assert(nodes_chain.size());
if (need_additional_node) {
nodes_chain.emplace_back(PotentialNode(node_name));
nodes_chain.emplace_back(node_name);
}
//setup metadata on newest node
@ -3319,7 +3319,7 @@ FBXConverter::KeyFrameListList FBXConverter::GetKeyframeList(const std::vector<c
}
}
inputs.push_back(std::make_tuple(Keys, Values, mapto));
inputs.emplace_back(Keys, Values, mapto);
}
}
return inputs; // pray for NRVO :-)
@ -3396,7 +3396,7 @@ FBXConverter::KeyFrameListList FBXConverter::GetRotationKeyframeList(const std::
}
}
}
inputs.push_back(std::make_tuple(Keys, Values, mapto));
inputs.emplace_back(Keys, Values, mapto);
}
}
return inputs;

View File

@ -66,11 +66,7 @@ Deformer::Deformer(uint64_t id, const Element& element, const Document& doc, con
}
// ------------------------------------------------------------------------------------------------
Deformer::~Deformer()
{
}
Deformer::~Deformer() = default;
// ------------------------------------------------------------------------------------------------
Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const std::string& name)
@ -119,11 +115,7 @@ Cluster::Cluster(uint64_t id, const Element& element, const Document& doc, const
// ------------------------------------------------------------------------------------------------
Cluster::~Cluster()
{
}
Cluster::~Cluster() = default;
// ------------------------------------------------------------------------------------------------
Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::string& name)
@ -152,10 +144,7 @@ Skin::Skin(uint64_t id, const Element& element, const Document& doc, const std::
// ------------------------------------------------------------------------------------------------
Skin::~Skin()
{
}
Skin::~Skin() = default;
// ------------------------------------------------------------------------------------------------
BlendShape::BlendShape(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: Deformer(id, element, doc, name)
@ -171,10 +160,7 @@ BlendShape::BlendShape(uint64_t id, const Element& element, const Document& doc,
}
}
// ------------------------------------------------------------------------------------------------
BlendShape::~BlendShape()
{
}
BlendShape::~BlendShape() = default;
// ------------------------------------------------------------------------------------------------
BlendShapeChannel::BlendShapeChannel(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: Deformer(id, element, doc, name)
@ -199,10 +185,7 @@ BlendShapeChannel::BlendShapeChannel(uint64_t id, const Element& element, const
}
}
// ------------------------------------------------------------------------------------------------
BlendShapeChannel::~BlendShapeChannel()
{
}
BlendShapeChannel::~BlendShapeChannel() = default;
// ------------------------------------------------------------------------------------------------
}
}

View File

@ -136,9 +136,7 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
// ------------------------------------------------------------------------------------------------
Material::~Material() {
// empty
}
Material::~Material() = default;
aiVector2D uvTrans;
aiVector2D uvScaling;
@ -255,9 +253,7 @@ Texture::Texture(uint64_t id, const Element& element, const Document& doc, const
}
Texture::~Texture() {
// empty
}
Texture::~Texture() = default;
LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Document& /*doc*/, const std::string& name) :
Object(id,element,name),
@ -276,9 +272,7 @@ LayeredTexture::LayeredTexture(uint64_t id, const Element& element, const Docume
}
}
LayeredTexture::~LayeredTexture() {
// empty
}
LayeredTexture::~LayeredTexture() = default;
void LayeredTexture::fillTexture(const Document& doc) {
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID());

View File

@ -665,9 +665,7 @@ ShapeGeometry::ShapeGeometry(uint64_t id, const Element& element, const std::str
}
// ------------------------------------------------------------------------------------------------
ShapeGeometry::~ShapeGeometry() {
// empty
}
ShapeGeometry::~ShapeGeometry() = default;
// ------------------------------------------------------------------------------------------------
const std::vector<aiVector3D>& ShapeGeometry::GetVertices() const {
return m_vertices;
@ -695,9 +693,7 @@ LineGeometry::LineGeometry(uint64_t id, const Element& element, const std::strin
}
// ------------------------------------------------------------------------------------------------
LineGeometry::~LineGeometry() {
// empty
}
LineGeometry::~LineGeometry() = default;
// ------------------------------------------------------------------------------------------------
const std::vector<aiVector3D>& LineGeometry::GetVertices() const {
return m_vertices;

View File

@ -619,9 +619,9 @@ void ParseVectorDataArray(std::vector<aiVector3D>& out, const Element& el)
if (type == 'd') {
const double* d = reinterpret_cast<const double*>(&buff[0]);
for (unsigned int i = 0; i < count3; ++i, d += 3) {
out.push_back(aiVector3D(static_cast<ai_real>(d[0]),
out.emplace_back(static_cast<ai_real>(d[0]),
static_cast<ai_real>(d[1]),
static_cast<ai_real>(d[2])));
static_cast<ai_real>(d[2]));
}
// for debugging
/*for ( size_t i = 0; i < out.size(); i++ ) {
@ -634,7 +634,7 @@ void ParseVectorDataArray(std::vector<aiVector3D>& out, const Element& el)
else if (type == 'f') {
const float* f = reinterpret_cast<const float*>(&buff[0]);
for (unsigned int i = 0; i < count3; ++i, f += 3) {
out.push_back(aiVector3D(f[0],f[1],f[2]));
out.emplace_back(f[0],f[1],f[2]);
}
}
@ -708,16 +708,16 @@ void ParseVectorDataArray(std::vector<aiColor4D>& out, const Element& el)
if (type == 'd') {
const double* d = reinterpret_cast<const double*>(&buff[0]);
for (unsigned int i = 0; i < count4; ++i, d += 4) {
out.push_back(aiColor4D(static_cast<float>(d[0]),
out.emplace_back(static_cast<float>(d[0]),
static_cast<float>(d[1]),
static_cast<float>(d[2]),
static_cast<float>(d[3])));
static_cast<float>(d[3]));
}
}
else if (type == 'f') {
const float* f = reinterpret_cast<const float*>(&buff[0]);
for (unsigned int i = 0; i < count4; ++i, f += 4) {
out.push_back(aiColor4D(f[0],f[1],f[2],f[3]));
out.emplace_back(f[0],f[1],f[2],f[3]);
}
}
return;
@ -789,13 +789,13 @@ void ParseVectorDataArray(std::vector<aiVector2D>& out, const Element& el) {
if (type == 'd') {
const double* d = reinterpret_cast<const double*>(&buff[0]);
for (unsigned int i = 0; i < count2; ++i, d += 2) {
out.push_back(aiVector2D(static_cast<float>(d[0]),
static_cast<float>(d[1])));
out.emplace_back(static_cast<float>(d[0]),
static_cast<float>(d[1]));
}
} else if (type == 'f') {
const float* f = reinterpret_cast<const float*>(&buff[0]);
for (unsigned int i = 0; i < count2; ++i, f += 2) {
out.push_back(aiVector2D(f[0],f[1]));
out.emplace_back(f[0],f[1]);
}
}

View File

@ -60,26 +60,20 @@ namespace FBX {
using namespace Util;
// ------------------------------------------------------------------------------------------------
Property::Property()
{
}
Property::Property() = default;
// ------------------------------------------------------------------------------------------------
Property::~Property()
{
}
// ------------------------------------------------------------------------------------------------
Property::~Property() = default;
namespace {
namespace {
void checkTokenCount(const TokenList& tok, unsigned int expectedCount)
{
void checkTokenCount(const TokenList &tok, unsigned int expectedCount) {
ai_assert(expectedCount >= 2);
if (tok.size() < expectedCount) {
const std::string& s = ParseTokenAsString(*tok[1]);
const std::string &s = ParseTokenAsString(*tok[1]);
if (tok[1]->IsBinary()) {
throw DeadlyImportError("Not enough tokens for property of type ", s, " at offset ", tok[1]->Offset());
}
else {
} else {
throw DeadlyImportError("Not enough tokens for property of type ", s, " at line ", tok[1]->Line());
}
}

View File

@ -79,9 +79,7 @@ Token::Token(const char* sbegin, const char* send, TokenType type, unsigned int
}
// ------------------------------------------------------------------------------------------------
Token::~Token()
{
}
namespace {

View File

@ -96,7 +96,7 @@ public:
/** construct a binary token */
Token(const char* sbegin, const char* send, TokenType type, size_t offset);
~Token();
~Token() = default;
public:
std::string StringContents() const {

View File

@ -72,15 +72,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
HMPImporter::HMPImporter() {
// nothing to do here
}
HMPImporter::HMPImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
HMPImporter::~HMPImporter() {
// nothing to do here
}
HMPImporter::~HMPImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -310,7 +310,7 @@ bool IntersectsBoundaryProfile(const IfcVector3 &e0, const IfcVector3 &e1, const
if (IfcVector2(diff.x, diff.y).SquareLength() < 1e-10)
continue;
}
intersect_results.push_back(std::make_pair(i, e0));
intersect_results.emplace_back(i, e0);
continue;
}
@ -324,7 +324,7 @@ bool IntersectsBoundaryProfile(const IfcVector3 &e0, const IfcVector3 &e1, const
if (IfcVector2(diff.x, diff.y).SquareLength() < 1e-10)
continue;
}
intersect_results.push_back(std::make_pair(i, p));
intersect_results.emplace_back(i, p);
}
}
@ -504,7 +504,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const Schema_2x3::IfcPoly
}
// now add them to the list of intersections
for (size_t b = 0; b < intersected_boundary.size(); ++b)
intersections.push_back(std::make_tuple(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first));
intersections.emplace_back(a, proj_inv * intersected_boundary[b].second, intersected_boundary[b].first);
// and calculate our new inside/outside state
if (intersected_boundary.size() & 1)

View File

@ -224,7 +224,7 @@ public:
IFCImporter::LogVerboseDebug("ignoring transition code on composite curve segment, only continuous transitions are supported");
}
curves.push_back( CurveEntry(bc,IsTrue(curveSegment.SameSense)) );
curves.emplace_back(bc,IsTrue(curveSegment.SameSense) );
total += bc->GetParametricRangeDelta();
}

View File

@ -170,7 +170,7 @@ void ProcessPolygonBoundaries(TempMesh& result, const TempMesh& inmesh, size_t m
continue;
}
fake_openings.push_back(TempOpening());
fake_openings.emplace_back();
TempOpening& opening = fake_openings.back();
opening.extrusionDir = master_normal;
@ -612,7 +612,7 @@ void ProcessExtrudedArea(const Schema_2x3::IfcExtrudedAreaSolid& solid, const Te
TempMesh& bounds = *t.profileMesh.get();
if( bounds.mVerts.size() <= 2 ) {
nors.push_back(IfcVector3());
nors.emplace_back();
continue;
}
auto nor = ((bounds.mVerts[2] - bounds.mVerts[0]) ^ (bounds.mVerts[1] - bounds.mVerts[0])).Normalize();

View File

@ -120,12 +120,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
IFCImporter::IFCImporter() {}
IFCImporter::IFCImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
IFCImporter::~IFCImporter() {
}
IFCImporter::~IFCImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -114,9 +114,9 @@ void QuadrifyPart(const IfcVector2& pmin, const IfcVector2& pmax, XYSortedField&
if (!found) {
// the rectangle [pmin,pend] is opaque, fill it
out.push_back(pmin);
out.push_back(IfcVector2(pmin.x,pmax.y));
out.emplace_back(pmin.x,pmax.y);
out.push_back(pmax);
out.push_back(IfcVector2(pmax.x,pmin.y));
out.emplace_back(pmax.x,pmin.y);
return;
}
@ -126,9 +126,9 @@ void QuadrifyPart(const IfcVector2& pmin, const IfcVector2& pmax, XYSortedField&
// see if there's an offset to fill at the top of our quad
if (xs - pmin.x) {
out.push_back(pmin);
out.push_back(IfcVector2(pmin.x,pmax.y));
out.push_back(IfcVector2(xs,pmax.y));
out.push_back(IfcVector2(xs,pmin.y));
out.emplace_back(pmin.x,pmax.y);
out.emplace_back(xs,pmax.y);
out.emplace_back(xs,pmin.y);
}
// search along the y-axis for all openings that overlap xs and our quad
@ -159,10 +159,10 @@ void QuadrifyPart(const IfcVector2& pmin, const IfcVector2& pmax, XYSortedField&
}
if (!found) {
// the rectangle [pmin,pend] is opaque, fill it
out.push_back(IfcVector2(xs,pmin.y));
out.push_back(IfcVector2(xs,pmax.y));
out.push_back(IfcVector2(xe,pmax.y));
out.push_back(IfcVector2(xe,pmin.y));
out.emplace_back(xs,pmin.y);
out.emplace_back(xs,pmax.y);
out.emplace_back(xe,pmax.y);
out.emplace_back(xe,pmin.y);
return;
}
if (ylast < pmax.y) {
@ -342,7 +342,7 @@ void InsertWindowContours(const ContourVector& contours,
if ((contour[a] - edge).SquareLength() > diag*diag*0.7) {
continue;
}
curmesh.mVerts.push_back(IfcVector3(contour[a].x, contour[a].y, 0.0f));
curmesh.mVerts.emplace_back(contour[a].x, contour[a].y, 0.0f);
}
if (edge != contour[last_hit]) {
@ -363,7 +363,7 @@ void InsertWindowContours(const ContourVector& contours,
corner.y = bb.second.y;
}
curmesh.mVerts.push_back(IfcVector3(corner.x, corner.y, 0.0f));
curmesh.mVerts.emplace_back(corner.x, corner.y, 0.0f);
}
else if (cnt == 1) {
// avoid degenerate polygons (also known as lines or points)
@ -399,7 +399,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
ClipperLib::Polygon clip;
for(const IfcVector2& pip : a) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if (ClipperLib::Orientation(clip)) {
@ -410,7 +410,7 @@ void MergeWindowContours (const std::vector<IfcVector2>& a,
clip.clear();
for(const IfcVector2& pip : b) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if (ClipperLib::Orientation(clip)) {
@ -433,7 +433,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
ClipperLib::Polygon clip;
for(const IfcVector2& pip : a) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if (ClipperLib::Orientation(clip)) {
@ -444,7 +444,7 @@ void MakeDisjunctWindowContours (const std::vector<IfcVector2>& a,
clip.clear();
for(const IfcVector2& pip : b) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if (ClipperLib::Orientation(clip)) {
@ -466,7 +466,7 @@ void CleanupWindowContour(ProjectedWindowContour& window)
ClipperLib::ExPolygons clipped;
for(const IfcVector2& pip : contour) {
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
subject.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
clipper.AddPolygon(subject,ClipperLib::ptSubject);
@ -524,7 +524,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
ClipperLib::Polygon clip;
clip.reserve(contour_flat.size());
for(const IfcVector2& pip : contour_flat) {
clip.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
clip.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if (!ClipperLib::Orientation(clip)) {
@ -544,7 +544,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
continue;
}
}
subject.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
subject.emplace_back(to_int64(pip.x), to_int64(pip.y));
if (--countdown == 0) {
if (!ClipperLib::Orientation(subject)) {
std::reverse(subject.begin(), subject.end());
@ -558,10 +558,10 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
for(const ClipperLib::ExPolygon& ex : clipped) {
iold.push_back(static_cast<unsigned int>(ex.outer.size()));
for(const ClipperLib::IntPoint& point : ex.outer) {
vold.push_back(IfcVector3(
vold.emplace_back(
from_int64(point.X),
from_int64(point.Y),
0.0f));
0.0f);
}
}
@ -1039,7 +1039,7 @@ void Quadrify(const std::vector< BoundingBox >& bbs, TempMesh& curmesh)
curmesh.mVertcnt.resize(quads.size()/4,4);
curmesh.mVerts.reserve(quads.size());
for(const IfcVector2& v2 : quads) {
curmesh.mVerts.push_back(IfcVector3(v2.x, v2.y, static_cast<IfcFloat>(0.0)));
curmesh.mVerts.emplace_back(v2.x, v2.y, static_cast<IfcFloat>(0.0));
}
}
@ -1095,7 +1095,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
vmin = std::min(vv, vmin);
vmax = std::max(vv, vmax);
out_contour.push_back(IfcVector2(vv.x,vv.y));
out_contour.emplace_back(vv.x,vv.y);
}
zcoord /= in_verts.size();
@ -1128,7 +1128,7 @@ IfcMatrix4 ProjectOntoPlane(std::vector<IfcVector2>& out_contour, const TempMesh
for(const IfcVector3& x : in_verts) {
const IfcVector3& vv = m * x;
out_contour2.push_back(IfcVector2(vv.x,vv.y));
out_contour2.emplace_back(vv.x,vv.y);
ai_assert(std::fabs(vv.z) < vmax.z + 1e-8);
}
@ -1378,12 +1378,12 @@ bool GenerateOpenings(std::vector<TempOpening>& openings,
if(!temp_contour.empty()) {
if (generate_connection_geometry) {
contours_to_openings.push_back(std::vector<TempOpening*>(
contours_to_openings.emplace_back(
joined_openings.begin(),
joined_openings.end()));
joined_openings.end());
}
contours.push_back(ProjectedWindowContour(temp_contour, bb, is_rectangle));
contours.emplace_back(temp_contour, bb, is_rectangle);
}
}
@ -1469,7 +1469,7 @@ std::vector<IfcVector2> GetContourInPlane2D(const std::shared_ptr<TempMesh>& mes
// XXX should not be necessary - but it is. Why? For precision reasons?
vv = is_extruded_side ? vv_extr : vv;
contour.push_back(IfcVector2(vv.x,vv.y));
contour.emplace_back(vv.x,vv.y);
}
ok = true;
@ -1758,7 +1758,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,
vmin = std::min(IfcVector2(vv.x, vv.y), vmin);
vmax = std::max(IfcVector2(vv.x, vv.y), vmax);
contour_flat.push_back(IfcVector2(vv.x,vv.y));
contour_flat.emplace_back(vv.x,vv.y);
}
// With the current code in DerivePlaneCoordinateSpace,
@ -1791,7 +1791,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,
pip.x = (pip.x - vmin.x) / vmax.x;
pip.y = (pip.y - vmin.y) / vmax.y;
hole.push_back(ClipperLib::IntPoint(to_int64(pip.x),to_int64(pip.y)));
hole.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if(!ClipperLib::Orientation(hole)) {
@ -1833,7 +1833,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,
pip.x = (pip.x - vmin.x) / vmax.x;
pip.y = (pip.y - vmin.y) / vmax.y;
poly.push_back(ClipperLib::IntPoint( to_int64(pip.x), to_int64(pip.y) ));
poly.emplace_back(to_int64(pip.x), to_int64(pip.y));
}
if (ClipperLib::Orientation(poly)) {
@ -1891,7 +1891,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,
// Build the poly2tri inner contours for all holes we got from ClipperLib
for(ClipperLib::Polygon& opening : clip.holes) {
contours.push_back(std::vector<p2t::Point*>());
contours.emplace_back();
std::vector<p2t::Point*>& contour = contours.back();
for(ClipperLib::IntPoint& point : opening) {

View File

@ -108,10 +108,10 @@ void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& de
const IfcFloat x = cprofile->XDim*0.5f, y = cprofile->YDim*0.5f;
meshout.mVerts.reserve(meshout.mVerts.size()+4);
meshout.mVerts.push_back( IfcVector3( x, y, 0.f ));
meshout.mVerts.push_back( IfcVector3(-x, y, 0.f ));
meshout.mVerts.push_back( IfcVector3(-x,-y, 0.f ));
meshout.mVerts.push_back( IfcVector3( x,-y, 0.f ));
meshout.mVerts.emplace_back( x, y, 0.f );
meshout.mVerts.emplace_back(-x, y, 0.f );
meshout.mVerts.emplace_back(-x,-y, 0.f );
meshout.mVerts.emplace_back( x,-y, 0.f );
meshout.mVertcnt.push_back(4);
}
else if( const Schema_2x3::IfcCircleProfileDef* const circle = def.ToPtr<Schema_2x3::IfcCircleProfileDef>()) {
@ -125,7 +125,7 @@ void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& de
IfcFloat angle = 0.f;
for(size_t i = 0; i < segments; ++i, angle += delta) {
meshout.mVerts.push_back( IfcVector3( std::cos(angle)*radius, std::sin(angle)*radius, 0.f ));
meshout.mVerts.emplace_back( std::cos(angle)*radius, std::sin(angle)*radius, 0.f );
}
meshout.mVertcnt.push_back(static_cast<unsigned int>(segments));
@ -136,18 +136,18 @@ void ProcessParametrizedProfile(const Schema_2x3::IfcParameterizedProfileDef& de
const IfcFloat inner_height = ishape->OverallDepth - ishape->FlangeThickness * 2;
meshout.mVerts.reserve(12);
meshout.mVerts.push_back(IfcVector3(0,0,0));
meshout.mVerts.push_back(IfcVector3(0,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(offset,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(offset,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(0,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(0,ishape->OverallDepth,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->OverallDepth,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0));
meshout.mVerts.push_back(IfcVector3(offset+ishape->WebThickness,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,ishape->FlangeThickness,0));
meshout.mVerts.push_back(IfcVector3(ishape->OverallWidth,0,0));
meshout.mVerts.emplace_back(0,0,0);
meshout.mVerts.emplace_back(0,ishape->FlangeThickness,0);
meshout.mVerts.emplace_back(offset,ishape->FlangeThickness,0);
meshout.mVerts.emplace_back(offset,ishape->FlangeThickness + inner_height,0);
meshout.mVerts.emplace_back(0,ishape->FlangeThickness + inner_height,0);
meshout.mVerts.emplace_back(0,ishape->OverallDepth,0);
meshout.mVerts.emplace_back(ishape->OverallWidth,ishape->OverallDepth,0);
meshout.mVerts.emplace_back(ishape->OverallWidth,ishape->FlangeThickness + inner_height,0);
meshout.mVerts.emplace_back(offset+ishape->WebThickness,ishape->FlangeThickness + inner_height,0);
meshout.mVerts.emplace_back(offset+ishape->WebThickness,ishape->FlangeThickness,0);
meshout.mVerts.emplace_back(ishape->OverallWidth,ishape->FlangeThickness,0);
meshout.mVerts.emplace_back(ishape->OverallWidth,0,0);
meshout.mVertcnt.push_back(12);
}

View File

@ -201,7 +201,7 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
size_t vidx = std::accumulate(mVertcnt.begin(),begin,0);
for(iit = begin; iit != end; vidx += *iit++) {
if (!*iit) {
normals.push_back(IfcVector3());
normals.emplace_back();
continue;
}
for(size_t vofs = 0, cnt = 0; vofs < *iit; ++vofs) {
@ -215,7 +215,7 @@ void TempMesh::ComputePolygonNormals(std::vector<IfcVector3>& normals,
++cnt;
}
normals.push_back(IfcVector3());
normals.emplace_back();
NewellNormal<4,4,4>(normals.back(),*iit,&temp[0],&temp[1],&temp[2]);
}

View File

@ -344,8 +344,7 @@ protected:
public:
typedef std::pair<IfcFloat, IfcFloat> ParamRange;
virtual ~Curve() {}
virtual ~Curve() = default;
// check if a curve is closed
virtual bool IsClosed() const = 0;

View File

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

View File

@ -88,9 +88,7 @@ IRRImporter::IRRImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
IRRImporter::~IRRImporter() {
// empty
}
IRRImporter::~IRRImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -628,7 +626,7 @@ void IRRImporter::GenerateGraph(Node *root, aiNode *rootOut, aiScene *scene,
ASSIMP_LOG_ERROR("IRR: Unable to load external file: ", root->meshPath);
break;
}
attach.push_back(AttachmentInfo(localScene, rootOut));
attach.emplace_back(localScene, rootOut);
// Now combine the material we've loaded for this mesh
// with the real materials we got from the file. As we
@ -979,7 +977,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// Materials can occur for nearly any type of node
if (inMaterials && curNode->type != Node::DUMMY) {
// This is a material description - parse it!
curNode->materials.push_back(std::pair<aiMaterial *, unsigned int>());
curNode->materials.emplace_back();
std::pair<aiMaterial *, unsigned int> &p = curNode->materials.back();
p.first = ParseMaterial(p.second);
@ -988,7 +986,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
} else if (inAnimator) {
// This is an animation path - add a new animator
// to the list.
curNode->animators.push_back(Animator());
curNode->animators.emplace_back();
curAnim = &curNode->animators.back();
++guessedAnimCnt;
@ -1015,7 +1013,7 @@ void IRRImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
// here N is the ONE-based index of the point
if (prop.name.length() >= 6 && prop.name.substr(0, 5) == "Point") {
// Add a new key to the list
curAnim->splineKeys.push_back(aiVectorKey());
curAnim->splineKeys.emplace_back();
aiVectorKey &key = curAnim->splineKeys.back();
// and parse its properties

View File

@ -206,8 +206,7 @@ private:
*/
struct SkyboxVertex
{
SkyboxVertex()
{}
SkyboxVertex() = default;
//! Construction from single vertex components
SkyboxVertex(ai_real px, ai_real py, ai_real pz,

View File

@ -79,7 +79,7 @@ IRRMeshImporter::IRRMeshImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
IRRMeshImporter::~IRRMeshImporter() {}
IRRMeshImporter::~IRRMeshImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -218,7 +218,7 @@ void LWOImporter::CopyFaceIndicesLWOB(FaceList::iterator& it,
// ------------------------------------------------------------------------------------------------
LWO::Texture* LWOImporter::SetupNewTextureLWOB(LWO::TextureList& list,unsigned int size)
{
list.push_back(LWO::Texture());
list.emplace_back();
LWO::Texture* tex = &list.back();
std::string type;

View File

@ -338,13 +338,7 @@ struct Face : public aiFace {
uint32_t type;
//! Assignment operator
Face &operator=(const LWO::Face &f) {
aiFace::operator=(f);
surfaceIndex = f.surfaceIndex;
smoothGroup = f.smoothGroup;
type = f.type;
return *this;
}
Face &operator=(const LWO::Face &f) = default;
};
// ---------------------------------------------------------------------------
@ -354,7 +348,7 @@ struct VMapEntry {
explicit VMapEntry(unsigned int _dims) :
dims(_dims) {}
virtual ~VMapEntry() {}
virtual ~VMapEntry() = default;
//! allocates memory for the vertex map
virtual void Allocate(unsigned int num) {

View File

@ -100,9 +100,7 @@ LWOImporter::LWOImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
LWOImporter::~LWOImporter() {
// empty
}
LWOImporter::~LWOImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -1097,7 +1095,7 @@ void LWOImporter::LoadLWO2VertexMap(unsigned int length, bool perPoly) {
void LWOImporter::LoadLWO2Clip(unsigned int length) {
AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 10);
mClips.push_back(LWO::Clip());
mClips.emplace_back();
LWO::Clip &clip = mClips.back();
// first - get the index of the clip
@ -1167,7 +1165,7 @@ void LWOImporter::LoadLWO2Clip(unsigned int length) {
void LWOImporter::LoadLWO3Clip(unsigned int length) {
AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 12);
mClips.push_back(LWO::Clip());
mClips.emplace_back();
LWO::Clip &clip = mClips.back();
// first - get the index of the clip
@ -1240,7 +1238,7 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length) {
LE_NCONST uint8_t *const end = mFileBuffer + length;
AI_LWO_VALIDATE_CHUNK_LENGTH(length, ENVL, 4);
mEnvelopes.push_back(LWO::Envelope());
mEnvelopes.emplace_back();
LWO::Envelope &envelope = mEnvelopes.back();
// Get the index of the envelope
@ -1292,7 +1290,7 @@ void LWOImporter::LoadLWO2Envelope(unsigned int length) {
case AI_LWO_KEY: {
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, KEY, 8);
envelope.keys.push_back(LWO::Key());
envelope.keys.emplace_back();
LWO::Key &key = envelope.keys.back();
key.time = GetF4();
@ -1348,7 +1346,7 @@ void LWOImporter::LoadLWO3Envelope(unsigned int length) {
LE_NCONST uint8_t *const end = mFileBuffer + length;
AI_LWO_VALIDATE_CHUNK_LENGTH(length, ENVL, 4);
mEnvelopes.push_back(LWO::Envelope());
mEnvelopes.emplace_back();
LWO::Envelope &envelope = mEnvelopes.back();
// Get the index of the envelope
@ -1390,7 +1388,7 @@ void LWOImporter::LoadLWO3Envelope(unsigned int length) {
case AI_LWO_KEY: {
AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, KEY, 10);
envelope.keys.push_back(LWO::Key());
envelope.keys.emplace_back();
LWO::Key &key = envelope.keys.back();
key.time = GetF4();

View File

@ -707,12 +707,10 @@ void LWOImporter::LoadNodalBlocks(unsigned int size) {
if (mFileBuffer + head.length > end) {
throw DeadlyImportError("LWO3: cannot read length; LoadNodalBlocks");
}
int node_idx = 0;
uint8_t *const next = mFileBuffer + head.length;
mFileBuffer += bufOffset;
switch (head.type) {
case AI_LWO_NNDS:
node_idx++;
LoadNodes(head.length);
break;
}

View File

@ -90,7 +90,7 @@ void LWS::Element::Parse(const char *&buffer) {
} else if (*buffer == '}')
return;
children.push_back(Element());
children.emplace_back();
// copy data line - read token per token
@ -141,9 +141,7 @@ LWSImporter::LWSImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
LWSImporter::~LWSImporter() {
// nothing to do here
}
LWSImporter::~LWSImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -199,7 +197,7 @@ void LWSImporter::ReadEnvelope(const LWS::Element &dad, LWO::Envelope &fill) {
const char *c = (*it).tokens[1].c_str();
if ((*it).tokens[0] == "Key") {
fill.keys.push_back(LWO::Key());
fill.keys.emplace_back();
LWO::Key &key = fill.keys.back();
float f;
@ -262,7 +260,7 @@ void LWSImporter::ReadEnvelope_Old(
num = strtoul10((*it).tokens[0].c_str());
for (unsigned int i = 0; i < num; ++i) {
nodes.channels.push_back(LWO::Envelope());
nodes.channels.emplace_back();
LWO::Envelope &envl = nodes.channels.back();
envl.index = i;
@ -384,7 +382,7 @@ void LWSImporter::BuildGraph(aiNode *nd, LWS::NodeDesc &src, std::vector<Attachm
//Push attachment, if the object came from an external file
if (obj) {
attach.push_back(AttachmentInfo(obj, nd));
attach.emplace_back(obj, nd);
}
}
@ -516,7 +514,7 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
std::list<LWS::NodeDesc> nodes;
unsigned int cur_light = 0, cur_camera = 0, cur_object = 0;
unsigned int num_light = 0, num_camera = 0, num_object = 0;
unsigned int num_light = 0, num_camera = 0;
// check magic identifier, 'LWSC'
bool motion_file = false;
@ -586,7 +584,6 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
d.id = batch.AddLoadRequest(path, 0, &props);
nodes.push_back(d);
++num_object;
} else if ((*it).tokens[0] == "LoadObject") { // 'LoadObject': load a LWO file into the scene-graph
// add node to list
@ -604,7 +601,6 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
d.path = path;
nodes.push_back(d);
++num_object;
} else if ((*it).tokens[0] == "AddNullObject") { // 'AddNullObject': add a dummy node to the hierarchy
// add node to list
@ -618,8 +614,6 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
}
d.name = c;
nodes.push_back(d);
num_object++;
}
// 'NumChannels': Number of envelope channels assigned to last layer
else if ((*it).tokens[0] == "NumChannels") {
@ -641,7 +635,7 @@ void LWSImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSy
}
// important: index of channel
nodes.back().channels.push_back(LWO::Envelope());
nodes.back().channels.emplace_back();
LWO::Envelope &env = nodes.back().channels.back();
env.index = strtoul10(c);

View File

@ -69,7 +69,7 @@ namespace LWS {
*/
class Element {
public:
Element() {}
Element() = default;
// first: name, second: rest
std::string tokens[2];

View File

@ -102,8 +102,7 @@ MD2Importer::MD2Importer()
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MD2Importer::~MD2Importer()
{}
MD2Importer::~MD2Importer() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -144,7 +144,7 @@ bool Q3Shader::LoadShader(ShaderData &fill, const std::string &pFile, IOSystem *
if (*buff == '{') {
++buff;
// add new map section
curData->maps.push_back(Q3Shader::ShaderMapBlock());
curData->maps.emplace_back();
curMap = &curData->maps.back();
for (; SkipSpacesAndLineEnd(&buff); SkipLine(&buff)) {
@ -209,7 +209,7 @@ bool Q3Shader::LoadShader(ShaderData &fill, const std::string &pFile, IOSystem *
}
} else {
// add new section
fill.blocks.push_back(Q3Shader::ShaderDataBlock());
fill.blocks.emplace_back();
curData = &fill.blocks.back();
// get the name of this section
@ -249,7 +249,7 @@ bool Q3Shader::LoadSkin(SkinData &fill, const std::string &pFile, IOSystem *io)
if (!::strncmp(&ss[0], "tag_", std::min((size_t)4, ss.length())))
continue;
fill.textures.push_back(SkinData::TextureEntry());
fill.textures.emplace_back();
SkinData::TextureEntry &entry = fill.textures.back();
entry.first = ss;
@ -345,7 +345,7 @@ MD3Importer::MD3Importer() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MD3Importer::~MD3Importer() {}
MD3Importer::~MD3Importer() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -584,7 +584,7 @@ bool MD3Importer::ReadMultipartFile() {
// original root
scene_lower->mRootNode->mName.Set("lower");
attach.push_back(AttachmentInfo(scene_lower, nd));
attach.emplace_back(scene_lower, nd);
// tag_torso
tag_torso = scene_lower->mRootNode->FindNode("tag_torso");
@ -593,7 +593,7 @@ bool MD3Importer::ReadMultipartFile() {
goto error_cleanup;
}
scene_upper->mRootNode->mName.Set("upper");
attach.push_back(AttachmentInfo(scene_upper, tag_torso));
attach.emplace_back(scene_upper, tag_torso);
// tag_head
tag_head = scene_upper->mRootNode->FindNode("tag_head");
@ -602,7 +602,7 @@ bool MD3Importer::ReadMultipartFile() {
goto error_cleanup;
}
scene_head->mRootNode->mName.Set("head");
attach.push_back(AttachmentInfo(scene_head, tag_head));
attach.emplace_back(scene_head, tag_head);
// Remove tag_head and tag_torso from all other model parts ...
// this ensures (together with AI_INT_MERGE_SCENE_GEN_UNIQUE_NAMES_IF_NECESSARY)

View File

@ -94,9 +94,7 @@ MD5Importer::MD5Importer() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MD5Importer::~MD5Importer() {
// empty
}
MD5Importer::~MD5Importer() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -76,7 +76,7 @@ MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) {
// and read all sections until we're finished
bool running = true;
while (running) {
mSections.push_back(Section());
mSections.emplace_back();
Section &sec = mSections.back();
if (!ParseSection(sec)) {
break;
@ -158,7 +158,7 @@ bool MD5Parser::ParseSection(Section &out) {
break;
}
out.mElements.push_back(Element());
out.mElements.emplace_back();
Element &elem = out.mElements.back();
elem.iLineNumber = lineNumber;
@ -253,7 +253,7 @@ MD5MeshParser::MD5MeshParser(SectionList &mSections) {
} else if ((*iter).mName == "joints") {
// "origin" -1 ( -0.000000 0.016430 -0.006044 ) ( 0.707107 0.000000 0.707107 )
for (const auto &elem : (*iter).mElements) {
mJoints.push_back(BoneDesc());
mJoints.emplace_back();
BoneDesc &desc = mJoints.back();
const char *sz = elem.szStart;
@ -267,7 +267,7 @@ MD5MeshParser::MD5MeshParser(SectionList &mSections) {
AI_MD5_READ_TRIPLE(desc.mRotationQuat); // normalized quaternion, so w is not there
}
} else if ((*iter).mName == "mesh") {
mMeshes.push_back(MeshDesc());
mMeshes.emplace_back();
MeshDesc &desc = mMeshes.back();
for (const auto &elem : (*iter).mElements) {
@ -364,7 +364,7 @@ MD5AnimParser::MD5AnimParser(SectionList &mSections) {
if ((*iter).mName == "hierarchy") {
// "sheath" 0 63 6
for (const auto &elem : (*iter).mElements) {
mAnimatedBones.push_back(AnimBoneDesc());
mAnimatedBones.emplace_back();
AnimBoneDesc &desc = mAnimatedBones.back();
const char *sz = elem.szStart;
@ -389,7 +389,7 @@ MD5AnimParser::MD5AnimParser(SectionList &mSections) {
for (const auto &elem : (*iter).mElements) {
const char *sz = elem.szStart;
mBaseFrames.push_back(BaseFrameDesc());
mBaseFrames.emplace_back();
BaseFrameDesc &desc = mBaseFrames.back();
AI_MD5_READ_TRIPLE(desc.vPositionXYZ);
@ -401,7 +401,7 @@ MD5AnimParser::MD5AnimParser(SectionList &mSections) {
continue;
}
mFrames.push_back(FrameDesc());
mFrames.emplace_back();
FrameDesc &desc = mFrames.back();
desc.iIndex = strtoul10((*iter).mGlobalValue.c_str());
@ -459,7 +459,7 @@ MD5CameraParser::MD5CameraParser(SectionList &mSections) {
for (const auto &elem : (*iter).mElements) {
const char *sz = elem.szStart;
frames.push_back(CameraAnimFrameDesc());
frames.emplace_back();
CameraAnimFrameDesc &cur = frames.back();
AI_MD5_READ_TRIPLE(cur.vPositionXYZ);
AI_MD5_READ_TRIPLE(cur.vRotationQuat);

View File

@ -105,9 +105,7 @@ MDCImporter::MDCImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MDCImporter::~MDCImporter() {
// empty
}
MDCImporter::~MDCImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -271,13 +269,13 @@ void MDCImporter::InternReadFile(
pcMesh->mMaterialIndex = (unsigned int)aszShaders.size();
// create a new shader
aszShaders.push_back(std::string(pcShader->ucName,
::strnlen(pcShader->ucName, sizeof(pcShader->ucName))));
aszShaders.emplace_back(pcShader->ucName,
::strnlen(pcShader->ucName, sizeof(pcShader->ucName)));
}
// need to create a default material
else if (UINT_MAX == iDefaultMatIndex) {
pcMesh->mMaterialIndex = iDefaultMatIndex = (unsigned int)aszShaders.size();
aszShaders.push_back(std::string());
aszShaders.emplace_back();
}
// otherwise assign a reference to the default material
else

View File

@ -68,8 +68,7 @@ UniqueNameGenerator::UniqueNameGenerator(const char *template_name, const char *
separator_(separator) {
}
UniqueNameGenerator::~UniqueNameGenerator() {
}
UniqueNameGenerator::~UniqueNameGenerator() = default;
void UniqueNameGenerator::make_unique(std::vector<std::string> &names) {
struct DuplicateInfo {

View File

@ -98,9 +98,7 @@ MDLImporter::MDLImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MDLImporter::~MDLImporter() {
// empty
}
MDLImporter::~MDLImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -83,9 +83,7 @@ MMDImporter::MMDImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor.
MMDImporter::~MMDImporter() {
// empty
}
MMDImporter::~MMDImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns true, if file is an pmx file.
@ -271,43 +269,30 @@ aiMesh *MMDImporter::CreateMesh(const pmx::PmxModel *pModel,
dynamic_cast<pmx::PmxVertexSkinningSDEF *>(v->skinning.get());
switch (v->skinning_type) {
case pmx::PmxVertexSkinningType::BDEF1:
bone_vertex_map[vsBDEF1_ptr->bone_index].push_back(
aiVertexWeight(index, 1.0));
bone_vertex_map[vsBDEF1_ptr->bone_index].emplace_back(index, 1.0);
break;
case pmx::PmxVertexSkinningType::BDEF2:
bone_vertex_map[vsBDEF2_ptr->bone_index1].push_back(
aiVertexWeight(index, vsBDEF2_ptr->bone_weight));
bone_vertex_map[vsBDEF2_ptr->bone_index2].push_back(
aiVertexWeight(index, 1.0f - vsBDEF2_ptr->bone_weight));
bone_vertex_map[vsBDEF2_ptr->bone_index1].emplace_back(index, vsBDEF2_ptr->bone_weight);
bone_vertex_map[vsBDEF2_ptr->bone_index2].emplace_back(index, 1.0f - vsBDEF2_ptr->bone_weight);
break;
case pmx::PmxVertexSkinningType::BDEF4:
bone_vertex_map[vsBDEF4_ptr->bone_index1].push_back(
aiVertexWeight(index, vsBDEF4_ptr->bone_weight1));
bone_vertex_map[vsBDEF4_ptr->bone_index2].push_back(
aiVertexWeight(index, vsBDEF4_ptr->bone_weight2));
bone_vertex_map[vsBDEF4_ptr->bone_index3].push_back(
aiVertexWeight(index, vsBDEF4_ptr->bone_weight3));
bone_vertex_map[vsBDEF4_ptr->bone_index4].push_back(
aiVertexWeight(index, vsBDEF4_ptr->bone_weight4));
bone_vertex_map[vsBDEF4_ptr->bone_index1].emplace_back(index, vsBDEF4_ptr->bone_weight1);
bone_vertex_map[vsBDEF4_ptr->bone_index2].emplace_back(index, vsBDEF4_ptr->bone_weight2);
bone_vertex_map[vsBDEF4_ptr->bone_index3].emplace_back(index, vsBDEF4_ptr->bone_weight3);
bone_vertex_map[vsBDEF4_ptr->bone_index4].emplace_back(index, vsBDEF4_ptr->bone_weight4);
break;
case pmx::PmxVertexSkinningType::SDEF: // TODO: how to use sdef_c, sdef_r0,
// sdef_r1?
bone_vertex_map[vsSDEF_ptr->bone_index1].push_back(
aiVertexWeight(index, vsSDEF_ptr->bone_weight));
bone_vertex_map[vsSDEF_ptr->bone_index2].push_back(
aiVertexWeight(index, 1.0f - vsSDEF_ptr->bone_weight));
bone_vertex_map[vsSDEF_ptr->bone_index1].emplace_back(index, vsSDEF_ptr->bone_weight);
bone_vertex_map[vsSDEF_ptr->bone_index2].emplace_back(index, 1.0f - vsSDEF_ptr->bone_weight);
break;
case pmx::PmxVertexSkinningType::QDEF:
const auto vsQDEF_ptr =
dynamic_cast<pmx::PmxVertexSkinningQDEF *>(v->skinning.get());
bone_vertex_map[vsQDEF_ptr->bone_index1].push_back(
aiVertexWeight(index, vsQDEF_ptr->bone_weight1));
bone_vertex_map[vsQDEF_ptr->bone_index2].push_back(
aiVertexWeight(index, vsQDEF_ptr->bone_weight2));
bone_vertex_map[vsQDEF_ptr->bone_index3].push_back(
aiVertexWeight(index, vsQDEF_ptr->bone_weight3));
bone_vertex_map[vsQDEF_ptr->bone_index4].push_back(
aiVertexWeight(index, vsQDEF_ptr->bone_weight4));
bone_vertex_map[vsQDEF_ptr->bone_index1].emplace_back(index, vsQDEF_ptr->bone_weight1);
bone_vertex_map[vsQDEF_ptr->bone_index2].emplace_back(index, vsQDEF_ptr->bone_weight2);
bone_vertex_map[vsQDEF_ptr->bone_index3].emplace_back(index, vsQDEF_ptr->bone_weight3);
bone_vertex_map[vsQDEF_ptr->bone_index4].emplace_back(index, vsQDEF_ptr->bone_weight4);
break;
}
}

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -48,19 +47,22 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <fstream>
#include "MMDCpp14.h"
namespace pmd
{
class PmdHeader
{
public:
namespace pmd {
struct PmdHeader {
std::string name;
std::string name_english;
std::string comment;
std::string comment_english;
bool Read(std::ifstream* stream)
{
char buffer[256];
PmdHeader() = default;
~PmdHeader() = default;
bool Read(std::ifstream *stream) {
if (stream == nullptr) {
return false;
}
char buffer[256] = {};
stream->read(buffer, 20);
name = std::string(buffer);
stream->read(buffer, 256);
@ -68,47 +70,50 @@ namespace pmd
return true;
}
bool ReadExtension(std::ifstream* stream)
{
char buffer[256];
bool ReadExtension(std::ifstream *stream) {
if (stream == nullptr) {
return false;
}
char buffer[256] = {};
stream->read(buffer, 20);
name_english = std::string(buffer);
stream->read(buffer, 256);
comment_english = std::string(buffer);
return true;
}
};
};
class PmdVertex
{
public:
struct PmdVertex {
float position[3];
float normal[3];
float uv[2];
uint16_t bone_index[2];
uint8_t bone_weight;
bool edge_invisible;
bool Read(std::ifstream* stream)
{
stream->read((char*) position, sizeof(float) * 3);
stream->read((char*) normal, sizeof(float) * 3);
stream->read((char*) uv, sizeof(float) * 2);
stream->read((char*) bone_index, sizeof(uint16_t) * 2);
stream->read((char*) &bone_weight, sizeof(uint8_t));
stream->read((char*) &edge_invisible, sizeof(uint8_t));
PmdVertex() :
position{ 0.0f }, normal{ 0.0f }, uv{ 0.0f }, bone_index{ 0 }, bone_weight(0), edge_invisible(false) {}
~PmdVertex() = default;
bool Read(std::ifstream *stream) {
if (stream == nullptr) {
return false;
}
stream->read((char *)position, sizeof(float) * 3);
stream->read((char *)normal, sizeof(float) * 3);
stream->read((char *)uv, sizeof(float) * 2);
stream->read((char *)bone_index, sizeof(uint16_t) * 2);
stream->read((char *)&bone_weight, sizeof(uint8_t));
stream->read((char *)&edge_invisible, sizeof(uint8_t));
return true;
}
};
};
class PmdMaterial
{
public:
struct PmdMaterial {
float diffuse[4];
float power;
float specular[3];
@ -119,34 +124,41 @@ namespace pmd
std::string texture_filename;
std::string sphere_filename;
bool Read(std::ifstream* stream)
{
char buffer[20];
stream->read((char*) &diffuse, sizeof(float) * 4);
stream->read((char*) &power, sizeof(float));
stream->read((char*) &specular, sizeof(float) * 3);
stream->read((char*) &ambient, sizeof(float) * 3);
stream->read((char*) &toon_index, sizeof(uint8_t));
stream->read((char*) &edge_flag, sizeof(uint8_t));
stream->read((char*) &index_count, sizeof(uint32_t));
stream->read((char*) &buffer, sizeof(char) * 20);
char* pstar = strchr(buffer, '*');
if (nullptr == pstar)
{
PmdMaterial() :
diffuse{ 0.0f }, power(0.0f), specular{ 0.0f }, ambient{ 0.0f }, toon_index(0), edge_flag(0), index_count(0), texture_filename(), sphere_filename() {}
~PmdMaterial() = default;
bool Read(std::ifstream *stream) {
if (stream == nullptr) {
return false;
}
constexpr size_t BufferSize = 20;
char buffer[BufferSize] = {};
stream->read((char *)&diffuse, sizeof(float) * 4);
stream->read((char *)&power, sizeof(float));
stream->read((char *)&specular, sizeof(float) * 3);
stream->read((char *)&ambient, sizeof(float) * 3);
stream->read((char *)&toon_index, sizeof(uint8_t));
stream->read((char *)&edge_flag, sizeof(uint8_t));
stream->read((char *)&index_count, sizeof(uint32_t));
stream->read((char *)&buffer, sizeof(char) * BufferSize);
char *pstar = strchr(buffer, '*');
if (nullptr == pstar) {
texture_filename = std::string(buffer);
sphere_filename.clear();
}
else {
} else {
*pstar = 0;
texture_filename = std::string(buffer);
sphere_filename = std::string(pstar+1);
sphere_filename = std::string(pstar + 1);
}
return true;
}
};
};
enum class BoneType : uint8_t
{
enum class BoneType : uint8_t {
Rotation,
RotationAndMove,
IkEffector,
@ -157,11 +169,10 @@ namespace pmd
Invisible,
Twist,
RotationMovement
};
class PmdBone
{
public:
};
struct PmdBone {
std::string name;
std::string name_english;
uint16_t parent_bone_index;
@ -170,155 +181,191 @@ namespace pmd
uint16_t ik_parent_bone_index;
float bone_head_pos[3];
void Read(std::istream *stream)
{
char buffer[20];
stream->read(buffer, 20);
PmdBone() :
name(), name_english(), parent_bone_index(0), tail_pos_bone_index(0), bone_type(BoneType::Unknown), ik_parent_bone_index(0), bone_head_pos{ 0.0f } {}
~PmdBone() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
constexpr size_t BufferSize = 20;
char buffer[BufferSize] = {};
stream->read(buffer, BufferSize);
name = std::string(buffer);
stream->read((char*) &parent_bone_index, sizeof(uint16_t));
stream->read((char*) &tail_pos_bone_index, sizeof(uint16_t));
stream->read((char*) &bone_type, sizeof(uint8_t));
stream->read((char*) &ik_parent_bone_index, sizeof(uint16_t));
stream->read((char*) &bone_head_pos, sizeof(float) * 3);
stream->read((char *)&parent_bone_index, sizeof(uint16_t));
stream->read((char *)&tail_pos_bone_index, sizeof(uint16_t));
stream->read((char *)&bone_type, sizeof(uint8_t));
stream->read((char *)&ik_parent_bone_index, sizeof(uint16_t));
stream->read((char *)&bone_head_pos, sizeof(float) * 3);
}
void ReadExpantion(std::istream *stream)
{
char buffer[20];
stream->read(buffer, 20);
void ReadExpantion(std::istream *stream) {
if (stream == nullptr) {
return;
}
constexpr size_t BufferSize = 20;
char buffer[BufferSize] = {};
stream->read(buffer, BufferSize);
name_english = std::string(buffer);
}
};
};
class PmdIk
{
public:
struct PmdIk {
uint16_t ik_bone_index;
uint16_t target_bone_index;
uint16_t iterations;
float angle_limit;
std::vector<uint16_t> ik_child_bone_index;
void Read(std::istream *stream)
{
stream->read((char *) &ik_bone_index, sizeof(uint16_t));
stream->read((char *) &target_bone_index, sizeof(uint16_t));
uint8_t ik_chain_length;
stream->read((char*) &ik_chain_length, sizeof(uint8_t));
stream->read((char *) &iterations, sizeof(uint16_t));
stream->read((char *) &angle_limit, sizeof(float));
ik_child_bone_index.resize(ik_chain_length);
for (int i = 0; i < ik_chain_length; i++)
{
stream->read((char *) &ik_child_bone_index[i], sizeof(uint16_t));
}
}
};
PmdIk() : ik_bone_index(0), target_bone_index(0), iterations(0), angle_limit(0.0f) {}
class PmdFaceVertex
{
public:
~PmdIk() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
stream->read((char *)&ik_bone_index, sizeof(uint16_t));
stream->read((char *)&target_bone_index, sizeof(uint16_t));
uint8_t ik_chain_length;
stream->read((char *)&ik_chain_length, sizeof(uint8_t));
stream->read((char *)&iterations, sizeof(uint16_t));
stream->read((char *)&angle_limit, sizeof(float));
ik_child_bone_index.resize(ik_chain_length);
for (int i = 0; i < ik_chain_length; i++) {
stream->read((char *)&ik_child_bone_index[i], sizeof(uint16_t));
}
}
};
struct PmdFaceVertex {
int vertex_index;
float position[3];
void Read(std::istream *stream)
{
stream->read((char *) &vertex_index, sizeof(int));
stream->read((char *) position, sizeof(float) * 3);
}
};
PmdFaceVertex() :
vertex_index(0), position{ 0.0f } {}
enum class FaceCategory : uint8_t
{
~PmdFaceVertex() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
stream->read((char *)&vertex_index, sizeof(int));
stream->read((char *)position, sizeof(float) * 3);
}
};
enum class FaceCategory : uint8_t {
Base,
Eyebrow,
Eye,
Mouth,
Other
};
};
class PmdFace
{
public:
struct PmdFace {
std::string name;
FaceCategory type;
std::vector<PmdFaceVertex> vertices;
std::string name_english;
void Read(std::istream *stream)
{
char buffer[20];
stream->read(buffer, 20);
PmdFace() :
name(), type(FaceCategory::Other), vertices(), name_english() {}
~PmdFace() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
constexpr size_t BufferSize = 20;
char buffer[BufferSize];
stream->read(buffer, BufferSize);
name = std::string(buffer);
int vertex_count;
stream->read((char*) &vertex_count, sizeof(int));
stream->read((char*) &type, sizeof(uint8_t));
stream->read((char *)&vertex_count, sizeof(int));
stream->read((char *)&type, sizeof(uint8_t));
vertices.resize(vertex_count);
for (int i = 0; i < vertex_count; i++)
{
for (int i = 0; i < vertex_count; i++) {
vertices[i].Read(stream);
}
}
void ReadExpantion(std::istream *stream)
{
void ReadExpantion(std::istream *stream) {
if (stream == nullptr) {
return;
}
char buffer[20];
stream->read(buffer, 20);
name_english = std::string(buffer);
}
};
};
class PmdBoneDispName
{
public:
struct PmdBoneDispName {
std::string bone_disp_name;
std::string bone_disp_name_english;
void Read(std::istream *stream)
{
PmdBoneDispName() = default;
~PmdBoneDispName() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
char buffer[50];
stream->read(buffer, 50);
bone_disp_name = std::string(buffer);
bone_disp_name_english.clear();
}
void ReadExpantion(std::istream *stream)
{
void ReadExpantion(std::istream *stream) {
if (stream == nullptr) {
return;
}
char buffer[50];
stream->read(buffer, 50);
bone_disp_name_english = std::string(buffer);
}
};
};
class PmdBoneDisp
{
public:
struct PmdBoneDisp {
uint16_t bone_index;
uint8_t bone_disp_index;
void Read(std::istream *stream)
{
stream->read((char*) &bone_index, sizeof(uint16_t));
stream->read((char*) &bone_disp_index, sizeof(uint8_t));
}
};
PmdBoneDisp() :
bone_index(0), bone_disp_index(0) {}
enum class RigidBodyShape : uint8_t
{
~PmdBoneDisp() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
stream->read((char *)&bone_index, sizeof(uint16_t));
stream->read((char *)&bone_disp_index, sizeof(uint8_t));
}
};
enum class RigidBodyShape : uint8_t {
Sphere = 0,
Box = 1,
Cpusel = 2
};
};
enum class RigidBodyType : uint8_t
{
enum class RigidBodyType : uint8_t {
BoneConnected = 0,
Physics = 1,
ConnectedPhysics = 2
};
};
class PmdRigidBody
{
public:
struct PmdRigidBody {
std::string name;
uint16_t related_bone_index;
uint8_t group_index;
@ -334,30 +381,36 @@ namespace pmd
float friction;
RigidBodyType rigid_type;
void Read(std::istream *stream)
{
PmdRigidBody() :
name(), related_bone_index(0), group_index(0), mask(0), shape(RigidBodyShape::Box), size{ 0.0f }, position{ 0.0f }, weight(0.0f), linear_damping(0.0f), anglar_damping(0.0f), restitution(0.0f), friction(0.0f), rigid_type(RigidBodyType::BoneConnected) {}
~PmdRigidBody() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
char buffer[20];
stream->read(buffer, sizeof(char) * 20);
name = (std::string(buffer));
stream->read((char*) &related_bone_index, sizeof(uint16_t));
stream->read((char*) &group_index, sizeof(uint8_t));
stream->read((char*) &mask, sizeof(uint16_t));
stream->read((char*) &shape, sizeof(uint8_t));
stream->read((char*) size, sizeof(float) * 3);
stream->read((char*) position, sizeof(float) * 3);
stream->read((char*) orientation, sizeof(float) * 3);
stream->read((char*) &weight, sizeof(float));
stream->read((char*) &linear_damping, sizeof(float));
stream->read((char*) &anglar_damping, sizeof(float));
stream->read((char*) &restitution, sizeof(float));
stream->read((char*) &friction, sizeof(float));
stream->read((char*) &rigid_type, sizeof(char));
stream->read((char *)&related_bone_index, sizeof(uint16_t));
stream->read((char *)&group_index, sizeof(uint8_t));
stream->read((char *)&mask, sizeof(uint16_t));
stream->read((char *)&shape, sizeof(uint8_t));
stream->read((char *)size, sizeof(float) * 3);
stream->read((char *)position, sizeof(float) * 3);
stream->read((char *)orientation, sizeof(float) * 3);
stream->read((char *)&weight, sizeof(float));
stream->read((char *)&linear_damping, sizeof(float));
stream->read((char *)&anglar_damping, sizeof(float));
stream->read((char *)&restitution, sizeof(float));
stream->read((char *)&friction, sizeof(float));
stream->read((char *)&rigid_type, sizeof(char));
}
};
};
class PmdConstraint
{
public:
struct PmdConstraint {
std::string name;
uint32_t rigid_body_index_a;
uint32_t rigid_body_index_b;
@ -370,27 +423,33 @@ namespace pmd
float linear_stiffness[3];
float angular_stiffness[3];
void Read(std::istream *stream)
{
PmdConstraint() :
name(), rigid_body_index_a(0), rigid_body_index_b(0), position{ 0.0f }, orientation{ 0.0f }, linear_lower_limit{ 0.0f }, linear_upper_limit{ 0.0f }, angular_lower_limit{ 0.0f }, angular_upper_limit{ 0.0f }, linear_stiffness{ 0.0f }, angular_stiffness{ 0.0f } {}
~PmdConstraint() = default;
void Read(std::istream *stream) {
if (stream == nullptr) {
return;
}
char buffer[20];
stream->read(buffer, 20);
name = std::string(buffer);
stream->read((char *) &rigid_body_index_a, sizeof(uint32_t));
stream->read((char *) &rigid_body_index_b, sizeof(uint32_t));
stream->read((char *) position, sizeof(float) * 3);
stream->read((char *) orientation, sizeof(float) * 3);
stream->read((char *) linear_lower_limit, sizeof(float) * 3);
stream->read((char *) linear_upper_limit, sizeof(float) * 3);
stream->read((char *) angular_lower_limit, sizeof(float) * 3);
stream->read((char *) angular_upper_limit, sizeof(float) * 3);
stream->read((char *) linear_stiffness, sizeof(float) * 3);
stream->read((char *) angular_stiffness, sizeof(float) * 3);
stream->read((char *)&rigid_body_index_a, sizeof(uint32_t));
stream->read((char *)&rigid_body_index_b, sizeof(uint32_t));
stream->read((char *)position, sizeof(float) * 3);
stream->read((char *)orientation, sizeof(float) * 3);
stream->read((char *)linear_lower_limit, sizeof(float) * 3);
stream->read((char *)linear_upper_limit, sizeof(float) * 3);
stream->read((char *)angular_lower_limit, sizeof(float) * 3);
stream->read((char *)angular_upper_limit, sizeof(float) * 3);
stream->read((char *)linear_stiffness, sizeof(float) * 3);
stream->read((char *)angular_stiffness, sizeof(float) * 3);
}
};
};
class PmdModel
{
public:
struct PmdModel {
float version;
PmdHeader header;
std::vector<PmdVertex> vertices;
@ -406,11 +465,18 @@ namespace pmd
std::vector<PmdRigidBody> rigid_bodies;
std::vector<PmdConstraint> constraints;
static std::unique_ptr<PmdModel> LoadFromFile(const char *filename)
{
PmdModel() :
version(0.0f) {}
~PmdModel() = default;
static std::unique_ptr<PmdModel> LoadFromFile(const char *filename) {
if (filename == nullptr) {
return nullptr;
}
std::ifstream stream(filename, std::ios::binary);
if (stream.fail())
{
if (stream.fail()) {
std::cerr << "could not open \"" << filename << "\"" << std::endl;
return nullptr;
}
@ -419,24 +485,21 @@ namespace pmd
return result;
}
static std::unique_ptr<PmdModel> LoadFromStream(std::ifstream *stream)
{
static std::unique_ptr<PmdModel> LoadFromStream(std::ifstream *stream) {
auto result = mmd::make_unique<PmdModel>();
char buffer[100];
// magic
char magic[3];
stream->read(magic, 3);
if (magic[0] != 'P' || magic[1] != 'm' || magic[2] != 'd')
{
if (magic[0] != 'P' || magic[1] != 'm' || magic[2] != 'd') {
std::cerr << "invalid file" << std::endl;
return nullptr;
}
// version
stream->read((char*) &(result->version), sizeof(float));
if (result ->version != 1.0f)
{
stream->read((char *)&(result->version), sizeof(float));
if (result->version != 1.0f) {
std::cerr << "invalid version" << std::endl;
return nullptr;
}
@ -446,152 +509,132 @@ namespace pmd
// vertices
uint32_t vertex_num;
stream->read((char*) &vertex_num, sizeof(uint32_t));
stream->read((char *)&vertex_num, sizeof(uint32_t));
result->vertices.resize(vertex_num);
for (uint32_t i = 0; i < vertex_num; i++)
{
for (uint32_t i = 0; i < vertex_num; i++) {
result->vertices[i].Read(stream);
}
// indices
uint32_t index_num;
stream->read((char*) &index_num, sizeof(uint32_t));
stream->read((char *)&index_num, sizeof(uint32_t));
result->indices.resize(index_num);
for (uint32_t i = 0; i < index_num; i++)
{
stream->read((char*) &result->indices[i], sizeof(uint16_t));
for (uint32_t i = 0; i < index_num; i++) {
stream->read((char *)&result->indices[i], sizeof(uint16_t));
}
// materials
uint32_t material_num;
stream->read((char*) &material_num, sizeof(uint32_t));
stream->read((char *)&material_num, sizeof(uint32_t));
result->materials.resize(material_num);
for (uint32_t i = 0; i < material_num; i++)
{
for (uint32_t i = 0; i < material_num; i++) {
result->materials[i].Read(stream);
}
// bones
uint16_t bone_num;
stream->read((char*) &bone_num, sizeof(uint16_t));
stream->read((char *)&bone_num, sizeof(uint16_t));
result->bones.resize(bone_num);
for (uint32_t i = 0; i < bone_num; i++)
{
for (uint32_t i = 0; i < bone_num; i++) {
result->bones[i].Read(stream);
}
// iks
uint16_t ik_num;
stream->read((char*) &ik_num, sizeof(uint16_t));
stream->read((char *)&ik_num, sizeof(uint16_t));
result->iks.resize(ik_num);
for (uint32_t i = 0; i < ik_num; i++)
{
for (uint32_t i = 0; i < ik_num; i++) {
result->iks[i].Read(stream);
}
// faces
uint16_t face_num;
stream->read((char*) &face_num, sizeof(uint16_t));
stream->read((char *)&face_num, sizeof(uint16_t));
result->faces.resize(face_num);
for (uint32_t i = 0; i < face_num; i++)
{
for (uint32_t i = 0; i < face_num; i++) {
result->faces[i].Read(stream);
}
// face frames
uint8_t face_frame_num;
stream->read((char*) &face_frame_num, sizeof(uint8_t));
stream->read((char *)&face_frame_num, sizeof(uint8_t));
result->faces_indices.resize(face_frame_num);
for (uint32_t i = 0; i < face_frame_num; i++)
{
stream->read((char*) &result->faces_indices[i], sizeof(uint16_t));
for (uint32_t i = 0; i < face_frame_num; i++) {
stream->read((char *)&result->faces_indices[i], sizeof(uint16_t));
}
// bone names
uint8_t bone_disp_num;
stream->read((char*) &bone_disp_num, sizeof(uint8_t));
stream->read((char *)&bone_disp_num, sizeof(uint8_t));
result->bone_disp_name.resize(bone_disp_num);
for (uint32_t i = 0; i < bone_disp_num; i++)
{
for (uint32_t i = 0; i < bone_disp_num; i++) {
result->bone_disp_name[i].Read(stream);
}
// bone frame
uint32_t bone_frame_num;
stream->read((char*) &bone_frame_num, sizeof(uint32_t));
stream->read((char *)&bone_frame_num, sizeof(uint32_t));
result->bone_disp.resize(bone_frame_num);
for (uint32_t i = 0; i < bone_frame_num; i++)
{
for (uint32_t i = 0; i < bone_frame_num; i++) {
result->bone_disp[i].Read(stream);
}
// english name
bool english;
stream->read((char*) &english, sizeof(char));
if (english)
{
stream->read((char *)&english, sizeof(char));
if (english) {
result->header.ReadExtension(stream);
for (uint32_t i = 0; i < bone_num; i++)
{
for (uint32_t i = 0; i < bone_num; i++) {
result->bones[i].ReadExpantion(stream);
}
for (uint32_t i = 0; i < face_num; i++)
{
if (result->faces[i].type == pmd::FaceCategory::Base)
{
for (uint32_t i = 0; i < face_num; i++) {
if (result->faces[i].type == pmd::FaceCategory::Base) {
continue;
}
result->faces[i].ReadExpantion(stream);
}
for (uint32_t i = 0; i < result->bone_disp_name.size(); i++)
{
for (uint32_t i = 0; i < result->bone_disp_name.size(); i++) {
result->bone_disp_name[i].ReadExpantion(stream);
}
}
// toon textures
if (stream->peek() == std::ios::traits_type::eof())
{
if (stream->peek() == std::ios::traits_type::eof()) {
result->toon_filenames.clear();
}
else {
} else {
result->toon_filenames.resize(10);
for (uint32_t i = 0; i < 10; i++)
{
for (uint32_t i = 0; i < 10; i++) {
stream->read(buffer, 100);
result->toon_filenames[i] = std::string(buffer);
}
}
// physics
if (stream->peek() == std::ios::traits_type::eof())
{
if (stream->peek() == std::ios::traits_type::eof()) {
result->rigid_bodies.clear();
result->constraints.clear();
}
else {
} else {
uint32_t rigid_body_num;
stream->read((char*) &rigid_body_num, sizeof(uint32_t));
stream->read((char *)&rigid_body_num, sizeof(uint32_t));
result->rigid_bodies.resize(rigid_body_num);
for (uint32_t i = 0; i < rigid_body_num; i++)
{
for (uint32_t i = 0; i < rigid_body_num; i++) {
result->rigid_bodies[i].Read(stream);
}
uint32_t constraint_num;
stream->read((char*) &constraint_num, sizeof(uint32_t));
stream->read((char *)&constraint_num, sizeof(uint32_t));
result->constraints.resize(constraint_num);
for (uint32_t i = 0; i < constraint_num; i++)
{
for (uint32_t i = 0; i < constraint_num; i++) {
result->constraints[i].Read(stream);
}
}
if (stream->peek() != std::ios::traits_type::eof())
{
if (stream->peek() != std::ios::traits_type::eof()) {
std::cerr << "there is unknown data" << std::endl;
}
return result;
}
};
}
};
} // namespace pmd

View File

@ -88,7 +88,7 @@ namespace pmx
{
public:
virtual void Read(std::istream *stream, PmxSetting *setting) = 0;
virtual ~PmxVertexSkinning() {}
virtual ~PmxVertexSkinning() = default;
};
class PmxVertexSkinningBDEF1 : public PmxVertexSkinning

View File

@ -86,8 +86,7 @@ MS3DImporter::MS3DImporter()
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
MS3DImporter::~MS3DImporter()
{}
MS3DImporter::~MS3DImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
bool MS3DImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool /*checkSig*/) const
@ -399,7 +398,7 @@ void MS3DImporter::InternReadFile( const std::string& pFile,
// if one of the groups has no material assigned, but there are other
// groups with materials, a default material needs to be added (
// scenepreprocessor adds a default material only if nummat==0).
materials.push_back(TempMaterial());
materials.emplace_back();
TempMaterial& m = materials.back();
strcpy(m.name,"<MS3D_DefaultMat>");

View File

@ -70,13 +70,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
NDOImporter::NDOImporter()
{}
NDOImporter::NDOImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
NDOImporter::~NDOImporter()
{}
NDOImporter::~NDOImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -171,7 +169,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
obj.edges.reserve(temp);
for (unsigned int e = 0; e < temp; ++e) {
obj.edges.push_back(Edge());
obj.edges.emplace_back();
Edge& edge = obj.edges.back();
for (unsigned int i = 0; i< 8; ++i) {
@ -188,7 +186,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
obj.faces.reserve(temp);
for (unsigned int e = 0; e < temp; ++e) {
obj.faces.push_back(Face());
obj.faces.emplace_back();
Face& face = obj.faces.back();
face.elem = file_format >= 12 ? reader.GetU4() : reader.GetU2();
@ -199,7 +197,7 @@ void NDOImporter::InternReadFile( const std::string& pFile,
obj.vertices.reserve(temp);
for (unsigned int e = 0; e < temp; ++e) {
obj.vertices.push_back(Vertex());
obj.vertices.emplace_back();
Vertex& v = obj.vertices.back();
v.num = file_format >= 12 ? reader.GetU4() : reader.GetU2();

View File

@ -73,11 +73,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
NFFImporter::NFFImporter() {}
NFFImporter::NFFImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
NFFImporter::~NFFImporter() {}
NFFImporter::~NFFImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -167,7 +167,7 @@ void NFFImporter::LoadNFF2MaterialTable(std::vector<ShadingInfo> &output,
// 'matdef' starts a new material in the file
else if (TokenMatch(sz, "matdef", 6)) {
// add a new material to the list
output.push_back(ShadingInfo());
output.emplace_back();
curShader = &output.back();
// parse the name of the material
@ -549,7 +549,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
}
if (!mesh) {
meshes.push_back(MeshInfo(PatchType_Simple, false));
meshes.emplace_back(PatchType_Simple, false);
mesh = &meshes.back();
mesh->matIndex = matIdx;
@ -614,7 +614,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
if (!currentMeshWithUVCoords) {
meshesWithUVCoords.push_back(MeshInfo(PatchType_UVAndNormals));
meshesWithUVCoords.emplace_back(PatchType_UVAndNormals);
currentMeshWithUVCoords = &meshesWithUVCoords.back();
currentMeshWithUVCoords->shader = s;
}
@ -631,7 +631,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
if (!currentMeshWithNormals) {
meshesWithNormals.push_back(MeshInfo(PatchType_Normals));
meshesWithNormals.emplace_back(PatchType_Normals);
currentMeshWithNormals = &meshesWithNormals.back();
currentMeshWithNormals->shader = s;
}
@ -649,7 +649,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
if (!currentMesh) {
meshes.push_back(MeshInfo(PatchType_Simple));
meshes.emplace_back(PatchType_Simple);
currentMesh = &meshes.back();
currentMesh->shader = s;
}
@ -749,7 +749,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
// 'l' - light source
else if (TokenMatch(sz, "l", 1)) {
lights.push_back(Light());
lights.emplace_back();
Light &light = lights.back();
AI_NFF_PARSE_TRIPLE(light.position);
@ -758,7 +758,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
// 's' - sphere
else if (TokenMatch(sz, "s", 1)) {
meshesLocked.push_back(MeshInfo(PatchType_Simple, true));
meshesLocked.emplace_back(PatchType_Simple, true);
MeshInfo &curMesh = meshesLocked.back();
curMesh.shader = s;
curMesh.shader.mapping = aiTextureMapping_SPHERE;
@ -774,7 +774,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
// 'dod' - dodecahedron
else if (TokenMatch(sz, "dod", 3)) {
meshesLocked.push_back(MeshInfo(PatchType_Simple, true));
meshesLocked.emplace_back(PatchType_Simple, true);
MeshInfo &curMesh = meshesLocked.back();
curMesh.shader = s;
curMesh.shader.mapping = aiTextureMapping_SPHERE;
@ -791,7 +791,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
// 'oct' - octahedron
else if (TokenMatch(sz, "oct", 3)) {
meshesLocked.push_back(MeshInfo(PatchType_Simple, true));
meshesLocked.emplace_back(PatchType_Simple, true);
MeshInfo &curMesh = meshesLocked.back();
curMesh.shader = s;
curMesh.shader.mapping = aiTextureMapping_SPHERE;
@ -808,7 +808,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
// 'tet' - tetrahedron
else if (TokenMatch(sz, "tet", 3)) {
meshesLocked.push_back(MeshInfo(PatchType_Simple, true));
meshesLocked.emplace_back(PatchType_Simple, true);
MeshInfo &curMesh = meshesLocked.back();
curMesh.shader = s;
curMesh.shader.mapping = aiTextureMapping_SPHERE;
@ -825,7 +825,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
// 'hex' - hexahedron
else if (TokenMatch(sz, "hex", 3)) {
meshesLocked.push_back(MeshInfo(PatchType_Simple, true));
meshesLocked.emplace_back(PatchType_Simple, true);
MeshInfo &curMesh = meshesLocked.back();
curMesh.shader = s;
curMesh.shader.mapping = aiTextureMapping_BOX;
@ -841,7 +841,7 @@ void NFFImporter::InternReadFile(const std::string &pFile,
}
// 'c' - cone
else if (TokenMatch(sz, "c", 1)) {
meshesLocked.push_back(MeshInfo(PatchType_Simple, true));
meshesLocked.emplace_back(PatchType_Simple, true);
MeshInfo &curMesh = meshesLocked.back();
curMesh.shader = s;
curMesh.shader.mapping = aiTextureMapping_CYLINDER;

View File

@ -73,13 +73,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
OFFImporter::OFFImporter()
{}
OFFImporter::OFFImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
OFFImporter::~OFFImporter()
{}
OFFImporter::~OFFImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -137,9 +137,7 @@ ObjExporter::ObjExporter(const char* _filename, const aiScene* pScene, bool noMt
}
// ------------------------------------------------------------------------------------------------
ObjExporter::~ObjExporter() {
// empty
}
ObjExporter::~ObjExporter() = default;
// ------------------------------------------------------------------------------------------------
std::string ObjExporter::GetMaterialLibName() {
@ -333,7 +331,7 @@ void ObjExporter::WriteGeometryFile(bool noMtl) {
// ------------------------------------------------------------------------------------------------
void ObjExporter::AddMesh(const aiString& name, const aiMesh* m, const aiMatrix4x4& mat) {
mMeshes.push_back(MeshInstance() );
mMeshes.emplace_back();
MeshInstance& mesh = mMeshes.back();
if ( nullptr != m->mColors[ 0 ] ) {

View File

@ -108,9 +108,7 @@ ObjFileMtlImporter::ObjFileMtlImporter(std::vector<char> &buffer,
// -------------------------------------------------------------------
// Destructor
ObjFileMtlImporter::~ObjFileMtlImporter() {
// empty
}
ObjFileMtlImporter::~ObjFileMtlImporter() = default;
// -------------------------------------------------------------------
// Loads the material description

View File

@ -90,15 +90,14 @@ ObjFileParser::ObjFileParser(IOStreamBuffer<char> &streamBuffer, const std::stri
// create default material and store it
m_pModel->mDefaultMaterial = new ObjFile::Material;
m_pModel->mDefaultMaterial->MaterialName.Set(DEFAULT_MATERIAL);
m_pModel->mMaterialLib.push_back(DEFAULT_MATERIAL);
m_pModel->mMaterialLib.emplace_back(DEFAULT_MATERIAL);
m_pModel->mMaterialMap[DEFAULT_MATERIAL] = m_pModel->mDefaultMaterial;
// Start parsing the file
parseFile(streamBuffer);
}
ObjFileParser::~ObjFileParser() {
}
ObjFileParser::~ObjFileParser() = default;
void ObjFileParser::setBuffer(std::vector<char> &buffer) {
m_DataIt = buffer.begin();
@ -112,7 +111,6 @@ ObjFile::Model *ObjFileParser::GetModel() const {
void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
// only update every 100KB or it'll be too slow
//const unsigned int updateProgressEveryBytes = 100 * 1024;
unsigned int progressCounter = 0;
const unsigned int bytesToProcess = static_cast<unsigned int>(streamBuffer.size());
const unsigned int progressTotal = bytesToProcess;
unsigned int processed = 0;
@ -129,7 +127,6 @@ void ObjFileParser::parseFile(IOStreamBuffer<char> &streamBuffer) {
if (lastFilePos < filePos) {
processed = static_cast<unsigned int>(filePos);
lastFilePos = filePos;
progressCounter++;
m_progress->UpdateFileRead(processed, progressTotal);
}

View File

@ -256,7 +256,7 @@ AssimpVertexBoneWeightList IVertexData::AssimpBoneWeights(size_t vertices) {
for (VertexBoneAssignmentList::const_iterator iter = vertexWeights.begin(), end = vertexWeights.end();
iter != end; ++iter) {
std::vector<aiVertexWeight> &boneWeights = weights[iter->boneIndex];
boneWeights.push_back(aiVertexWeight(static_cast<unsigned int>(vi), iter->weight));
boneWeights.emplace_back(static_cast<unsigned int>(vi), iter->weight);
}
}
return weights;
@ -272,8 +272,7 @@ std::set<uint16_t> IVertexData::ReferencedBonesByWeights() const {
// VertexData
VertexData::VertexData() {
}
VertexData::VertexData() = default;
VertexData::~VertexData() {
Reset();
@ -310,8 +309,7 @@ VertexElement *VertexData::GetVertexElement(VertexElement::Semantic semantic, ui
// VertexDataXml
VertexDataXml::VertexDataXml() {
}
VertexDataXml::VertexDataXml() = default;
bool VertexDataXml::HasPositions() const {
return !positions.empty();

View File

@ -46,11 +46,9 @@ namespace OpenGEX {
#ifndef ASSIMP_BUILD_NO_OPENGEX_EXPORTER
OpenGEXExporter::OpenGEXExporter() {
}
OpenGEXExporter::OpenGEXExporter() = default;
OpenGEXExporter::~OpenGEXExporter() {
}
bool OpenGEXExporter::exportScene( const char * /*filename*/, const aiScene* /*pScene*/ ) {
return true;

View File

@ -55,7 +55,7 @@ namespace OpenGEX {
class OpenGEXExporter {
public:
OpenGEXExporter();
~OpenGEXExporter();
~OpenGEXExporter() = default;
bool exportScene( const char *filename, const aiScene* pScene );
};

View File

@ -245,9 +245,7 @@ PlyExporter::PlyExporter(const char* _filename, const aiScene* pScene, bool bina
}
// ------------------------------------------------------------------------------------------------
PlyExporter::~PlyExporter() {
// empty
}
PlyExporter::~PlyExporter() = default;
// ------------------------------------------------------------------------------------------------
void PlyExporter::WriteMeshVerts(const aiMesh* m, unsigned int components)

View File

@ -94,9 +94,7 @@ PLYImporter::PLYImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
PLYImporter::~PLYImporter() {
// empty
}
PLYImporter::~PLYImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -560,9 +560,9 @@ bool Q3BSPFileImporter::importTextureFromArchive(const Q3BSP::Q3BSPModel *model,
}
std::vector<std::string> supportedExtensions;
supportedExtensions.push_back(".jpg");
supportedExtensions.push_back(".png");
supportedExtensions.push_back(".tga");
supportedExtensions.emplace_back(".jpg");
supportedExtensions.emplace_back(".png");
supportedExtensions.emplace_back(".tga");
std::string textureName, ext;
if (expandFile(archive, pTexture->strName, supportedExtensions, textureName, ext)) {
IOStream *pTextureStream = archive->Open(textureName.c_str());

View File

@ -72,15 +72,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
Q3DImporter::Q3DImporter() {
// empty
}
Q3DImporter::Q3DImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
Q3DImporter::~Q3DImporter() {
// empty
}
Q3DImporter::~Q3DImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -157,7 +153,7 @@ void Q3DImporter::InternReadFile(const std::string &pFile,
// Meshes chunk
case 'm': {
for (unsigned int quak = 0; quak < numMeshes; ++quak) {
meshes.push_back(Mesh());
meshes.emplace_back();
Mesh &mesh = meshes.back();
// read all vertices
@ -184,7 +180,7 @@ void Q3DImporter::InternReadFile(const std::string &pFile,
// number of indices
for (unsigned int i = 0; i < numVerts; ++i) {
faces.push_back(Face(stream.GetI2()));
faces.emplace_back(stream.GetI2());
if (faces.back().indices.empty())
throw DeadlyImportError("Quick3D: Found face with zero indices");
}
@ -248,7 +244,7 @@ void Q3DImporter::InternReadFile(const std::string &pFile,
case 'c':
for (unsigned int i = 0; i < numMats; ++i) {
materials.push_back(Material());
materials.emplace_back();
Material &mat = materials.back();
// read the material name
@ -402,7 +398,7 @@ outer:
// If we have no materials loaded - generate a default mat
if (materials.empty()) {
ASSIMP_LOG_INFO("Quick3D: No material found, generating one");
materials.push_back(Material());
materials.emplace_back();
materials.back().diffuse = fgColor;
}
@ -422,7 +418,7 @@ outer:
(*fit).mat = 0;
}
if (fidx[(*fit).mat].empty()) ++pScene->mNumMeshes;
fidx[(*fit).mat].push_back(FaceIdx(p, q));
fidx[(*fit).mat].emplace_back(p, q);
}
}
pScene->mNumMaterials = pScene->mNumMeshes;

View File

@ -72,15 +72,11 @@ static const aiImporterDesc desc = {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
RAWImporter::RAWImporter() {
// empty
}
RAWImporter::RAWImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
RAWImporter::~RAWImporter() {
// empty
}
RAWImporter::~RAWImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -138,7 +134,7 @@ void RAWImporter::InternReadFile(const std::string &pFile,
}
}
if (sz2) {
outGroups.push_back(GroupInformation(std::string(sz, length)));
outGroups.emplace_back(std::string(sz, length));
curGroup = outGroups.end() - 1;
}
} else {
@ -179,7 +175,7 @@ void RAWImporter::InternReadFile(const std::string &pFile,
}
// if we don't have the mesh, create it
if (!output) {
(*curGroup).meshes.push_back(MeshInformation(std::string(sz, length)));
(*curGroup).meshes.emplace_back(std::string(sz, length));
output = &((*curGroup).meshes.back());
}
if (12 == num) {
@ -188,13 +184,13 @@ void RAWImporter::InternReadFile(const std::string &pFile,
output->colors.push_back(v);
output->colors.push_back(v);
output->vertices.push_back(aiVector3D(data[3], data[4], data[5]));
output->vertices.push_back(aiVector3D(data[6], data[7], data[8]));
output->vertices.push_back(aiVector3D(data[9], data[10], data[11]));
output->vertices.emplace_back(data[3], data[4], data[5]);
output->vertices.emplace_back(data[6], data[7], data[8]);
output->vertices.emplace_back(data[9], data[10], data[11]);
} else {
output->vertices.push_back(aiVector3D(data[0], data[1], data[2]));
output->vertices.push_back(aiVector3D(data[3], data[4], data[5]));
output->vertices.push_back(aiVector3D(data[6], data[7], data[8]));
output->vertices.emplace_back(data[0], data[1], data[2]);
output->vertices.emplace_back(data[3], data[4], data[5]);
output->vertices.emplace_back(data[6], data[7], data[8]);
}
}
}

View File

@ -202,15 +202,11 @@ static aiString ReadString(StreamReaderLE *stream, uint32_t numWChars) {
// ------------------------------------------------------------------------------------------------
// Constructor to be privately used by Importer
SIBImporter::SIBImporter() {
// empty
}
SIBImporter::SIBImporter() = default;
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
SIBImporter::~SIBImporter() {
// empty
}
SIBImporter::~SIBImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -95,9 +95,7 @@ SMDImporter::SMDImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
SMDImporter::~SMDImporter() {
// empty
}
SMDImporter::~SMDImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -147,10 +145,8 @@ void SMDImporter::InternReadFile( const std::string& pFile, aiScene* scene, IOSy
if (!asBones.empty()) {
// Check whether all bones have been initialized
for (std::vector<SMD::Bone>::const_iterator
i = asBones.begin();
i != asBones.end();++i) {
if (!(*i).mName.length()) {
for (const auto &asBone : asBones) {
if (!asBone.mName.length()) {
ASSIMP_LOG_WARN("SMD: Not all bones have been initialized");
break;
}
@ -210,14 +206,10 @@ void SMDImporter::LogWarning(const char* msg) {
void SMDImporter::FixTimeValues() {
double dDelta = (double)iSmallestFrame;
double dMax = 0.0f;
for (std::vector<SMD::Bone>::iterator
iBone = asBones.begin();
iBone != asBones.end();++iBone) {
for (std::vector<SMD::Bone::Animation::MatrixKey>::iterator
iKey = (*iBone).sAnim.asKeys.begin();
iKey != (*iBone).sAnim.asKeys.end();++iKey) {
(*iKey).dTime -= dDelta;
dMax = std::max(dMax, (*iKey).dTime);
for (auto &asBone : asBones) {
for (auto &asKey : asBone.sAnim.asKeys) {
asKey.dTime -= dDelta;
dMax = std::max(dMax, asKey.dTime);
}
}
dLengthOfAnim = dMax;
@ -227,7 +219,7 @@ void SMDImporter::FixTimeValues() {
// create output meshes
void SMDImporter::CreateOutputMeshes() {
if (aszTextures.empty()) {
aszTextures.push_back(std::string());
aszTextures.emplace_back();
}
// we need to sort all faces by their material index
@ -237,7 +229,7 @@ void SMDImporter::CreateOutputMeshes() {
pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
typedef std::vector<unsigned int> FaceList;
FaceList* aaiFaces = new FaceList[pScene->mNumMeshes];
std::unique_ptr<FaceList[]> aaiFaces(new FaceList[pScene->mNumMeshes]);
// approximate the space that will be required
unsigned int iNum = (unsigned int)asTriangles.size() / pScene->mNumMeshes;
@ -248,17 +240,14 @@ void SMDImporter::CreateOutputMeshes() {
// collect all faces
iNum = 0;
for (std::vector<SMD::Face>::const_iterator
iFace = asTriangles.begin();
iFace != asTriangles.end();++iFace,++iNum) {
if (UINT_MAX == (*iFace).iTexture) {
aaiFaces[(*iFace).iTexture].push_back( 0 );
} else if ((*iFace).iTexture >= aszTextures.size()) {
for (const auto &asTriangle : asTriangles) {
if (asTriangle.iTexture >= aszTextures.size()) {
ASSIMP_LOG_INFO("[SMD/VTA] Material index overflow in face");
aaiFaces[(*iFace).iTexture].push_back((unsigned int)aszTextures.size()-1);
aaiFaces[asTriangle.iTexture].push_back((unsigned int)aszTextures.size()-1);
} else {
aaiFaces[(*iFace).iTexture].push_back(iNum);
aaiFaces[asTriangle.iTexture].push_back(iNum);
}
++iNum;
}
// now create the output meshes
@ -275,7 +264,7 @@ void SMDImporter::CreateOutputMeshes() {
typedef std::pair<unsigned int,float> TempWeightListEntry;
typedef std::vector< TempWeightListEntry > TempBoneWeightList;
TempBoneWeightList* aaiBones = new TempBoneWeightList[asBones.size()]();
std::unique_ptr<TempBoneWeightList[]> aaiBones(new TempBoneWeightList[asBones.size()]());
// try to reserve enough memory without wasting too much
for (unsigned int iBone = 0; iBone < asBones.size();++iBone) {
@ -331,7 +320,7 @@ void SMDImporter::CreateOutputMeshes() {
"to the vertex' parent node");
continue;
}
aaiBones[pairval.first].push_back(TempWeightListEntry(iNum,pairval.second));
aaiBones[pairval.first].emplace_back(iNum,pairval.second);
fSum += pairval.second;
}
// ******************************************************************
@ -351,8 +340,7 @@ void SMDImporter::CreateOutputMeshes() {
if (fSum) {
fSum = 1 / fSum;
for (unsigned int iBone = 0;iBone < face.avVertices[iVert].aiBoneLinks.size();++iBone) {
TempWeightListEntry& pairval = face.avVertices[iVert].aiBoneLinks[iBone];
for (auto &pairval : face.avVertices[iVert].aiBoneLinks) {
if (pairval.first >= asBones.size()) {
continue;
}
@ -360,8 +348,7 @@ void SMDImporter::CreateOutputMeshes() {
}
}
} else {
aaiBones[face.avVertices[iVert].iParentNode].push_back(
TempWeightListEntry(iNum,1.0f-fSum));
aaiBones[face.avVertices[iVert].iParentNode].emplace_back(iNum,1.0f-fSum);
}
}
pcMesh->mFaces[iFace].mIndices[iVert] = iNum++;
@ -398,9 +385,7 @@ void SMDImporter::CreateOutputMeshes() {
++iNum;
}
}
delete[] aaiBones;
}
delete[] aaiFaces;
}
// ------------------------------------------------------------------------------------------------
@ -411,8 +396,7 @@ void SMDImporter::AddBoneChildren(aiNode* pcNode, uint32_t iParent) {
ai_assert( nullptr == pcNode->mChildren);
// first count ...
for (unsigned int i = 0; i < asBones.size();++i) {
SMD::Bone& bone = asBones[i];
for (auto &bone : asBones) {
if (bone.iParent == iParent) {
++pcNode->mNumChildren;
}
@ -516,27 +500,25 @@ void SMDImporter::CreateOutputAnimation(int index, const std::string &name) {
// now build valid keys
unsigned int a = 0;
for (std::vector<SMD::Bone>::const_iterator i = asBones.begin(); i != asBones.end(); ++i) {
for (const auto &asBone : asBones) {
aiNodeAnim* p = pp[a] = new aiNodeAnim();
// copy the name of the bone
p->mNodeName.Set(i->mName);
p->mNodeName.Set(asBone.mName);
p->mNumRotationKeys = (unsigned int)(*i).sAnim.asKeys.size();
p->mNumRotationKeys = (unsigned int)asBone.sAnim.asKeys.size();
if (p->mNumRotationKeys){
p->mNumPositionKeys = p->mNumRotationKeys;
aiVectorKey* pVecKeys = p->mPositionKeys = new aiVectorKey[p->mNumRotationKeys];
aiQuatKey* pRotKeys = p->mRotationKeys = new aiQuatKey[p->mNumRotationKeys];
for (std::vector<SMD::Bone::Animation::MatrixKey>::const_iterator
qq = (*i).sAnim.asKeys.begin();
qq != (*i).sAnim.asKeys.end(); ++qq) {
pRotKeys->mTime = pVecKeys->mTime = (*qq).dTime;
for (const auto &asKey : asBone.sAnim.asKeys) {
pRotKeys->mTime = pVecKeys->mTime = asKey.dTime;
// compute the rotation quaternion from the euler angles
// aiQuaternion: The order of the parameters is yzx?
pRotKeys->mValue = aiQuaternion((*qq).vRot.y, (*qq).vRot.z, (*qq).vRot.x);
pVecKeys->mValue = (*qq).vPos;
pRotKeys->mValue = aiQuaternion(asKey.vRot.y, asKey.vRot.z, asKey.vRot.x);
pVecKeys->mValue = asKey.vPos;
++pVecKeys; ++pRotKeys;
}
@ -589,7 +571,7 @@ void SMDImporter::GetAnimationFileList(const std::string &pFile, IOSystem* pIOHa
animPath = p;
animName = DefaultIOSystem::completeBaseName(animPath);
}
outList.push_back(std::make_tuple(animName, base + "/" + animPath));
outList.emplace_back(animName, base + "/" + animPath);
}
tok1 = strtok_s(nullptr, "\r\n", &context1);
}
@ -799,7 +781,7 @@ void SMDImporter::ParseVASection(const char* szCurrent, const char** szCurrentOu
SkipLine(szCurrent,&szCurrent);
} else {
if(0 == iCurIndex) {
asTriangles.push_back(SMD::Face());
asTriangles.emplace_back();
}
if (++iCurIndex == 3) {
iCurIndex = 0;
@ -919,7 +901,7 @@ void SMDImporter::ParseSkeletonElement(const char* szCurrent, const char** szCur
}
SMD::Bone& bone = asBones[iBone];
bone.sAnim.asKeys.push_back(SMD::Bone::Animation::MatrixKey());
bone.sAnim.asKeys.emplace_back();
SMD::Bone::Animation::MatrixKey& key = bone.sAnim.asKeys.back();
key.dTime = (double)iTime;
@ -964,7 +946,7 @@ void SMDImporter::ParseSkeletonElement(const char* szCurrent, const char** szCur
// ------------------------------------------------------------------------------------------------
// Parse a triangle
void SMDImporter::ParseTriangle(const char* szCurrent, const char** szCurrentOut) {
asTriangles.push_back(SMD::Face());
asTriangles.emplace_back();
SMD::Face& face = asTriangles.back();
if(!SkipSpaces(szCurrent,&szCurrent)) {
@ -982,8 +964,8 @@ void SMDImporter::ParseTriangle(const char* szCurrent, const char** szCurrentOut
SkipSpacesAndLineEnd(szCurrent,&szCurrent);
// load three vertices
for (unsigned int iVert = 0; iVert < 3;++iVert) {
ParseVertex(szCurrent,&szCurrent, face.avVertices[iVert]);
for (auto &avVertex : face.avVertices) {
ParseVertex(szCurrent,&szCurrent, avVertex);
}
*szCurrentOut = szCurrent;
}
@ -1080,13 +1062,11 @@ void SMDImporter::ParseVertex(const char* szCurrent,
}
vertex.aiBoneLinks.resize(iSize,std::pair<unsigned int, float>(0,0.0f));
for (std::vector<std::pair<unsigned int, float> >::iterator
i = vertex.aiBoneLinks.begin();
i != vertex.aiBoneLinks.end();++i) {
if(!ParseUnsignedInt(szCurrent,&szCurrent,(*i).first)) {
for (auto &aiBoneLink : vertex.aiBoneLinks) {
if(!ParseUnsignedInt(szCurrent,&szCurrent,aiBoneLink.first)) {
SMDI_PARSE_RETURN;
}
if(!ParseFloat(szCurrent,&szCurrent,(*i).second)) {
if(!ParseFloat(szCurrent,&szCurrent,aiBoneLink.second)) {
SMDI_PARSE_RETURN;
}
}

View File

@ -134,9 +134,7 @@ STLImporter::STLImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
STLImporter::~STLImporter() {
// empty
}
STLImporter::~STLImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -75,9 +75,7 @@ TerragenImporter::TerragenImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
TerragenImporter::~TerragenImporter() {
// empty
}
TerragenImporter::~TerragenImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.

View File

@ -174,9 +174,7 @@ UnrealImporter::UnrealImporter() :
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
UnrealImporter::~UnrealImporter() {
// empty
}
UnrealImporter::~UnrealImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -335,7 +333,7 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
SkipSpacesAndLineEnd(&data);
if (TokenMatchI(data, "IMPORT", 6)) {
tempTextures.push_back(std::pair<std::string, std::string>());
tempTextures.emplace_back();
std::pair<std::string, std::string> &me = tempTextures.back();
for (; !IsLineEnd(*data); ++data) {
if (!::ASSIMP_strincmp(data, "NAME=", 5)) {
@ -361,7 +359,7 @@ void UnrealImporter::InternReadFile(const std::string &pFile,
if (TokenMatchI(data, "SETTEXTURE", 10)) {
textures.push_back(std::pair<unsigned int, std::string>());
textures.emplace_back();
std::pair<unsigned int, std::string> &me = textures.back();
for (; !IsLineEnd(*data); ++data) {

View File

@ -82,9 +82,7 @@ XFileImporter::XFileImporter()
// ------------------------------------------------------------------------------------------------
// Destructor, private as well
XFileImporter::~XFileImporter() {
// empty
}
XFileImporter::~XFileImporter() = default;
// ------------------------------------------------------------------------------------------------
// Returns whether the class can handle the format of the given file.
@ -380,7 +378,7 @@ void XFileImporter::CreateMeshes( aiScene* pScene, aiNode* pNode, const std::vec
// does the new vertex stem from an old vertex which was influenced by this bone?
ai_real w = oldWeights[orgPoints[d]];
if ( w > 0.0 ) {
newWeights.push_back( aiVertexWeight( d, w ) );
newWeights.emplace_back( d, w );
}
}

View File

@ -454,7 +454,7 @@ void XFileParser::ParseDataObjectSkinWeights(Mesh *pMesh) {
std::string transformNodeName;
GetNextTokenAsString(transformNodeName);
pMesh->mBones.push_back(Bone());
pMesh->mBones.emplace_back();
Bone &bone = pMesh->mBones.back();
bone.mName = transformNodeName;
@ -640,7 +640,7 @@ void XFileParser::ParseDataObjectMeshMaterialList(Mesh *pMesh) {
CheckForClosingBrace(); // skip }
} else if (objectName == "Material") {
pMesh->mMaterials.push_back(Material());
pMesh->mMaterials.emplace_back();
ParseDataObjectMaterial(&pMesh->mMaterials.back());
} else if (objectName == ";") {
// ignore
@ -678,12 +678,12 @@ void XFileParser::ParseDataObjectMaterial(Material *pMaterial) {
// some exporters write "TextureFileName" instead.
std::string texname;
ParseDataObjectTextureFilename(texname);
pMaterial->mTextures.push_back(TexEntry(texname));
pMaterial->mTextures.emplace_back(texname);
} else if (objectName == "NormalmapFilename" || objectName == "NormalmapFileName") {
// one exporter writes out the normal map in a separate filename tag
std::string texname;
ParseDataObjectTextureFilename(texname);
pMaterial->mTextures.push_back(TexEntry(texname, true));
pMaterial->mTextures.emplace_back(texname, true);
} else {
ASSIMP_LOG_WARN("Unknown data object in material in x file");
ParseUnknownDataObject();

View File

@ -131,7 +131,7 @@ void X3DExporter::AttrHelper_Color3ToAttrList(std::list<SAttribute> &pList, cons
if (pValue == pDefaultValue) return;
AttrHelper_Col3DArrToString(&pValue, 1, tstr);
pList.push_back({ pName, tstr });
pList.emplace_back( pName, tstr );
}
void X3DExporter::AttrHelper_FloatToAttrList(std::list<SAttribute> &pList, const string &pName, const float pValue, const float pDefaultValue) {
@ -140,7 +140,7 @@ void X3DExporter::AttrHelper_FloatToAttrList(std::list<SAttribute> &pList, const
if (pValue == pDefaultValue) return;
AttrHelper_FloatToString(pValue, tstr);
pList.push_back({ pName, tstr });
pList.emplace_back( pName, tstr );
}
void X3DExporter::NodeHelper_OpenNode(const string &pNodeName, const size_t pTabLevel, const bool pEmptyElement, const list<SAttribute> &pAttrList) {
@ -186,7 +186,7 @@ void X3DExporter::Export_Node(const aiNode *pNode, const size_t pTabLevel) {
if (CheckAndExport_Light(*pNode, pTabLevel)) return;
// Check if need DEF.
if (pNode->mName.length) attr_list.push_back({ "DEF", pNode->mName.C_Str() });
if (pNode->mName.length) attr_list.emplace_back( "DEF", pNode->mName.C_Str() );
// Check if need <Transformation> node against <Group>.
if (!pNode->mTransformation.IsIdentity()) {
@ -213,13 +213,13 @@ void X3DExporter::Export_Node(const aiNode *pNode, const size_t pTabLevel) {
pNode->mTransformation.Decompose(scale, rotate_axis, rotate_angle, translate);
// Check if values different from default
if ((rotate_angle != 0) && (rotate_axis.Length() > 0))
attr_list.push_back({ "rotation", Rotation2String(rotate_axis, rotate_angle) });
attr_list.emplace_back( "rotation", Rotation2String(rotate_axis, rotate_angle) );
if (!scale.Equal({ 1.0, 1.0, 1.0 })) {
attr_list.push_back({ "scale", Vector2String(scale) });
attr_list.emplace_back( "scale", Vector2String(scale) );
}
if (translate.Length() > 0) {
attr_list.push_back({ "translation", Vector2String(translate) });
attr_list.emplace_back( "translation", Vector2String(translate) );
}
}
@ -284,7 +284,7 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
// Check if mesh already defined early.
if (mDEF_Map_Mesh.find(pIdxMesh) != mDEF_Map_Mesh.end()) {
// Mesh already defined, just refer to it
attr_list.push_back({ "USE", mDEF_Map_Mesh.at(pIdxMesh) });
attr_list.emplace_back( "USE", mDEF_Map_Mesh.at(pIdxMesh) );
NodeHelper_OpenNode(NodeName_Shape, pTabLevel, true, attr_list);
return;
@ -293,7 +293,7 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
string mesh_name(mesh.mName.C_Str() + string("_IDX_") + to_string(pIdxMesh)); // Create mesh name
// Define mesh name.
attr_list.push_back({ "DEF", mesh_name });
attr_list.emplace_back( "DEF", mesh_name );
mDEF_Map_Mesh[pIdxMesh] = mesh_name;
//
@ -327,7 +327,7 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
// remove last space symbol.
coordIndex.resize(coordIndex.length() - 1);
attr_list.push_back({ "coordIndex", coordIndex });
attr_list.emplace_back( "coordIndex", coordIndex );
// create node
NodeHelper_OpenNode(NodeName_IFS, pTabLevel + 1, false, attr_list);
attr_list.clear();
@ -336,14 +336,14 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
// Export <Coordinate>
AttrHelper_Vec3DArrToString(mesh.mVertices, mesh.mNumVertices, attr_value);
attr_list.push_back({ "point", attr_value });
attr_list.emplace_back( "point", attr_value );
NodeHelper_OpenNode("Coordinate", pTabLevel + 2, true, attr_list);
attr_list.clear();
// Export <ColorRGBA>
if (mesh.HasVertexColors(0)) {
AttrHelper_Col4DArrToString(mesh.mColors[0], mesh.mNumVertices, attr_value);
attr_list.push_back({ "color", attr_value });
attr_list.emplace_back( "color", attr_value );
NodeHelper_OpenNode("ColorRGBA", pTabLevel + 2, true, attr_list);
attr_list.clear();
}
@ -351,7 +351,7 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
// Export <TextureCoordinate>
if (mesh.HasTextureCoords(0)) {
AttrHelper_Vec3DAsVec2fArrToString(mesh.mTextureCoords[0], mesh.mNumVertices, attr_value);
attr_list.push_back({ "point", attr_value });
attr_list.emplace_back( "point", attr_value );
NodeHelper_OpenNode("TextureCoordinate", pTabLevel + 2, true, attr_list);
attr_list.clear();
}
@ -359,7 +359,7 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) {
// Export <Normal>
if (mesh.HasNormals()) {
AttrHelper_Vec3DArrToString(mesh.mNormals, mesh.mNumVertices, attr_value);
attr_list.push_back({ "vector", attr_value });
attr_list.emplace_back( "vector", attr_value );
NodeHelper_OpenNode("Normal", pTabLevel + 2, true, attr_list);
attr_list.clear();
}
@ -380,7 +380,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
// Check if material already defined early.
if (mDEF_Map_Material.find(pIdxMaterial) != mDEF_Map_Material.end()) {
// Material already defined, just refer to it
attr_list.push_back({ "USE", mDEF_Map_Material.at(pIdxMaterial) });
attr_list.emplace_back( "USE", mDEF_Map_Material.at(pIdxMaterial) );
NodeHelper_OpenNode(NodeName_A, pTabLevel, true, attr_list);
return;
@ -392,7 +392,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
if (material.Get(AI_MATKEY_NAME, ai_mat_name) == AI_SUCCESS) material_name.insert(0, ai_mat_name.C_Str());
// Define material name.
attr_list.push_back({ "DEF", material_name });
attr_list.emplace_back( "DEF", material_name );
mDEF_Map_Material[pIdxMaterial] = material_name;
//
@ -410,7 +410,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
if (aiColor3D(pAttrValue.r, pAttrValue.g, pAttrValue.b) != pAttrDefaultValue) {
AttrHelper_Col4DArrToString(&pAttrValue, 1, tstr);
attr_list.push_back({ pAttrName, tstr });
attr_list.emplace_back( pAttrName, tstr );
}
};
@ -462,7 +462,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
//
{
auto RepeatToAttrList = [&](const string &pAttrName, const bool pAttrValue) {
if (!pAttrValue) attr_list.push_back({ pAttrName, "false" });
if (!pAttrValue) attr_list.emplace_back( pAttrName, "false" );
};
bool tvalb;
@ -473,7 +473,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
if (strncmp(tstring.C_Str(), AI_EMBEDDED_TEXNAME_PREFIX, strlen(AI_EMBEDDED_TEXNAME_PREFIX)) == 0)
LogError("Embedded texture is not supported");
else
attr_list.push_back({ "url", string("\"") + tstring.C_Str() + "\"" });
attr_list.emplace_back( "url", string("\"") + tstring.C_Str() + "\"" );
}
// repeatS="true" SFBool
@ -495,7 +495,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
if (pAttrValue != pAttrDefaultValue) {
AttrHelper_Vec2DArrToString(&pAttrValue, 1, tstr);
attr_list.push_back({ pAttrName, tstr });
attr_list.emplace_back( pAttrName, tstr );
}
};
@ -520,40 +520,40 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe
void X3DExporter::Export_MetadataBoolean(const aiString &pKey, const bool pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
attr_list.push_back({ "value", pValue ? "true" : "false" });
attr_list.emplace_back( "name", pKey.C_Str() );
attr_list.emplace_back( "value", pValue ? "true" : "false" );
NodeHelper_OpenNode("MetadataBoolean", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataDouble(const aiString &pKey, const double pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
attr_list.push_back({ "value", to_string(pValue) });
attr_list.emplace_back( "name", pKey.C_Str() );
attr_list.emplace_back( "value", to_string(pValue) );
NodeHelper_OpenNode("MetadataDouble", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataFloat(const aiString &pKey, const float pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
attr_list.push_back({ "value", to_string(pValue) });
attr_list.emplace_back( "name", pKey.C_Str() );
attr_list.emplace_back( "value", to_string(pValue) );
NodeHelper_OpenNode("MetadataFloat", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataInteger(const aiString &pKey, const int32_t pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
attr_list.push_back({ "value", to_string(pValue) });
attr_list.emplace_back( "name", pKey.C_Str() );
attr_list.emplace_back( "value", to_string(pValue) );
NodeHelper_OpenNode("MetadataInteger", pTabLevel, true, attr_list);
}
void X3DExporter::Export_MetadataString(const aiString &pKey, const aiString &pValue, const size_t pTabLevel) {
list<SAttribute> attr_list;
attr_list.push_back({ "name", pKey.C_Str() });
attr_list.push_back({ "value", pValue.C_Str() });
attr_list.emplace_back( "name", pKey.C_Str() );
attr_list.emplace_back( "value", pValue.C_Str() );
NodeHelper_OpenNode("MetadataString", pTabLevel, true, attr_list);
}
@ -565,7 +565,7 @@ bool X3DExporter::CheckAndExport_Light(const aiNode &pNode, const size_t pTabLev
if (pAttrValue != pAttrDefaultValue) {
AttrHelper_Vec3DArrToString(&pAttrValue, 1, tstr);
attr_list.push_back({ pAttrName, tstr });
attr_list.emplace_back( pAttrName, tstr );
}
};
@ -590,8 +590,8 @@ bool X3DExporter::CheckAndExport_Light(const aiNode &pNode, const size_t pTabLev
aiMatrix4x4 trafo_mat = Matrix_GlobalToCurrent(pNode).Inverse();
attr_list.push_back({ "DEF", light.mName.C_Str() });
attr_list.push_back({ "global", "true" }); // "false" is not supported.
attr_list.emplace_back( "DEF", light.mName.C_Str() );
attr_list.emplace_back( "global", "true" ); // "false" is not supported.
// ambientIntensity="0" SFFloat [inputOutput]
AttrHelper_FloatToAttrList(attr_list, "ambientIntensity", aiVector3D(light.mColorAmbient.r, light.mColorAmbient.g, light.mColorAmbient.b).Length(), 0);
// color="1 1 1" SFColor [inputOutput]
@ -648,10 +648,10 @@ X3DExporter::X3DExporter(const char *pFileName, IOSystem *pIOSystem, const aiSce
XML_Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
XML_Write("<!DOCTYPE X3D PUBLIC \"ISO//Web3D//DTD X3D 3.3//EN\" \"http://www.web3d.org/specifications/x3d-3.3.dtd\">\n");
// Root node
attr_list.push_back({ "profile", "Interchange" });
attr_list.push_back({ "version", "3.3" });
attr_list.push_back({ "xmlns:xsd", "http://www.w3.org/2001/XMLSchema-instance" });
attr_list.push_back({ "xsd:noNamespaceSchemaLocation", "http://www.web3d.org/specifications/x3d-3.3.xsd" });
attr_list.emplace_back( "profile", "Interchange" );
attr_list.emplace_back( "version", "3.3" );
attr_list.emplace_back( "xmlns:xsd", "http://www.w3.org/2001/XMLSchema-instance" );
attr_list.emplace_back( "xsd:noNamespaceSchemaLocation", "http://www.web3d.org/specifications/x3d-3.3.xsd" );
NodeHelper_OpenNode("X3D", 0, false, attr_list);
attr_list.clear();
// <head>: meta data.

View File

@ -241,7 +241,7 @@ public:
/// \fn ~X3DExporter()
/// Default destructor.
~X3DExporter() {}
~X3DExporter() = default;
}; // class X3DExporter

View File

@ -193,7 +193,7 @@ void X3DGeoHelper::add_color(aiMesh &pMesh, const std::list<aiColor3D> &pColors,
// create RGBA array from RGB.
for (std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); ++it)
tcol.push_back(aiColor4D((*it).r, (*it).g, (*it).b, 1));
tcol.emplace_back((*it).r, (*it).g, (*it).b, 1);
// call existing function for adding RGBA colors
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.
for (std::list<aiColor3D>::const_iterator it = pColors.begin(); it != pColors.end(); ++it) {
tcol.push_back(aiColor4D((*it).r, (*it).g, (*it).b, 1));
tcol.emplace_back((*it).r, (*it).g, (*it).b, 1);
}
// 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.
texcoord_arr_copy.reserve(pTexCoords.size());
for (std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); ++it) {
texcoord_arr_copy.push_back(aiVector3D((*it).x, (*it).y, 0));
texcoord_arr_copy.emplace_back((*it).x, (*it).y, 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.
tc_arr_copy.reserve(pTexCoords.size());
for (std::list<aiVector2D>::const_iterator it = pTexCoords.begin(); it != pTexCoords.end(); ++it) {
tc_arr_copy.push_back(aiVector3D((*it).x, (*it).y, 0));
tc_arr_copy.emplace_back((*it).x, (*it).y, 0);
}
// copy texture coordinates to mesh

View File

@ -477,9 +477,6 @@ void X3DImporter::ParseHelper_Node_Exit() {
// check if we can walk up.
if (mNodeElementCur != nullptr) {
mNodeElementCur = mNodeElementCur->Parent;
} else {
int i = 0;
++i;
}
}

View File

@ -270,7 +270,7 @@ public:
void Clear();
private:
X3DNodeElementBase *MACRO_USE_CHECKANDAPPLY(XmlNode &node, std::string pDEF, std::string pUSE, X3DElemType pType, X3DNodeElementBase *pNE);
X3DNodeElementBase *MACRO_USE_CHECKANDAPPLY(XmlNode &node, const std::string &pDEF, const std::string &pUSE, X3DElemType pType, X3DNodeElementBase *pNE);
bool isNodeEmpty(XmlNode &node);
void checkNodeMustBeEmpty(XmlNode &node);
void skipUnsupportedNode(const std::string &pParentNodeName, XmlNode &node);

View File

@ -2,8 +2,7 @@
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2019, assimp team
Copyright (c) 2006-2022, assimp team
All rights reserved.
@ -152,7 +151,7 @@ void X3DImporter::readArcClose2D(XmlNode &node) {
std::list<aiVector3D> &vlist = ((X3DNodeElementGeometry2D *)ne)->Vertices; // just short alias.
if ((closureType == "PIE") || (closureType == "\"PIE\""))
vlist.push_back(aiVector3D(0, 0, 0)); // center point - first radial line
vlist.emplace_back(0, 0, 0); // center point - first radial line
else if ((closureType != "CHORD") && (closureType != "\"CHORD\""))
Throw_IncorrectAttrValue("ArcClose2D", "closureType");
@ -262,22 +261,25 @@ void X3DImporter::readDisk2D(XmlNode &node) {
//
// create quad list from two point lists
//
if (tlist_i.size() < 2) throw DeadlyImportError("Disk2D. Not enough points for creating quad list."); // tlist_i and tlist_o has equal size.
if (tlist_i.size() < 2) {
// tlist_i and tlist_o has equal size.
throw DeadlyImportError("Disk2D. Not enough points for creating quad list.");
}
// add all quads except last
for (std::list<aiVector3D>::iterator it_i = tlist_i.begin(), it_o = tlist_o.begin(); it_i != tlist_i.end();) {
// do not forget - CCW direction
vlist.push_back(*it_i++); // 1st point
vlist.push_back(*it_o++); // 2nd point
vlist.push_back(*it_o); // 3rd point
vlist.push_back(*it_i); // 4th point
vlist.emplace_back(*it_i++); // 1st point
vlist.emplace_back(*it_o++); // 2nd point
vlist.emplace_back(*it_o); // 3rd point
vlist.emplace_back(*it_i); // 4th point
}
// add last quad
vlist.push_back(*tlist_i.end()); // 1st point
vlist.push_back(*tlist_o.end()); // 2nd point
vlist.push_back(*tlist_o.begin()); // 3rd point
vlist.push_back(*tlist_o.begin()); // 4th point
vlist.emplace_back(tlist_i.back()); // 1st point
vlist.emplace_back(tlist_o.back()); // 2nd point
vlist.emplace_back(tlist_o.front()); // 3rd point
vlist.emplace_back(tlist_i.front()); // 4th point
((X3DNodeElementGeometry2D *)ne)->NumIndices = 4;
}
@ -321,7 +323,7 @@ void X3DImporter::readPolyline2D(XmlNode &node) {
// convert vec2 to vec3
for (std::list<aiVector2D>::iterator it2 = lineSegments.begin(); it2 != lineSegments.end(); ++it2)
tlist.push_back(aiVector3D(it2->x, it2->y, 0));
tlist.emplace_back(it2->x, it2->y, 0);
// convert point set to line set
X3DGeoHelper::extend_point_to_line(tlist, ((X3DNodeElementGeometry2D *)ne)->Vertices);
@ -359,7 +361,7 @@ void X3DImporter::readPolypoint2D(XmlNode &node) {
// convert vec2 to vec3
for (std::list<aiVector2D>::iterator it2 = point.begin(); it2 != point.end(); ++it2) {
((X3DNodeElementGeometry2D *)ne)->Vertices.push_back(aiVector3D(it2->x, it2->y, 0));
((X3DNodeElementGeometry2D *)ne)->Vertices.emplace_back(it2->x, it2->y, 0);
}
((X3DNodeElementGeometry2D *)ne)->NumIndices = 1;
@ -403,10 +405,10 @@ void X3DImporter::readRectangle2D(XmlNode &node) {
float y2 = size.y / 2.0f;
std::list<aiVector3D> &vlist = ((X3DNodeElementGeometry2D *)ne)->Vertices; // just short alias.
vlist.push_back(aiVector3D(x2, y1, 0)); // 1st point
vlist.push_back(aiVector3D(x2, y2, 0)); // 2nd point
vlist.push_back(aiVector3D(x1, y2, 0)); // 3rd point
vlist.push_back(aiVector3D(x1, y1, 0)); // 4th point
vlist.emplace_back(x2, y1, 0); // 1st point
vlist.emplace_back(x2, y2, 0); // 2nd point
vlist.emplace_back(x1, y2, 0); // 3rd point
vlist.emplace_back(x1, y1, 0); // 4th point
((X3DNodeElementGeometry2D *)ne)->Solid = solid;
((X3DNodeElementGeometry2D *)ne)->NumIndices = 4;
// check for X3DMetadataObject childs.
@ -447,7 +449,7 @@ void X3DImporter::readTriangleSet2D(XmlNode &node) {
// convert vec2 to vec3
for (std::list<aiVector2D>::iterator it2 = vertices.begin(); it2 != vertices.end(); ++it2) {
((X3DNodeElementGeometry2D *)ne)->Vertices.push_back(aiVector3D(it2->x, it2->y, 0));
((X3DNodeElementGeometry2D *)ne)->Vertices.emplace_back(it2->x, it2->y, 0);
}
((X3DNodeElementGeometry2D *)ne)->Solid = solid;

View File

@ -59,7 +59,7 @@ namespace Assimp {
/// \param [in] pUSE - string holding "USE" value.
/// \param [in] pType - type of element to find.
/// \param [out] pNE - pointer to found node element.
inline X3DNodeElementBase *X3DImporter::MACRO_USE_CHECKANDAPPLY(XmlNode &node, std::string pDEF, std::string pUSE, X3DElemType pType, X3DNodeElementBase *pNE) {
inline X3DNodeElementBase *X3DImporter::MACRO_USE_CHECKANDAPPLY(XmlNode &node, const std::string &pDEF, const std::string &pUSE, X3DElemType pType, X3DNodeElementBase *pNE) {
checkNodeMustBeEmpty(node);
if (!pDEF.empty())
Assimp::Throw_DEF_And_USE(node.name());

View File

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

View File

@ -1114,10 +1114,6 @@ inline void AssetMetadata::Read(Document &doc) {
ReadMember(*curProfile, "version", this->profile.version);
}
}
if (version.empty() || version[0] != '1') {
throw DeadlyImportError("GLTF: Unsupported glTF version: ", version);
}
}
//
@ -1222,6 +1218,10 @@ inline void Asset::Load(const std::string &pFile, bool isBinary) {
// Load the metadata
asset.Read(doc);
if (!asset) {
return;
}
ReadExtensionsUsed(doc);
// Prepare the dictionaries

View File

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

View File

@ -391,7 +391,7 @@ struct Object {
//! Objects marked as special are not exported (used to emulate the binary body buffer)
virtual bool IsSpecial() const { return false; }
virtual ~Object() {}
virtual ~Object() = default;
//! Maps special IDs to another ID, where needed. Subclasses may override it (statically)
static const char *TranslateId(Asset & /*r*/, const char *id) { return id; }
@ -613,7 +613,7 @@ struct Accessor : public Object {
return Indexer(*this);
}
Accessor() {}
Accessor() = default;
void Read(Value &obj, Asset &r);
//sparse
@ -681,7 +681,7 @@ struct Light : public Object {
float innerConeAngle;
float outerConeAngle;
Light() {}
Light() = default;
void Read(Value &obj, Asset &r);
};
@ -877,7 +877,7 @@ struct Mesh : public Object {
std::vector<float> weights;
std::vector<std::string> targetNames;
Mesh() {}
Mesh() = default;
/// Get mesh data from JSON-object and place them to root asset.
/// \param [in] pJSON_Object - reference to pJSON-object from which data are read.
@ -903,12 +903,12 @@ struct Node : public Object {
Ref<Node> parent; //!< This is not part of the glTF specification. Used as a helper.
Node() {}
Node() = default;
void Read(Value &obj, Asset &r);
};
struct Program : public Object {
Program() {}
Program() = default;
void Read(Value &obj, Asset &r);
};
@ -927,12 +927,12 @@ struct Scene : public Object {
std::string name;
std::vector<Ref<Node>> nodes;
Scene() {}
Scene() = default;
void Read(Value &obj, Asset &r);
};
struct Shader : public Object {
Shader() {}
Shader() = default;
void Read(Value &obj, Asset &r);
};
@ -942,7 +942,7 @@ struct Skin : public Object {
std::vector<Ref<Node>> jointNames; //!< Joint names of the joints (nodes with a jointName property) in this skin.
std::string name; //!< The user-defined name of this object.
Skin() {}
Skin() = default;
void Read(Value &obj, Asset &r);
};
@ -957,7 +957,7 @@ struct Texture : public Object {
//TextureTarget target; //!< The target that the WebGL texture should be bound to. (default: TextureTarget_TEXTURE_2D)
//TextureType type; //!< Texel datatype. (default: TextureType_UNSIGNED_BYTE)
Texture() {}
Texture() = default;
void Read(Value &obj, Asset &r);
};
@ -990,14 +990,14 @@ struct Animation : public Object {
std::vector<Sampler> samplers; //!< All the key-frame data for this animation.
std::vector<Channel> channels; //!< Data to connect nodes to key-frames.
Animation() {}
Animation() = default;
void Read(Value &obj, Asset &r);
};
//! Base class for LazyDict that acts as an interface
class LazyDictBase {
public:
virtual ~LazyDictBase() {}
virtual ~LazyDictBase() = default;
virtual void AttachToDocument(Document &doc) = 0;
virtual void DetachFromDocument() = 0;

View File

@ -124,9 +124,7 @@ glTF2Exporter::glTF2Exporter(const char *filename, IOSystem *pIOSystem, const ai
}
}
glTF2Exporter::~glTF2Exporter() {
// empty
}
glTF2Exporter::~glTF2Exporter() = default;
/*
* Copy a 4x4 matrix from struct aiMatrix to typedef mat4.

View File

@ -103,9 +103,7 @@ glTF2Importer::glTF2Importer() :
// empty
}
glTF2Importer::~glTF2Importer() {
// empty
}
glTF2Importer::~glTF2Importer() = default;
const aiImporterDesc *glTF2Importer::GetInfo() const {
return &desc;

View File

@ -5,8 +5,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
@ -50,23 +48,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iostream>
#include <cstdlib>
void Assimp::defaultAiAssertHandler(const char* failedExpression, const char* file, int line)
{
void Assimp::defaultAiAssertHandler(const char* failedExpression, const char* file, int line) {
std::cerr << "ai_assert failure in " << file << "(" << line << "): " << failedExpression << std::endl;
std::abort();
}
namespace
{
namespace {
Assimp::AiAssertHandler s_handler = Assimp::defaultAiAssertHandler;
}
void Assimp::setAiAssertHandler(AiAssertHandler handler)
{
void Assimp::setAiAssertHandler(AiAssertHandler handler) {
if (handler != nullptr) {
s_handler = handler;
} else {
s_handler = Assimp::defaultAiAssertHandler;
}
}
void Assimp::aiAssertViolation(const char* failedExpression, const char* file, int line)
{
void Assimp::aiAssertViolation(const char* failedExpression, const char* file, int line) {
s_handler(failedExpression, file, line);
}

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