Fix MSVC Warnings With “emplace_back()”
Several places in the code call `std::vector<aiVector3D>.emplace_back(0, 0, 0)`. The constructor of `aiVector3D` actually expects arguments of the type `ai_real`, (alias of `float` if compiling without `ASSIMP_DOUBLE_PRECISION`) but the literal `0` is of type `int`. `emplace_back()` does support promotion, but `int` to `float` is a potentially lossy conversion. tl;dr: On warning level 4, MSVC spits out a very deeply nested `warning C4244: 'argument': conversion from '_Ty' to 'TReal', possible loss of data with _Ty=int and TReal=ai_real`.
This commit is contained in:
@@ -269,7 +269,7 @@ 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].emplace_back(index, 1.0);
|
||||
bone_vertex_map[vsBDEF1_ptr->bone_index].emplace_back(index, static_cast<ai_real>(1));
|
||||
break;
|
||||
case pmx::PmxVertexSkinningType::BDEF2:
|
||||
bone_vertex_map[vsBDEF2_ptr->bone_index1].emplace_back(index, vsBDEF2_ptr->bone_weight);
|
||||
|
||||
Reference in New Issue
Block a user