tests: first steps on a light test case

This commit is contained in:
Eric Wasylishen 2022-10-30 15:32:41 -06:00
parent 35ffc00462
commit da5910e732
4 changed files with 70 additions and 0 deletions

View File

@ -472,3 +472,4 @@ const img::texture *Face_Texture(const mbsp_t *bsp, const mface_t *face);
const qvec3b &Face_LookupTextureColor(const mbsp_t *bsp, const mface_t *face);
const qvec3d &Face_LookupTextureBounceColor(const mbsp_t *bsp, const mface_t *face);
int light_main(int argc, const char **argv);
int light_main(const std::vector<std::string> &args);

View File

@ -1475,3 +1475,13 @@ int light_main(int argc, const char **argv)
return 0;
}
int light_main(const std::vector<std::string> &args)
{
std::vector<const char *> argPtrs;
for (const std::string &arg : args) {
argPtrs.push_back(arg.data());
}
return light_main(argPtrs.size(), argPtrs.data());
}

View File

@ -123,6 +123,19 @@
( 0 -172 112 ) ( 128 -184 120 ) ( 0 -184 120 ) e1u1/color1_6 [ 1 0 0 0 ] [ 0 -0.8320502943378437 0.5547001962252291 0 ] 0 1 1
( 16 -144 48 ) ( 16 -144 49 ) ( 16 -143 48 ) e1u1/color1_6 [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
// brush 13
{
( -136 -201.37258300203052 -1.9411254969542853 ) ( -136 -173.0883117545686 3.715728752538098 ) ( -136 -184.40202025355336 15.02943725152285 ) e1u1/color1_6 [ 0.7071067811865477 0.5000000000000002 0.5 -29.892334 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 31.399715 1 1 0 0 0
( -120 -212.68629150101526 -13.254833995939052 ) ( -136 -190.05887450304573 -13.254833995939038 ) ( -136 -201.37258300203052 -1.9411254969542853 ) e1u1/color1_6 [ -0.7071067811865477 0.5000000000000002 0.5 -30.225405 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 32.6499 1 1 0 0 0
( -120 -173.08831175456856 26.343145750507603 ) ( -136 -173.0883117545686 3.715728752538098 ) ( -120 -161.77460325558383 15.029437251522836 ) e1u1/color1_6 [ 0.7071067811865477 0.5000000000000002 0.5 -29.89235 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 32.6499 1 1 0 0 0
( -80 -961.3725830018886 792 ) ( -120 -950.058874502904 803.3137084991148 ) ( -96 -950.058874502904 803.3137084991148 ) e1u1/color1_6 [ 1 0 0 32 ] [ 0 -0.7071067811865477 -0.7071067811865474 0.23550415 ] 0 1 1 0 0 0
( -96 -212.68629150101526 -13.254833995939052 ) ( -120 -201.37258300203052 -24.568542494923804 ) ( -120 -212.68629150101526 -13.254833995939052 ) e1u1/color1_6 [ -0.7071067811865477 0.5000000000000002 0.5 -30.225407 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 0 1 1 0 0 0
( -96 -173.08831175456856 26.343145750507603 ) ( -120 -161.77460325558383 15.029437251522836 ) ( -96 -161.77460325558383 15.029437251522836 ) e1u1/color1_6 [ 0.7071067811865477 -0.5000000000000002 -0.5 15.362465 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 0 1 1 0 0 0
( -80 -53.6568542494953 -115.71572875253534 ) ( -96 -81.9411254969572 -144 ) ( -80 -70.62741699797243 -132.68629150101248 ) e1u1/color1_6 [ -1 0 0 -32 ] [ 0 -0.7071067811865477 -0.7071067811865474 0.23550415 ] 0 1 1 0 0 0
( -80 -201.37258300203052 -1.9411254969542853 ) ( -96 -201.37258300203052 -24.568542494923804 ) ( -96 -212.68629150101526 -13.254833995939052 ) e1u1/color1_6 [ -0.7071067811865477 -0.5000000000000002 -0.5 30.225388 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 327.3501 1 1 0 0 0
( -96 -161.77460325558383 15.029437251522836 ) ( -80 -184.40202025355336 15.02943725152285 ) ( -96 -173.08831175456856 26.343145750507603 ) e1u1/color1_6 [ 0.7071067811865477 -0.5000000000000002 -0.5 15.362471 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 327.3501 1 1 0 0 0
( -80 -184.40202025355336 15.02943725152285 ) ( -80 -190.05887450304573 -13.254833995939038 ) ( -80 -201.37258300203052 -1.9411254969542853 ) e1u1/color1_6 [ -0.7071067811865477 -0.5000000000000002 -0.5 30.225403 ] [ 0 0.7071067811865475 -0.7071067811865478 29.019348 ] 328.60028 1 1 0 0 0
}
}
// entity 1
{

View File

@ -0,0 +1,46 @@
#include <doctest/doctest.h>
#include <light/light.hh>
#include <qbsp/qbsp.hh>
#include <testmaps.hh>
static void LoadTestmap(const std::filesystem::path &name, std::vector<std::string> extra_args)
{
auto map_path = std::filesystem::path(testmaps_dir) / name;
auto bsp_path = fs::path(test_quake2_maps_dir) / name.filename();
bsp_path.replace_extension(".bsp");
auto wal_metadata_path = std::filesystem::path(testmaps_dir) / "q2_wal_metadata";
std::vector<std::string> args{
"", // the exe path, which we're ignoring in this case
"-noverbose",
"-q2bsp",
"-path",
wal_metadata_path.string()
};
for (auto &arg : extra_args) {
args.push_back(arg);
}
args.push_back(map_path.string());
args.push_back(bsp_path.string());
// run qbsp
InitQBSP(args);
ProcessFile();
// run light
{
std::vector<std::string> light_args{
"", // the exe path, which we're ignoring in this case
bsp_path.string()
};
light_main(light_args);
}
}
TEST_CASE("TestLight") {
LoadTestmap("q2_lightmap_custom_scale.map", {});
}