diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..317eb5a --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "godotTools.editorPath.godot4": "c:\\Users\\NilsPC\\Desktop\\Godot_v4.2-stable_win64.exe" +} \ No newline at end of file diff --git a/addons/godot-xr-tools/xr/start_xr.gd b/addons/godot-xr-tools/xr/start_xr.gd index 590ba15..3c85a92 100644 --- a/addons/godot-xr-tools/xr/start_xr.gd +++ b/addons/godot-xr-tools/xr/start_xr.gd @@ -186,6 +186,10 @@ func _set_enable_passthrough(p_new_value : bool) -> void: else: xr_interface.stop_passthrough() + var modes = xr_interface.get_supported_environment_blend_modes() + if xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND in modes: + xr_interface.set_environment_blend_mode(xr_interface.XR_ENV_BLEND_MODE_ALPHA_BLEND) + # Perform WebXR setup func _setup_for_webxr() -> bool: diff --git a/assets/canvas.png.import b/assets/canvas.png.import index 56156bb..440cfd6 100644 --- a/assets/canvas.png.import +++ b/assets/canvas.png.import @@ -3,25 +3,27 @@ importer="texture" type="CompressedTexture2D" uid="uid://hy2f6is7qjyv" -path="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.ctex" +path.s3tc="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.s3tc.ctex" +path.etc2="res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.etc2.ctex" metadata={ -"vram_texture": false +"imported_formats": ["s3tc_bptc", "etc2_astc"], +"vram_texture": true } [deps] source_file="res://assets/canvas.png" -dest_files=["res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.ctex"] +dest_files=["res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.s3tc.ctex", "res://.godot/imported/canvas.png-aa470cb9edfe91c0a54e6c5fa29d4c26.etc2.ctex"] [params] -compress/mode=0 +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=false +mipmaps/generate=true mipmaps/limit=-1 roughness/mode=0 roughness/src_normal="" @@ -31,4 +33,4 @@ process/normal_map_invert_y=false process/hdr_as_srgb=false process/hdr_clamp_exposure=false process/size_limit=0 -detect_3d/compress_to=1 +detect_3d/compress_to=0 diff --git a/content/entities/light/light.tscn b/content/entities/light/light.tscn index 45d9921..9296d6e 100644 --- a/content/entities/light/light.tscn +++ b/content/entities/light/light.tscn @@ -113,16 +113,18 @@ transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.15, [node name="CollisionShape3D" type="CollisionShape3D" parent="ColorWheel"] shape = SubResource("ConvexPolygonShape3D_k3ob2") +[node name="Sprite3D" type="Sprite3D" parent="ColorWheel"] +transform = Transform3D(0.15, 0, 0, 0, -6.55671e-09, -0.15, 0, 0.15, -6.55671e-09, 0, 0.004, 0) +flip_v = true +pixel_size = 0.001 +texture = ExtResource("7_ximu1") + [node name="MeshInstance3D" type="MeshInstance3D" parent="ColorWheel"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.002, 0) material_override = SubResource("StandardMaterial3D_7p762") mesh = SubResource("CylinderMesh_c10un") skeleton = NodePath("../..") -[node name="Decal" type="Decal" parent="ColorWheel/MeshInstance3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.005, 0) -size = Vector3(0.15, 0.001, 0.15) -texture_albedo = ExtResource("7_ximu1") - [node name="Clickable" type="Node" parent="ColorWheel"] script = ExtResource("8_1sfll") diff --git a/content/functions/occludable.gd b/content/functions/occludable.gd index 1479ab3..e0bf7a2 100644 --- a/content/functions/occludable.gd +++ b/content/functions/occludable.gd @@ -9,7 +9,13 @@ func _ready(): ray.set_collision_mask_value(5, true) get_parent().add_child.call_deferred(ray) -func _process(_delta): + EventSystem.on_slow_tick.connect(_slow_tick) + +func _slow_tick(_delta): + if player_camera.is_inside_tree() == false: + printerr("Player camera is not inside the tree") + return + ray.target_position = get_parent().to_local(player_camera.global_position) get_parent().visible = ray.is_colliding() == false diff --git a/content/main.gd b/content/main.gd index bc873e1..f46b74a 100644 --- a/content/main.gd +++ b/content/main.gd @@ -16,6 +16,7 @@ func _ready(): if OS.get_name() == "Android": # OS.request_permissions() environment.environment.sky.set_material(sky_passthrough) + get_viewport().transparent_bg = true else: RenderingServer.set_debug_generate_wireframes(true) diff --git a/content/system/house/house.gd b/content/system/house/house.gd index b4f8336..2a52242 100644 --- a/content/system/house/house.gd +++ b/content/system/house/house.gd @@ -6,6 +6,7 @@ const RoomType = preload("./room/room.gd") @onready var levels = $Levels @onready var collision_shape = $Levels/CollisionShape3D @onready var align_reference = $AlignReference +@onready var animate_timer = $AnimateTimer var fixing_reference: bool = false var editing_room: RoomType = null @@ -22,9 +23,11 @@ func _ready(): ) func _physics_process(delta): - levels.scale.x = lerp(levels.scale.x, target_size, 10.0 * delta) - levels.scale.y = lerp(levels.scale.y, target_size, 10.0 * delta) - levels.scale.z = lerp(levels.scale.z, target_size, 10.0 * delta) + + if animate_timer.is_stopped() == false: + levels.scale.x = lerp(levels.scale.x, target_size, 10.0 * delta) + levels.scale.y = lerp(levels.scale.y, target_size, 10.0 * delta) + levels.scale.z = lerp(levels.scale.z, target_size, 10.0 * delta) func update_house(): for old_room in get_rooms(0): @@ -210,6 +213,7 @@ func update_mini_view(): levels.position = Vector3(0, 0, 0) target_size = 0.1 if mini_view else 1.0 + animate_timer.start() for room in get_rooms(0): room.state_machine.change_to("Mini" if mini_view else "View") diff --git a/content/system/house/house.tscn b/content/system/house/house.tscn index b17ab66..3e90713 100644 --- a/content/system/house/house.tscn +++ b/content/system/house/house.tscn @@ -25,3 +25,6 @@ lock_rotation = true [node name="AlignReference" parent="." instance=ExtResource("3_e1tcn")] visible = false disabled = true + +[node name="AnimateTimer" type="Timer" parent="."] +one_shot = true diff --git a/content/system/house/room/room.tscn b/content/system/house/room/room.tscn index 0c89780..36a4f70 100644 --- a/content/system/house/room/room.tscn +++ b/content/system/house/room/room.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=10 format=3 uid="uid://bswgmclohuqui"] +[gd_scene load_steps=9 format=3 uid="uid://bswgmclohuqui"] [ext_resource type="Script" path="res://content/system/house/room/room.gd" id="1_fccq0"] [ext_resource type="Script" path="res://content/functions/clickable.gd" id="1_ugebq"] -[ext_resource type="Material" uid="uid://bbx6fv7jq50tr" path="res://content/system/house/room/walls.tres" id="3_al1ev"] [ext_resource type="Script" path="res://lib/utils/state_machine/state_machine.gd" id="4_nbbo6"] [ext_resource type="Script" path="res://content/system/house/room/states/mini.gd" id="6_g4qca"] [ext_resource type="Script" path="res://content/system/house/room/states/view.gd" id="6_g066t"] @@ -27,10 +26,8 @@ shape = SubResource("WorldBoundaryShape3D_08sv0") script = ExtResource("1_ugebq") [node name="WallMesh" type="MeshInstance3D" parent="."] -material_override = ExtResource("3_al1ev") [node name="CeilingMesh" type="MeshInstance3D" parent="."] -material_override = ExtResource("3_al1ev") [node name="WallCollisions" type="Node3D" parent="."] diff --git a/content/system/house/room/states/mini.gd b/content/system/house/room/states/mini.gd index 99f17d6..394db7a 100644 --- a/content/system/house/room/states/mini.gd +++ b/content/system/house/room/states/mini.gd @@ -6,7 +6,7 @@ const walls_material = preload("../walls.tres") func _on_enter(): room.wall_mesh.visible = true - room.ceiling_mesh.visible = true + room.ceiling_mesh.visible = false room.wall_mesh.material_override = walls_mini_material room.room_ceiling.get_node("CollisionShape3D").disabled = true room.room_floor.get_node("CollisionShape3D").disabled = true diff --git a/content/system/house/room/states/view.gd b/content/system/house/room/states/view.gd index 441c3ac..40d1b06 100644 --- a/content/system/house/room/states/view.gd +++ b/content/system/house/room/states/view.gd @@ -9,8 +9,8 @@ func _on_enter(): if room_store == null || room_store.corners.size() < 3: return - room.wall_mesh.visible = true - room.ceiling_mesh.visible = true + room.wall_mesh.visible = false + room.ceiling_mesh.visible = false room.wall_mesh.mesh = Room.generate_wall_mesh(room_store) @@ -37,13 +37,8 @@ func _on_enter(): static_body.collision_mask = 0 static_body.add_child(collision) room.wall_collisions.add_child(static_body) - - room.wall_mesh.visible = true func _on_leave(): - room.wall_mesh.visible = false - room.ceiling_mesh.visible = false - room.room_ceiling.get_node("CollisionShape3D").disabled = true room.room_floor.get_node("CollisionShape3D").disabled = true diff --git a/export_presets.cfg b/export_presets.cfg index 468efad..ff4c5b1 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -248,7 +248,7 @@ architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false architectures/x86_64=false -version/code=10 +version/code=11 version/name="v0.3.1" package/unique_name="de.nitwel.$genname" package/name="Immersive Home" diff --git a/lib/globals/event_system.gd b/lib/globals/event_system.gd index bfa00d5..6b4be4b 100644 --- a/lib/globals/event_system.gd +++ b/lib/globals/event_system.gd @@ -2,6 +2,7 @@ extends Node const FN_PREFIX = "_on_" const SIGNAL_PREFIX = "on_" +const SLOW_TICK = 0.1 # Interaction Events signal on_click(event: EventPointer) @@ -30,6 +31,15 @@ signal on_touch_leave(event: EventTouch) signal on_notify(event: EventNotify) +signal on_slow_tick(delta: float) + +var _slow_tick: float = 0.0 +func _physics_process(delta): + _slow_tick += delta + if _slow_tick >= SLOW_TICK: + on_slow_tick.emit(_slow_tick) + _slow_tick -= SLOW_TICK + var _active_node: Node = null func emit(type: String, event: Event): diff --git a/project.godot b/project.godot index 90f7f4c..0ca5bc8 100644 --- a/project.godot +++ b/project.godot @@ -25,6 +25,10 @@ EventSystem="*res://lib/globals/event_system.gd" Store="*res://lib/globals/main_store.gd" House="*res://lib/globals/house_body.gd" +[display] + +window/vsync/vsync_mode=0 + [editor_plugins] enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg", "res://addons/godotopenxrvendors/plugin.cfg") @@ -53,15 +57,23 @@ theme/custom_font="res://assets/fonts/ui_font_500.tres" 3d_physics/layer_4="physics" 3d_physics/layer_5="room" +[physics] + +common/physics_ticks_per_second=30 + [rendering] -renderer/rendering_method="mobile" +renderer/rendering_method="gl_compatibility" +renderer/rendering_method.mobile="gl_compatibility" textures/vram_compression/import_etc2_astc=true lights_and_shadows/directional_shadow/soft_shadow_filter_quality=4 lights_and_shadows/directional_shadow/soft_shadow_filter_quality.mobile=4 +viewport/transparent_background=true [xr] openxr/enabled=true +openxr/foveation_level=1 +openxr/foveation_dynamic=true openxr/startup_alert=false shaders/enabled=true