test_ltface: add test for `-visapprox vis` issue with opaque liquids
This commit is contained in:
parent
331dbfc20d
commit
924847661c
|
|
@ -0,0 +1,83 @@
|
|||
// Game: Quake 2
|
||||
// Format: Quake2
|
||||
// entity 0
|
||||
{
|
||||
"classname" "worldspawn"
|
||||
"_tb_textures" "textures/e1u1"
|
||||
"_bounce" "0"
|
||||
// brush 0
|
||||
{
|
||||
( 480 1088 928 ) ( 480 1089 928 ) ( 480 1088 929 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 704 1088 928 ) ( 704 1088 929 ) ( 705 1088 928 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 704 1088 928 ) ( 705 1088 928 ) ( 704 1089 928 ) e1u1/twall2_1 0 0 0 1 1
|
||||
( 944 1472 944 ) ( 944 1473 944 ) ( 945 1472 944 ) e1u1/twall2_1 0 0 0 1 1
|
||||
( 944 1488 944 ) ( 945 1488 944 ) ( 944 1488 945 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 1056 1472 944 ) ( 1056 1472 945 ) ( 1056 1473 944 ) e1u1/twall2_1 0 32 0 1 1
|
||||
}
|
||||
// brush 1
|
||||
{
|
||||
( 480 1088 1248 ) ( 480 1089 1248 ) ( 480 1088 1249 ) e1u1/twall2_1 0 96 0 1 1
|
||||
( 704 1072 1248 ) ( 704 1072 1249 ) ( 705 1072 1248 ) e1u1/twall2_1 0 96 0 1 1
|
||||
( 704 1088 1248 ) ( 705 1088 1248 ) ( 704 1089 1248 ) e1u1/twall2_1 0 0 0 1 1
|
||||
( 944 1472 1264 ) ( 944 1473 1264 ) ( 945 1472 1264 ) e1u1/twall2_1 0 0 0 1 1
|
||||
( 944 1488 1264 ) ( 945 1488 1264 ) ( 944 1488 1265 ) e1u1/twall2_1 0 96 0 1 1
|
||||
( 1056 1472 1264 ) ( 1056 1472 1265 ) ( 1056 1473 1264 ) e1u1/twall2_1 0 96 0 1 1
|
||||
}
|
||||
// brush 2
|
||||
{
|
||||
( 480 1072 928 ) ( 480 1073 928 ) ( 480 1072 929 ) e1u1/twall2_1 16 32 0 1 1
|
||||
( 704 1072 928 ) ( 704 1072 929 ) ( 705 1072 928 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 704 1072 928 ) ( 705 1072 928 ) ( 704 1073 928 ) e1u1/twall2_1 0 -16 0 1 1
|
||||
( 944 1456 1248 ) ( 944 1457 1248 ) ( 945 1456 1248 ) e1u1/twall2_1 0 -16 0 1 1
|
||||
( 944 1088 944 ) ( 945 1088 944 ) ( 944 1088 945 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 1056 1456 944 ) ( 1056 1456 945 ) ( 1056 1457 944 ) e1u1/twall2_1 16 32 0 1 1
|
||||
}
|
||||
// brush 3
|
||||
{
|
||||
( 480 1392 928 ) ( 480 1393 928 ) ( 480 1392 929 ) e1u1/twall2_1 -48 32 0 1 1
|
||||
( 832 1488 928 ) ( 832 1488 929 ) ( 833 1488 928 ) e1u1/twall2_1 -128 32 0 1 1
|
||||
( 832 1392 928 ) ( 833 1392 928 ) ( 832 1393 928 ) e1u1/twall2_1 -128 48 0 1 1
|
||||
( 1072 1776 1248 ) ( 1072 1777 1248 ) ( 1073 1776 1248 ) e1u1/twall2_1 -128 48 0 1 1
|
||||
( 1072 1504 944 ) ( 1073 1504 944 ) ( 1072 1504 945 ) e1u1/twall2_1 -128 32 0 1 1
|
||||
( 1056 1392 928 ) ( 1056 1392 929 ) ( 1056 1393 928 ) e1u1/twall2_1 -48 32 0 1 1
|
||||
}
|
||||
// brush 4
|
||||
{
|
||||
( 1056 1088 1056 ) ( 1056 1089 1056 ) ( 1056 1088 1057 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 736 1088 1056 ) ( 736 1088 1057 ) ( 737 1088 1056 ) e1u1/twall2_1 -32 32 0 1 1
|
||||
( 736 1088 928 ) ( 737 1088 928 ) ( 736 1089 928 ) e1u1/twall2_1 -32 0 0 1 1
|
||||
( 976 1472 1248 ) ( 976 1473 1248 ) ( 977 1472 1248 ) e1u1/twall2_1 -32 0 0 1 1
|
||||
( 976 1488 1072 ) ( 977 1488 1072 ) ( 976 1488 1073 ) e1u1/twall2_1 -32 32 0 1 1
|
||||
( 1072 1472 1072 ) ( 1072 1472 1073 ) ( 1072 1473 1072 ) e1u1/twall2_1 0 32 0 1 1
|
||||
}
|
||||
// brush 5
|
||||
{
|
||||
( 464 1088 1056 ) ( 464 1089 1056 ) ( 464 1088 1057 ) e1u1/twall2_1 0 32 0 1 1
|
||||
( 144 1072 1056 ) ( 144 1072 1057 ) ( 145 1072 1056 ) e1u1/twall2_1 48 32 0 1 1
|
||||
( 144 1088 928 ) ( 145 1088 928 ) ( 144 1089 928 ) e1u1/twall2_1 48 0 0 1 1
|
||||
( 384 1472 1248 ) ( 384 1473 1248 ) ( 385 1472 1248 ) e1u1/twall2_1 48 0 0 1 1
|
||||
( 384 1488 1072 ) ( 385 1488 1072 ) ( 384 1488 1073 ) e1u1/twall2_1 48 32 0 1 1
|
||||
( 480 1472 1072 ) ( 480 1472 1073 ) ( 480 1473 1072 ) e1u1/twall2_1 0 32 0 1 1
|
||||
}
|
||||
// brush 6
|
||||
{
|
||||
( 544 1088 944 ) ( 544 1089 944 ) ( 544 1088 945 ) e1u1/water4 0 0 0 1 1 32 0 0
|
||||
( 544 1088 944 ) ( 544 1088 945 ) ( 545 1088 944 ) e1u1/water4 16 0 0 1 1 32 0 0
|
||||
( 544 1088 944 ) ( 545 1088 944 ) ( 544 1089 944 ) e1u1/water4 16 0 0 1 1 32 0 0
|
||||
( 608 1488 1248 ) ( 608 1489 1248 ) ( 609 1488 1248 ) e1u1/water4 16 0 0 1 1 32 0 0
|
||||
( 608 1488 960 ) ( 609 1488 960 ) ( 608 1488 961 ) e1u1/water4 16 0 0 1 1 32 0 0
|
||||
( 608 1488 960 ) ( 608 1488 961 ) ( 608 1489 960 ) e1u1/water4 0 0 0 1 1 32 0 0
|
||||
}
|
||||
}
|
||||
// entity 1
|
||||
{
|
||||
"classname" "info_player_start"
|
||||
"origin" "976 1408 968"
|
||||
"angle" "180"
|
||||
}
|
||||
// entity 2
|
||||
{
|
||||
"classname" "light"
|
||||
"origin" "552 1240 1080"
|
||||
"light" "1000"
|
||||
}
|
||||
|
|
@ -4,13 +4,19 @@
|
|||
#include <common/bspinfo.hh>
|
||||
#include <qbsp/qbsp.hh>
|
||||
#include <testmaps.hh>
|
||||
#include <vis/vis.hh>
|
||||
|
||||
struct testresults_t {
|
||||
mbsp_t bsp;
|
||||
bspxentries_t bspx;
|
||||
};
|
||||
|
||||
static testresults_t LoadTestmap(const std::filesystem::path &name, std::vector<std::string> extra_args)
|
||||
enum class runvis_t {
|
||||
no, yes
|
||||
};
|
||||
|
||||
static testresults_t LoadTestmap(const std::filesystem::path &name, std::vector<std::string> extra_args,
|
||||
runvis_t run_vis = runvis_t::no)
|
||||
{
|
||||
auto map_path = std::filesystem::path(testmaps_dir) / name;
|
||||
|
||||
|
|
@ -34,6 +40,15 @@ static testresults_t LoadTestmap(const std::filesystem::path &name, std::vector<
|
|||
InitQBSP(args);
|
||||
ProcessFile();
|
||||
|
||||
// run vis
|
||||
if (run_vis == runvis_t::yes) {
|
||||
std::vector<std::string> vis_args{
|
||||
"", // the exe path, which we're ignoring in this case
|
||||
};
|
||||
vis_args.push_back(bsp_path.string());
|
||||
vis_main(vis_args);
|
||||
}
|
||||
|
||||
// run light
|
||||
{
|
||||
std::vector<std::string> light_args{
|
||||
|
|
@ -236,3 +251,19 @@ TEST_CASE("q2_light_translucency") {
|
|||
CHECK(sample == qvec3b(100, 150, 100));
|
||||
});
|
||||
}
|
||||
|
||||
TEST_CASE("-visapprox vis with opaque liquids" * doctest::may_fail()) {
|
||||
INFO("opaque liquids block vis, but don't cast shadows by default.");
|
||||
INFO("this map has a point light in such an opaque liquid;");
|
||||
INFO("make sure '-visapprox vis' doesn't wrongly cull rays that should illuminate the level.");
|
||||
|
||||
auto [bsp, bspx] = LoadTestmap("q2_light_visapprox.map", {"-visapprox", "vis"}, runvis_t::yes);
|
||||
|
||||
auto *ceil_face = BSP_FindFaceAtPoint(&bsp, &bsp.dmodels[0], {968, 1368, 1248});
|
||||
REQUIRE(ceil_face);
|
||||
|
||||
CheckFaceLuxels(bsp, *ceil_face, [](qvec3b sample){
|
||||
INFO("ceiling above player start receiving light");
|
||||
REQUIRE(sample[0] > 200);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue