mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-27 05:37:25 +00:00
Fix C4305 msvc warning
'argument': truncation from 'double' to 'float'
This commit is contained in:
parent
5891d58f63
commit
2eae3227ba
@ -338,10 +338,10 @@ namespace
|
||||
AreaType_ground, mSource, mObjectTransform
|
||||
);
|
||||
const auto recastMesh = std::move(builder).create(mGeneration, mRevision);
|
||||
EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5), std::vector<float>({
|
||||
0, -4.24264049530029296875, 4.44089209850062616169452667236328125e-16,
|
||||
0, -3.535533905029296875, -0.707106769084930419921875,
|
||||
0, -3.535533905029296875, 0.707106769084930419921875,
|
||||
EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector<float>({
|
||||
0, -4.24264049530029296875f, 4.44089209850062616169452667236328125e-16f,
|
||||
0, -3.535533905029296875f, -0.707106769084930419921875f,
|
||||
0, -3.535533905029296875f, 0.707106769084930419921875f,
|
||||
}))) << recastMesh->getMesh().getVertices();
|
||||
EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector<int>({1, 2, 0}));
|
||||
EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector<AreaType>({AreaType_ground}));
|
||||
@ -363,10 +363,10 @@ namespace
|
||||
AreaType_ground, mSource, mObjectTransform
|
||||
);
|
||||
const auto recastMesh = std::move(builder).create(mGeneration, mRevision);
|
||||
EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5), std::vector<float>({
|
||||
-4.24264049530029296875, 0, 4.44089209850062616169452667236328125e-16,
|
||||
-3.535533905029296875, 0, -0.707106769084930419921875,
|
||||
-3.535533905029296875, 0, 0.707106769084930419921875,
|
||||
EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector<float>({
|
||||
-4.24264049530029296875f, 0, 4.44089209850062616169452667236328125e-16f,
|
||||
-3.535533905029296875f, 0, -0.707106769084930419921875f,
|
||||
-3.535533905029296875f, 0, 0.707106769084930419921875f,
|
||||
}))) << recastMesh->getMesh().getVertices();
|
||||
EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector<int>({1, 2, 0}));
|
||||
EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector<AreaType>({AreaType_ground}));
|
||||
@ -388,10 +388,10 @@ namespace
|
||||
AreaType_ground, mSource, mObjectTransform
|
||||
);
|
||||
const auto recastMesh = std::move(builder).create(mGeneration, mRevision);
|
||||
EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5), std::vector<float>({
|
||||
-1.41421353816986083984375, -1.1102230246251565404236316680908203125e-16, 0,
|
||||
1.1102230246251565404236316680908203125e-16, -1.41421353816986083984375, 0,
|
||||
1.41421353816986083984375, 1.1102230246251565404236316680908203125e-16, 0,
|
||||
EXPECT_THAT(recastMesh->getMesh().getVertices(), Pointwise(FloatNear(1e-5f), std::vector<float>({
|
||||
-1.41421353816986083984375f, -1.1102230246251565404236316680908203125e-16f, 0,
|
||||
1.1102230246251565404236316680908203125e-16f, -1.41421353816986083984375f, 0,
|
||||
1.41421353816986083984375f, 1.1102230246251565404236316680908203125e-16f, 0,
|
||||
}))) << recastMesh->getMesh().getVertices();
|
||||
EXPECT_EQ(recastMesh->getMesh().getIndices(), std::vector<int>({2, 0, 1}));
|
||||
EXPECT_EQ(recastMesh->getMesh().getAreaTypes(), std::vector<AreaType>({AreaType_ground}));
|
||||
|
@ -33,7 +33,7 @@ namespace
|
||||
EXPECT_EQ(serialized.size(), 10); // version, type, 8 bytes value
|
||||
sol::object value = LuaUtil::deserialize(lua, serialized);
|
||||
ASSERT_TRUE(value.is<double>());
|
||||
EXPECT_FLOAT_EQ(value.as<double>(), 3.14);
|
||||
EXPECT_DOUBLE_EQ(value.as<double>(), 3.14);
|
||||
}
|
||||
|
||||
TEST(LuaSerializationTest, Boolean)
|
||||
@ -183,7 +183,7 @@ namespace
|
||||
EXPECT_EQ(t.get<bool>("ab"), true);
|
||||
EXPECT_EQ(t.get<sol::table>("nested").get<int>("aa"), 2);
|
||||
EXPECT_EQ(t.get<sol::table>("nested").get<std::string>("bb"), "something");
|
||||
EXPECT_FLOAT_EQ(t.get<sol::table>("nested").get<double>(5), -0.5);
|
||||
EXPECT_DOUBLE_EQ(t.get<sol::table>("nested").get<double>(5), -0.5);
|
||||
EXPECT_EQ(t.get<osg::Vec2f>(1), osg::Vec2f(1, 2));
|
||||
EXPECT_EQ(t.get<osg::Vec2f>(2), osg::Vec2f(2, 1));
|
||||
}
|
||||
|
@ -172,12 +172,12 @@ namespace
|
||||
lua.open_libraries(sol::lib::base, sol::lib::math, sol::lib::string);
|
||||
lua["util"] = LuaUtil::initUtilPackage(lua);
|
||||
lua.safe_script("v = util.vector2(1, 0):rotate(math.rad(120))");
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "v.x"), -0.5);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "v.y"), 0.86602539);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.normalizeAngle(math.pi * 10 + 0.1)"), 0.1);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.clamp(0.1, 0, 1.5)"), 0.1);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "v.x"), -0.5f);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "v.y"), 0.86602539f);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.normalizeAngle(math.pi * 10 + 0.1)"), 0.1f);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.clamp(0.1, 0, 1.5)"), 0.1f);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.clamp(-0.1, 0, 1.5)"), 0);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.clamp(2.1, 0, 1.5)"), 1.5);
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "util.clamp(2.1, 0, 1.5)"), 1.5f);
|
||||
lua.safe_script("t = util.makeReadOnly({x = 1})");
|
||||
EXPECT_FLOAT_EQ(get<float>(lua, "t.x"), 1);
|
||||
EXPECT_ERROR(lua.safe_script("t.y = 2"), "userdata value");
|
||||
|
Loading…
x
Reference in New Issue
Block a user