diff --git a/irr/include/irrMath.h b/irr/include/irrMath.h index e11d47360..4e74381a6 100644 --- a/irr/include/irrMath.h +++ b/irr/include/irrMath.h @@ -25,7 +25,7 @@ constexpr f64 ROUNDING_ERROR_f64 = 0.00000001; #undef PI #endif //! Constant for PI. -constexpr f32 PI = M_PI; +constexpr f32 PI = static_cast(M_PI); #ifdef PI64 // make sure we don't collide with a define #undef PI64 diff --git a/irr/src/CGLTFMeshFileLoader.cpp b/irr/src/CGLTFMeshFileLoader.cpp index 32fa4829c..87712595a 100644 --- a/irr/src/CGLTFMeshFileLoader.cpp +++ b/irr/src/CGLTFMeshFileLoader.cpp @@ -549,12 +549,10 @@ void SelfType::MeshExtractor::deferAddMesh( static core::matrix4 loadTransform(const tiniergltf::Node::Matrix &m, SkinnedMesh::SJoint *joint) { - // Note: Under the hood, this casts these doubles to floats. - core::matrix4 mat = convertHandedness(core::matrix4( - m[0], m[1], m[2], m[3], - m[4], m[5], m[6], m[7], - m[8], m[9], m[10], m[11], - m[12], m[13], m[14], m[15])); + core::matrix4 mat; + for (size_t i = 0; i < m.size(); ++i) + mat[i] = static_cast(m[i]); + mat = convertHandedness(mat); // Decompose the matrix into translation, scale, and rotation. joint->Animatedposition = mat.getTranslation(); diff --git a/irr/src/OpenGL/ExtensionHandler.h b/irr/src/OpenGL/ExtensionHandler.h index 413ab7f23..2ee3543d5 100644 --- a/irr/src/OpenGL/ExtensionHandler.h +++ b/irr/src/OpenGL/ExtensionHandler.h @@ -166,7 +166,7 @@ public: inline void irrGlObjectLabel(GLenum identifier, GLuint name, const char *label) { if (KHRDebugSupported) { - u32 len = strlen(label); + u32 len = static_cast(strlen(label)); // Since our texture strings can get quite long we also truncate // to a hardcoded limit of 82 len = std::min(len, std::min(MaxLabelLength, 82U)); diff --git a/src/client/minimap.cpp b/src/client/minimap.cpp index e60608688..0d44f9d00 100644 --- a/src/client/minimap.cpp +++ b/src/client/minimap.cpp @@ -704,8 +704,8 @@ void Minimap::updateActiveMarkers() continue; } - m_active_markers.emplace_back(((float)pos.X / (float)MINIMAP_MAX_SX) - 0.5, - (1.0 - (float)pos.Z / (float)MINIMAP_MAX_SY) - 0.5); + m_active_markers.emplace_back(((float)pos.X / (float)MINIMAP_MAX_SX) - 0.5f, + (1.0f - (float)pos.Z / (float)MINIMAP_MAX_SY) - 0.5f); } } diff --git a/src/client/shadows/dynamicshadowsrender.cpp b/src/client/shadows/dynamicshadowsrender.cpp index a7d21d647..70bc2d2cf 100644 --- a/src/client/shadows/dynamicshadowsrender.cpp +++ b/src/client/shadows/dynamicshadowsrender.cpp @@ -36,7 +36,7 @@ ShadowRenderer::ShadowRenderer(IrrlichtDevice *device, Client *client) : m_shadow_map_max_distance = g_settings->getFloat("shadow_map_max_distance"); - m_shadow_map_texture_size = g_settings->getFloat("shadow_map_texture_size"); + m_shadow_map_texture_size = g_settings->getU32("shadow_map_texture_size"); m_shadow_map_texture_32bit = g_settings->getBool("shadow_map_texture_32bit"); m_shadow_map_colored = g_settings->getBool("shadow_map_color"); @@ -273,7 +273,7 @@ void ShadowRenderer::updateSMTextures() // Static shader values. for (auto cb : {m_shadow_depth_cb, m_shadow_depth_entity_cb, m_shadow_depth_trans_cb}) { if (cb) { - cb->MapRes = (f32)m_shadow_map_texture_size; + cb->MapRes = (u32)m_shadow_map_texture_size; cb->MaxFar = (f32)m_shadow_map_max_distance * BS; cb->PerspectiveBiasXY = getPerspectiveBiasXY(); cb->PerspectiveBiasZ = getPerspectiveBiasZ(); diff --git a/src/client/shadows/dynamicshadowsrender.h b/src/client/shadows/dynamicshadowsrender.h index 1c7b6e482..7026e39a9 100644 --- a/src/client/shadows/dynamicshadowsrender.h +++ b/src/client/shadows/dynamicshadowsrender.h @@ -124,7 +124,7 @@ private: video::SColor m_shadow_tint; float m_shadow_strength_gamma; float m_shadow_map_max_distance; - float m_shadow_map_texture_size; + u32 m_shadow_map_texture_size; float m_time_day; int m_shadow_samples; bool m_shadow_map_texture_32bit; diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 0e802d9c7..e4d94b3fc 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -104,7 +104,7 @@ void read_item_definition(lua_State* L, int index, } else if (lua_isstring(L, -1)) { video::SColor color; read_color(L, -1, &color); - def.wear_bar_params = WearBarParams({{0.0, color}}, + def.wear_bar_params = WearBarParams({{0.0f, color}}, WearBarParams::BLEND_MODE_CONSTANT); } diff --git a/src/unittest/test_utilities.cpp b/src/unittest/test_utilities.cpp index 1a810c06d..7a07c37fe 100644 --- a/src/unittest/test_utilities.cpp +++ b/src/unittest/test_utilities.cpp @@ -320,7 +320,7 @@ void TestUtilities::testUTF8() // try to check that the conversion function does not accidentally keep // its internal state across invocations. // \xC4\x81 is UTF-8 for \u0101 - utf8_to_wide("\xC4"); + static_cast(utf8_to_wide("\xC4")); UASSERT(utf8_to_wide("\x81") != L"\u0101"); }