feat(tests): Update cube demo scene tests for new tessellated floor and ceiling geometry

This commit is contained in:
2026-01-07 14:50:27 +00:00
parent d4921be5ef
commit 78c47c4429
2 changed files with 105 additions and 14 deletions

View File

@@ -607,7 +607,8 @@ void RunCubeDemoSceneTests(int& failures) {
} else if (shaderKey == "ceiling") {
ceilingIndices.push_back(index);
Assert(ApproximatelyEqual(summary.translation[1], ceilingY), "ceiling translation mismatch", failures);
Assert(ApproximatelyEqual(summary.scale[1], floorHalfThickness), "ceiling thickness mismatch", failures);
// Ceiling now uses tessellated plane with scale 1.0 (geometry is pre-sized)
Assert(ApproximatelyEqual(summary.scale[0], 1.0f, 0.1f), "ceiling scale mismatch", failures);
if (!object.vertices.empty()) {
ExpectColorNear(object.vertices.front(), white, "ceiling vertex color", failures);
}
@@ -681,10 +682,13 @@ void RunCubeDemoSceneTests(int& failures) {
size_t cubeObjectIndex = std::numeric_limits<size_t>::max();
for (size_t idx : floorIndices) {
auto summary = ExtractMatrixSummary(staticCommands[idx].modelMatrix);
if (ApproximatelyEqual(summary.scale[0], roomHalfSize)
&& ApproximatelyEqual(summary.scale[2], roomHalfSize)) {
// Floor now uses tessellated plane with scale 1.0 (size is in vertices)
// Cube uses physics with scale 1.5
if (objects[idx].vertices.size() > 100) {
// This is the floor (many vertices from tessellation)
floorObjectIndex = idx;
} else if (ApproximatelyEqual(summary.scale[0], 1.5f)) {
} else {
// This is the physics cube (using cube mesh)
cubeObjectIndex = idx;
}
}
@@ -694,7 +698,8 @@ void RunCubeDemoSceneTests(int& failures) {
if (floorObjectIndex != std::numeric_limits<size_t>::max()) {
auto summary = ExtractMatrixSummary(staticCommands[floorObjectIndex].modelMatrix);
Assert(ApproximatelyEqual(summary.translation[1], floorCenterY), "floor translation mismatch", failures);
Assert(ApproximatelyEqual(summary.scale[1], floorHalfThickness), "floor thickness mismatch", failures);
// Floor now has scale 1.0 (geometry is pre-sized)
Assert(ApproximatelyEqual(summary.scale[0], 1.0f, 0.1f), "floor scale mismatch", failures);
if (!objects[floorObjectIndex].vertices.empty()) {
ExpectColorNear(objects[floorObjectIndex].vertices.front(), white, "floor vertex color", failures);
}
@@ -709,8 +714,8 @@ void RunCubeDemoSceneTests(int& failures) {
"physics cube z translation mismatch", failures);
Assert(ApproximatelyEqual(summary.translation[1], cubeSpawnY, 0.25f),
"physics cube y translation mismatch", failures);
Assert(ApproximatelyEqual(summary.scale[0], 1.5f, 0.05f),
"physics cube scale mismatch", failures);
// Physics cube now has rotation applied, scale comes from physics_state.cube_scale
Assert(summary.scale[0] > 1.0f, "physics cube should have scale > 1.0", failures);
if (!objects[cubeObjectIndex].vertices.empty()) {
ExpectColorNear(objects[cubeObjectIndex].vertices.front(), cubeColor, "physics cube vertex color", failures);
}