diff --git a/.gitignore b/.gitignore index 0af181c..58cbc6d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ # Godot 4+ specific ignores .godot/ /android/ +.idea diff --git a/levels/level_3_rooms.tscn b/levels/level_3_rooms.tscn index 744e763..ba48947 100644 --- a/levels/level_3_rooms.tscn +++ b/levels/level_3_rooms.tscn @@ -135,5 +135,4 @@ base = NodePath("../WorldEnvironment") [node name="ProceduralMeshMaker" parent="." node_paths=PackedStringArray("portal") instance=ExtResource("8_vdsn8")] width = 2.0 -shadow_mesh = true portal = NodePath("../Portal_orange") diff --git a/levels/level_cube_portals.tscn b/levels/level_cube_portals.tscn new file mode 100644 index 0000000..ea2d3cb --- /dev/null +++ b/levels/level_cube_portals.tscn @@ -0,0 +1,121 @@ +[gd_scene load_steps=15 format=4 uid="uid://d2d7xy8ash3kk"] + +[ext_resource type="PackedScene" uid="uid://b5x7fmpwck335" path="res://hud.tscn" id="1_ghyw7"] +[ext_resource type="Material" uid="uid://bx6qeabdhq2s" path="res://addons/kenney_prototype_tools/materials/dark/material_01.tres" id="1_gpwe8"] +[ext_resource type="Texture2D" uid="uid://cvxwlhcjdg7u7" path="res://textures/kloppenheim_06_puresky_2k.exr" id="1_i8fn5"] +[ext_resource type="PackedScene" uid="uid://cgdlowfuuorvi" path="res://player.tscn" id="2_84t5d"] +[ext_resource type="Script" uid="uid://d2bvvjsibau8c" path="res://addons/simple-portal-system/scripts/portal.gd" id="5_jfr1b"] +[ext_resource type="Script" uid="uid://cili3lyodjqel" path="res://portal_environment_adapter.gd" id="6_jdap8"] +[ext_resource type="PackedScene" uid="uid://d1dtxvwk86ple" path="res://procedural_mesh_maker.tscn" id="7_mq505"] + +[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_ghyw7"] +panorama = ExtResource("1_i8fn5") + +[sub_resource type="Sky" id="Sky_jfr1b"] +sky_material = SubResource("PanoramaSkyMaterial_ghyw7") + +[sub_resource type="Environment" id="Environment_jdap8"] +background_mode = 2 +sky = SubResource("Sky_jfr1b") +tonemap_mode = 1 +tonemap_exposure = 0.53 +glow_enabled = true + +[sub_resource type="BoxShape3D" id="BoxShape3D_gpwe8"] +size = Vector3(30, 1, 30) + +[sub_resource type="BoxMesh" id="BoxMesh_84t5d"] +material = ExtResource("1_gpwe8") +size = Vector3(30, 1, 30) + +[sub_resource type="ArrayMesh" id="ArrayMesh_mq505"] +_surfaces = [{ +"aabb": AABB(-1, -1.5, -0.1, 2, 3, 0.1), +"attribute_data": PackedByteArray("AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AACAPwAAgD/NzEw9iYgIPTMzcz+JiAg9zcxMPXd3dz8zM3M/d3d3Pw=="), +"format": 34359742487, +"index_count": 30, +"index_data": PackedByteArray("AAABAAQABAABAAUAAQADAAUABQADAAcAAwACAAcABwACAAYAAgAAAAYABgAAAAQABAAFAAYABgAFAAcA"), +"name": "Portal Material", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AACAvwAAwD8AAAAAAACAPwAAwD8AAAAAAACAvwAAwL8AAAAAAACAPwAAwL8AAAAAZmZmvzMzsz/NzMy9ZmZmPzMzsz/NzMy9ZmZmvzMzs7/NzMy9ZmZmPzMzs7/NzMy9/3//f/9/AID/f/9//38AgP9//3//fwCA/3//f/9/AID/f/9//38AgP9//3//fwCA/3//f/9/AID/f/9//38AgA==") +}] + +[sub_resource type="ArrayMesh" id="ArrayMesh_gnq53"] +_surfaces = [{ +"aabb": AABB(-1, -1.5, -0.1, 2, 3, 0.1), +"attribute_data": PackedByteArray("AAAAAAAAAAAAAIA/AAAAAAAAAAAAAIA/AACAPwAAgD/NzEw9iYgIPTMzcz+JiAg9zcxMPXd3dz8zM3M/d3d3Pw=="), +"format": 34359742487, +"index_count": 30, +"index_data": PackedByteArray("AAABAAQABAABAAUAAQADAAUABQADAAcAAwACAAcABwACAAYAAgAAAAYABgAAAAQABAAFAAYABgAFAAcA"), +"name": "Portal Material", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AACAvwAAwD8AAAAAAACAPwAAwD8AAAAAAACAvwAAwL8AAAAAAACAPwAAwL8AAAAAZmZmvzMzsz/NzMy9ZmZmPzMzsz/NzMy9ZmZmvzMzs7/NzMy9ZmZmPzMzs7/NzMy9/3//f/9/AID/f/9//38AgP9//3//fwCA/3//f/9/AID/f/9//38AgP9//3//fwCA/3//f/9/AID/f/9//38AgA==") +}] + +[node name="level_cube_portals" type="Node3D"] + +[node name="HUD" parent="." instance=ExtResource("1_ghyw7")] +offset_right = 219.0 +offset_bottom = 77.0 + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(0.901453, 0.27592, -0.333544, -0.158086, 0.927146, 0.339718, 0.402979, -0.253511, 0.879398, 0, 2.37678, 0) +shadow_enabled = true + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_jdap8") + +[node name="StaticBody3D" type="StaticBody3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="StaticBody3D"] +shape = SubResource("BoxShape3D_gpwe8") + +[node name="Ground" type="MeshInstance3D" parent="StaticBody3D"] +mesh = SubResource("BoxMesh_84t5d") +skeleton = NodePath("../..") + +[node name="Player" parent="." instance=ExtResource("2_84t5d")] + +[node name="Portal A" type="MeshInstance3D" parent="." node_paths=PackedStringArray("exit_portal")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -6) +mesh = SubResource("ArrayMesh_mq505") +script = ExtResource("5_jfr1b") +destroy_disabled_viewport = false +fade_out_distance_max = 100.0 +fade_out_distance_min = 95.0 +fade_out_color = Color(1, 0, 1, 1) +exit_portal = NodePath("../Portal B") + +[node name="Label3D" type="Label3D" parent="Portal A"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.89275, 0) +billboard = 2 +text = "Portal A" + +[node name="Portal B" type="MeshInstance3D" parent="." node_paths=PackedStringArray("exit_portal")] +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1, 6) +mesh = SubResource("ArrayMesh_gnq53") +script = ExtResource("5_jfr1b") +destroy_disabled_viewport = false +fade_out_distance_max = 100.0 +fade_out_distance_min = 95.0 +fade_out_color = Color(1, 0, 1, 1) +exit_portal = NodePath("../Portal A") + +[node name="Label3D" type="Label3D" parent="Portal B"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.89275, 0) +billboard = 2 +text = "Portal B" + +[node name="PortalEnvironmentAdapter" type="Node" parent="." node_paths=PackedStringArray("base")] +script = ExtResource("6_jdap8") +base = NodePath("../WorldEnvironment") + +[node name="ProceduralMeshMaker" parent="." node_paths=PackedStringArray("portal") instance=ExtResource("7_mq505")] +height = 3.0 +width = 2.0 +portal = NodePath("../Portal B") diff --git a/menu.gd b/menu.gd index eed7203..6eff30f 100644 --- a/menu.gd +++ b/menu.gd @@ -4,14 +4,16 @@ const LEVEL_5_ROOMS = preload("res://levels/level_5rooms.tscn") const LEVEL_3_ROOMS = preload("res://levels/level_3_rooms.tscn") const LEVEL_PLATFORMER = preload("res://levels/level_platformer.tscn") const LEVEL_SEMAPHORE_LIGHTS = preload("res://levels/level_semaphore_lights.tscn") +const LEVEL_CUBE_PORTALS = preload("res://levels/level_cube_portals.tscn") @onready var items_container: VBoxContainer = $CenterContainer/ItemsContainer var levels = { "Semaphore": LEVEL_3_ROOMS, - "Semaphore - Lights": LEVEL_SEMAPHORE_LIGHTS, + "Semaphore - Lights Demo": LEVEL_SEMAPHORE_LIGHTS, "5 rooms": LEVEL_5_ROOMS, - "Infinite fall": LEVEL_PLATFORMER + "Platform": LEVEL_PLATFORMER, + "Cube portals": LEVEL_CUBE_PORTALS } func _ready() -> void: diff --git a/procedural_mesh_maker.gd b/procedural_mesh_maker.gd index 439eee0..8cf9cba 100644 --- a/procedural_mesh_maker.gd +++ b/procedural_mesh_maker.gd @@ -6,8 +6,6 @@ extends Node ## Player camera's NEAR clip distance @export_range(0, 0.2, 0.001) var indent: float = 0.1 -@export var shadow_mesh: bool = true - @export var portal: Portal @export var portal_material: BaseMaterial3D @@ -125,9 +123,4 @@ func generate_portal_mesh() -> void: mesh.surface_set_name(0, "Portal Material") portal.mesh = mesh - # TODO: Shadow mesh maybe? Should a portal even cast a shadow? - if shadow_mesh: - mesh.shadow_mesh = mesh - - print("[PMM] Mesh assigned") diff --git a/project.godot b/project.godot index 45632c3..d970df8 100644 --- a/project.godot +++ b/project.godot @@ -24,6 +24,12 @@ window/size/viewport_height=1080 enabled=PackedStringArray("res://addons/inspector_buttons/plugin.cfg") +[file_customization] + +folder_colors={ +"res://addons/": "blue" +} + [input] move_left={ diff --git a/textures/kloppenheim_06_puresky_2k.exr b/textures/kloppenheim_06_puresky_2k.exr new file mode 100644 index 0000000..e139b22 Binary files /dev/null and b/textures/kloppenheim_06_puresky_2k.exr differ diff --git a/textures/kloppenheim_06_puresky_2k.exr.import b/textures/kloppenheim_06_puresky_2k.exr.import new file mode 100644 index 0000000..65542c3 --- /dev/null +++ b/textures/kloppenheim_06_puresky_2k.exr.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cvxwlhcjdg7u7" +path.bptc="res://.godot/imported/kloppenheim_06_puresky_2k.exr-160a1911b7cbaf5d31339e358952146a.bptc.ctex" +metadata={ +"imported_formats": ["s3tc_bptc"], +"vram_texture": true +} + +[deps] + +source_file="res://textures/kloppenheim_06_puresky_2k.exr" +dest_files=["res://.godot/imported/kloppenheim_06_puresky_2k.exr-160a1911b7cbaf5d31339e358952146a.bptc.ctex"] + +[params] + +compress/mode=2 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=0