Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Commit 35d8ac9

Browse files
authored
Merge pull request #16 from Project-Collapse-Studios/psc-dev
Merge recent changes
2 parents 7e12cea + 354884e commit 35d8ac9

5 files changed

Lines changed: 102 additions & 15 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
@PointClass
2+
iconsprite("editor/light.vmt")
3+
autovis(Postcompiler)
4+
color(255 0 0)
5+
sphere(_fifty_percent_distance)
6+
sphere(_zero_percent_distance)
7+
sphere(_distance)
8+
sphere(_hard_radius_override)
9+
clusteredlight(point)
10+
= comp_light_bounce: "Generates bounced lighting (only) without direct lighting. Internally a light_rt."
11+
[
12+
_light(color255) : "Brightness" : "255 255 255 200" : "Color and brightness of the light."
13+
_lightHDR(color255) : "BrightnessHDR" : "-1 -1 -1 1"
14+
_lightscaleHDR(float) : "BrightnessScaleHDR" : 1 : "Amount to scale the light by when compiling for HDR."
15+
16+
linedivider_color(string) readonly : "-------------------------------------------------------------------------------------------------------"
17+
18+
_constant_attn(string) : "Constant" : 0
19+
_linear_attn(string) : "Linear" : 0
20+
_quadratic_attn(string) : "Quadratic" : 1
21+
_fifty_percent_distance(string) : "50 percent falloff distance" : 0 : "Distance at which brightness should fall off to 50%. If set, overrides linear constant and quadratic parameters."
22+
_zero_percent_distance(string) : "0 percent falloff distance" : 0 : "Distance at which brightness should fall off to negligible (1/256)%. Must set _fifty_percent_distance to use."
23+
24+
linedivider_falloff(string) readonly : "-------------------------------------------------------------------------------------------------------"
25+
26+
_hardfalloff(integer) : "Hard Falloff" : 0 : "If set, causes lights to fall to exactly zero beyond the zero percent distance. May cause unrealistic lighting if not used carefully."
27+
_distance(integer) : "Maximum Distance" : 0 : "The distance that light is allowed to cast."
28+
_hard_radius_threshold(float) : "Hard radius minimum brightness threshold" : 32
29+
_hard_radius_override(float) : "Hard radius override" : 0
30+
31+
]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
@PointClass
2+
color(255 255 0)
3+
autovis(Postcompiler)
4+
lightprop("models/editor/spot.mdl")
5+
lightcone()
6+
line(255 255 255, targetname, target)
7+
sphere(_fifty_percent_distance)
8+
sphere(_zero_percent_distance)
9+
sphere(_distance)
10+
sphere(_hard_radius_override)
11+
clusteredlight(spot)
12+
= comp_light_bounce_spot: "Generates bounced lighting (only) without direct lighting. Internally a light_rt_spot."
13+
[
14+
angles(angle) : "Pitch Yaw Roll (X Y Z)" : "0 0 0" : "This entity\'s orientation in the world. Roll is the rotation around the X axis, pitch is rotation around the Y axis and yaw is the rotation around the Z axis."
15+
16+
linedivider_base(string) readonly : "-------------------------------------------------------------------------------------------------------"
17+
18+
_light(color255) : "Brightness" : "255 255 255 200" : "Color and brightness of the light."
19+
_lightHDR(color255) : "BrightnessHDR" : "-1 -1 -1 1"
20+
_lightscaleHDR(float) : "BrightnessScaleHDR" : 1 : "Amount to scale the light by when compiling for HDR."
21+
22+
linedivider_color(string) readonly : "-------------------------------------------------------------------------------------------------------"
23+
24+
_inner_cone(integer) : "Inner (bright) angle" : 30
25+
_cone(integer) : "Outer (fading) angle" : 45
26+
_exponent(integer) : "Focus" : 1
27+
28+
linedivider_shape(string) readonly : "-------------------------------------------------------------------------------------------------------"
29+
30+
_constant_attn(string) : "Constant" : 0
31+
_linear_attn(string) : "Linear" : 0
32+
_quadratic_attn(string) : "Quadratic" : 1
33+
_fifty_percent_distance(string) : "50 percent falloff distance" : 0 : "Distance at which brightness should fall off to 50%. If set, overrides linear constant and quadratic parameters."
34+
_zero_percent_distance(string) : "0 percent falloff distance" : 0 : "Distance at which brightness should fall off to negligible (1/256)%. Must set _fifty_percent_distance to use."
35+
36+
linedivider_falloff(string) readonly : "-------------------------------------------------------------------------------------------------------"
37+
38+
target(target_destination) : "Entity to point at" : : "The name of an entity in the map that the spotlight will point at. This will override the spotlight\'s angles."
39+
pitch(angle_negative_pitch) : "Pitch" : -90
40+
41+
_hardfalloff(integer) : "Hard Falloff" : 0 : "If set, causes lights to fall to exactly zero beyond the zero percent distance. May cause unrealistic lighting if not used carefully."
42+
_distance(integer) : "Maximum Distance" : 0 : "The distance that light is allowed to cast."
43+
_hard_radius_threshold(float) : "Hard radius minimum brightness threshold" : 32
44+
_hard_radius_override(float) : "Hard radius override" : 0
45+
46+
]

transforms/comp_light_bounce.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
"""An entity that generates only baked bounced lighting."""
2+
3+
from hammeraddons.bsp_transform import trans, Context
4+
from srctools.logger import get_logger
5+
from srctools import VMF
6+
7+
8+
@trans("comp_light_bounce", priority=999) # Run last to allow other transformations to take place first
9+
def comp_light_bounce(ctx: Context):
10+
vmf: VMF = ctx.vmf
11+
12+
for light in vmf.by_class["comp_light_bounce_spot"]:
13+
light["classname"] = "light_rt_spot"
14+
light["spawnflags"] = 1
15+
light["_lightmode"] = 2
16+
17+
for light in vmf.by_class["comp_light_bounce"]:
18+
light["classname"] = "light_rt"
19+
light["spawnflags"] = 1
20+
light["_lightmode"] = 2
21+
22+
23+

transforms/dynamic_priority.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,18 +126,6 @@ def dynamic_priority(ctx: Context):
126126
vmf.add_ents([light_bounce])
127127

128128

129-
# HACK: Make VRAD skip processing dynamic lights
130-
match light["classname"]:
131-
case "light_rt_spot":
132-
light["classname"] = "_dynpr_rt_spot"
133-
134-
case "light_rt":
135-
light["classname"] = "_dynpr_rt"
136-
137-
case _:
138-
pass
139-
140-
141129

142130
def AddLogic(vmf: VMF, pos: Vec):
143131
"""Add the necessary logic to load the saved state on every map load."""

transforms/workaround_bakedbounce.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22

33
from hammeraddons.bsp_transform import trans, Context
44
from srctools.logger import get_logger
5-
from srctools import Entity, VMF, Output, conv_int
5+
from srctools import VMF
66

77

88

99
LOGGER = get_logger(__name__)
1010

11-
@trans("workaround_bakedbounce")
11+
@trans("workaround_bakedbounce", priority=-999999) # Run first
1212
def bbounceworkaround(ctx: Context):
1313
vmf: VMF = ctx.vmf
1414
for light in vmf.by_class["light"] | vmf.by_class["light_spot"] | vmf.by_class["light_rt"] | vmf.by_class["light_rt_spot"]:
1515
if light["targetname", ""] and light["_lightmode", 2] == "2":
16-
LOGGER.info(f"Changing light {light["targetname"]}")
1716
light["_lightmode"] = 3
1817
light["style"] = 0
1918

0 commit comments

Comments
 (0)