mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 13:44:58 +00:00
feat(tests): Update GPU render test expectations and remove skybox references
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -392,8 +392,8 @@ bool RunGpuRenderTest(int& failures,
|
||||
auto sceneScriptService = std::make_shared<sdl3cpp::services::impl::SceneScriptService>(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<sdl3cpp::services::impl::SceneScriptService>(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<float, 3> white = {1.0f, 1.0f, 1.0f};
|
||||
const std::array<float, 3> lanternColor = {1.0f, 0.9f, 0.6f};
|
||||
const std::array<float, 3> skyboxColor = {0.04f, 0.05f, 0.08f};
|
||||
const std::array<float, 3> cubeColor = {0.92f, 0.34f, 0.28f};
|
||||
|
||||
const float roomHalfSize = 15.0f;
|
||||
@@ -616,7 +611,6 @@ void RunCubeDemoSceneTests(int& failures) {
|
||||
std::vector<size_t> wallIndices;
|
||||
std::vector<size_t> ceilingIndices;
|
||||
std::vector<size_t> solidIndices;
|
||||
std::vector<size_t> skyboxIndices;
|
||||
std::vector<size_t> otherIndices;
|
||||
std::vector<std::array<float, 3>> 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user