diff --git a/docs/light.rst b/docs/light.rst index cd0dc678..2454c6c3 100644 --- a/docs/light.rst +++ b/docs/light.rst @@ -1031,7 +1031,7 @@ Also called directional light. Emitted from sky faces. Equivalent to worldspawn key :worldspawn-key:`_sunlight`. -.. sunlight-key:: "color" "r g b" +.. sunlight-key:: "_color" "r g b" Equivalent to worldspawn key :worldspawn-key:`_sunlight_color`. diff --git a/testmaps/q1_light_suntexture.map b/testmaps/q1_light_suntexture.map new file mode 100644 index 00000000..28ceddc0 --- /dev/null +++ b/testmaps/q1_light_suntexture.map @@ -0,0 +1,118 @@ +// Game: Quake +// Format: Standard +// entity 0 +{ +"classname" "worldspawn" +"_tb_textures" "textures/e1u1" +"_bounce" "0" +"wad" "deprecated/free_wad.wad" +// brush 0 +{ +( 480 1088 928 ) ( 480 1089 928 ) ( 480 1088 929 ) bolt14 0 32 0 1 1 +( 704 1088 928 ) ( 704 1088 929 ) ( 705 1088 928 ) bolt14 0 32 0 1 1 +( 704 1088 928 ) ( 705 1088 928 ) ( 704 1089 928 ) bolt14 0 0 0 1 1 +( 944 1472 944 ) ( 944 1473 944 ) ( 945 1472 944 ) bolt14 0 0 0 1 1 +( 944 1488 944 ) ( 945 1488 944 ) ( 944 1488 945 ) bolt14 0 32 0 1 1 +( 1056 1472 944 ) ( 1056 1472 945 ) ( 1056 1473 944 ) bolt14 0 32 0 1 1 +} +// brush 1 +{ +( 720 1088 1232 ) ( 720 1089 1232 ) ( 720 1088 1233 ) bolt14 0 16 0 1 1 +( 704 1072 1232 ) ( 704 1072 1233 ) ( 705 1072 1232 ) bolt14 0 16 0 1 1 +( 704 1088 1232 ) ( 705 1088 1232 ) ( 704 1089 1232 ) bolt14 0 0 0 1 1 +( 944 1472 1248 ) ( 944 1473 1248 ) ( 945 1472 1248 ) bolt14 0 0 0 1 1 +( 944 1488 1248 ) ( 945 1488 1248 ) ( 944 1488 1249 ) bolt14 0 16 0 1 1 +( 784 1472 1248 ) ( 784 1472 1249 ) ( 784 1473 1248 ) bolt14 0 16 0 1 1 +} +// brush 2 +{ +( 480 1072 928 ) ( 480 1073 928 ) ( 480 1072 929 ) bolt14 16 32 0 1 1 +( 704 1072 928 ) ( 704 1072 929 ) ( 705 1072 928 ) bolt14 0 32 0 1 1 +( 704 1072 928 ) ( 705 1072 928 ) ( 704 1073 928 ) bolt14 0 -16 0 1 1 +( 944 1456 1248 ) ( 944 1457 1248 ) ( 945 1456 1248 ) bolt14 0 -16 0 1 1 +( 944 1088 944 ) ( 945 1088 944 ) ( 944 1088 945 ) bolt14 0 32 0 1 1 +( 1056 1456 944 ) ( 1056 1456 945 ) ( 1056 1457 944 ) bolt14 16 32 0 1 1 +} +// brush 3 +{ +( 480 1392 928 ) ( 480 1393 928 ) ( 480 1392 929 ) bolt14 -48 32 0 1 1 +( 832 1488 928 ) ( 832 1488 929 ) ( 833 1488 928 ) bolt14 -128 32 0 1 1 +( 832 1392 928 ) ( 833 1392 928 ) ( 832 1393 928 ) bolt14 -128 48 0 1 1 +( 1072 1776 1248 ) ( 1072 1777 1248 ) ( 1073 1776 1248 ) bolt14 -128 48 0 1 1 +( 1072 1504 944 ) ( 1073 1504 944 ) ( 1072 1504 945 ) bolt14 -128 32 0 1 1 +( 1056 1392 928 ) ( 1056 1392 929 ) ( 1056 1393 928 ) bolt14 -48 32 0 1 1 +} +// brush 4 +{ +( 1056 1088 1056 ) ( 1056 1089 1056 ) ( 1056 1088 1057 ) bolt14 0 32 0 1 1 +( 736 1088 1056 ) ( 736 1088 1057 ) ( 737 1088 1056 ) bolt14 -32 32 0 1 1 +( 736 1088 928 ) ( 737 1088 928 ) ( 736 1089 928 ) bolt14 -32 0 0 1 1 +( 976 1472 1248 ) ( 976 1473 1248 ) ( 977 1472 1248 ) bolt14 -32 0 0 1 1 +( 976 1488 1072 ) ( 977 1488 1072 ) ( 976 1488 1073 ) bolt14 -32 32 0 1 1 +( 1072 1472 1072 ) ( 1072 1472 1073 ) ( 1072 1473 1072 ) bolt14 0 32 0 1 1 +} +// brush 5 +{ +( 464 1088 1056 ) ( 464 1089 1056 ) ( 464 1088 1057 ) bolt14 0 32 0 1 1 +( 144 1072 1056 ) ( 144 1072 1057 ) ( 145 1072 1056 ) bolt14 48 32 0 1 1 +( 144 1088 928 ) ( 145 1088 928 ) ( 144 1089 928 ) bolt14 48 0 0 1 1 +( 384 1472 1248 ) ( 384 1473 1248 ) ( 385 1472 1248 ) bolt14 48 0 0 1 1 +( 384 1488 1072 ) ( 385 1488 1072 ) ( 384 1488 1073 ) bolt14 48 32 0 1 1 +( 480 1472 1072 ) ( 480 1472 1073 ) ( 480 1473 1072 ) bolt14 0 32 0 1 1 +} +// brush 6 +{ +( 480 1088 1248 ) ( 480 1089 1248 ) ( 480 1088 1249 ) sky_void 0 32 0 1 1 +( 704 1072 1248 ) ( 704 1072 1249 ) ( 705 1072 1248 ) sky_void 0 32 0 1 1 +( 704 1088 1248 ) ( 705 1088 1248 ) ( 704 1089 1248 ) sky_void 0 0 0 1 1 +( 944 1472 1264 ) ( 944 1473 1264 ) ( 945 1472 1264 ) sky_void 0 0 0 1 1 +( 944 1488 1264 ) ( 945 1488 1264 ) ( 944 1488 1265 ) sky_void 0 32 0 1 1 +( 720 1472 1264 ) ( 720 1472 1265 ) ( 720 1473 1264 ) sky_void 0 32 0 1 1 +} +// brush 7 +{ +( 784 1104 1248 ) ( 784 1105 1248 ) ( 784 1104 1249 ) sky3 -16 32 0 1 1 +( 1008 1088 1248 ) ( 1008 1088 1249 ) ( 1009 1088 1248 ) sky3 -48 32 0 1 1 +( 1008 1104 1248 ) ( 1009 1104 1248 ) ( 1008 1105 1248 ) sky3 -48 16 0 1 1 +( 1248 1488 1264 ) ( 1248 1489 1264 ) ( 1249 1488 1264 ) sky3 -48 16 0 1 1 +( 1248 1504 1264 ) ( 1249 1504 1264 ) ( 1248 1504 1265 ) sky3 -48 32 0 1 1 +( 1056 1488 1264 ) ( 1056 1488 1265 ) ( 1056 1489 1264 ) sky3 -16 32 0 1 1 +} +} +// entity 1 +{ +"classname" "info_player_start" +"origin" "976 1408 968" +"angle" "180" +} +// entity 2 +{ +"classname" "light" +"origin" "568 1288 1080" +"target" "t1" +"_sun" "1" +"_color" "0.25 0 0" +"_suntexture" "sky_void" +} +// entity 3 +{ +"classname" "info_null" +"origin" "504 1288 944" +"targetname" "t1" +} +// entity 4 +{ +"classname" "info_null" +"origin" "1000 1288 944" +"targetname" "t2" +"angle" "180" +} +// entity 5 +{ +"classname" "light" +"origin" "936 1288 1080" +"target" "t2" +"_sun" "1" +"_color" "0 0 1" +"_suntexture" "sky3" +} diff --git a/tests/test_ltface.cc b/tests/test_ltface.cc index adb2a477..41b8c859 100644 --- a/tests/test_ltface.cc +++ b/tests/test_ltface.cc @@ -868,6 +868,15 @@ TEST_CASE("q1_sunlight") CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[0], {49, 49, 49}, {0, 0, 0}, {0, 0, 1}, &lit); } +TEST_CASE("q1_light_suntexture") +{ + INFO("different _sun 1 entities can emit from specific texture names using _suntexture"); + + auto [bsp, bspx, lit] = QbspVisLight_Q1("q1_light_suntexture.map", {}); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[0], {35, 0, 0}, {504, 1288, 944}, {0, 0, 1}, &lit); + CheckFaceLuxelAtPoint(&bsp, &bsp.dmodels[0], {0, 0, 142}, {1000, 1288, 944}, {0, 0, 1}, &lit); +} + TEST_CASE("q1_light_bounce_litwater without the water") { auto [bsp, bspx] = QbspVisLight_Common("q1_light_bounce_litwater.map", {"-omitdetail"}, {"-lit", "-bounce", "4"}, runvis_t::no);