From 2df839cfc24367e2e7efe2be8117d05dbacb273d Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Mon, 21 Jan 2019 23:53:24 -0700 Subject: [PATCH] light: Add "_bounce" "-1" to disable bouncing for a func_detail/etc. --- include/common/bspfile.hh | 1 + include/qbsp/qbsp.hh | 1 + light/bounce.cc | 7 ++- man/light.1 | 7 ++- qbsp/map.cc | 2 + testmaps/nobounce.map | 121 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 137 insertions(+), 2 deletions(-) create mode 100644 testmaps/nobounce.map diff --git a/include/common/bspfile.hh b/include/common/bspfile.hh index b276bdde..37c2bcd5 100644 --- a/include/common/bspfile.hh +++ b/include/common/bspfile.hh @@ -350,6 +350,7 @@ typedef struct { #define TEX_NOSHADOW (1ULL << 44) /* don't cast a shadow */ #define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45 #define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */ +#define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */ // Q2 Texture flags. #define Q2_SURF_LIGHT 0x1 // value will hold the light strength diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index 086ae33f..4372b3db 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -138,6 +138,7 @@ #define TEX_NOSHADOW (1ULL << 44) /* don't cast a shadow */ #define TEX_PHONG_ANGLE_CONCAVE_SHIFT 45 #define TEX_PHONG_ANGLE_CONCAVE_MASK (255ULL << TEX_PHONG_ANGLE_CONCAVE_SHIFT) /* 8 bit value. if non zero, overrides _phong_angle for concave joints. */ +#define TEX_NOBOUNCE (1ULL << 53) /* light doesn't bounce off this face */ /* * The quality of the bsp output is highly sensitive to these epsilon values. diff --git a/light/bounce.cc b/light/bounce.cc index aa510dab..0081c62e 100644 --- a/light/bounce.cc +++ b/light/bounce.cc @@ -113,7 +113,12 @@ Face_ShouldBounce(const mbsp_t *bsp, const bsp2_dface_t *face) if (!strcmp("skip", texname)) { return false; } - + + // check for "_bounce" "-1" + if (extended_texinfo_flags[face->texinfo] & TEX_NOBOUNCE) { + return false; + } + return true; } diff --git a/man/light.1 b/man/light.1 index 3ea7ee89..0cecba3b 100644 --- a/man/light.1 +++ b/man/light.1 @@ -229,7 +229,7 @@ When set to 1, spotlight falloff is calculated from the distance to the targeted .PP The following keys can be used on any entity with a brush model. -"_minlight", "_mincolor", "_dirt", "_phong", "_phong_angle", "_phong_angle_concave", "_shadow" are supported on func_detail/func_group as well, if +"_minlight", "_mincolor", "_dirt", "_phong", "_phong_angle", "_phong_angle_concave", "_shadow", "_bounce" are supported on func_detail/func_group as well, if qbsp from these tools is used. .IP "\fB""_minlight"" ""n""\fP" @@ -287,6 +287,11 @@ If it's 0 or unset, the same value as "_phong_angle" is used. .IP "\fB""_lightignore"" ""n""\fP" 1 makes a model receive minlight only, ignoring all lights / sunlight. Could be useful on rotators / trains. +.IP "\fB""_bounce"" ""n""\fP" +Set to -1 to prevent this model from bouncing light (i.e. prevents its brushes from emitting bounced light they receive from elsewhere.) Only has an effect if "_bounce" is enabled in worldspawn. + + + .SH "LIGHT ENTITY KEYS" .PP diff --git a/qbsp/map.cc b/qbsp/map.cc index fa72e906..03c5b557 100644 --- a/qbsp/map.cc +++ b/qbsp/map.cc @@ -294,6 +294,8 @@ FindTexinfoEnt(mtexinfo_t *texinfo, const mapentity_t *entity) flags |= TEX_SPECIAL; if (atoi(ValueForKey(entity, "_dirt")) == -1) flags |= TEX_NODIRT; + if (atoi(ValueForKey(entity, "_bounce")) == -1) + flags |= TEX_NOBOUNCE; if (shadow == -1) flags |= TEX_NOSHADOW; if (!Q_strcasecmp("func_detail_illusionary", ValueForKey(entity, "classname"))) { diff --git a/testmaps/nobounce.map b/testmaps/nobounce.map new file mode 100644 index 00000000..a23a7f02 --- /dev/null +++ b/testmaps/nobounce.map @@ -0,0 +1,121 @@ +// Game: Quake +// Format: Standard +// entity 0 +{ +"classname" "worldspawn" +"wad" "quake.wad" +"_bounce" "1" +// brush 0 +{ +( 448 64 -16 ) ( 448 -256 -16 ) ( 448 64 320 ) wswamp1_4 -0 -0 -0 1 1 +( 432 -848 -16 ) ( 432 -848 320 ) ( 448 -848 -16 ) wswamp1_4 -0 -0 -0 1 1 +( 432 64 320 ) ( 432 64 -16 ) ( 448 64 320 ) wswamp1_4 -0 -0 -0 1 1 +( 432 -256 320 ) ( 432 64 320 ) ( 448 -256 320 ) woodflr1_2 -0 -0 -0 1 1 +( 432 64 -16 ) ( 432 -256 -16 ) ( 448 64 -16 ) woodflr1_4 -0 -0 -0 1 1 +( 432 64 320 ) ( 432 -256 320 ) ( 432 64 -16 ) wswamp1_4 -0 -0 -0 1 1 +} +// brush 1 +{ +( -176 -528 -16 ) ( -496 -528 -16 ) ( -176 -528 320 ) wswamp1_4 16 -0 180 1 -1 +( 416 -512 320 ) ( 416 -512 -16 ) ( 416 -528 320 ) wswamp1_4 16 -0 -0 1 1 +( -48 -512 -16 ) ( -48 -512 320 ) ( -48 -528 -16 ) wswamp1_4 16 -0 -0 1 1 +( -496 -512 320 ) ( -176 -512 320 ) ( -496 -528 320 ) woodflr1_2 16 -16 90 1 1 +( -176 -512 -16 ) ( -496 -512 -16 ) ( -176 -528 -16 ) woodflr1_4 16 -16 90 1 1 +( -176 -512 -16 ) ( -176 -512 320 ) ( -496 -512 -16 ) wswamp1_4 16 -0 180 1 -1 +} +// brush 2 +{ +( -48 -176 320 ) ( -48 -176 -16 ) ( 432 -176 320 ) wswamp1_4 -0 -0 -0 1 1 +( 432 48 320 ) ( -48 48 320 ) ( 432 64 320 ) woodflr1_2 -0 -0 -0 1 1 +( -48 48 -16 ) ( 432 48 -16 ) ( -48 64 -16 ) woodflr1_4 -0 -0 -0 1 1 +( 432 48 -16 ) ( 432 48 320 ) ( 432 64 -16 ) woodflr1_4 0 0 0 1 1 +( -480 48 320 ) ( -480 48 -16 ) ( -480 64 320 ) woodflr1_4 -0 -0 -0 1 1 +( 432 -192 320 ) ( 432 -192 -16 ) ( -48 -192 320 ) wswamp1_4 -0 -0 -0 1 1 +} +// brush 3 +{ +( -48 -864 -16 ) ( -48 -864 320 ) ( 432 -864 -16 ) wswamp1_4 -0 -0 -0 1 1 +( -48 -848 320 ) ( 432 -848 320 ) ( -48 -864 320 ) woodflr1_2 -0 -32 -0 1 1 +( 432 -848 -16 ) ( -48 -848 -16 ) ( 432 -864 -16 ) woodflr1_4 -0 -32 -0 1 1 +( 432 -848 320 ) ( 432 -848 -16 ) ( 432 -864 320 ) woodflr1_4 32 -0 -0 1 1 +( -480 -848 -16 ) ( -480 -848 320 ) ( -480 -864 -16 ) woodflr1_4 32 -0 -0 1 1 +( -48 -848 -16 ) ( 432 -848 -16 ) ( -48 -848 320 ) wswamp1_4 -0 -0 -0 1 1 +} +// brush 4 +{ +( 432 -240 320 ) ( -48 -240 320 ) ( 432 48 320 ) woodflr1_2 -0 -0 -0 1 1 +( 432 48 304 ) ( 432 -240 304 ) ( 432 48 320 ) woodflr1_4 0 0 0 1 1 +( -480 -240 304 ) ( -480 48 304 ) ( -480 -240 320 ) woodflr1_4 -0 -0 -0 1 1 +( -48 48 304 ) ( 432 48 304 ) ( -48 48 320 ) woodflr1_4 0 0 0 1 1 +( 432 -848 304 ) ( -48 -848 304 ) ( 432 -848 320 ) woodflr1_4 -0 -0 -0 1 1 +( 432 48 304 ) ( -48 48 304 ) ( 432 -240 304 ) woodflr1_2 -0 -0 -0 1 1 +} +// brush 5 +{ +( -48 -240 -16 ) ( 432 -240 -16 ) ( -48 48 -16 ) woodflr1_4 -0 -0 -0 1 1 +( 432 -240 -0 ) ( 432 48 -0 ) ( 432 -240 -16 ) woodflr1_4 0 0 0 1 1 +( -480 48 -0 ) ( -480 -240 -0 ) ( -480 48 -16 ) woodflr1_4 -0 -0 -0 1 1 +( 432 48 -0 ) ( -48 48 -0 ) ( 432 48 -16 ) woodflr1_4 0 0 0 1 1 +( -48 -848 -0 ) ( 432 -848 -0 ) ( -48 -848 -16 ) woodflr1_4 -0 -0 -0 1 1 +( -48 -240 -0 ) ( -48 48 -0 ) ( 432 -240 -0 ) woodflr1_4 -0 -0 -0 1 1 +} +// brush 6 +{ +( 288 -736 -0 ) ( 288 -735 -0 ) ( 288 -736 1 ) wiz1_4 48 -0 -0 1 1 +( 304 -592 16 ) ( 304 -592 17 ) ( 304 -591 16 ) wiz1_4 48 -0 -0 1 1 +( 240 -784 -0 ) ( 240 -784 1 ) ( 241 -784 -0 ) wiz1_4 -16 -0 -0 1 1 +( 304 -592 16 ) ( 305 -592 16 ) ( 304 -592 17 ) wiz1_4 -16 -0 -0 1 1 +( 304 -592 192 ) ( 304 -591 192 ) ( 305 -592 192 ) wiz1_4 -16 -48 -0 1 1 +( 240 -736 -0 ) ( 241 -736 -0 ) ( 240 -735 -0 ) wiz1_4 -16 -48 -0 1 1 +} +// brush 7 +{ +( -464 64 -16 ) ( -464 -256 -16 ) ( -464 64 320 ) wswamp1_4 -0 -0 -0 1 1 +( -480 -848 -16 ) ( -480 -848 320 ) ( -464 -848 -16 ) wswamp1_4 16 -0 -0 1 1 +( -480 64 320 ) ( -480 64 -16 ) ( -464 64 320 ) wswamp1_4 16 -0 -0 1 1 +( -480 -256 320 ) ( -480 64 320 ) ( -464 -256 320 ) woodflr1_2 16 -0 -0 1 1 +( -480 64 -16 ) ( -480 -256 -16 ) ( -464 64 -16 ) woodflr1_4 16 -0 -0 1 1 +( -480 64 320 ) ( -480 -256 320 ) ( -480 64 -16 ) wswamp1_4 -0 -0 -0 1 1 +} +} +// entity 1 +{ +"classname" "info_player_start" +"origin" "-352 -512 24" +"_bounce" "1" +} +// entity 2 +{ +"classname" "func_detail" +"_bounce" "-1" +// brush 0 +{ +( 288 -416 -0 ) ( 288 -415 -0 ) ( 288 -416 1 ) wiz1_4 48 -0 -0 1 1 +( 304 -272 16 ) ( 304 -272 17 ) ( 304 -271 16 ) wiz1_4 48 -0 -0 1 1 +( 240 -464 -0 ) ( 240 -464 1 ) ( 241 -464 -0 ) wiz1_4 -16 -0 -0 1 1 +( 304 -272 16 ) ( 305 -272 16 ) ( 304 -272 17 ) wiz1_4 -16 -0 -0 1 1 +( 304 -272 192 ) ( 304 -271 192 ) ( 305 -272 192 ) wiz1_4 -16 -48 -0 1 1 +( 240 -416 -0 ) ( 241 -416 -0 ) ( 240 -415 -0 ) wiz1_4 -16 -48 -0 1 1 +} +} +// entity 3 +{ +"classname" "light" +"origin" "205 -360 5" +"mangle" "0 -321 -0" +"delay" "2" +"light" "5000" +} +// entity 4 +{ +"classname" "light" +"origin" "205 -696 5" +"mangle" "0 -321 -0" +"delay" "2" +"light" "5000" +} +// entity 5 +{ +"classname" "info_null" +"origin" "-120 -328 120" +}