mirror of
https://github.com/johndoe6345789/SDL3CPlusPlus.git
synced 2026-04-24 13:44:58 +00:00
feat(tests): Update cube demo scene tests for new tessellated floor and ceiling geometry
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user