Merge pull request #101 from Nitwel/performance

Performance improvements and Rendering engine change
This commit is contained in:
Nitwel 2024-02-27 16:39:10 +01:00 committed by GitHub
commit ec82c8c303
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 68 additions and 29 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"godotTools.editorPath.godot4": "c:\\Users\\NilsPC\\Desktop\\Godot_v4.2-stable_win64.exe"
}

View File

@ -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:

View File

@ -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

View File

@ -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")

View File

@ -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

View File

@ -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)

View File

@ -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,6 +23,8 @@ func _ready():
)
func _physics_process(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)
@ -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")

View File

@ -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

View File

@ -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="."]

View File

@ -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

View File

@ -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)
@ -38,12 +38,7 @@ func _on_enter():
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

View File

@ -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"

View File

@ -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):

View File

@ -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