mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Fix some (MSVC) compiler warnings
This commit is contained in:
parent
695d526764
commit
e1143783e5
8 changed files with 13 additions and 15 deletions
|
@ -25,7 +25,7 @@ constexpr f64 ROUNDING_ERROR_f64 = 0.00000001;
|
||||||
#undef PI
|
#undef PI
|
||||||
#endif
|
#endif
|
||||||
//! Constant for PI.
|
//! Constant for PI.
|
||||||
constexpr f32 PI = M_PI;
|
constexpr f32 PI = static_cast<f32>(M_PI);
|
||||||
|
|
||||||
#ifdef PI64 // make sure we don't collide with a define
|
#ifdef PI64 // make sure we don't collide with a define
|
||||||
#undef PI64
|
#undef PI64
|
||||||
|
|
|
@ -549,12 +549,10 @@ void SelfType::MeshExtractor::deferAddMesh(
|
||||||
|
|
||||||
static core::matrix4 loadTransform(const tiniergltf::Node::Matrix &m, SkinnedMesh::SJoint *joint)
|
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;
|
||||||
core::matrix4 mat = convertHandedness(core::matrix4(
|
for (size_t i = 0; i < m.size(); ++i)
|
||||||
m[0], m[1], m[2], m[3],
|
mat[i] = static_cast<f32>(m[i]);
|
||||||
m[4], m[5], m[6], m[7],
|
mat = convertHandedness(mat);
|
||||||
m[8], m[9], m[10], m[11],
|
|
||||||
m[12], m[13], m[14], m[15]));
|
|
||||||
|
|
||||||
// Decompose the matrix into translation, scale, and rotation.
|
// Decompose the matrix into translation, scale, and rotation.
|
||||||
joint->Animatedposition = mat.getTranslation();
|
joint->Animatedposition = mat.getTranslation();
|
||||||
|
|
|
@ -166,7 +166,7 @@ public:
|
||||||
inline void irrGlObjectLabel(GLenum identifier, GLuint name, const char *label)
|
inline void irrGlObjectLabel(GLenum identifier, GLuint name, const char *label)
|
||||||
{
|
{
|
||||||
if (KHRDebugSupported) {
|
if (KHRDebugSupported) {
|
||||||
u32 len = strlen(label);
|
u32 len = static_cast<u32>(strlen(label));
|
||||||
// Since our texture strings can get quite long we also truncate
|
// Since our texture strings can get quite long we also truncate
|
||||||
// to a hardcoded limit of 82
|
// to a hardcoded limit of 82
|
||||||
len = std::min(len, std::min(MaxLabelLength, 82U));
|
len = std::min(len, std::min(MaxLabelLength, 82U));
|
||||||
|
|
|
@ -704,8 +704,8 @@ void Minimap::updateActiveMarkers()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_active_markers.emplace_back(((float)pos.X / (float)MINIMAP_MAX_SX) - 0.5,
|
m_active_markers.emplace_back(((float)pos.X / (float)MINIMAP_MAX_SX) - 0.5f,
|
||||||
(1.0 - (float)pos.Z / (float)MINIMAP_MAX_SY) - 0.5);
|
(1.0f - (float)pos.Z / (float)MINIMAP_MAX_SY) - 0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_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_texture_32bit = g_settings->getBool("shadow_map_texture_32bit");
|
||||||
m_shadow_map_colored = g_settings->getBool("shadow_map_color");
|
m_shadow_map_colored = g_settings->getBool("shadow_map_color");
|
||||||
|
@ -273,7 +273,7 @@ void ShadowRenderer::updateSMTextures()
|
||||||
// Static shader values.
|
// Static shader values.
|
||||||
for (auto cb : {m_shadow_depth_cb, m_shadow_depth_entity_cb, m_shadow_depth_trans_cb}) {
|
for (auto cb : {m_shadow_depth_cb, m_shadow_depth_entity_cb, m_shadow_depth_trans_cb}) {
|
||||||
if (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->MaxFar = (f32)m_shadow_map_max_distance * BS;
|
||||||
cb->PerspectiveBiasXY = getPerspectiveBiasXY();
|
cb->PerspectiveBiasXY = getPerspectiveBiasXY();
|
||||||
cb->PerspectiveBiasZ = getPerspectiveBiasZ();
|
cb->PerspectiveBiasZ = getPerspectiveBiasZ();
|
||||||
|
|
|
@ -124,7 +124,7 @@ private:
|
||||||
video::SColor m_shadow_tint;
|
video::SColor m_shadow_tint;
|
||||||
float m_shadow_strength_gamma;
|
float m_shadow_strength_gamma;
|
||||||
float m_shadow_map_max_distance;
|
float m_shadow_map_max_distance;
|
||||||
float m_shadow_map_texture_size;
|
u32 m_shadow_map_texture_size;
|
||||||
float m_time_day;
|
float m_time_day;
|
||||||
int m_shadow_samples;
|
int m_shadow_samples;
|
||||||
bool m_shadow_map_texture_32bit;
|
bool m_shadow_map_texture_32bit;
|
||||||
|
|
|
@ -104,7 +104,7 @@ void read_item_definition(lua_State* L, int index,
|
||||||
} else if (lua_isstring(L, -1)) {
|
} else if (lua_isstring(L, -1)) {
|
||||||
video::SColor color;
|
video::SColor color;
|
||||||
read_color(L, -1, &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);
|
WearBarParams::BLEND_MODE_CONSTANT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -320,7 +320,7 @@ void TestUtilities::testUTF8()
|
||||||
// try to check that the conversion function does not accidentally keep
|
// try to check that the conversion function does not accidentally keep
|
||||||
// its internal state across invocations.
|
// its internal state across invocations.
|
||||||
// \xC4\x81 is UTF-8 for \u0101
|
// \xC4\x81 is UTF-8 for \u0101
|
||||||
utf8_to_wide("\xC4");
|
static_cast<void>(utf8_to_wide("\xC4"));
|
||||||
UASSERT(utf8_to_wide("\x81") != L"\u0101");
|
UASSERT(utf8_to_wide("\x81") != L"\u0101");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue