1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-30 19:22:14 +00:00

Remove irr namespace (#16309)

This commit is contained in:
Lars Müller 2025-07-09 10:35:52 +02:00 committed by GitHub
parent 7e22c72492
commit 61551cfc3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
381 changed files with 680 additions and 1632 deletions

View file

@ -24,9 +24,9 @@ const auto gamespec = findSubgame("devtest");
if (!gamespec.isValid())
SKIP();
irr::SIrrlichtCreationParameters p;
SIrrlichtCreationParameters p;
p.DriverType = video::EDT_NULL;
auto *driver = irr::createDeviceEx(p);
auto *driver = createDeviceEx(p);
REQUIRE(driver);
auto *smgr = driver->getSceneManager();
@ -74,7 +74,7 @@ SECTION("minimal triangle") {
SECTION("vertex coordinates are correct") {
REQUIRE(mesh->getMeshBuffer(0)->getVertexCount() == 3);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(0)->getVertices());
CHECK(vertices[0].Pos == v3f {0.0f, 0.0f, 0.0f});
CHECK(vertices[1].Pos == v3f {1.0f, 0.0f, 0.0f});
@ -83,7 +83,7 @@ SECTION("minimal triangle") {
SECTION("vertex indices are correct") {
REQUIRE(mesh->getMeshBuffer(0)->getIndexCount() == 3);
auto indices = static_cast<const irr::u16 *>(
auto indices = static_cast<const u16 *>(
mesh->getMeshBuffer(0)->getIndices());
CHECK(indices[0] == 2);
CHECK(indices[1] == 1);
@ -93,7 +93,7 @@ SECTION("minimal triangle") {
auto check_cube_vertices = [](auto *meshbuf) {
REQUIRE(meshbuf->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
meshbuf->getVertices());
CHECK(vertices[0].Pos == v3f{-1.0f, -1.0f, -1.0f});
CHECK(vertices[3].Pos == v3f{-1.0f, 1.0f, -1.0f});
@ -112,7 +112,7 @@ SECTION("blender cube") {
const auto mesh = loadMesh(path);
REQUIRE(mesh);
REQUIRE(mesh->getMeshBufferCount() == 1);
auto *meshbuf = dynamic_cast<irr::scene::SSkinMeshBuffer *>(
auto *meshbuf = dynamic_cast<scene::SSkinMeshBuffer *>(
mesh->getMeshBuffer(0));
REQUIRE(meshbuf);
SECTION("vertex coordinates are correct") {
@ -124,7 +124,7 @@ SECTION("blender cube") {
SECTION("vertex indices are correct") {
REQUIRE(meshbuf->getIndexCount() == 36);
auto indices = static_cast<const irr::u16 *>(
auto indices = static_cast<const u16 *>(
meshbuf->getIndices());
CHECK(indices[0] == 16);
CHECK(indices[1] == 5);
@ -134,7 +134,7 @@ SECTION("blender cube") {
SECTION("vertex normals are correct") {
REQUIRE(meshbuf->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
meshbuf->getVertices());
CHECK(vertices[0].Normal == v3f{-1.0f, 0.0f, 0.0f});
CHECK(vertices[1].Normal == v3f{0.0f, -1.0f, 0.0f});
@ -147,7 +147,7 @@ SECTION("blender cube") {
SECTION("texture coords are correct") {
REQUIRE(meshbuf->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
meshbuf->getVertices());
CHECK(vertices[0].TCoords == v2f{0.375f, 1.0f});
CHECK(vertices[1].TCoords == v2f{0.125f, 0.25f});
@ -161,7 +161,7 @@ SECTION("blender cube scaled") {
const auto mesh = loadMesh(model_stem + "blender_cube_scaled.gltf");
REQUIRE(mesh);
REQUIRE(mesh->getMeshBufferCount() == 1);
auto *meshbuf = dynamic_cast<irr::scene::SSkinMeshBuffer *>(
auto *meshbuf = dynamic_cast<scene::SSkinMeshBuffer *>(
mesh->getMeshBuffer(0));
REQUIRE(meshbuf);
@ -179,11 +179,11 @@ SECTION("blender cube matrix transform") {
REQUIRE(mesh->getMeshBufferCount() == 1);
SECTION("Transformation is correct") {
auto *meshbuf = dynamic_cast<irr::scene::SSkinMeshBuffer *>(
auto *meshbuf = dynamic_cast<scene::SSkinMeshBuffer *>(
mesh->getMeshBuffer(0));
REQUIRE(meshbuf);
REQUIRE(meshbuf->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
meshbuf->getVertices());
const auto checkVertex = [&](const std::size_t i, v3f vec) {
// The transform scales by (1, 2, 3) and translates by (4, 5, 6).
@ -210,7 +210,7 @@ SECTION("snow man") {
SECTION("vertex coordinates are correct for all buffers") {
REQUIRE(mesh->getMeshBuffer(0)->getVertexCount() == 24);
{
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(0)->getVertices());
CHECK(vertices[0].Pos == v3f{3.0f, 24.0f, -3.0f});
CHECK(vertices[3].Pos == v3f{3.0f, 18.0f, 3.0f});
@ -223,7 +223,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(1)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(1)->getVertices());
CHECK(vertices[2].Pos == v3f{5.0f, 10.0f, 5.0f});
CHECK(vertices[3].Pos == v3f{5.0f, 0.0f, 5.0f});
@ -236,7 +236,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(2)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(2)->getVertices());
CHECK(vertices[1].Pos == v3f{4.0f, 10.0f, -4.0f});
CHECK(vertices[2].Pos == v3f{4.0f, 18.0f, 4.0f});
@ -252,7 +252,7 @@ SECTION("snow man") {
SECTION("vertex indices are correct for all buffers") {
{
REQUIRE(mesh->getMeshBuffer(0)->getIndexCount() == 36);
auto indices = static_cast<const irr::u16 *>(
auto indices = static_cast<const u16 *>(
mesh->getMeshBuffer(0)->getIndices());
CHECK(indices[0] == 23);
CHECK(indices[1] == 21);
@ -261,7 +261,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(1)->getIndexCount() == 36);
auto indices = static_cast<const irr::u16 *>(
auto indices = static_cast<const u16 *>(
mesh->getMeshBuffer(1)->getIndices());
CHECK(indices[10] == 16);
CHECK(indices[11] == 18);
@ -270,7 +270,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(2)->getIndexCount() == 36);
auto indices = static_cast<const irr::u16 *>(
auto indices = static_cast<const u16 *>(
mesh->getMeshBuffer(2)->getIndices());
CHECK(indices[26] == 6);
CHECK(indices[27] == 5);
@ -283,7 +283,7 @@ SECTION("snow man") {
SECTION("vertex normals are correct for all buffers") {
{
REQUIRE(mesh->getMeshBuffer(0)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(0)->getVertices());
CHECK(vertices[0].Normal == v3f{1.0f, 0.0f, -0.0f});
CHECK(vertices[1].Normal == v3f{1.0f, 0.0f, -0.0f});
@ -294,7 +294,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(1)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(1)->getVertices());
CHECK(vertices[0].Normal == v3f{1.0f, 0.0f, -0.0f});
CHECK(vertices[1].Normal == v3f{1.0f, 0.0f, -0.0f});
@ -305,7 +305,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(2)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(2)->getVertices());
CHECK(vertices[3].Normal == v3f{1.0f, 0.0f, -0.0f});
CHECK(vertices[4].Normal == v3f{-1.0f, 0.0f, -0.0f});
@ -320,7 +320,7 @@ SECTION("snow man") {
SECTION("texture coords are correct for all buffers") {
{
REQUIRE(mesh->getMeshBuffer(0)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(0)->getVertices());
CHECK(vertices[0].TCoords == v2f{0.583333313f, 0.791666686f});
CHECK(vertices[1].TCoords == v2f{0.583333313f, 0.666666686f});
@ -331,7 +331,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(1)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(1)->getVertices());
CHECK(vertices[1].TCoords == v2f{0.0f, 0.791666686f});
@ -343,7 +343,7 @@ SECTION("snow man") {
}
{
REQUIRE(mesh->getMeshBuffer(2)->getVertexCount() == 24);
auto vertices = static_cast<const irr::video::S3DVertex *>(
auto vertices = static_cast<const video::S3DVertex *>(
mesh->getMeshBuffer(2)->getVertices());
CHECK(vertices[10].TCoords == v2f{0.375f, 0.416666657f});
CHECK(vertices[11].TCoords == v2f{0.375f, 0.583333313f});
@ -360,7 +360,7 @@ SECTION("simple sparse accessor")
{
const auto mesh = loadMesh(model_stem + "simple_sparse_accessor.gltf");
REQUIRE(mesh);
const auto *vertices = reinterpret_cast<irr::video::S3DVertex *>(
const auto *vertices = reinterpret_cast<video::S3DVertex *>(
mesh->getMeshBuffer(0)->getVertices());
const std::array<v3f, 14> expectedPositions = {
// Lower
@ -387,7 +387,7 @@ SECTION("simple sparse accessor")
// https://github.com/KhronosGroup/glTF-Sample-Models/tree/main/2.0/SimpleSkin
SECTION("simple skin")
{
using SkinnedMesh = irr::scene::SkinnedMesh;
using SkinnedMesh = scene::SkinnedMesh;
const auto mesh = loadMesh(model_stem + "simple_skin.gltf");
REQUIRE(mesh != nullptr);
auto csm = dynamic_cast<const SkinnedMesh*>(mesh);
@ -414,17 +414,17 @@ SECTION("simple skin")
{
const auto &transform = std::get<core::Transform>(parent->transform);
CHECK(transform.translation == v3f(0, 0, 0));
CHECK(transform.rotation == irr::core::quaternion());
CHECK(transform.rotation == core::quaternion());
CHECK(transform.scale == v3f(1, 1, 1));
CHECK(parent->GlobalInversedMatrix == irr::core::matrix4());
CHECK(parent->GlobalInversedMatrix == core::matrix4());
}
{
const auto &transform = std::get<core::Transform>(child->transform);
const v3f translation(0, 1, 0);
CHECK(transform.translation == translation);
CHECK(transform.rotation == irr::core::quaternion());
CHECK(transform.rotation == core::quaternion());
CHECK(transform.scale == v3f(1, 1, 1));
irr::core::matrix4 inverseBindMatrix;
core::matrix4 inverseBindMatrix;
inverseBindMatrix.setTranslation(-translation);
CHECK(child->GlobalInversedMatrix == inverseBindMatrix);
}
@ -433,7 +433,7 @@ SECTION("simple skin")
SECTION("weights are correct")
{
const auto weights = [&](const SkinnedMesh::SJoint *joint) {
std::unordered_map<irr::u32, irr::f32> weights;
std::unordered_map<u32, f32> weights;
for (std::size_t i = 0; i < joint->Weights.size(); ++i) {
const auto weight = joint->Weights[i];
REQUIRE(weight.buffer_id == 0);
@ -444,7 +444,7 @@ SECTION("simple skin")
const auto parentWeights = weights(parent);
const auto childWeights = weights(child);
const auto checkWeights = [&](irr::u32 index, irr::f32 parentWeight, irr::f32 childWeight) {
const auto checkWeights = [&](u32 index, f32 parentWeight, f32 childWeight) {
const auto getWeight = [](auto weights, auto index) {
const auto it = weights.find(index);
return it == weights.end() ? 0.0f : it->second;

View file

@ -25,9 +25,9 @@ const auto gamespec = findSubgame("devtest");
if (!gamespec.isValid())
SKIP();
irr::SIrrlichtCreationParameters p;
SIrrlichtCreationParameters p;
p.DriverType = video::EDT_NULL;
auto *driver = irr::createDeviceEx(p);
auto *driver = createDeviceEx(p);
REQUIRE(driver);
@ -42,7 +42,7 @@ const static auto model_stem = gamespec.gamemods_path +
DIR_DELIM + "testentities" + DIR_DELIM + "models" + DIR_DELIM + "testentities_";
SECTION("cool guy") {
const auto *mesh = dynamic_cast<irr::scene::SkinnedMesh*>(loadMesh(model_stem + "cool_guy.x"));
const auto *mesh = dynamic_cast<scene::SkinnedMesh*>(loadMesh(model_stem + "cool_guy.x"));
REQUIRE(mesh);
REQUIRE(mesh->getMeshBufferCount() == 1);

View file

@ -71,28 +71,28 @@ void TestKeycode::testCreateFromString()
void TestKeycode::testCreateFromSKeyInput()
{
KeyPress k;
irr::SEvent::SKeyInput in;
SEvent::SKeyInput in;
// Character key
in.Key = irr::KEY_KEY_3;
in.Key = KEY_KEY_3;
in.Char = L'3';
k = KeyPress(in);
UASSERTEQ_STR(k.sym(), "KEY_KEY_3");
// Non-Character key
in.Key = irr::KEY_RSHIFT;
in.Key = KEY_RSHIFT;
in.Char = L'\0';
k = KeyPress(in);
UASSERTEQ_STR(k.sym(), "KEY_RSHIFT");
// Irrlicht-unknown key
in.Key = irr::KEY_KEY_CODES_COUNT;
in.Key = KEY_KEY_CODES_COUNT;
in.Char = L'?';
k = KeyPress(in);
UASSERTEQ_STR(k.sym(), "?");
// prefer_character mode
in.Key = irr::KEY_COMMA;
in.Key = KEY_COMMA;
in.Char = L'G';
k = KeyPress(in, true);
UASSERTEQ_STR(k.sym(), "KEY_KEY_G");
@ -105,15 +105,15 @@ void TestKeycode::testCompare()
UASSERT(!(KeyPress("5") == KeyPress("KEY_NUMPAD5")));
// Matching char suffices
// note: This is a real-world example, Irrlicht maps XK_equal to irr::KEY_PLUS on Linux
irr::SEvent::SKeyInput in;
in.Key = irr::KEY_PLUS;
// note: This is a real-world example, Irrlicht maps XK_equal to KEY_PLUS on Linux
SEvent::SKeyInput in;
in.Key = KEY_PLUS;
in.Char = L'=';
UASSERT(KeyPress("=") == KeyPress(in));
// Matching keycode suffices
irr::SEvent::SKeyInput in2;
in.Key = in2.Key = irr::KEY_OEM_CLEAR;
SEvent::SKeyInput in2;
in.Key = in2.Key = KEY_OEM_CLEAR;
in.Char = L'\0';
in2.Char = L';';
UASSERT(KeyPress(in) == KeyPress(in2));

View file

@ -370,7 +370,7 @@ void TestUtilities::testWrapRows()
void TestUtilities::testEnrichedString()
{
EnrichedString str(L"Test bar");
irr::video::SColor color(0xFF, 0, 0, 0xFF);
video::SColor color(0xFF, 0, 0, 0xFF);
UASSERT(str.substr(1, 3).getString() == L"est");
str += L" BUZZ";