From 2eb7d632dd7699ad19f77aff49580146f8481fea Mon Sep 17 00:00:00 2001 From: johndoe6345789 Date: Wed, 7 Jan 2026 20:24:53 +0000 Subject: [PATCH] feat(tests): Update GPU render test expectations and remove skybox references --- CMakeLists.txt | 1 + config/seed_runtime.json | 7 ------- scripts/cube_logic.lua | 19 ------------------- tests/test_cube_script.cpp | 26 +++----------------------- 4 files changed, 4 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bf4ef2..b7da836 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -380,6 +380,7 @@ if(NOT ENABLE_VITA) add_executable(script_engine_tests tests/test_cube_script.cpp src/services/impl/bgfx_graphics_backend.cpp + src/services/impl/bgfx_shader_compiler.cpp src/services/impl/logger_service.cpp src/services/impl/mesh_service.cpp src/services/impl/physics_bridge_service.cpp diff --git a/config/seed_runtime.json b/config/seed_runtime.json index af42f8e..ea01fb1 100644 --- a/config/seed_runtime.json +++ b/config/seed_runtime.json @@ -94,13 +94,6 @@ "shader_key": "solid", "document": "MaterialX/resources/Materials/Examples/StandardSurface/standard_surface_brass_tiled.mtlx", "material": "Tiled_Brass" - }, - { - "shader_key": "skybox", - "document": "MaterialX/resources/Materials/Examples/StandardSurface/standard_surface_default.mtlx", - "material": "Default", - "use_constant_color": true, - "constant_color": [0.04, 0.05, 0.08] } ], "atmospherics": { diff --git a/scripts/cube_logic.lua b/scripts/cube_logic.lua index 19b6763..1bed888 100644 --- a/scripts/cube_logic.lua +++ b/scripts/cube_logic.lua @@ -12,7 +12,6 @@ local cube_mesh_info = { local cube_vertices = {} local cube_indices = {} local cube_indices_double_sided = {} -local skybox_color = {0.04, 0.05, 0.08} local function build_double_sided_indices(indices) local doubled = {} @@ -756,23 +755,6 @@ local function create_static_cube(position, scale, color, shader_key, object_typ } end -local function create_skybox() - local room_extent = room.half_size + room.wall_thickness - local skybox_scale = room_extent * 2.5 - local function compute_model_matrix() - local translation = math3d.translation(camera.position[1], camera.position[2], camera.position[3]) - local scaling = scale_matrix(skybox_scale, skybox_scale, skybox_scale) - return math3d.multiply(translation, scaling) - end - - return { - vertices = apply_color_to_vertices(skybox_color), - indices = (#cube_indices_double_sided > 0) and cube_indices_double_sided or cube_indices, - compute_model_matrix = compute_model_matrix, - shader_keys = {"skybox"}, - object_type = "skybox", - } -end local function create_physics_cube() if not ensure_physics_setup() then @@ -1088,7 +1070,6 @@ end function get_scene_objects() local objects = {} - objects[#objects + 1] = create_skybox() for i = 1, #room_objects do objects[#objects + 1] = room_objects[i] end diff --git a/tests/test_cube_script.cpp b/tests/test_cube_script.cpp index 0187094..66a2f27 100644 --- a/tests/test_cube_script.cpp +++ b/tests/test_cube_script.cpp @@ -392,8 +392,8 @@ bool RunGpuRenderTest(int& failures, auto sceneScriptService = std::make_shared(engineService, logger); auto objects = sceneScriptService->LoadSceneObjects(); - if (objects.size() != 16) { - std::cerr << "GPU render test: Scene loaded " << objects.size() << " objects, expected 16\n"; + if (objects.size() != 15) { + std::cerr << "GPU render test: Scene loaded " << objects.size() << " objects, expected 15\n"; ++failures; success = false; } @@ -403,7 +403,6 @@ bool RunGpuRenderTest(int& failures, bool hasCeiling = false; int wallCount = 0; int lanternCount = 0; - bool hasSkybox = false; bool hasCube = false; for (const auto& obj : objects) { @@ -417,8 +416,6 @@ bool RunGpuRenderTest(int& failures, wallCount++; } else if (type == "lantern") { lanternCount++; - } else if (type == "skybox") { - hasSkybox = true; } else if (type == "physics_cube" || type == "spinning_cube") { hasCube = true; } @@ -428,7 +425,6 @@ bool RunGpuRenderTest(int& failures, Assert(hasCeiling, "GPU render test: Missing ceiling geometry", failures); Assert(wallCount == 4, "GPU render test: Expected 4 walls, got " + std::to_string(wallCount), failures); Assert(lanternCount == 8, "GPU render test: Expected 8 lanterns, got " + std::to_string(lanternCount), failures); - Assert(hasSkybox, "GPU render test: Missing skybox geometry", failures); Assert(hasCube, "GPU render test: Missing physics cube geometry", failures); // Validate all scene objects have valid shader keys (critical for rendering) @@ -558,7 +554,7 @@ void RunCubeDemoSceneTests(int& failures) { auto sceneScriptService = std::make_shared(engineService, logger); auto objects = sceneScriptService->LoadSceneObjects(); - Assert(objects.size() == 16, "cube demo should return 16 scene objects", failures); + Assert(objects.size() == 15, "cube demo should return 15 scene objects", failures); if (objects.empty()) { engineService->Shutdown(); return; @@ -590,7 +586,6 @@ void RunCubeDemoSceneTests(int& failures) { const std::array white = {1.0f, 1.0f, 1.0f}; const std::array lanternColor = {1.0f, 0.9f, 0.6f}; - const std::array skyboxColor = {0.04f, 0.05f, 0.08f}; const std::array cubeColor = {0.92f, 0.34f, 0.28f}; const float roomHalfSize = 15.0f; @@ -616,7 +611,6 @@ void RunCubeDemoSceneTests(int& failures) { std::vector wallIndices; std::vector ceilingIndices; std::vector solidIndices; - std::vector skyboxIndices; std::vector otherIndices; std::vector> wallTranslations; wallTranslations.reserve(4); @@ -659,11 +653,6 @@ void RunCubeDemoSceneTests(int& failures) { if (!object.vertices.empty()) { ExpectColorNear(object.vertices.front(), lanternColor, "lantern vertex color", failures); } - } else if (objectType == "skybox") { - skyboxIndices.push_back(index); - if (!object.vertices.empty()) { - ExpectColorNear(object.vertices.front(), skyboxColor, "skybox vertex color", failures); - } } else if (objectType == "physics_cube" || objectType == "spinning_cube") { // Physics cube is tracked separately below } else { @@ -674,7 +663,6 @@ void RunCubeDemoSceneTests(int& failures) { Assert(ceilingIndices.size() == 1, "expected 1 ceiling object", failures); Assert(wallIndices.size() == 4, "expected 4 wall objects", failures); Assert(solidIndices.size() == 8, "expected 8 lantern objects", failures); - Assert(skyboxIndices.size() == 1, "expected 1 skybox object", failures); Assert(floorIndices.size() == 1, "expected 1 floor object", failures); Assert(otherIndices.empty(), "unexpected object types in cube demo scene", failures); @@ -762,14 +750,6 @@ void RunCubeDemoSceneTests(int& failures) { Assert(!objects[cubeObjectIndex].indices.empty(), "cube indices should not be empty", failures); } - if (!skyboxIndices.empty()) { - auto summary = ExtractMatrixSummary(staticCommands[skyboxIndices.front()].modelMatrix); - Assert(ApproximatelyEqual(summary.translation[0], 0.0f), "skybox x translation mismatch", failures); - Assert(ApproximatelyEqual(summary.translation[1], 1.6f), "skybox y translation mismatch", failures); - Assert(ApproximatelyEqual(summary.translation[2], 10.0f), "skybox z translation mismatch", failures); - Assert(!objects[skyboxIndices.front()].indices.empty(), "skybox indices should not be empty", failures); - } - sceneManager->Shutdown(); engineService->Shutdown(); }