3D Lights and shadows

This commit is contained in:
Marco 2025-06-28 10:05:07 +02:00
commit f3edc2b433
13 changed files with 2409 additions and 2173 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,15 +1,21 @@
[gd_scene format=3 uid="uid://cnnm5cqi1xfoc"]
[gd_scene load_steps=3 format=3 uid="uid://cnnm5cqi1xfoc"]
[ext_resource type="Script" uid="uid://ysbgwxewn4kr" path="res://3D/TrenchBroom/EntityScripts/Lights/light_special.gd" id="1_v4khc"]
[ext_resource type="Script" uid="uid://c8k0yi3krclkl" path="res://3D/TrenchBroom/EntityScripts/Lights/SpecialSubSpotLight.cs" id="2_kwm36"]
[node name="OmniLight3dSpecial" type="OmniLight3D"]
script = ExtResource("1_v4khc")
[node name="SpotLight3D" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
shadow_enabled = true
spot_angle = 75.0
spot_angle_attenuation = 0.1
script = ExtResource("2_kwm36")
[node name="SpotLight3D2" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0)
light_negative = true
spot_angle = 75.0
spot_angle_attenuation = 0.1
script = ExtResource("2_kwm36")

View file

@ -0,0 +1,25 @@
[gd_resource type="Resource" script_class="FuncGodotFGDPointClass" load_steps=4 format=3 uid="uid://tqytdmynf2ko"]
[ext_resource type="Resource" uid="uid://bpiblsew5s5so" path="res://3D/TrenchBroom/EntityDefinitions/base/light_base.tres" id="1_dnvj2"]
[ext_resource type="PackedScene" uid="uid://cnnm5cqi1xfoc" path="res://3D/Scenes/Lights/OmniLight3DSpecial.tscn" id="2_dnvj2"]
[ext_resource type="Script" uid="uid://c83r7t467hm4m" path="res://addons/func_godot/src/fgd/func_godot_fgd_point_class.gd" id="2_mtfeu"]
[resource]
script = ExtResource("2_mtfeu")
scene_file = ExtResource("2_dnvj2")
apply_rotation_on_map_build = false
apply_scale_on_map_build = true
classname = "light_special"
description = "Special Light entity with two sub spot lights for shadows"
func_godot_internal = false
base_classes = Array[Resource]([ExtResource("1_dnvj2")])
class_properties = {
"range": 320.0
}
class_property_descriptions = {
"range": "The light's radius in Quake Units. The entity script converts this to Godot Units in the LightOmni script."
}
auto_apply_to_matching_node_properties = false
meta_properties = {}
node_class = "OmniLight3D"
name_property = ""

View file

@ -0,0 +1,15 @@
using Godot;
namespace Cirno._3D.TrenchBroom.EntityScripts.Lights;
[Tool]
public partial class SpecialSubSpotLight : SpotLight3D
{
public override void _Ready()
{
var parent = GetParent<OmniLight3D>();
this.SpotRange = parent.OmniRange;
this.SpotAttenuation = parent.OmniAttenuation;
}
}

View file

@ -0,0 +1 @@
uid://c8k0yi3krclkl

View file

@ -0,0 +1,7 @@
@tool
class_name LightSpecial
extends OmniLight3D
func _func_godot_apply_properties(props: Dictionary) -> void:
#LightBase._func_godot_apply_properties(self, props)
omni_range = (props["range"] as float) * TbManager.INVERSE_SCALE

View file

@ -0,0 +1 @@
uid://ysbgwxewn4kr

View file

@ -1,4 +1,4 @@
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=38 format=3 uid="uid://b700sa4be6dfa"]
[gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=39 format=3 uid="uid://b700sa4be6dfa"]
[ext_resource type="Resource" uid="uid://ia1t5p4mhom3" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_omni.tres" id="1_7vcj1"]
[ext_resource type="Script" uid="uid://cknmd0lgmorx2" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_lykim"]
@ -37,6 +37,7 @@
[ext_resource type="Resource" uid="uid://cr3xqfglolihb" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/Actor_Furniture_ComputerTower.tres" id="34_wy0ht"]
[ext_resource type="Resource" uid="uid://m0xahs14etiy" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/Actor_SecurityCamera.tres" id="35_3jqmy"]
[ext_resource type="Resource" uid="uid://db7vsj36v1m2e" path="res://3D/TrenchBroom/EntityDefinitions/point/actors/Actor_Wallfan.tres" id="36_p5b6l"]
[ext_resource type="Resource" uid="uid://tqytdmynf2ko" path="res://3D/TrenchBroom/EntityDefinitions/point/lights/light_special.tres" id="37_53o7h"]
[resource]
script = ExtResource("1_lykim")
@ -44,5 +45,5 @@ export_file = false
target_map_editor = 1
fgd_name = "FuncGodot"
base_fgd_files = Array[Resource]([])
entity_definitions = Array[Resource]([ExtResource("1_7vcj1"), ExtResource("2_u7uvb"), ExtResource("3_u7uvb"), ExtResource("4_1nmxk"), ExtResource("5_ljb2x"), ExtResource("6_seuvu"), ExtResource("7_fmwex"), ExtResource("8_c8m8m"), ExtResource("9_14sjf"), ExtResource("10_xik3w"), ExtResource("11_dgiqm"), ExtResource("12_1teik"), ExtResource("13_f0hti"), ExtResource("14_6ld6e"), ExtResource("15_g8j5j"), ExtResource("16_7h4of"), ExtResource("17_m3sbm"), ExtResource("18_m3sbm"), ExtResource("19_hvhb8"), ExtResource("20_3v5us"), ExtResource("21_g67cj"), ExtResource("22_iy67w"), ExtResource("23_b5lmu"), ExtResource("24_ndas4"), ExtResource("25_n7wsi"), ExtResource("26_v48k5"), ExtResource("27_ombvk"), ExtResource("28_31lma"), ExtResource("29_louv0"), ExtResource("30_wfgfu"), ExtResource("31_elv2e"), ExtResource("32_elv2e"), ExtResource("33_aawmv"), ExtResource("34_wy0ht"), ExtResource("35_3jqmy"), ExtResource("36_p5b6l")])
entity_definitions = Array[Resource]([ExtResource("1_7vcj1"), ExtResource("2_u7uvb"), ExtResource("3_u7uvb"), ExtResource("4_1nmxk"), ExtResource("5_ljb2x"), ExtResource("6_seuvu"), ExtResource("7_fmwex"), ExtResource("8_c8m8m"), ExtResource("9_14sjf"), ExtResource("10_xik3w"), ExtResource("11_dgiqm"), ExtResource("12_1teik"), ExtResource("13_f0hti"), ExtResource("14_6ld6e"), ExtResource("15_g8j5j"), ExtResource("16_7h4of"), ExtResource("17_m3sbm"), ExtResource("18_m3sbm"), ExtResource("19_hvhb8"), ExtResource("20_3v5us"), ExtResource("21_g67cj"), ExtResource("22_iy67w"), ExtResource("23_b5lmu"), ExtResource("24_ndas4"), ExtResource("25_n7wsi"), ExtResource("26_v48k5"), ExtResource("27_ombvk"), ExtResource("28_31lma"), ExtResource("29_louv0"), ExtResource("30_wfgfu"), ExtResource("31_elv2e"), ExtResource("32_elv2e"), ExtResource("33_aawmv"), ExtResource("34_wy0ht"), ExtResource("35_3jqmy"), ExtResource("36_p5b6l"), ExtResource("37_53o7h")])
metadata/_custom_type_script = "uid://cknmd0lgmorx2"

View file

@ -65,7 +65,7 @@ hframes = 4
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.84862, 0, -4.8932)
[node name="StartPosition" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 80.6638, 1.57535, -31.6094)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.7161, 1.57535, 4.13675)
[node name="CameraTarget" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 21.0389, 2.33215, 3.16925)

View file

@ -1,21 +1,11 @@
[gd_scene load_steps=7 format=3 uid="uid://byc67yxbkefyk"]
[gd_scene load_steps=4 format=3 uid="uid://byc67yxbkefyk"]
[ext_resource type="Script" uid="uid://cg6y36s7buapp" path="res://Scripts/Weapons/Bullet3D.cs" id="1_48dvc"]
[ext_resource type="Texture2D" uid="uid://cybpmpb0d8yva" path="res://Sprites/Projectile.png" id="2_pklkt"]
[ext_resource type="Script" uid="uid://dvln1783wvvuw" path="res://Scripts/Components/Actors/ShadowProvider.cs" id="3_pklkt"]
[sub_resource type="SphereShape3D" id="SphereShape3D_pklkt"]
radius = 0.172059
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_y20hp"]
transparency = 1
depth_draw_mode = 2
shading_mode = 0
albedo_color = Color(0, 0, 0, 0.235294)
[sub_resource type="QuadMesh" id="QuadMesh_6q4hk"]
material = SubResource("StandardMaterial3D_y20hp")
[node name="Bullet" type="Area3D" groups=["bullets"]]
collision_layer = 8
collision_mask = 85
@ -34,14 +24,6 @@ shape = SubResource("SphereShape3D_pklkt")
[node name="VisibleOnScreenNotifier" type="VisibleOnScreenNotifier3D" parent="."]
[node name="Shadow" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, -0.29, 0)
mesh = SubResource("QuadMesh_6q4hk")
script = ExtResource("3_pklkt")
MaxShadowScale = 0.2
MinShadowScale = 0.05
CollisionMask = 1
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="screen_exited" from="VisibleOnScreenNotifier" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]