tests: add test for solid black lightmaps in HL mode
This commit is contained in:
parent
23591efba9
commit
e8747407d6
|
|
@ -0,0 +1,81 @@
|
|||
// Game: Half-Life
|
||||
// Format: Standard
|
||||
// entity 0
|
||||
{
|
||||
"classname" "worldspawn"
|
||||
"_bounce" "0"
|
||||
// brush 0
|
||||
{
|
||||
( 480 1088 928 ) ( 480 1089 928 ) ( 480 1088 929 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 704 1088 928 ) ( 704 1088 929 ) ( 705 1088 928 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 704 1088 928 ) ( 705 1088 928 ) ( 704 1089 928 ) OUT_WALL4B 0 0 0 1 1
|
||||
( 944 1472 944 ) ( 944 1473 944 ) ( 945 1472 944 ) OUT_WALL4B 0 0 0 1 1
|
||||
( 944 1488 944 ) ( 945 1488 944 ) ( 944 1488 945 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 1056 1472 944 ) ( 1056 1472 945 ) ( 1056 1473 944 ) OUT_WALL4B 0 32 0 1 1
|
||||
}
|
||||
// brush 1
|
||||
{
|
||||
( 480 1088 1248 ) ( 480 1089 1248 ) ( 480 1088 1249 ) OUT_WALL4B 0 96 0 1 1
|
||||
( 704 1072 1248 ) ( 704 1072 1249 ) ( 705 1072 1248 ) OUT_WALL4B 0 96 0 1 1
|
||||
( 704 1088 1248 ) ( 705 1088 1248 ) ( 704 1089 1248 ) OUT_WALL4B 0 0 0 1 1
|
||||
( 944 1472 1264 ) ( 944 1473 1264 ) ( 945 1472 1264 ) OUT_WALL4B 0 0 0 1 1
|
||||
( 944 1488 1264 ) ( 945 1488 1264 ) ( 944 1488 1265 ) OUT_WALL4B 0 96 0 1 1
|
||||
( 1056 1472 1264 ) ( 1056 1472 1265 ) ( 1056 1473 1264 ) OUT_WALL4B 0 96 0 1 1
|
||||
}
|
||||
// brush 2
|
||||
{
|
||||
( 480 1072 928 ) ( 480 1073 928 ) ( 480 1072 929 ) OUT_WALL4B 16 32 0 1 1
|
||||
( 704 1072 928 ) ( 704 1072 929 ) ( 705 1072 928 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 704 1072 928 ) ( 705 1072 928 ) ( 704 1073 928 ) OUT_WALL4B 0 -16 0 1 1
|
||||
( 944 1456 1248 ) ( 944 1457 1248 ) ( 945 1456 1248 ) OUT_WALL4B 0 -16 0 1 1
|
||||
( 944 1088 944 ) ( 945 1088 944 ) ( 944 1088 945 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 1056 1456 944 ) ( 1056 1456 945 ) ( 1056 1457 944 ) OUT_WALL4B 16 32 0 1 1
|
||||
}
|
||||
// brush 3
|
||||
{
|
||||
( 480 1392 928 ) ( 480 1393 928 ) ( 480 1392 929 ) OUT_WALL4B -48 32 0 1 1
|
||||
( 832 1488 928 ) ( 832 1488 929 ) ( 833 1488 928 ) OUT_WALL4B -128 32 0 1 1
|
||||
( 832 1392 928 ) ( 833 1392 928 ) ( 832 1393 928 ) OUT_WALL4B -128 48 0 1 1
|
||||
( 1072 1776 1248 ) ( 1072 1777 1248 ) ( 1073 1776 1248 ) OUT_WALL4B -128 48 0 1 1
|
||||
( 1072 1504 944 ) ( 1073 1504 944 ) ( 1072 1504 945 ) OUT_WALL4B -128 32 0 1 1
|
||||
( 1056 1392 928 ) ( 1056 1392 929 ) ( 1056 1393 928 ) OUT_WALL4B -48 32 0 1 1
|
||||
}
|
||||
// brush 4
|
||||
{
|
||||
( 1056 1088 1056 ) ( 1056 1089 1056 ) ( 1056 1088 1057 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 736 1088 1056 ) ( 736 1088 1057 ) ( 737 1088 1056 ) OUT_WALL4B -32 32 0 1 1
|
||||
( 736 1088 928 ) ( 737 1088 928 ) ( 736 1089 928 ) OUT_WALL4B -32 0 0 1 1
|
||||
( 976 1472 1248 ) ( 976 1473 1248 ) ( 977 1472 1248 ) OUT_WALL4B -32 0 0 1 1
|
||||
( 976 1488 1072 ) ( 977 1488 1072 ) ( 976 1488 1073 ) OUT_WALL4B -32 32 0 1 1
|
||||
( 1072 1472 1072 ) ( 1072 1472 1073 ) ( 1072 1473 1072 ) OUT_WALL4B 0 32 0 1 1
|
||||
}
|
||||
// brush 5
|
||||
{
|
||||
( 464 1088 1056 ) ( 464 1089 1056 ) ( 464 1088 1057 ) OUT_WALL4B 0 32 0 1 1
|
||||
( 144 1072 1056 ) ( 144 1072 1057 ) ( 145 1072 1056 ) OUT_WALL4B 48 32 0 1 1
|
||||
( 144 1088 928 ) ( 145 1088 928 ) ( 144 1089 928 ) OUT_WALL4B 48 0 0 1 1
|
||||
( 384 1472 1248 ) ( 384 1473 1248 ) ( 385 1472 1248 ) OUT_WALL4B 48 0 0 1 1
|
||||
( 384 1488 1072 ) ( 385 1488 1072 ) ( 384 1488 1073 ) OUT_WALL4B 48 32 0 1 1
|
||||
( 480 1472 1072 ) ( 480 1472 1073 ) ( 480 1473 1072 ) OUT_WALL4B 0 32 0 1 1
|
||||
}
|
||||
}
|
||||
// entity 1
|
||||
{
|
||||
"classname" "info_player_start"
|
||||
"origin" "976 1408 1000"
|
||||
"angle" "180"
|
||||
}
|
||||
// entity 2
|
||||
{
|
||||
"classname" "light"
|
||||
"origin" "600 1288 1112"
|
||||
"light" "1000"
|
||||
"angle" "30"
|
||||
"target" "s1"
|
||||
}
|
||||
// entity 3
|
||||
{
|
||||
"classname" "info_null"
|
||||
"origin" "484 1284 1116"
|
||||
"targetname" "s1"
|
||||
}
|
||||
|
|
@ -13,9 +13,18 @@ static testresults_t QbspVisLight_Common(const std::filesystem::path &name, std:
|
|||
std::vector<std::string> extra_light_args, runvis_t run_vis)
|
||||
{
|
||||
const bool is_q2 = std::find(extra_qbsp_args.begin(), extra_qbsp_args.end(), "-q2bsp") != extra_qbsp_args.end();
|
||||
const bool is_hl = std::find(extra_qbsp_args.begin(), extra_qbsp_args.end(), "-hlbsp") != extra_qbsp_args.end();
|
||||
|
||||
auto map_path = std::filesystem::path(testmaps_dir) / name;
|
||||
|
||||
auto bsp_dir = fs::path(is_q2 ? test_quake2_maps_dir : test_quake_maps_dir);
|
||||
fs::path bsp_dir;
|
||||
if (is_q2) {
|
||||
bsp_dir = fs::path(test_quake2_maps_dir);
|
||||
} else if (is_hl) {
|
||||
bsp_dir = fs::path(test_halflife_maps_dir);
|
||||
} else {
|
||||
bsp_dir = fs::path(test_quake_maps_dir);
|
||||
}
|
||||
// Try to get an absolute path, so our output .bsp (for qbsp) and input .bsp paths (for vis/light) are
|
||||
// absolute. Otherwise we risk light.exe picking up the wrong .bsp (especially if there are debug .bsp's in the
|
||||
// testmaps folder).
|
||||
|
|
@ -104,6 +113,12 @@ testresults_t QbspVisLight_Q2(
|
|||
return QbspVisLight_Common(name, {"-q2bsp"}, extra_light_args, run_vis);
|
||||
}
|
||||
|
||||
testresults_t QbspVisLight_HL(
|
||||
const std::filesystem::path &name, std::vector<std::string> extra_light_args, runvis_t run_vis)
|
||||
{
|
||||
return QbspVisLight_Common(name, {"-hlbsp"}, extra_light_args, run_vis);
|
||||
}
|
||||
|
||||
TEST_CASE("lightgrid_sample_t equality")
|
||||
{
|
||||
SUBCASE("style equality") {
|
||||
|
|
@ -934,3 +949,24 @@ TEST_CASE("q1_light_black")
|
|||
// and rendering as solid black (correct) in vkQuake 1.30.1, FTEQW Mar 1 2022
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("hl_light_black")
|
||||
{
|
||||
auto [bsp, bspx] = QbspVisLight_HL("hl_light_black.map", {});
|
||||
|
||||
{
|
||||
const qvec3d point{1056, 1300, 972};
|
||||
|
||||
INFO("ensure completely black lightmaps are written out as style 255 / lightofs -1 in HL mode");
|
||||
|
||||
const mface_t *face = BSP_FindFaceAtPoint(&bsp, &bsp.dmodels[0], point, {-1, 0, 0});
|
||||
REQUIRE(face);
|
||||
CHECK(face->styles[0] == 255);
|
||||
CHECK(face->styles[1] == 255);
|
||||
CHECK(face->styles[2] == 255);
|
||||
CHECK(face->styles[3] == 255);
|
||||
CHECK(face->lightofs == -1);
|
||||
|
||||
// confirmed that this renders as expected (black lightmaps) in the Dec 2023 HL build
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,4 +51,6 @@ enum class runvis_t
|
|||
testresults_lit_t QbspVisLight_Q1(
|
||||
const std::filesystem::path &name, std::vector<std::string> extra_light_args, runvis_t run_vis = runvis_t::no);
|
||||
testresults_t QbspVisLight_Q2(
|
||||
const std::filesystem::path &name, std::vector<std::string> extra_light_args, runvis_t run_vis = runvis_t::no);
|
||||
const std::filesystem::path &name, std::vector<std::string> extra_light_args, runvis_t run_vis = runvis_t::no);
|
||||
testresults_t QbspVisLight_HL(
|
||||
const std::filesystem::path &name, std::vector<std::string> extra_light_args, runvis_t run_vis = runvis_t::no);
|
||||
|
|
|
|||
Loading…
Reference in New Issue