Compare commits

..

No commits in common. "fd8d6244376b9c5d350a246ad5297ad48cb31ff7" and "2eb79e9840b1f71fdb2fc1fc37de15a9d28d41cb" have entirely different histories.

37 changed files with 62 additions and 642 deletions

View File

@ -1,14 +0,0 @@
name: Validate with hassfest
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *'
jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v4"
- uses: "home-assistant/actions/hassfest@master"

View File

@ -1,17 +0,0 @@
name: HACS Action
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
hacs:
name: HACS Action
runs-on: "ubuntu-latest"
steps:
- name: HACS Action
uses: "hacs/action@main"
with:
category: "integration"

View File

@ -5,7 +5,7 @@ const Entity = preload ("../entity.gd")
@export var view_width = 0.15
@onready var view = $View
@onready var http_request: HTTPRequest = $HTTPRequest
@onready var http_request = $HTTPRequest
@onready var mesh = $MeshInstance3D
@onready var refresh_timer = $RefreshTimer
@onready var settings = $Settings
@ -33,7 +33,6 @@ func _ready():
)
R.effect(func(_arg):
print("Cam active: ", cam_active.value)
if cam_active.value:
refresh_timer.start()
else:
@ -70,10 +69,6 @@ func set_state(stateInfo):
refresh_timer.timeout.connect(load_image.bind(url))
func load_image(url: String):
if http_request.get_http_client_status() != HTTPClient.STATUS_DISCONNECTED:
print("HTTP client is busy, skipping")
return
http_request.request("http://192.168.33.33:8123" + url)
var result = await http_request.request_completed
@ -120,8 +115,6 @@ func load_image(url: String):
view.pixel_size = pixel_size
mesh.visible = false
print("Loaded image: ", url)
func get_options():
return {
"cam_active": cam_active.value,

View File

@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_t8xp5"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="5_opf0y"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ikxbe"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_smnuk"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("2_wwobq")
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_qfg01"]
[sub_resource type="QuadMesh" id="QuadMesh_jill0"]
size = Vector2(0.3, 0.2)
[sub_resource type="BoxShape3D" id="BoxShape3D_ctomk"]
@ -34,8 +34,8 @@ collision_mask = 0
script = ExtResource("1_1ixy6")
[node name="Panel" parent="." instance=ExtResource("1_myvk1")]
material_override = SubResource("ShaderMaterial_ikxbe")
mesh = SubResource("QuadMesh_qfg01")
material_override = SubResource("ShaderMaterial_smnuk")
mesh = SubResource("QuadMesh_jill0")
skeleton = NodePath("../..")
size = Vector2(0.3, 0.2)
@ -82,7 +82,6 @@ horizontal_alignment = 0
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.06, -0.01, 0)
label = "videocam_off"
icon = true
toggleable = true
[node name="FPSLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.05, 0)

View File

@ -6,7 +6,7 @@
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="3_2gpr3"]
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="4_upyp3"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_00j7x"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_t0vpw"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("2_m4moa")
@ -21,7 +21,7 @@ shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_3236q"]
[sub_resource type="QuadMesh" id="QuadMesh_s453u"]
size = Vector2(0.3, 0.25)
[sub_resource type="BoxShape3D" id="BoxShape3D_bu024"]
@ -34,8 +34,8 @@ script = ExtResource("1_gw2gi")
[node name="Panel" parent="." instance=ExtResource("1_78ups")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -7.45058e-09, 0)
material_override = SubResource("ShaderMaterial_00j7x")
mesh = SubResource("QuadMesh_3236q")
material_override = SubResource("ShaderMaterial_t0vpw")
mesh = SubResource("QuadMesh_s453u")
skeleton = NodePath("../..")
size = Vector2(0.3, 0.25)

View File

@ -7,7 +7,7 @@
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_ecnnd"]
[ext_resource type="PackedScene" uid="uid://wgnowarejk5y" path="res://content/ui/components/select/select.tscn" id="6_egqee"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_pqb3y"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3ewpv"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("3_vjmg5")
@ -22,7 +22,7 @@ shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_b6qk4"]
[sub_resource type="QuadMesh" id="QuadMesh_t2fh8"]
size = Vector2(0.3, 0.2)
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
@ -34,8 +34,8 @@ collision_mask = 0
script = ExtResource("1_xxfkt")
[node name="Panel" parent="." instance=ExtResource("2_4g761")]
material_override = SubResource("ShaderMaterial_pqb3y")
mesh = SubResource("QuadMesh_b6qk4")
material_override = SubResource("ShaderMaterial_3ewpv")
mesh = SubResource("QuadMesh_t2fh8")
skeleton = NodePath("../..")
size = Vector2(0.3, 0.2)

View File

@ -12,40 +12,14 @@ const Entity = preload ("../entity.gd")
@onready var artist = $PlayingInfo/Artist
@onready var http_request = $PlayingInfo/HTTPRequest
@onready var slider = $Slider
@onready var settings = $Settings
var playing = false
var volume = 50
var show_volume = R.state(true)
var show_image = R.state(true)
# Called when the node enters the scene tree for the first time.
func _ready():
super()
remove_child(settings)
R.effect(func(_arg):
if show_settings.value:
add_child(settings)
elif settings.is_inside_tree():
remove_child(settings)
camera_follower.reset()
App.house.save_all_entities()
)
R.effect(func(_arg):
if show_volume.value:
add_child(slider)
else:
remove_child(slider)
)
R.effect(func(_arg):
logo.visible=show_image.value
)
icon.value = "pause_circle"
var stateInfo = await HomeApi.get_state(entity_id)
@ -120,13 +94,3 @@ func load_image(url: String):
var texture = ImageTexture.create_from_image(image)
logo.texture = texture
logo.pixel_size = pixel_size
func get_options():
return {
"show_volume": show_volume.value,
"show_image": show_image.value
}
func set_options(options):
if options.has("show_volume"): show_volume.value = options["show_volume"]
if options.has("show_image"): show_image.value = options["show_image"]

View File

@ -1,12 +1,10 @@
[gd_scene load_steps=9 format=3 uid="uid://dyktdg7ggiwl4"]
[gd_scene load_steps=7 format=3 uid="uid://dyktdg7ggiwl4"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="1_8opk3"]
[ext_resource type="Script" path="res://content/entities/media_player/media_player.gd" id="1_ame17"]
[ext_resource type="Script" path="res://content/functions/camera_follower.gd" id="3_24ewx"]
[ext_resource type="Script" path="res://content/functions/movable.gd" id="3_bguto"]
[ext_resource type="PackedScene" uid="uid://pk5k1q8bx0rj" path="res://content/ui/components/slider/slider.tscn" id="4_w73hw"]
[ext_resource type="FontVariation" uid="uid://sshfnckriqxn" path="res://assets/icons/icons.tres" id="5_koe28"]
[ext_resource type="PackedScene" uid="uid://cm070pgl3s7gm" path="res://content/entities/media_player/settings.tscn" id="6_iuvm7"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vi3eg"]
size = Vector3(0.23, 0.142768, 0.01)
@ -15,14 +13,6 @@ size = Vector3(0.23, 0.142768, 0.01)
collision_mask = 0
script = ExtResource("1_ame17")
[node name="Movable" type="Node" parent="."]
script = ExtResource("3_bguto")
resizable = true
[node name="CameraFollower" type="Node" parent="." node_paths=PackedStringArray("focus_point")]
script = ExtResource("3_24ewx")
focus_point = NodePath("../Settings")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0364514, -0.01)
shape = SubResource("BoxShape3D_vi3eg")
@ -66,6 +56,10 @@ pixel_size = 0.001
[node name="HTTPRequest" type="HTTPRequest" parent="PlayingInfo"]
[node name="Movable" type="Node" parent="."]
script = ExtResource("3_bguto")
resizable = true
[node name="Slider" parent="." instance=ExtResource("4_w73hw")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0562844, 0)
max = 100.0
@ -80,6 +74,3 @@ text = "volume_up"
font = ExtResource("5_koe28")
font_size = 18
outline_size = 4
[node name="Settings" parent="." instance=ExtResource("6_iuvm7")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.27, 0, 0)

View File

@ -1,30 +0,0 @@
extends StaticBody3D
const MediaPlayer = preload ("./media_player.gd")
@onready var close_button: Button3D = $Close
@onready var id_input: Input3D = $IDInput
@onready var volume_button: Button3D = $VolumeButton
@onready var image_button: Button3D = $ImageButton
var media_player: MediaPlayer
func _ready():
media_player = get_parent()
close_button.on_button_up.connect(func():
media_player.show_settings.value=false
)
id_input.text = media_player.entity_id
R.effect(func(_arg):
volume_button.label="check" if media_player.show_volume.value else "close"
)
R.effect(func(_arg):
image_button.label="check" if media_player.show_image.value else "close"
)
R.bind(volume_button, "active", media_player.show_volume, volume_button.on_toggled)
R.bind(image_button, "active", media_player.show_image, image_button.on_toggled)

View File

@ -1,102 +0,0 @@
[gd_scene load_steps=9 format=3 uid="uid://cm070pgl3s7gm"]
[ext_resource type="Script" path="res://content/entities/media_player/settings.gd" id="1_03bil"]
[ext_resource type="PackedScene" uid="uid://dnam3fe36gg62" path="res://content/ui/components/panel/panel.tscn" id="2_kt6qc"]
[ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_abcrk"]
[ext_resource type="PackedScene" uid="uid://bsjqdvkt0u87c" path="res://content/ui/components/button/button.tscn" id="4_u2igx"]
[ext_resource type="PackedScene" uid="uid://blrhy2uccrdn4" path="res://content/ui/components/input/input.tscn" id="5_1jm5m"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_ncmoa"]
resource_local_to_scene = true
render_priority = 10
shader = ExtResource("3_abcrk")
shader_parameter/color = Color(1, 1, 1, 0.3)
shader_parameter/border_color = Color(1, 1, 1, 1)
shader_parameter/edge_color = Color(0, 0, 0, 1)
shader_parameter/size = Vector2(7.5, 5)
shader_parameter/border_size = 0.01
shader_parameter/border_fade_in = 0.05
shader_parameter/border_fade_out = 0.0
shader_parameter/corner_radius = 0.2
shader_parameter/roughness = 0.3
shader_parameter/grain_amount = 0.02
[sub_resource type="QuadMesh" id="QuadMesh_qm2qb"]
size = Vector2(0.3, 0.2)
[sub_resource type="BoxShape3D" id="BoxShape3D_53oq0"]
size = Vector3(0.3, 0.2, 0.02)
[node name="Settings" type="StaticBody3D"]
script = ExtResource("1_03bil")
[node name="Panel" parent="." instance=ExtResource("2_kt6qc")]
material_override = SubResource("ShaderMaterial_ncmoa")
mesh = SubResource("QuadMesh_qm2qb")
skeleton = NodePath("../..")
size = Vector2(0.3, 0.2)
[node name="Name" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.07, 0)
pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Media Player Settings"
font_size = 20
outline_size = 0
horizontal_alignment = 0
[node name="Close" parent="." instance=ExtResource("4_u2igx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.12, 0.07, 0)
label = "close"
icon = true
[node name="IDLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, 0.03, 0)
pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "ID:"
font_size = 18
outline_size = 0
horizontal_alignment = 0
[node name="IDInput" parent="." instance=ExtResource("5_1jm5m")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.03, 0.03, 0)
disabled = true
[node name="VideoLabel" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.02, 0)
pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Show Volume:"
font_size = 18
outline_size = 0
horizontal_alignment = 0
[node name="VolumeButton" parent="." instance=ExtResource("4_u2igx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.02, 0)
label = "close"
icon = true
toggleable = true
[node name="VideoLabel2" type="Label3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.14, -0.07, 0)
pixel_size = 0.001
render_priority = 15
outline_render_priority = 14
text = "Show Image:"
font_size = 18
outline_size = 0
horizontal_alignment = 0
[node name="ImageButton" parent="." instance=ExtResource("4_u2igx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.02, -0.07, 0)
label = "close"
icon = true
toggleable = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.01)
shape = SubResource("BoxShape3D_53oq0")

View File

@ -43,7 +43,7 @@ func _on_action_value(event: EventAction):
if event.name != "primary"||event.initiator != initiator:
return
relative_transform = relative_transform.translated(Vector3(0, 0, -event.value.y * 0.05)).rotated_local(Vector3(0, 1, 0), event.value.x * 0.05)
relative_transform = relative_transform.translated(Vector3(0, 0, -event.value.y * 0.05))
func _on_grab_down(event: EventPointer):
if disabled:

View File

@ -125,9 +125,9 @@ func _setup_hand():
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
if hand != 0: return
hand_active=active&&_is_hand_simulated() == false
hand_active=active
$IndexTip/TouchArea/CollisionShape3D.disabled=!hand_active
$IndexTip/TouchArea/CollisionShape3D.disabled=!active
hand_mesh.visible=active
)
@ -155,17 +155,6 @@ func _setup_hand():
pointer = Pointer.new(initiator, ray)
add_child(pointer)
func _is_hand_simulated():
var hand_trackers = XRServer.get_trackers(XRServer.TRACKER_HAND)
for tracker in hand_trackers.values():
if tracker.hand != XRPositionalTracker.TrackerHand.TRACKER_HAND_LEFT:
continue
return tracker.hand_tracking_source == XRHandTracker.HAND_TRACKING_SOURCE_CONTROLLER
return false
func _get_entity(node: Node):
if node is Entity:
return node

View File

@ -56,9 +56,9 @@ func _setup_hand():
auto_hand.hand_active_changed.connect(func(hand: int, active: bool):
if hand != 1: return
hand_active=active&&_is_hand_simulated() == false
hand_active=active
$IndexTip/TouchArea/CollisionShape3D.disabled=!hand_active
$IndexTip/TouchArea/CollisionShape3D.disabled=!active
hand_mesh.visible=active
)
@ -83,15 +83,4 @@ func _physics_process(_delta):
grabbed = true
elif !grab_close&&grabbed:
pointer.released(Initiator.EventType.GRIP)
grabbed = false
func _is_hand_simulated():
var hand_trackers = XRServer.get_trackers(XRServer.TRACKER_HAND)
for tracker in hand_trackers.values():
if tracker.hand != XRPositionalTracker.TrackerHand.TRACKER_HAND_RIGHT:
continue
return tracker.hand_tracking_source == XRHandTracker.HAND_TRACKING_SOURCE_CONTROLLER
return false
grabbed = false

View File

@ -29,9 +29,6 @@ mesh = SubResource("BoxMesh_ir3co")
[node name="AutoHandtracker" parent="." instance=ExtResource("3_pjmb2")]
visible = false
applymiddlefingerfix = null
applyscaling = null
coincidewristorknuckle = null
visiblehandtrackskeleton = false
enableautotracker = false

View File

@ -1,7 +1,6 @@
extends StaticBody3D
const Entity = preload ("res://content/entities/entity.gd")
const Light = preload ("res://content/entities/light/light.gd")
const TOUCH_LONG = 400.0
@ -10,7 +9,6 @@ const TOUCH_LONG = 400.0
@onready var collision = $CollisionShape3D
@onready var area = $Area3D/CollisionShape3D2
@onready var snap_sound = $SnapSound
# @onready var light: OmniLight3D = $OmniLight3D
@onready var label = $Label3D
var active = R.state(false)
var disabled = null
@ -19,16 +17,6 @@ var moved_ran = false
var touch_ran = false
func _ready():
# Wait until https://github.com/godotengine/godot/pull/83360 is merged for faster vertex lighting
# if entity is Light:
# R.effect(func(_arg):
# light.light_energy=1 if entity.active.value else 0
# light.light_color=entity.color.value
# )
# else:
# remove_child(light)
# light.queue_free()
R.effect(func(_arg):
label.text=entity.icon.value
label.modulate=entity.icon_color.value

View File

@ -1,8 +1,6 @@
extends Node3D
const ConstructRoomMesh = preload ("res://lib/utils/mesh/construct_room_mesh.gd")
const ConstructDoorMesh = preload ("res://lib/utils/mesh/construct_door_mesh.gd")
const RoomMaterial = preload ("res://content/system/house/room/states/room.tres")
@onready var wall_corners = $Ceiling/WallCorners
@onready var wall_edges = $Ceiling/WallEdges
@ -12,7 +10,6 @@ const RoomMaterial = preload ("res://content/system/house/room/states/room.tres"
@onready var room_floor = $Floor
@onready var room_ceiling = $Ceiling
@onready var doors = $Doors
@onready var state_machine: StateMachine = $StateMachine
@ -87,29 +84,3 @@ static func generate_ceiling_mesh(room: Dictionary):
var corners = room.corners
return ConstructRoomMesh.generate_ceiling_mesh(corners)
func generate_doors_mesh():
for door in Store.house.state.doors:
if door.room1 != name:
continue
var door_mesh = MeshInstance3D.new()
doors.add_child(door_mesh)
if Geometry2D.is_polygon_clockwise([
Vector2(door.room1_position1.x, door.room1_position1.z),
Vector2(door.room2_position1.x, door.room2_position1.z),
Vector2(door.room2_position2.x, door.room2_position2.z),
Vector2(door.room1_position2.x, door.room1_position2.z)
]):
door_mesh.mesh = ConstructDoorMesh.generate_door_mesh(door.room1_position2, door.room2_position2, door.room2_position1, door.room1_position1)
else:
door_mesh.mesh = ConstructDoorMesh.generate_door_mesh(door.room1_position1, door.room2_position1, door.room2_position2, door.room1_position2)
door_mesh.material_override = RoomMaterial
func clear_doors_mesh():
for door in doors.get_children():
doors.remove_child(door)
door.queue_free()

View File

@ -1,14 +1,24 @@
[gd_scene load_steps=9 format=3 uid="uid://bswgmclohuqui"]
[gd_scene load_steps=12 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://d0i5oae6evn08" path="res://content/system/house/room/states/room.tres" id="3_fmi1g"]
[ext_resource type="Material" uid="uid://xehjkoeofqc" path="res://content/system/house/room/room_next.tres" id="3_4q8ik"]
[ext_resource type="Shader" path="res://content/system/house/room/room.gdshader" id="3_lwge0"]
[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/view.gd" id="6_g066t"]
[ext_resource type="Script" path="res://content/system/house/room/states/edit.gd" id="7_ap14h"]
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_08sv0"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_rqpss"]
render_priority = -100
next_pass = ExtResource("3_4q8ik")
shader = ExtResource("3_lwge0")
[sub_resource type="ShaderMaterial" id="ShaderMaterial_1hn7n"]
render_priority = -100
shader = ExtResource("3_lwge0")
[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_ap613"]
plane = Plane(0, -1, 0, 0)
@ -26,10 +36,10 @@ shape = SubResource("WorldBoundaryShape3D_08sv0")
script = ExtResource("1_ugebq")
[node name="WallMesh" type="MeshInstance3D" parent="."]
material_override = ExtResource("3_fmi1g")
material_override = SubResource("ShaderMaterial_rqpss")
[node name="CeilingMesh" type="MeshInstance3D" parent="."]
material_override = ExtResource("3_fmi1g")
material_override = SubResource("ShaderMaterial_1hn7n")
[node name="WallCollision" type="StaticBody3D" parent="."]
collision_layer = 24
@ -66,6 +76,4 @@ script = ExtResource("6_g066t")
[node name="Edit" type="Node" parent="StateMachine"]
script = ExtResource("7_ap14h")
[node name="Doors" type="Node3D" parent="."]
[node name="Entities" type="Node3D" parent="."]

View File

@ -1,9 +0,0 @@
[gd_resource type="ShaderMaterial" load_steps=3 format=3 uid="uid://d0i5oae6evn08"]
[ext_resource type="Material" uid="uid://xehjkoeofqc" path="res://content/system/house/room/room_next.tres" id="1_irw15"]
[ext_resource type="Shader" path="res://content/system/house/room/room.gdshader" id="2_hhffe"]
[resource]
render_priority = -100
next_pass = ExtResource("1_irw15")
shader = ExtResource("2_hhffe")

View File

@ -30,14 +30,10 @@ func _on_enter():
wall_collisions.backface_collision = true
room.wall_collision.shape = wall_collisions
room.generate_doors_mesh()
func _on_leave():
room.room_ceiling.get_node("CollisionShape3D").disabled = true
room.room_floor.get_node("CollisionShape3D").disabled = true
room.wall_collision.shape = null
room.wall_mesh.mesh = null
room.ceiling_mesh.mesh = null
room.clear_doors_mesh()
room.ceiling_mesh.mesh = null

View File

@ -5,8 +5,3 @@
[resource]
render_priority = 0
shader = ExtResource("1_sbr3e")
shader_parameter/data = null
shader_parameter/data_size = null
shader_parameter/alpha = 0.3
shader_parameter/roughness = 0.85
shader_parameter/edge_color = Color(0, 0, 0, 1)

View File

@ -63,22 +63,22 @@ void fragment() {
ROUGHNESS = roughness;
DEPTH = FRAGCOORD.z + 0.0001;
ALBEDO = vec3(color.xyz);
vec2 pos = vec2(UV.x * aspect_ratio.x, UV.y * aspect_ratio.y);
float border = 0.05;
if (pos.x <= border) {
ALBEDO = mix(vec3(0.0), ALBEDO, pos.x / border);
}
if (pos.x >= aspect_ratio.x - border) {
ALBEDO = mix(vec3(0.0), ALBEDO, 1.0 - (pos.x - (aspect_ratio.x - border)) / border);
}
if (pos.y <= border) {
ALBEDO = mix(vec3(0.0), ALBEDO, pos.y / border);
}
if (pos.y >= aspect_ratio.y - border) {
ALBEDO = mix(vec3(0.0), ALBEDO, 1.0 - (pos.y - (aspect_ratio.y - border)) / border);
}

View File

@ -1,7 +1,6 @@
extends Node3D
const ConstructRoomMesh = preload ("res://lib/utils/mesh/construct_room_mesh.gd")
const ConstructDoorMesh = preload ("res://lib/utils/mesh/construct_door_mesh.gd")
const wall_material = preload ("./mini_wall.tres")
const humidity_gradient = preload ("./humid_gradient.tres")
const temperature_gradient = preload ("./temp_gradient.tres")
@ -79,28 +78,6 @@ func _ready():
walls_mesh.material_override=wall_material
floor_mesh.material_override=wall_material
walls_mesh.set_layer_mask_value(2, true)
floor_mesh.set_layer_mask_value(2, true)
for door in Store.house.state.doors:
var door_mesh=MeshInstance3D.new()
model.add_child(door_mesh)
if Geometry2D.is_polygon_clockwise([
Vector2(door.room1_position1.x, door.room1_position1.z),
Vector2(door.room2_position1.x, door.room2_position1.z),
Vector2(door.room2_position2.x, door.room2_position2.z),
Vector2(door.room1_position2.x, door.room1_position2.z)
]):
door_mesh.mesh=ConstructDoorMesh.generate_door_mesh(door.room1_position2, door.room2_position2, door.room2_position1, door.room1_position1)
else:
door_mesh.mesh=ConstructDoorMesh.generate_door_mesh(door.room1_position1, door.room2_position1, door.room2_position2, door.room1_position2)
door_mesh.material_override=wall_material
door_mesh.set_layer_mask_value(2, true)
)
# Update Size

View File

@ -1,163 +0,0 @@
## Generate a door mesh between two rooms based on their upper left and right corners
static func generate_door_mesh(room1_pos1: Vector3, room2_pos1: Vector3, room2_pos2: Vector3, room1_pos2: Vector3):
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
st.set_custom_format(0, SurfaceTool.CUSTOM_RG_FLOAT)
var points = [room1_pos1, room2_pos1, room2_pos2, room1_pos2, Vector3(room1_pos1.x, 0, room1_pos1.z), Vector3(room2_pos1.x, 0, room2_pos1.z), Vector3(room2_pos2.x, 0, room2_pos2.z), Vector3(room1_pos2.x, 0, room1_pos2.z)]
# Add top face
add_quad(st, points, 0, 1, 2, 3)
# Add bottom face
add_quad(st, points, 5, 4, 7, 6)
# Add side faces
add_quad(st, points, 0, 4, 5, 1)
add_quad(st, points, 2, 6, 7, 3)
st.deindex()
st.generate_normals()
st.generate_tangents()
return st.commit()
static func generate_door_mesh_grid(room1_pos1: Vector3, room2_pos1: Vector3, room2_pos2: Vector3, room1_pos2: Vector3, grid:=0.1):
var st = SurfaceTool.new()
var room1_pos1_bottom = Vector3(room1_pos1.x, 0, room1_pos1.z)
var room2_pos1_bottom = Vector3(room2_pos1.x, 0, room2_pos1.z)
var room2_pos2_bottom = Vector3(room2_pos2.x, 0, room2_pos2.z)
var room1_pos2_bottom = Vector3(room1_pos2.x, 0, room1_pos2.z)
st.begin(Mesh.PRIMITIVE_TRIANGLES)
st.set_custom_format(0, SurfaceTool.CUSTOM_RG_FLOAT)
# Add top
add_quad_grid(st, room1_pos1, room1_pos2, room2_pos2, room2_pos1, false, grid)
# Add bottom
add_quad_grid(st, room1_pos1_bottom, room1_pos2_bottom, room2_pos2_bottom, room2_pos1_bottom, true, grid)
# Add side faces
add_quad_grid(st, room1_pos1, room1_pos1_bottom, room2_pos1_bottom, room2_pos1, true, grid)
add_quad_grid(st, room1_pos2, room1_pos2_bottom, room2_pos2_bottom, room2_pos2, false, grid)
st.deindex()
st.generate_normals()
st.generate_tangents()
return st.commit()
static func add_quad(st: SurfaceTool, points, index1: int, index2: int, index3: int, index4: int):
st.set_uv(Vector2(0.0, 0.0))
st.set_custom(0, Color(2.0, 2.0, 0, 0))
st.add_vertex(points[index1])
st.set_uv(Vector2(1.0, 1.0))
st.set_custom(0, Color(2.0, 2.0, 0, 0))
st.add_vertex(points[index3])
st.set_uv(Vector2(1.0, 0.0))
st.set_custom(0, Color(2.0, 2.0, 0, 0))
st.add_vertex(points[index2])
st.set_uv(Vector2(0.0, 0.0))
st.set_custom(0, Color(2.0, 2.0, 0, 0))
st.add_vertex(points[index1])
st.set_uv(Vector2(0.0, 1.0))
st.set_custom(0, Color(2.0, 2.0, 0, 0))
st.add_vertex(points[index4])
st.set_uv(Vector2(1.0, 1.0))
st.set_custom(0, Color(2.0, 2.0, 0, 0))
st.add_vertex(points[index3])
static func add_quad_grid(st: SurfaceTool, p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3, flipped: bool=false, grid:=1.0):
var d1 = (p2 - p1).normalized()
var d2 = (p4 - p1).normalized()
var n1 = d1.cross(d2).normalized()
var transform_local = Transform3D(d1, n1, d2, p1)
var lp1 = transform_local.affine_inverse() * p1
var lp2 = transform_local.affine_inverse() * p2
var lp3 = transform_local.affine_inverse() * p3
var lp4 = transform_local.affine_inverse() * p4
lp1 = Vector2(lp1.x, lp1.z)
lp2 = Vector2(lp2.x, lp2.z)
lp3 = Vector2(lp3.x, lp3.z)
lp4 = Vector2(lp4.x, lp4.z)
var points = PackedVector2Array()
# Generate edges
var edge_points = [lp1, lp2, lp3, lp4]
for i in range(4):
var delta: Vector2 = edge_points[(i + 1) % 4] - edge_points[i]
var steps = ceil(delta.length() / grid)
for j in range(steps):
var p = edge_points[i] + delta.normalized() * j * grid
points.push_back(p)
var edges = PackedInt32Array()
for k in range(points.size()):
edges.append(k)
edges.append((k + 1) % points.size())
# Generate points
var rect = Rect2()
rect = rect.expand(lp1)
rect = rect.expand(lp2)
rect = rect.expand(lp3)
rect = rect.expand(lp4)
var ls = rect.position
var ld1 = rect.size.x
var ld2 = rect.size.y
var steps = Vector2(ld1 / grid, ld2 / grid).ceil() + Vector2(2, 2)
for i in range(steps.x):
for j in range(steps.y):
var p = Vector2(i, j) * grid + ls - Vector2(0.5, 0.5) * grid
points.push_back(p)
# Triangulate
var cdt: ConstrainedTriangulation = ConstrainedTriangulation.new()
cdt.init(true, true, 0.01)
cdt.insert_vertices(points)
cdt.insert_edges(edges)
cdt.erase_outer_triangles()
points = cdt.get_all_vertices()
var triangles: PackedInt32Array = cdt.get_all_triangles()
var points3D = PackedVector3Array()
for i in range(points.size()):
var pos3D = transform_local * Vector3(points[i].x, 0, points[i].y)
points3D.push_back(pos3D)
if flipped:
for i in range(triangles.size() / 3):
var temp = triangles[i * 3]
triangles[i * 3] = triangles[i * 3 + 1]
triangles[i * 3 + 1] = temp
for i in range(triangles.size()):
st.set_uv(Vector2(0.5, 0.5))
st.set_custom(0, Color(1.0, 1.0, 0, 0))
st.add_vertex(points3D[triangles[i]])

View File

@ -138,7 +138,7 @@ static func generate_ceiling_mesh(corners):
return _create_mesh_2d(points, triangles)
static func generate_wall_mesh_with_doors_grid(corners, height, doors, grid:=0.2):
static func generate_wall_mesh_with_doors_grid(corners, height, doors, grid:=0.1):
if corners.size() < 3:
return null
@ -241,7 +241,7 @@ static func generate_wall_mesh_with_doors_grid(corners, height, doors, grid:=0.2
return mesh
static func generate_wall_mesh_grid(corners, height, grid: Vector2=Vector2(0.2, 0.2)):
static func generate_wall_mesh_grid(corners, height, grid: Vector2=Vector2(0.1, 0.1)):
if corners.size() < 3:
return null
@ -289,7 +289,7 @@ static func generate_wall_mesh_grid(corners, height, grid: Vector2=Vector2(0.2,
return mesh
static func generate_ceiling_mesh_grid(corners, grid: Vector2=Vector2(0.2, 0.2)):
static func generate_ceiling_mesh_grid(corners, grid: Vector2=Vector2(0.1, 0.1)):
var points: PackedVector2Array = PackedVector2Array()
var edges: PackedInt32Array = PackedInt32Array()
var triangles: PackedInt32Array

View File

@ -46,8 +46,7 @@ enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg")
folder_colors={
"res://assets/": "blue",
"res://content/": "teal",
"res://lib/": "yellow",
"res://test/": "purple"
"res://lib/": "yellow"
}
[filesystem]

View File

@ -1,15 +0,0 @@
@tool
extends Node3D
const ConstructDoorMesh = preload ("res://lib/utils/mesh/construct_door_mesh.gd")
@onready var door_mesh = $DoorMesh
@onready var door_mesh_grid = $DoorMeshGrid
@onready var room1_pos1 = $Room1Pos1
@onready var room1_pos2 = $Room1Pos2
@onready var room2_pos1 = $Room2Pos1
@onready var room2_pos2 = $Room2Pos2
func _ready():
door_mesh.mesh = ConstructDoorMesh.generate_door_mesh(room1_pos1.position, room2_pos1.position, room2_pos2.position, room1_pos2.position)
door_mesh_grid.mesh = ConstructDoorMesh.generate_door_mesh_grid(room1_pos1.position, room2_pos1.position, room2_pos2.position, room1_pos2.position)

File diff suppressed because one or more lines are too long

View File

@ -1,20 +0,0 @@
{
"domain": "immersive_home",
"name": "ImmersiveHome",
"codeowners": [
"@nitwel"
],
"config_flow": true,
"dependencies": [
"http",
"websocket_api"
],
"documentation": "https://docs.immersive-home.org",
"homekit": {},
"iot_class": "local_push",
"issue_tracker": "https://github.com/Nitwel/Immersive-Home/issues",
"requirements": [],
"ssdp": [],
"version": "0.0.1",
"zeroconf": []
}

View File

@ -1,8 +0,0 @@
{
"name": "Immersive Home",
"content_in_root": false,
"zip_release": true,
"filename": "Integration.zip",
"render_readme": true,
"hide_default_branch": true
}

View File

@ -0,0 +1,14 @@
{
"domain": "immersive_home",
"name": "ImmersiveHome",
"codeowners": ["@nitwel"],
"config_flow": true,
"dependencies": ["http", "websocket_api"],
"documentation": "https://www.home-assistant.io/integrations/immersive_home",
"homekit": {},
"iot_class": "local_push",
"requirements": [],
"ssdp": [],
"zeroconf": [],
"version": "0.0.1"
}