Skip to content

Commit

Permalink
Add entity shadow and shadow origin offset to lights
Browse files Browse the repository at this point in the history
Also split into more bases to reduce duplication

See StrataSource#181.
  • Loading branch information
TeamSpen210 committed Apr 26, 2023
1 parent a8c23d2 commit 5ca3c43
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 81 deletions.
37 changes: 2 additions & 35 deletions fgd/bases/BaseLight.fgd
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@
@BaseClass
@BaseClass
sphere(_fifty_percent_distance)
sphere(_zero_percent_distance)
sphere(_distance)
color(255 255 0)
= BaseLight
= BaseLight: "Parameters common to light and light_spot."
[
_light(color255) : "Brightness" : "255 255 255 200" : "Color and brightness of the light."
_lightHDR(color255) : "BrightnessHDR" : "-1 -1 -1 1"
_lightscaleHDR(float) : "BrightnessScaleHDR" : "1" : "Amount to scale the light by when compiling for HDR."

style[engine](integer) : "Appearance" : 0
style(choices) : "Appearance" : 0 =
[
0 : "Normal"
10: "Fluorescent flicker"
2 : "Slow, strong pulse"
11: "Slow pulse, noblack"
5 : "Gentle pulse"
1 : "Flicker A"
6 : "Flicker B"
3 : "Candle A"
7 : "Candle B"
8 : "Candle C"
4 : "Fast strobe"
9 : "Slow strobe"
12 : "Underwater light mutation"
]
pattern(string) : "Custom Appearance" : "" : "Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."
_constant_attn(string) : "Constant" : "0"
_linear_attn(string) : "Linear" : "0"
_quadratic_attn(string) : "Quadratic" : "1"
Expand All @@ -35,19 +17,4 @@
_hardfalloff(integer) : "Hard Falloff" : 0 : "If set, causes lights to fall to exactly zero beyond the zero percent distance. May cause unrealistic lightijng if not used carefully."

_distance(integer) : "Maximum Distance" : 0 : "The distance that light is allowed to cast."

// GMOD: GOPORT
_castentityshadow[engine](boolean)
_castentityshadow[GMod](Choices) : "Cast entity shadows" : 0 : "Objects illuminated by this light will cast a directional shadow." =
[
0 : "Don't affect entity shadow angles"
1 : "Affect entity shadow angles"
]

// Inputs
input TurnOn(void) : "Turn the light on."
input TurnOff(void) : "The the light off."
input Toggle(void) : "Toggle the light's current state."
input SetPattern(string) : "Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."
input FadeToPattern(string) : "Fades from first value in old pattern, to first value in the new given pattern. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."
]
28 changes: 28 additions & 0 deletions fgd/bases/LightPattern.fgd
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@BaseClass = LightPattern
[
style[engine](integer) : "Appearance" : 0
style(choices) : "Appearance" : 0 =
[
0 : "Normal"
10: "Fluorescent flicker"
2 : "Slow, strong pulse"
11: "Slow pulse, noblack"
5 : "Gentle pulse"
1 : "Flicker A"
6 : "Flicker B"
3 : "Candle A"
7 : "Candle B"
8 : "Candle C"
4 : "Fast strobe"
9 : "Slow strobe"
12 : "Underwater light mutation"
]
pattern(string) : "Custom Appearance" : "" : "Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."

// Inputs
input TurnOn(void) : "Turn the light on."
input TurnOff(void) : "The the light off."
input Toggle(void) : "Toggle the light's current state."
input SetPattern(string) : "Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."
input FadeToPattern(string) : "Fades from first value in old pattern, to first value in the new given pattern. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."
]
12 changes: 12 additions & 0 deletions fgd/bases/LightShadows.fgd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@BaseClass = LightShadows
[
// GMod backports this feature.
_castentityshadow[engine](boolean)
_castentityshadow[since_L4D, GMod](Choices) : "Cast entity shadows" : 0 : "Objects illuminated by this light can be set to cast a fake directional shadow away from this light." =
[
0 : "Don't affect entity shadow angles"
1 : "Affect entity shadow angles"
]

_shadoworiginoffset[since_L4D, GMod](vec_dir) : "Shadow Cast Offset" : "0 0 0" : "A world-space offset that gets applied to the light origin when casting entity shadows. Useful for dealing with funny-looking shadows from very low lights: Just offset up the z axis. Default 0 0 0."
]
8 changes: 3 additions & 5 deletions fgd/point/light/light.fgd
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
@PointClass base(BaseEntityPoint, BaseLight)
@PointClass base(BaseEntityPoint, BaseLight, LightPattern, LightShadows)
autovis(Lights, Omnidirectional Light)
light()
iconsprite("editor/light.vmt")
sphere(_distance)
line(255 255 255, targetname, target)
light()
iconsprite("editor/light.vmt")
= light: "An invisible omnidirectional lightsource."
[
spawnflags(flags) =
Expand Down
6 changes: 3 additions & 3 deletions fgd/point/light/light_directional.fgd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@PointClass base(Angles)
@PointClass base(Angles)
autovis(Lights, Directional Light)
color(255 255 0)
appliesto(since_L4D)
appliesto(since_L4D)
iconsprite("editor/light_directional.vmt") = light_directional: "A directional light with no falloff. Similar to sunlight in light_environment."
[
pitch(integer) : "Pitch" : 0 : "The downward pitch of the light from the sun. 0 is horizontal, -90 is straight down."
pitch(angle_negative_pitch) : "Pitch" : 0 : "The downward pitch of the light from the sun. 0 is horizontal, -90 is straight down."
_light(color255) : "Brightness" : "255 255 255 200"
_lighthdr(color255) : "BrightnessHDR" : "-1 -1 -1 1"
_lightscalehdr(float) : "BrightnessScaleHDR" : 0.7 : "Amount to scale the light by when compiling for HDR."
Expand Down
35 changes: 1 addition & 34 deletions fgd/point/light/light_environment.fgd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@PointClass base(BaseEntityPoint, Angles)
@PointClass base(BaseEntityPoint, Angles, LightPattern, LightShadows)
autovis(Lights, Environment Light)
iconsprite("editor/light_environment.vmt")
color(255 255 0)
Expand All @@ -15,38 +15,5 @@
_ambientscalehdr(float) : "AmbientScaleHDR" : 1 : "Amount to scale the ambient light by when compiling for hdr."
sunspreadangle(float) : "SunSpreadAngle" : 5 : "The angular extent of the sun for casting soft shadows. Higher numbers are more diffuse. 5 is a good starting value."

style[engine](integer) : "Appearance" : 0
style(choices) : "Appearance" : 0 =
[
0 : "Normal"
10: "Fluorescent flicker"
2 : "Slow, strong pulse"
11: "Slow pulse, noblack"
5 : "Gentle pulse"
1 : "Flicker A"
6 : "Flicker B"
3 : "Candle A"
7 : "Candle B"
8 : "Candle C"
4 : "Fast strobe"
9 : "Slow strobe"
12 : "Underwater light mutation"
]
pattern(string) : "Custom Appearance" : "" : "Set a custom pattern of light brightness for this light. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."

_castentityshadow[engine](boolean)
_castentityshadow[GMod](Choices) : "Cast entity shadows" : 0 : "Objects illuminated by this light will cast a directional shadow." =
[
0 : "Don't affect entity shadow angles"
1 : "Affect entity shadow angles"
]

// Inputs
input TurnOn(void) : "Turn the Sun on."
input TurnOff(void) : "The the Sun off."
input Toggle(void) : "Toggle the Sun's current state."
input SetPattern(string) : "Set a custom pattern of light brightness for the Sun. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."
input FadeToPattern(string) : "Fades from first value in old pattern, to first value in the new given pattern. Pattern format is a string of characters, where 'a' is total darkness, 'z' fully bright. i.e. 'aaggnnttzz' would be a steppy fade in from dark to light."

@resources []
]
7 changes: 3 additions & 4 deletions fgd/point/light/light_spot.fgd
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
@PointClass base(BaseEntityPoint, BaseLight)
@PointClass base(BaseEntityPoint, BaseLight, LightPattern, LightShadows)
autovis(Lights, Spotlight)
lightprop("models/editor/spot.mdl")
lightcone()
sphere(_distance)
lightprop("models/editor/spot.mdl")
lightcone()
line(255 255 255, targetname, target)
= light_spot: "An invisible and directional spotlight."
[
Expand Down

0 comments on commit 5ca3c43

Please sign in to comment.