render: add test for double switchable lights

https://github.com/w23/xash3d-fwgs/issues/679
This commit is contained in:
Ivan Avdeev 2023-12-04 13:50:54 -05:00
parent d62e8b0a3a
commit 7c6fa9627d
26 changed files with 83 additions and 4 deletions

BIN
render/gold/material_2light0_679_basecolor.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_direct.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_emissive.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_full.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_indirect.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_indirect_diffuse.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_indirect_specular.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_lighting.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_ngeom.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light0_679_nshade.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_basecolor.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_direct.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_emissive.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_full.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_indirect.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_indirect_diffuse.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_indirect_specular.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_lighting.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_ngeom.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/gold/material_2light1_679_nshade.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/maps/test_material.bsp (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,9 @@
// debug light
DEBUG_RED 255 0 0 5000
DEBUG_GREEN 0 255 0 5000
DEBUG_BLUE 0 0 255 5000
DEBUG_L_1000 255 255 255 5000
DEBUG_L_5000 255 128 128 5000
//c1a0_labflre 20 255 0 550
//+0~fifts_lght3 255 0 0 100

View File

@ -39,7 +39,7 @@ def test_list(arg: str) -> [str]:
for item in items: for item in items:
r = re.compile(item) r = re.compile(item)
for save in saves: for save in saves:
if r.match(save): if r.search(save):
tests.append(save) tests.append(save)
if not tests: if not tests:
raise argparse.ArgumentTypeError(f'No tests match {item}. Available tests are: {saves}') raise argparse.ArgumentTypeError(f'No tests match {item}. Available tests are: {saves}')
@ -52,7 +52,7 @@ parser.add_argument('--tests', '-t', type=test_list, default=saves, help='Run on
# TODO how to check that the dir is valid? presence of xash3d executable and valve dir? # TODO how to check that the dir is valid? presence of xash3d executable and valve dir?
parser.add_argument('--xash-dir', '-x', type=str, default=os.getcwd(), help='Path to xash3d-fwgs installation directory') parser.add_argument('--xash-dir', '-x', type=str, default=os.getcwd(), help='Path to xash3d-fwgs installation directory')
# TODO parse commands in type=.. function # TODO parse commands in type=.. function
parser.add_argument('command', type=str, default=None, help='Action to perform') parser.add_argument('command', type=str, default=None, help='Action to perform')
args = parser.parse_args() args = parser.parse_args()
@ -96,6 +96,7 @@ def compile():
def copy_assets(): def copy_assets():
print('Copying assets') print('Copying assets')
shutil.copy2(src=f'{ROOT}/vulkan_debug.wad', dst=f'{args.xash_dir}/valve/')
shutil.copytree(src=f'{ROOT}/maps', dst=f'{args.xash_dir}/valve/maps/', dirs_exist_ok=True) shutil.copytree(src=f'{ROOT}/maps', dst=f'{args.xash_dir}/valve/maps/', dirs_exist_ok=True)
shutil.copytree(src=f'{ROOT}/save', dst=f'{args.xash_dir}/valve/save/', dirs_exist_ok=True) shutil.copytree(src=f'{ROOT}/save', dst=f'{args.xash_dir}/valve/save/', dirs_exist_ok=True)
with open(f'{args.xash_dir}/rendertest.script', 'w') as script: with open(f'{args.xash_dir}/rendertest.script', 'w') as script:
@ -134,6 +135,7 @@ def compare_one(test: str, channel: str, image_base: str, image_gold: str, image
return ret return ret
def compare(): def compare():
mkdir_p(WORKDIR)
screenshot_base = f'{args.xash_dir}/valve/rendertest' screenshot_base = f'{args.xash_dir}/valve/rendertest'
diffs = [] diffs = []
with concurrent.futures.ThreadPoolExecutor() as executor: with concurrent.futures.ThreadPoolExecutor() as executor:
@ -150,7 +152,7 @@ def compare():
executor.submit(subprocess.run, ['convert', executor.submit(subprocess.run, ['convert',
'(', image_gold, '-bordercolor', 'gold', '-border', '2x2', '-gravity', 'SouthWest', '-font', 'Impact', '-pointsize', '24', '-fill', 'gold', '-stroke', 'black', '-annotate', '0', 'GOLD', ')', '(', image_gold, '-bordercolor', 'gold', '-border', '2x2', '-gravity', 'SouthWest', '-font', 'Impact', '-pointsize', '24', '-fill', 'gold', '-stroke', 'black', '-annotate', '0', 'GOLD', ')',
'(', image_test, '-bordercolor', 'white', '-border', '2x2', '-fill', 'white', '-annotate', '0', 'TEST', ')', '(', image_test, '-bordercolor', 'white', '-border', '2x2', '-fill', 'white', '-annotate', '0', 'TEST', ')',
'-loop', '0', '-set', 'delay', '25', image_flip], check=True) '-loop', '0', '-set', 'delay', '100', image_flip], check=True)
results = [diff.result() for diff in diffs] results = [diff.result() for diff in diffs]
# json.dump(results, open(f'{WORKDIR}/data.json', 'w')) # json.dump(results, open(f'{WORKDIR}/data.json', 'w'))
@ -181,7 +183,6 @@ def command_run():
copy_assets() copy_assets()
render() render()
compare() compare()
#report()
def command_render(): def command_render():
compile() compile()

BIN
render/save/rendertest_material_2light0_679.sav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/save/rendertest_material_2light1_679.sav (Stored with Git LFS) Normal file

Binary file not shown.

BIN
render/vulkan_debug.wad Normal file

Binary file not shown.