Skip to content

Commit

Permalink
Add occlusion via rooms & portals
Browse files Browse the repository at this point in the history
  • Loading branch information
lawnjelly committed Aug 18, 2022
1 parent 967344a commit 0f8bca8
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ height = 0.4
_data = [ Vector2( 0, 0 ), 0.0, 0.37234, 0, 0, Vector2( 0.462338, 0.981818 ), 5.18966, -5.0, 0, 0, Vector2( 1, 0 ), 0.0, 0.0, 0, 0 ]

[node name="PartDisappearPuff" type="CPUParticles"]
portal_mode = 2
material_override = SubResource( 1 )
emitting = false
lifetime = 1.5
Expand All @@ -63,6 +64,7 @@ color_ramp = SubResource( 4 )
script = ExtResource( 3 )

[node name="MiniBlasts" type="CPUParticles" parent="."]
portal_mode = 2
material_override = SubResource( 5 )
emitting = false
amount = 16
Expand Down
8 changes: 8 additions & 0 deletions enemies/red_robot/parts/part_head.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://enemies/red_robot/parts/part_head.glb" type="PackedScene" id=1]

[node name="part_head" instance=ExtResource( 1 )]

[node name="EvilRoboHead" parent="." index="0"]
portal_mode = 2
8 changes: 8 additions & 0 deletions enemies/red_robot/parts/part_shield.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://enemies/red_robot/parts/part_shield.glb" type="PackedScene" id=1]

[node name="part_shield" instance=ExtResource( 1 )]

[node name="EvilRoboShield" parent="." index="0"]
portal_mode = 2
38 changes: 28 additions & 10 deletions enemies/red_robot/red_robot.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

[ext_resource path="res://enemies/red_robot/red_robot.gd" type="Script" id=1]
[ext_resource path="res://enemies/red_robot/model/red_robot.dae" type="PackedScene" id=2]
[ext_resource path="res://enemies/red_robot/parts/part_head.tscn" type="PackedScene" id=3]
[ext_resource path="res://enemies/red_robot/laser/LaserMaterial.tres" type="Material" id=4]
[ext_resource path="res://enemies/red_robot/laser/EmberTrailCutoff.tres" type="Material" id=5]
[ext_resource path="res://enemies/red_robot/laser/EmbersColorOverLife.tres" type="Gradient" id=6]
[ext_resource path="res://enemies/red_robot/laser/impact_effect/EmissionEmbers.tres" type="Material" id=7]
[ext_resource path="res://enemies/red_robot/parts/sparks_effect/SparkMaterial.tres" type="Material" id=8]
[ext_resource path="res://enemies/red_robot/audio/charge.wav" type="AudioStream" id=9]
[ext_resource path="res://enemies/red_robot/audio/shoot.wav" type="AudioStream" id=10]
[ext_resource path="res://enemies/red_robot/parts/part_head.glb" type="PackedScene" id=11]
[ext_resource path="res://enemies/red_robot/parts/part_shield.glb" type="PackedScene" id=12]
[ext_resource path="res://enemies/red_robot/parts/part_shield.tscn" type="PackedScene" id=13]
[ext_resource path="res://enemies/red_robot/audio/explosion.wav" type="AudioStream" id=17]
[ext_resource path="res://enemies/red_robot/audio/hit.wav" type="AudioStream" id=18]
[ext_resource path="res://enemies/red_robot/audio/walk.wav" type="AudioStream" id=19]
Expand Down Expand Up @@ -116,7 +116,7 @@ uniform_name = "Displacement"

[sub_resource type="VisualShader" id=22]
code = "shader_type spatial;
render_mode specular_schlick_ggx;
render_mode specular_schlick_ggx, async_visible;

uniform sampler2D noise;
uniform float Displacement;
Expand Down Expand Up @@ -400,7 +400,7 @@ nodes/hit3/position = Vector2( 980, 240 )
nodes/output/position = Vector2( 1180, 200 )
nodes/state/node = SubResource( 51 )
nodes/state/position = Vector2( 60, 100 )
node_connections = [ "state", 0, "Animation", "state", 1, "Animation 3", "state", 2, "Animation 2", "state", 3, "Animation 4", "output", 0, "hit3", "aiming", 0, "state", "aiming", 1, "aim", "hit1", 0, "aiming", "hit1", 1, "Animation 5", "hit2", 0, "hit1", "hit2", 1, "Animation 6", "hit3", 0, "hit2", "hit3", 1, "Animation 7" ]
node_connections = [ "state", 0, "Animation", "state", 1, "Animation 3", "state", 2, "Animation 2", "state", 3, "Animation 4", "output", 0, "hit3", "hit1", 0, "aiming", "hit1", 1, "Animation 5", "aiming", 0, "state", "aiming", 1, "aim", "hit3", 0, "hit2", "hit3", 1, "Animation 7", "hit2", 0, "hit1", "hit2", 1, "Animation 6" ]

[sub_resource type="SphereShape" id=53]
radius = 1.11815
Expand Down Expand Up @@ -770,24 +770,39 @@ script = ExtResource( 1 )
[node name="Skeleton" parent="RedRobotModel/Armature" index="0"]
bones/14/bound_children = [ NodePath("RayFrom") ]

[node name="EvilRoboBody" parent="RedRobotModel/Armature/Skeleton" index="0"]
portal_mode = 2

[node name="EvilRoboBody001" parent="RedRobotModel/Armature/Skeleton" index="1"]
portal_mode = 2

[node name="EvilRoboShield-L" parent="RedRobotModel/Armature/Skeleton" index="2"]
portal_mode = 2

[node name="EvilRoboShield-R" parent="RedRobotModel/Armature/Skeleton" index="3"]
portal_mode = 2

[node name="RayFrom" type="BoneAttachment" parent="RedRobotModel/Armature/Skeleton" index="4"]
transform = Transform( -0.997439, -0.070985, -0.00878045, -0.0710157, 0.99747, 0.00323016, 0.00852894, 0.00384544, -0.999956, -0.149183, 1.9902, 0.191941 )
bone_name = "CannonAnimRecoil"

[node name="Circle" type="MeshInstance" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
transform = Transform( 1, 0, 1.73472e-18, 0, -8.88178e-16, -1, 0, 1, 0, 0, 0, -1 )
portal_mode = 2
mesh = SubResource( 2 )
skeleton = NodePath("")
material/0 = ExtResource( 4 )

[node name="RayMesh" type="MeshInstance" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -1.25 )
portal_mode = 2
mesh = SubResource( 4 )
skeleton = NodePath("")
material/0 = ExtResource( 4 )

[node name="BuildupParticles" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
transform = Transform( 1, 3.70164e-10, 5.82077e-11, 3.66526e-10, 1, 9.31323e-10, 0, 1.86265e-09, 1, -1.39698e-09, 0, -1.47648 )
portal_mode = 2
material_override = ExtResource( 7 )
emitting = false
amount = 64
Expand All @@ -810,6 +825,7 @@ hue_variation_random = 0.87

[node name="LaserEmber" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
transform = Transform( 1, 7.30506e-09, 4.65661e-10, 0, 1, 0, 0, 3.72529e-09, 1, -7.45058e-09, 0.0332088, -10.283 )
portal_mode = 2
emitting = false
amount = 200
lifetime = 2.0
Expand All @@ -835,6 +851,7 @@ anim_offset_random = 1.0

[node name="LaserCenter" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
transform = Transform( 1, 3.72893e-10, 1.74623e-10, 3.66526e-10, 1, 4.65661e-09, 0, 5.58794e-09, 1, -8.3819e-09, 0, -1.47136 )
portal_mode = 2
material_override = SubResource( 25 )
emitting = false
amount = 1
Expand All @@ -846,6 +863,7 @@ scale_amount_curve = SubResource( 27 )

[node name="Smoke" type="CPUParticles" parent="RedRobotModel/Armature/Skeleton/RayFrom"]
transform = Transform( 1, 1.16415e-10, -4.0518e-10, 3.66526e-10, -4.19095e-08, -1, 0, 1, -4.65661e-08, -6.51926e-09, -1.43051e-06, -1.34189 )
portal_mode = 2
material_override = SubResource( 31 )
emitting = false
amount = 3
Expand Down Expand Up @@ -948,8 +966,6 @@ scale_amount_random = 0.09
scale_amount_curve = SubResource( 57 )
color_ramp = SubResource( 58 )

[node name="Model" parent="Death/PartShield1" instance=ExtResource( 12 )]

[node name="Col1" type="CollisionShape" parent="Death/PartShield1"]
transform = Transform( 1, 0, 0, 0, 0.908425, 0.418048, 0, -0.418048, 0.908425, -0.0167698, 0.5788, -0.122978 )
shape = SubResource( 59 )
Expand All @@ -960,6 +976,8 @@ transform = Transform( 1, 0, 0, 0, 0.994888, 0.100984, 0, -0.100984, 0.994888, 0
shape = SubResource( 60 )
disabled = true

[node name="Model" parent="Death/PartShield1" instance=ExtResource( 13 )]

[node name="PartShield2" type="RigidBody" parent="Death"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1.75083, 1.02975, 0.162546 )
collision_layer = 3
Expand Down Expand Up @@ -992,8 +1010,6 @@ scale_amount_random = 0.09
scale_amount_curve = SubResource( 57 )
color_ramp = SubResource( 58 )

[node name="Model" parent="Death/PartShield2" instance=ExtResource( 12 )]

[node name="Col1" type="CollisionShape" parent="Death/PartShield2"]
transform = Transform( 1, 0, 0, 0, 0.908425, 0.418048, 0, -0.418048, 0.908425, -0.0150018, 0.599786, -0.170673 )
shape = SubResource( 62 )
Expand All @@ -1004,6 +1020,8 @@ transform = Transform( 1, 0, 0, 0, 0.999275, -0.038063, 0, 0.038063, 0.999275, 0
shape = SubResource( 63 )
disabled = true

[node name="Model" parent="Death/PartShield2" instance=ExtResource( 13 )]

[node name="PartHead" type="RigidBody" parent="Death"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0374503, 1.02975, 0.162546 )
collision_layer = 3
Expand Down Expand Up @@ -1037,8 +1055,6 @@ scale_amount_random = 0.09
scale_amount_curve = SubResource( 57 )
color_ramp = SubResource( 58 )

[node name="Model" parent="Death/PartHead" instance=ExtResource( 11 )]

[node name="Col1" type="CollisionShape" parent="Death/PartHead"]
shape = SubResource( 65 )
disabled = true
Expand All @@ -1048,6 +1064,8 @@ transform = Transform( 1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, -0.0753
shape = SubResource( 66 )
disabled = true

[node name="Model" parent="Death/PartHead" instance=ExtResource( 3 )]

[node name="Explosion" type="AnimationPlayer" parent="Death"]
anims/kaboom = SubResource( 67 )

Expand Down
31 changes: 31 additions & 0 deletions level/forklift/flying_forklift.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,42 @@ script = ExtResource( 3 )

[node name="RedFlyingForklift" parent="FlyingForkliftModel" index="0"]
visible = false
portal_mode = 2

[node name="prop_cargobox3023" parent="FlyingForkliftModel/RedFlyingForklift" index="0"]
portal_mode = 2

[node name="prop_cargobox5a020" parent="FlyingForkliftModel/RedFlyingForklift" index="1"]
portal_mode = 2

[node name="YellowFlyingForklift" parent="FlyingForkliftModel" index="1"]
visible = false
portal_mode = 2

[node name="prop_cargobox3lid020" parent="FlyingForkliftModel/YellowFlyingForklift" index="0"]
portal_mode = 2

[node name="prop_cargobox4019" parent="FlyingForkliftModel/YellowFlyingForklift" index="1"]
portal_mode = 2

[node name="prop_cargobox5a000" parent="FlyingForkliftModel/YellowFlyingForklift" index="2"]
portal_mode = 2

[node name="BlueFlyingForklift" parent="FlyingForkliftModel" index="2"]
portal_mode = 2

[node name="prop_cargobox3000" parent="FlyingForkliftModel/BlueFlyingForklift" index="0"]
portal_mode = 2

[node name="prop_cargobox5b000" parent="FlyingForkliftModel/BlueFlyingForklift" index="1"]
portal_mode = 2

[node name="Collider" type="CollisionShape" parent="."]
shape = SubResource( 1 )

[node name="Particles1" type="CPUParticles" parent="."]
transform = Transform( -1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0.471727, -0.377269, -3.29514 )
portal_mode = 2
amount = 16
lifetime = 0.5
fixed_fps = 60
Expand All @@ -58,6 +85,7 @@ color_ramp = SubResource( 4 )

[node name="Particles2" type="CPUParticles" parent="."]
transform = Transform( -1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, -0.501376, -0.377269, -3.29514 )
portal_mode = 2
amount = 16
lifetime = 0.5
fixed_fps = 60
Expand All @@ -73,6 +101,7 @@ color_ramp = SubResource( 4 )

[node name="Particles3" type="CPUParticles" parent="."]
transform = Transform( -1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 1.42691, -0.514244, -2.88934 )
portal_mode = 2
amount = 16
lifetime = 0.5
fixed_fps = 60
Expand All @@ -88,6 +117,7 @@ color_ramp = SubResource( 4 )

[node name="Particles4" type="CPUParticles" parent="."]
transform = Transform( -1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, -1.33273, -0.514244, -2.88934 )
portal_mode = 2
amount = 16
lifetime = 0.5
fixed_fps = 60
Expand All @@ -103,6 +133,7 @@ color_ramp = SubResource( 4 )

[node name="SpotLight" type="SpotLight" parent="."]
transform = Transform( 1, 0, 0, 0, -0.819152, 0.573576, 0, -0.573576, -0.819152, 0, 0.181815, 4.10661 )
portal_mode = 2
light_bake_mode = 0
shadow_enabled = true
spot_range = 7.70138
Expand Down
3 changes: 3 additions & 0 deletions level/geometry/scenes/core.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ mesh = ExtResource( 7 )

[node name="CPUParticles" type="CPUParticles" parent="Plasma"]
physics_interpolation_mode = 1
portal_mode = 1
material_override = SubResource( 20 )
amount = 3
preprocess = 5.29
Expand All @@ -236,6 +237,7 @@ color_ramp = SubResource( 22 )

[node name="CPUParticles2" type="CPUParticles" parent="Plasma"]
physics_interpolation_mode = 1
portal_mode = 1
material_override = SubResource( 23 )
amount = 5
mesh = ExtResource( 12 )
Expand All @@ -251,6 +253,7 @@ color_ramp = SubResource( 25 )

[node name="CPUParticles3" type="CPUParticles" parent="Plasma"]
physics_interpolation_mode = 1
portal_mode = 1
material_override = SubResource( 23 )
amount = 7
explosiveness = 0.14
Expand Down
10 changes: 10 additions & 0 deletions level/level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ signal replace_main_scene # Useless, but needed as there is no clean way to chec
onready var world_environment = $WorldEnvironment

func _ready():
$RoomManager.rooms_convert()

if Settings.gi_quality == Settings.GIQuality.HIGH:
ProjectSettings["rendering/quality/voxel_cone_tracing/high_quality"] = true
elif Settings.gi_quality == Settings.GIQuality.LOW:
Expand Down Expand Up @@ -67,3 +69,11 @@ func _input(event):
if event.is_action_pressed("quit"):
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
emit_signal("quit")

if event.is_action_pressed("ui_portals"):
if $RoomManager.rooms_get_active():
$RoomManager.rooms_set_active(false)
print("portals off")
else:
$RoomManager.rooms_set_active(true)
print("portals on")
Loading

0 comments on commit 0f8bca8

Please sign in to comment.