From 9636d23dd0e5cb84ff7de1163d3d352207cf763f Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 24 Jan 2023 23:26:17 +0000 Subject: [PATCH 01/30] Refactor map editor UI to support interior maps --- local_player.scn | 3 + map_editor.scn | 4 +- ...group.res => edit_action_button_group.res} | 0 map_editor/map_editor_menu.gd | 18 +++ map_editor/paint_selector_button_group.res | 3 + mesh_grid.gd | 122 ++++++++++++++++++ player_controller.gd | 2 +- project.godot | 41 +++++- terrain/terrain_instance_3d.gd | 6 +- .../terrain_map_canvas.gd | 8 +- user_interface/action_prompt.gd | 43 ++++++ user_interface/selection_prompt.gd | 68 ++++++++++ user_interface/worker_prompt.gd | 46 +++++++ 13 files changed, 351 insertions(+), 13 deletions(-) create mode 100644 local_player.scn rename map_editor/{edit_mode_button_group.res => edit_action_button_group.res} (100%) create mode 100644 map_editor/map_editor_menu.gd create mode 100644 map_editor/paint_selector_button_group.res create mode 100644 mesh_grid.gd rename map_editor/map_editor_terrain_canvas.gd => terrain/terrain_map_canvas.gd (92%) create mode 100644 user_interface/action_prompt.gd create mode 100644 user_interface/selection_prompt.gd create mode 100644 user_interface/worker_prompt.gd diff --git a/local_player.scn b/local_player.scn new file mode 100644 index 0000000..84d8f30 --- /dev/null +++ b/local_player.scn @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4912b4281b1cd75eef06be3477b72f9c47c2ac69e3af9ecdb661e326e9be6453 +size 673 diff --git a/map_editor.scn b/map_editor.scn index ee8ad61..4bde408 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e4df576b189d644adb94f3fb8f29b9eb20ca41226e3a7b40b979aea2835b18c -size 8510 +oid sha256:854502f2bf396099a9c1b387703b268785ba2993794304fb574193ecf12cd5ca +size 8188 diff --git a/map_editor/edit_mode_button_group.res b/map_editor/edit_action_button_group.res similarity index 100% rename from map_editor/edit_mode_button_group.res rename to map_editor/edit_action_button_group.res diff --git a/map_editor/map_editor_menu.gd b/map_editor/map_editor_menu.gd new file mode 100644 index 0000000..c84d4ae --- /dev/null +++ b/map_editor/map_editor_menu.gd @@ -0,0 +1,18 @@ +class_name MapEditorMenu extends VBoxContainer + +## +## +## +signal edit_activated(edit_action: Callable) + +## +## +## +func activate_editor(edit_action: Callable) -> void: + edit_activated.emit(edit_action) + +## +## +## +func reset() -> void: + pass diff --git a/map_editor/paint_selector_button_group.res b/map_editor/paint_selector_button_group.res new file mode 100644 index 0000000..5b6b9de --- /dev/null +++ b/map_editor/paint_selector_button_group.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86a92428de499a71f64905c562804c4d1c4fc8ba763dffc2ba30079ceec27ed1 +size 208 diff --git a/mesh_grid.gd b/mesh_grid.gd new file mode 100644 index 0000000..aca0ea2 --- /dev/null +++ b/mesh_grid.gd @@ -0,0 +1,122 @@ +class_name MeshGrid extends Node3D + +const _CELL_COUNT := 8 + +class _Chunk: + var multimesh_instances: Array[_MultimeshInstance] = [] + + var meshes: Array[Mesh] = [] + + func _init() -> void: + self.meshes.resize(_CELL_COUNT * _CELL_COUNT) + +class _MultimeshInstance: + var _instance_rid := RID() + + var _multimesh_rid := RID() + + func _init(scenario_rid: RID, mesh: Mesh, transforms: Array) -> void: + _multimesh_rid = RenderingServer.multimesh_create() + _instance_rid = RenderingServer.instance_create2(_multimesh_rid, scenario_rid) + + RenderingServer.multimesh_set_mesh(_multimesh_rid, mesh.get_rid()) + + var transform_count := transforms.size() + + RenderingServer.multimesh_allocate_data(_multimesh_rid, + transform_count, RenderingServer.MULTIMESH_TRANSFORM_3D, true) + + for i in transform_count: + RenderingServer.multimesh_instance_set_transform(_multimesh_rid, i, transforms[i]) + +var _chunks: Array[_Chunk] = [] + +var _grid_origin := Vector2(0.5, 0.5) + +## +## The number of horizontal and vertical cells in the current grid. +## +## Setting this value will result in the current grid data being completely overwritten to return +## it to a sensible default. +## +@export +var size: Vector2i: + set(value): + self._chunks.resize(int(ceil((value.x * value.y) / float(_CELL_COUNT)))) + + for i in self._chunks.size(): + self._chunks[i] = _Chunk.new() + + size = value + +func _notification(what: int) -> void: + match what: + NOTIFICATION_TRANSFORM_CHANGED: + for chunk in _chunks: + for multimesh_instance in chunk.multimesh_instances: + RenderingServer.instance_set_transform( + multimesh_instance._instance_rid, multimesh_instance.global_transform) + +## +## Sets the cell at [code]coordinate[/code] to display [code]mesh[/code]. +## +## Note that this function assumes [code]coordinate[/code] is within the bounds of the grid +## coordinate space. +## +## Note that changes to a cell result in the chunk it resides in being completely regenerated as +## part of its modification, and therefore has an implicitly higher overhead to other setter +## operations defined by [MeshGrid]. +## +func set_mesh(coordinate: Vector2i, mesh: Mesh) -> void: + assert(Rect2i(Vector2i.ZERO, size).has_point(coordinate), "coordinate must be within grid") + + # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. + var chunk_coordinate := coordinate / _CELL_COUNT + var cell_coordinate := coordinate % _CELL_COUNT + var chunk := _chunks[(size.x * chunk_coordinate.y) + chunk_coordinate.x] + var chunk_meshes := chunk.meshes + + chunk_meshes[(_CELL_COUNT * cell_coordinate.y) + cell_coordinate.x] = mesh + + # Invalide any existing baked multimeshes in the chunk. + for multimesh_instance in chunk.multimesh_instances: + RenderingServer.free_rid(multimesh_instance._instance_rid) + RenderingServer.free_rid(multimesh_instance._multimesh_rid) + + chunk.multimesh_instances.clear() + + # Normalize mesh instance data for the chunk. + var mesh_transform_sets := {} + + for i in chunk_meshes.size(): + var chunk_mesh := chunk_meshes[i] + + if chunk_mesh != null: + if not(chunk_mesh in mesh_transform_sets): + mesh_transform_sets[chunk_mesh] = [] + + mesh_transform_sets[chunk_mesh].push_back(Transform3D(Basis.IDENTITY, Vector3( + (float(chunk_coordinate.x * _CELL_COUNT) + (i % _CELL_COUNT)) - + (float(size.x) * _grid_origin.x), 0.0, + (float(chunk_coordinate.y * _CELL_COUNT) + (i / _CELL_COUNT)) - + (float(size.y) * _grid_origin.y)))) + + # Bake into multimesh instances for the chunk. + var scenario_rid := get_world_3d().scenario + + for chunk_mesh in mesh_transform_sets: + var multimesh_instance :=\ + _MultimeshInstance.new(scenario_rid, chunk_mesh, mesh_transform_sets[chunk_mesh]) + + RenderingServer.instance_set_transform(multimesh_instance._instance_rid, global_transform) + + chunk.multimesh_instances.push_back(multimesh_instance) + +## +## Returns [code]world_position[/code] converted into a coordinate aligned with the [MeshGrid]. +## +## Note that [code]world_position[/code] values not within the [MeshGrid] will produce grid +## coordinates outside of the [MeshGrid] bounds as well. +## +func world_to_grid(world_position: Vector2) -> Vector2i: + return Vector2i((world_position + (Vector2(size) * _grid_origin)).floor()) diff --git a/player_controller.gd b/player_controller.gd index 5eb9353..968840a 100644 --- a/player_controller.gd +++ b/player_controller.gd @@ -192,7 +192,7 @@ func get_cursor_point() -> Vector2: ## Successful point intersection will return the plane coordinates in a [class Vector2], otherwise ## [code]null[/code] is returned. ## -func screen_to_plane(screen_point: Vector2): +func screen_to_plane(screen_point: Vector2) -> Variant: if self._camera != null: var plane_target = Plane(Vector3.UP, 0.0).intersects_ray( self._camera.global_position, self._camera.project_ray_normal(screen_point)) diff --git a/project.godot b/project.godot index 233e611..56234b4 100644 --- a/project.godot +++ b/project.godot @@ -9,21 +9,36 @@ config_version=5 _global_script_classes=[{ +"base": "Control", +"class": &"ActionPrompt", +"language": &"GDScript", +"path": "res://user_interface/action_prompt.gd" +}, { "base": "HFlowContainer", "class": &"ItemSelection", "language": &"GDScript", "path": "res://user_interface/button_selection.gd" }, { -"base": "Node", -"class": &"MapEditorTerrainCanvas", +"base": "VBoxContainer", +"class": &"MapEditorMenu", "language": &"GDScript", -"path": "res://map_editor/map_editor_terrain_canvas.gd" +"path": "res://map_editor/map_editor_menu.gd" +}, { +"base": "Node3D", +"class": &"MeshGrid", +"language": &"GDScript", +"path": "res://mesh_grid.gd" }, { "base": "Node3D", "class": &"PlayerController", "language": &"GDScript", "path": "res://player_controller.gd" }, { +"base": "Control", +"class": &"SelectionPrompt", +"language": &"GDScript", +"path": "res://user_interface/selection_prompt.gd" +}, { "base": "Node", "class": &"Settings", "language": &"GDScript", @@ -34,18 +49,33 @@ _global_script_classes=[{ "language": &"GDScript", "path": "res://terrain/terrain_instance_3d.gd" }, { +"base": "Node", +"class": &"TerrainMapCanvas", +"language": &"GDScript", +"path": "res://terrain/terrain_map_canvas.gd" +}, { "base": "Resource", "class": &"TerrainPaint", "language": &"GDScript", "path": "res://terrain/paints/terrain_paint.gd" +}, { +"base": "Control", +"class": &"WorkerPrompt", +"language": &"GDScript", +"path": "res://user_interface/worker_prompt.gd" }] _global_script_class_icons={ +"ActionPrompt": "", "ItemSelection": "", -"MapEditorTerrainCanvas": "", +"MapEditorMenu": "", +"MeshGrid": "", "PlayerController": "", +"SelectionPrompt": "", "Settings": "", "TerrainInstance3D": "", -"TerrainPaint": "" +"TerrainMapCanvas": "", +"TerrainPaint": "", +"WorkerPrompt": "" } [application] @@ -59,6 +89,7 @@ config/icon="res://icon.png" [autoload] GameSettings="*res://settings.gd" +LocalPlayer="*res://local_player.scn" [debug] diff --git a/terrain/terrain_instance_3d.gd b/terrain/terrain_instance_3d.gd index 4e4cefe..f844714 100644 --- a/terrain/terrain_instance_3d.gd +++ b/terrain/terrain_instance_3d.gd @@ -10,9 +10,9 @@ const _SHADER := preload("res://terrain/terrain.gdshader") ## enum PaintSlot { ERASE, - RED, - GREEN, - BLUE, + PAINT_1, + PAINT_2, + PAINT_3, } var _albedo_maps: Array[Texture2D] = [null, null, null, null] diff --git a/map_editor/map_editor_terrain_canvas.gd b/terrain/terrain_map_canvas.gd similarity index 92% rename from map_editor/map_editor_terrain_canvas.gd rename to terrain/terrain_map_canvas.gd index ae75b45..00cafad 100644 --- a/map_editor/map_editor_terrain_canvas.gd +++ b/terrain/terrain_map_canvas.gd @@ -1,4 +1,4 @@ -class_name MapEditorTerrainCanvas extends Node +class_name TerrainMapCanvas extends Node ## ## Blank sample value. @@ -37,7 +37,11 @@ func clear(clear_elevation: float) -> void: _editable_texture.update(_editable_image) ## -## Returns the canvas data as a [Texture2D]. +## Returns the canvas data as a [Texture2D] where RGB channels are encoded in the red, green, and +## blue, component of each pixel and the height is the alpha component. +## +## The returned value is designed for use with a [TerrainInstance3D] or other class compatible with +## the encoded format specified above. ## func get_texture() -> Texture2D: return _editable_texture diff --git a/user_interface/action_prompt.gd b/user_interface/action_prompt.gd new file mode 100644 index 0000000..d667e7f --- /dev/null +++ b/user_interface/action_prompt.gd @@ -0,0 +1,43 @@ +@tool +class_name ActionPrompt extends Control + +## +## +## +signal prompt_accepted() + +## +## +## +signal prompted() + +@export +var _accept_button: BaseButton = null + +@export +var initial_focus: Control = null + +func _get_configuration_warnings() -> PackedStringArray: + var warnings := PackedStringArray() + + if _accept_button == null: + warnings.append("`Accept Button` must point to a valid BaseButton instance") + + return warnings + +func _ready() -> void: + assert(_accept_button != null, "accept button cannot be null") + + _accept_button.pressed.connect(func () -> void: + prompt_accepted.emit() + hide()) + +## +## +## +func prompt() -> void: + show() + prompted.emit() + + if initial_focus != null: + initial_focus.grab_focus() diff --git a/user_interface/selection_prompt.gd b/user_interface/selection_prompt.gd new file mode 100644 index 0000000..1bf69ee --- /dev/null +++ b/user_interface/selection_prompt.gd @@ -0,0 +1,68 @@ +@tool +class_name SelectionPrompt extends Control + +## +## +## +signal prompted() + +## +## +## +signal prompt_selected(selected_item: int) + +@export +var _button_group: ButtonGroup = null + +## +## If set to [code]true[/code], the selection prompt dismisses itself after a selection is made. +## Otherwise, if set to [code]false[/code], the prompt remains present after a selection is made. +## +@export +var dismiss_on_selection := false + +func _get_configuration_warnings() -> PackedStringArray: + var warnings := PackedStringArray() + + if _button_group == null: + warnings.append("`Button Group` must point to a valid BaseButton instance") + + return warnings + +func _ready() -> void: + assert(_button_group != null, "button group cannot be null") + + _button_group.pressed.connect(func (button: BaseButton) -> void: + var selected_item = _button_group.get_buttons().find(button) + + assert(selected_item > -1, "selected item cannot be less than 0") + prompt_selected.emit(selected_item) + + if dismiss_on_selection: + hide()) + +## +## Returns the [ButtonGroup] used by the selection prompt to handle selections. +## +func get_button_group() -> ButtonGroup: + return _button_group + +## +## Displays the selection prompt, with [code]initial_selection[/code] as the initial value selected. +## +## Once a value has been manually selected in the prompt, [signal prompt_selected] is emitted. +## +## *Note* that [code]initial_selection[/code] *must* be a valid index in the range of the button +## group used by the selection prompt, which may be accessed by the calling logic via +## [member get_button_group] +## +func prompt(initial_selection: int) -> void: + assert(_button_group != null, "button group cannot be null") + + var selected_button := _button_group.get_buttons()[initial_selection] + + selected_button.button_pressed = true + + show() + selected_button.grab_focus() + prompted.emit() diff --git a/user_interface/worker_prompt.gd b/user_interface/worker_prompt.gd new file mode 100644 index 0000000..ac4c4ea --- /dev/null +++ b/user_interface/worker_prompt.gd @@ -0,0 +1,46 @@ +class_name WorkerPrompt extends Control + +## +## +## +signal prompted() + +var _worker_thread := Thread.new() + +## +## +## +@export +var label: Label = null + +## +## +## +@export +var progress: Range = null + +## +## +## +func prompt(display_message: String, steps: Array) -> void: + show() + prompted.emit() + + if label != null: + label.text = display_message + + _worker_thread.start(func () -> void: + var count := steps.size() + var total := float(count) + + for i in count: + steps[i].call() + + if progress != null: + progress.value = i / total) + + while _worker_thread.is_alive(): + await get_tree().process_frame + + _worker_thread.wait_to_finish() + hide() -- 2.34.1 From 7526e600376a9bc8ddf1366045d53590276234d0 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:35:36 +0000 Subject: [PATCH 02/30] Work around parser regression in latest Godot 4 beta --- terrain/terrain_instance_3d.gd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/terrain/terrain_instance_3d.gd b/terrain/terrain_instance_3d.gd index f844714..62c65fa 100644 --- a/terrain/terrain_instance_3d.gd +++ b/terrain/terrain_instance_3d.gd @@ -15,13 +15,13 @@ enum PaintSlot { PAINT_3, } -var _albedo_maps: Array[Texture2D] = [null, null, null, null] +var _albedo_maps: Array[Texture2D] = [] var _material := ShaderMaterial.new() var _mesh := PlaneMesh.new() -var _normal_maps: Array[Texture2D] = [null, null, null, null] +var _normal_maps: Array[Texture2D] = [] ## ## Range of the height channel value, ranging from [code]0.0[/code] to [code]100.0[/code]. @@ -54,6 +54,11 @@ var size := Vector2i.ONE: size = value func _init() -> void: + var paint_channels := PaintSlot.values().size() + + _albedo_maps.resize(paint_channels) + _normal_maps.resize(paint_channels) + _material.shader = _SHADER _mesh.surface_set_material(0, _material) -- 2.34.1 From 0d11abfe234ca4716e9e029958d549d7121a8179 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:36:53 +0000 Subject: [PATCH 03/30] Add support for multi-context control overrides to player controller --- player_controller.gd | 135 +++++++++++++++++++++++-------------------- 1 file changed, 72 insertions(+), 63 deletions(-) diff --git a/player_controller.gd b/player_controller.gd index 968840a..e9acec7 100644 --- a/player_controller.gd +++ b/player_controller.gd @@ -37,6 +37,8 @@ const _ROTATE_CW := "player_controller_rotate_cw" const _DRAG_SPEED_BASE_MODIFIER := 0.15 +const _MOVE_SMOOTHING := 0.5 + const _MOVE_SPEED_BASE_MODIFIER := 50.0 const _ROTATE_SPEED_BASE := 5.0 @@ -46,6 +48,8 @@ const _TRANSFORM_DELTA := 10.0 @export var _camera: Camera3D = null +var _control_override_count := 0 + var _cursor_point := Vector2.ZERO var _is_drag_panning := false @@ -58,52 +62,40 @@ var _select_mode := SelectMode.NONE var _selection_area: Control = null @onready -var _target_position := self.position +var _target_position := position @onready -var _target_orientation := self.global_rotation.y - -## -## Smoothness applies to the interpolation toward rotation and movement target values. -## -@export -var movement_smoothing := 0.5 - -## -## Whether or not player movement input processed by the controller should be ignored. -## -@export -var frozen := false +var _target_orientation := global_rotation.y func _input(event: InputEvent) -> void: if event is InputEventMouseButton: match event.button_index: MOUSE_BUTTON_MIDDLE: - self._is_drag_panning = event.is_pressed() and not(self.frozen) + _is_drag_panning = event.is_pressed() and not(is_frozen()) Input.mouse_mode = Input.MOUSE_MODE_CAPTURED if\ - self._is_drag_panning else Input.MOUSE_MODE_VISIBLE + _is_drag_panning else Input.MOUSE_MODE_VISIBLE MOUSE_BUTTON_LEFT: - self._is_selecting = event.is_pressed() + _is_selecting = event.is_pressed() - if self._is_selecting: - self.selection_started.emit() + if _is_selecting: + selection_started.emit() else: - self.selection_stopped.emit() + selection_stopped.emit() return - if (event is InputEventMouseMotion) and self._is_drag_panning: - var global_basis := self.global_transform.basis + if (event is InputEventMouseMotion) and _is_drag_panning: + var global_basis := global_transform.basis var camera_settings := GameSettings.camera_settings var dampened_speed := camera_settings.movement_speed_modifier * _DRAG_SPEED_BASE_MODIFIER - self._target_position += dampened_speed.y * (-global_basis.z) *\ + _target_position += dampened_speed.y * (-global_basis.z) *\ event.relative.y * (-1.0 if camera_settings.is_y_inverted else 1.0) - self._target_position += dampened_speed.x * (-global_basis.x) *\ + _target_position += dampened_speed.x * (-global_basis.x) *\ event.relative.x * (-1.0 if camera_settings.is_x_inverted else 1.0) return @@ -115,65 +107,49 @@ func _input(event: InputEvent) -> void: return func _process(delta: float) -> void: - if not(self.frozen): - var global_basis := self.global_transform.basis + if not(is_frozen()): + var global_basis := global_transform.basis var camera_settings := GameSettings.camera_settings var delta_speed :=\ camera_settings.movement_speed_modifier * _MOVE_SPEED_BASE_MODIFIER * delta - self._target_position += delta_speed.y * (-global_basis.z) *\ + _target_position += delta_speed.y * (-global_basis.z) *\ (Input.get_action_strength(_FORWARD) - Input.get_action_strength(_BACKWARD)) *\ (-1.0 if camera_settings.is_y_inverted else 1.0) - self._target_position += delta_speed.x * (-global_basis.x) *\ + _target_position += delta_speed.x * (-global_basis.x) *\ (Input.get_action_strength(_LEFT) - Input.get_action_strength(_RIGHT)) *\ (-1.0 if camera_settings.is_y_inverted else 1.0) - self._target_orientation += (Input.get_action_strength(_ROTATE_CCW) -\ + _target_orientation += (Input.get_action_strength(_ROTATE_CCW) -\ Input.get_action_strength(_ROTATE_CW)) * _ROTATE_SPEED_BASE *\ camera_settings.rotation_speed_modifier * delta - self.global_transform = self.global_transform.interpolate_with( - Transform3D(Basis(Vector3.UP, self._target_orientation), self._target_position), - delta * _TRANSFORM_DELTA * self.movement_smoothing) + global_transform = global_transform.interpolate_with( + Transform3D(Basis(Vector3.UP, _target_orientation), _target_position), + delta * _TRANSFORM_DELTA * _MOVE_SMOOTHING) - match self._select_mode: + match _select_mode: SelectMode.NONE: - self._cursor_point = self.get_viewport().size / 2.0 + _cursor_point = get_viewport().size / 2.0 SelectMode.MOUSE: - self._cursor_point = self.get_viewport().get_mouse_position() + _cursor_point = get_viewport().get_mouse_position() func _ready() -> void: - if self._selection_area != null: - self._selection_area.mouse_entered.connect(func () -> void: - if self._select_mode != SelectMode.MOUSE: - self._select_mode = SelectMode.MOUSE + if _selection_area != null: + _selection_area.mouse_entered.connect(func () -> void: + if _select_mode != SelectMode.MOUSE: + _select_mode = SelectMode.MOUSE - self.select_mode_changed.emit(SelectMode.MOUSE)) + select_mode_changed.emit(SelectMode.MOUSE)) - self._selection_area.mouse_exited.connect(func () -> void: - if self._select_mode != SelectMode.NONE: - self._select_mode = SelectMode.NONE + _selection_area.mouse_exited.connect(func () -> void: + if _select_mode != SelectMode.NONE: + _select_mode = SelectMode.NONE - self.select_mode_changed.emit(SelectMode.NONE)) - -## -## -## -func in_select_area() -> bool: - return self._select_mode != SelectMode.NONE - -## -## Returns [code]true[/code] if the player controller is currently selecting a location on the -## screen, otherwise [code]false[/code]. -## -## *Note* that it is discouraged that this be continuously polled for single-fire events. Instead, -## see [signal selection_started] and [signal selection_stopped]. -## -func is_selecting() -> bool: - return self._is_selecting + select_mode_changed.emit(SelectMode.NONE)) ## ## Returns the position of the selection cursor with respect to the select current mode being used. @@ -183,7 +159,40 @@ func is_selecting() -> bool: ## states - including gamepad - this will be the middle of screenspace at all times. ## func get_cursor_point() -> Vector2: - return self._cursor_point + return _cursor_point + +func is_frozen() -> bool: + assert(_control_override_count > -1, "control override count cannot be less than 0") + + return _control_override_count != 0 + +## +## +## +func in_select_area() -> bool: + return _select_mode != SelectMode.NONE + +## +## Returns [code]true[/code] if the player controller is currently selecting a location on the +## screen, otherwise [code]false[/code]. +## +## *Note* that it is discouraged that this be continuously polled for single-fire events. Instead, +## see [signal selection_started] and [signal selection_stopped]. +## +func is_selecting() -> bool: + return _is_selecting + +## +## +## +func override_controls(unlock_signal: Signal) -> void: + assert(_control_override_count > -1, "control override count cannot be less than 0") + + _control_override_count += 1 + + unlock_signal.connect(func () -> void: + assert(_control_override_count > 0, "control override count cannot be less than 1") + _control_override_count -= 1, Object.CONNECT_ONE_SHOT) ## ## Attempts to convert the screen coordinates in [code]screen_point[/code] into 2D worldspace @@ -193,9 +202,9 @@ func get_cursor_point() -> Vector2: ## [code]null[/code] is returned. ## func screen_to_plane(screen_point: Vector2) -> Variant: - if self._camera != null: + if _camera != null: var plane_target = Plane(Vector3.UP, 0.0).intersects_ray( - self._camera.global_position, self._camera.project_ray_normal(screen_point)) + _camera.global_position, _camera.project_ray_normal(screen_point)) if plane_target is Vector3: return Vector2(plane_target.x, plane_target.z) -- 2.34.1 From 7a8225240b943a5117e883d6f6029b5ca290a78c Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:39:10 +0000 Subject: [PATCH 04/30] Add support for building menu to toolbar --- local_player.scn | 4 +- map_editor.scn | 4 +- map_editor/paint_selector_button_group.res | 2 +- map_editor/structure_button_group.res | 3 + project.godot | 82 ++------------------ terrain/paints/default_terrain_paint.res | 4 +- terrain/paints/desert_sand_terrain_paint.res | 4 +- terrain/paints/dry_mud_terrain_paint.res | 4 +- user_interface/action_prompt.gd | 1 + user_interface/selection_prompt.gd | 1 + user_interface/worker_prompt.gd | 1 + 11 files changed, 23 insertions(+), 87 deletions(-) create mode 100644 map_editor/structure_button_group.res diff --git a/local_player.scn b/local_player.scn index 84d8f30..d169f96 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4912b4281b1cd75eef06be3477b72f9c47c2ac69e3af9ecdb661e326e9be6453 -size 673 +oid sha256:6a4fe7961f0b6694c50311a199915c2acf0b1297a8bb1cb460dbab0e0c375cd2 +size 668 diff --git a/map_editor.scn b/map_editor.scn index 4bde408..fd487c0 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:854502f2bf396099a9c1b387703b268785ba2993794304fb574193ecf12cd5ca -size 8188 +oid sha256:5f0091343aa355a20889877ca201bc9e66b2e03333e793ea53a4a26767d8289c +size 8570 diff --git a/map_editor/paint_selector_button_group.res b/map_editor/paint_selector_button_group.res index 5b6b9de..1c80674 100644 --- a/map_editor/paint_selector_button_group.res +++ b/map_editor/paint_selector_button_group.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:86a92428de499a71f64905c562804c4d1c4fc8ba763dffc2ba30079ceec27ed1 +oid sha256:a62c0405f427f5da97173b050f0baba2aab0b093b45fc283749ee252aab47f6e size 208 diff --git a/map_editor/structure_button_group.res b/map_editor/structure_button_group.res new file mode 100644 index 0000000..6097737 --- /dev/null +++ b/map_editor/structure_button_group.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d6c88793bdb0c4c2c80b7a913b1b3fc98cea238405973ca04709f9c16bec1903 +size 199 diff --git a/project.godot b/project.godot index 56234b4..986754a 100644 --- a/project.godot +++ b/project.godot @@ -8,76 +8,6 @@ config_version=5 -_global_script_classes=[{ -"base": "Control", -"class": &"ActionPrompt", -"language": &"GDScript", -"path": "res://user_interface/action_prompt.gd" -}, { -"base": "HFlowContainer", -"class": &"ItemSelection", -"language": &"GDScript", -"path": "res://user_interface/button_selection.gd" -}, { -"base": "VBoxContainer", -"class": &"MapEditorMenu", -"language": &"GDScript", -"path": "res://map_editor/map_editor_menu.gd" -}, { -"base": "Node3D", -"class": &"MeshGrid", -"language": &"GDScript", -"path": "res://mesh_grid.gd" -}, { -"base": "Node3D", -"class": &"PlayerController", -"language": &"GDScript", -"path": "res://player_controller.gd" -}, { -"base": "Control", -"class": &"SelectionPrompt", -"language": &"GDScript", -"path": "res://user_interface/selection_prompt.gd" -}, { -"base": "Node", -"class": &"Settings", -"language": &"GDScript", -"path": "res://settings.gd" -}, { -"base": "GeometryInstance3D", -"class": &"TerrainInstance3D", -"language": &"GDScript", -"path": "res://terrain/terrain_instance_3d.gd" -}, { -"base": "Node", -"class": &"TerrainMapCanvas", -"language": &"GDScript", -"path": "res://terrain/terrain_map_canvas.gd" -}, { -"base": "Resource", -"class": &"TerrainPaint", -"language": &"GDScript", -"path": "res://terrain/paints/terrain_paint.gd" -}, { -"base": "Control", -"class": &"WorkerPrompt", -"language": &"GDScript", -"path": "res://user_interface/worker_prompt.gd" -}] -_global_script_class_icons={ -"ActionPrompt": "", -"ItemSelection": "", -"MapEditorMenu": "", -"MeshGrid": "", -"PlayerController": "", -"SelectionPrompt": "", -"Settings": "", -"TerrainInstance3D": "", -"TerrainMapCanvas": "", -"TerrainPaint": "", -"WorkerPrompt": "" -} - [application] config/name="Protectorate" @@ -116,32 +46,32 @@ enabled=PackedStringArray() player_controller_left={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null) ] } player_controller_right={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null) ] } player_controller_forward={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null) ] } player_controller_backward={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"echo":false,"script":null) ] } player_controller_rotate_cw={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":0,"echo":false,"script":null) ] } player_controller_rotate_ccw={ "deadzone": 0.5, -"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"unicode":0,"echo":false,"script":null) +"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":81,"key_label":0,"unicode":0,"echo":false,"script":null) ] } editor_paint={ diff --git a/terrain/paints/default_terrain_paint.res b/terrain/paints/default_terrain_paint.res index e8202f5..fb94070 100644 --- a/terrain/paints/default_terrain_paint.res +++ b/terrain/paints/default_terrain_paint.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4f7bc9218bdd88690b9994999715acb1e1233299ba9fe008d835a6cc9ff592f0 -size 294 +oid sha256:e08b6ac8b5ebc3a2ef443939261f0c1b9414149f8e45dea3ca968fa6ae02e706 +size 299 diff --git a/terrain/paints/desert_sand_terrain_paint.res b/terrain/paints/desert_sand_terrain_paint.res index e60460e..8f738b1 100644 --- a/terrain/paints/desert_sand_terrain_paint.res +++ b/terrain/paints/desert_sand_terrain_paint.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c1908a2b3087d64658ebe340148554aa109658b52c1fbf662d340dec961f36a6 -size 293 +oid sha256:7b8347472c2f8fc58b36e57427084fd2e39a289f13f7e0b2d92023f88e6cc074 +size 298 diff --git a/terrain/paints/dry_mud_terrain_paint.res b/terrain/paints/dry_mud_terrain_paint.res index e6ff33e..41d29f8 100644 --- a/terrain/paints/dry_mud_terrain_paint.res +++ b/terrain/paints/dry_mud_terrain_paint.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:555af3c288502203b9fa4b8a71f5acdb273a988262a0bffb929a218540158561 -size 289 +oid sha256:e94e02d26626e20c9ff337427b07e8663f04d6a840e456565625c71a464373b1 +size 294 diff --git a/user_interface/action_prompt.gd b/user_interface/action_prompt.gd index d667e7f..ded869a 100644 --- a/user_interface/action_prompt.gd +++ b/user_interface/action_prompt.gd @@ -36,6 +36,7 @@ func _ready() -> void: ## ## func prompt() -> void: + LocalPlayer.override_controls(hidden) show() prompted.emit() diff --git a/user_interface/selection_prompt.gd b/user_interface/selection_prompt.gd index 1bf69ee..f9d0c41 100644 --- a/user_interface/selection_prompt.gd +++ b/user_interface/selection_prompt.gd @@ -57,6 +57,7 @@ func get_button_group() -> ButtonGroup: ## [member get_button_group] ## func prompt(initial_selection: int) -> void: + LocalPlayer.override_controls(hidden) assert(_button_group != null, "button group cannot be null") var selected_button := _button_group.get_buttons()[initial_selection] diff --git a/user_interface/worker_prompt.gd b/user_interface/worker_prompt.gd index ac4c4ea..11c1f32 100644 --- a/user_interface/worker_prompt.gd +++ b/user_interface/worker_prompt.gd @@ -23,6 +23,7 @@ var progress: Range = null ## ## func prompt(display_message: String, steps: Array) -> void: + LocalPlayer.override_controls(hidden) show() prompted.emit() -- 2.34.1 From f3f837f31b54a3b40ef90c371466b6c203091cc4 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:42:50 +0000 Subject: [PATCH 05/30] Rename Frame rate: 144.638397 Frame rate: 144.000000 Frame rate: 144.000000 Frame rate: 144.000000 Frame rate: 144.000000 Frame rate: 144.000000 Frame rate: 144.000000 Frame rate: 144.000000 to and to in UI and code --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index fd487c0..cf3cfb0 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f0091343aa355a20889877ca201bc9e66b2e03333e793ea53a4a26767d8289c -size 8570 +oid sha256:949b1edd807d8f7a774ca52b8bebd34d8ae9de5922dd83f27c1f27ac5311053b +size 8584 -- 2.34.1 From 9dd28af5245092adb95cdc4611a019fcd7fe96b0 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:47:37 +0000 Subject: [PATCH 06/30] Fix regression in terrain visibility --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index cf3cfb0..c2f7085 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:949b1edd807d8f7a774ca52b8bebd34d8ae9de5922dd83f27c1f27ac5311053b -size 8584 +oid sha256:0f0bc4c3cbef9be7eb03bfcf0d08b3249b09840bf92c8487f282baea6e7c085e +size 8602 -- 2.34.1 From eb20329586ff104191db4605143cb25e101b9e89 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:48:13 +0000 Subject: [PATCH 07/30] Remove testing cube from map editor --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index c2f7085..1aa2188 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0f0bc4c3cbef9be7eb03bfcf0d08b3249b09840bf92c8487f282baea6e7c085e -size 8602 +oid sha256:c9948b7c49555550b25347a7c9dd0a35752de1c06ab4f10cecbbd0be7d86aa67 +size 8462 -- 2.34.1 From 725ab3c55d605ce4432335532e3c5ef08fc96723 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 25 Jan 2023 23:55:18 +0000 Subject: [PATCH 08/30] Modify WorkerPrompt to use signals over awaitable functions --- map_editor.scn | 4 ++-- user_interface/worker_prompt.gd | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 1aa2188..eafb473 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c9948b7c49555550b25347a7c9dd0a35752de1c06ab4f10cecbbd0be7d86aa67 -size 8462 +oid sha256:b1bd6e544f9f7711be7f8d59e72ab2f26e40b52ff7d939a999afbf0a6beca810 +size 8474 diff --git a/user_interface/worker_prompt.gd b/user_interface/worker_prompt.gd index 11c1f32..8b037dc 100644 --- a/user_interface/worker_prompt.gd +++ b/user_interface/worker_prompt.gd @@ -1,5 +1,10 @@ class_name WorkerPrompt extends Control +## +## +## +signal prompt_completed() + ## ## ## @@ -44,4 +49,6 @@ func prompt(display_message: String, steps: Array) -> void: await get_tree().process_frame _worker_thread.wait_to_finish() + prompt_completed.emit() hide() + -- 2.34.1 From fbe4213c7fdb15ab3071277c335ac6e80c6debbf Mon Sep 17 00:00:00 2001 From: kayomn Date: Thu, 26 Jan 2023 00:08:06 +0000 Subject: [PATCH 09/30] Remove dependency on ItemSelection --- map_editor.scn | 4 +- map_editor/brush_selection_button_group.res | 3 + user_interface/button_selection.gd | 86 --------------------- 3 files changed, 5 insertions(+), 88 deletions(-) create mode 100644 map_editor/brush_selection_button_group.res delete mode 100644 user_interface/button_selection.gd diff --git a/map_editor.scn b/map_editor.scn index eafb473..9a25dd8 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b1bd6e544f9f7711be7f8d59e72ab2f26e40b52ff7d939a999afbf0a6beca810 -size 8474 +oid sha256:a2def289ce26e4987f7d26f54923bfdebe247282b6c8f1277701af6fb4828e74 +size 8664 diff --git a/map_editor/brush_selection_button_group.res b/map_editor/brush_selection_button_group.res new file mode 100644 index 0000000..b00a106 --- /dev/null +++ b/map_editor/brush_selection_button_group.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d0755c5adedfce65aecf47ce200085de76ed8801f7a17ae387c04fbbec483eba +size 212 diff --git a/user_interface/button_selection.gd b/user_interface/button_selection.gd deleted file mode 100644 index f79eb5c..0000000 --- a/user_interface/button_selection.gd +++ /dev/null @@ -1,86 +0,0 @@ -@tool -class_name ItemSelection extends HFlowContainer - -## -## An item has been selected via GUI selection or [method select_item]. -## -signal item_selected(index: int) - -var _button_group := ButtonGroup.new() - -## -## Number of items in the selection. -## -var item_count: int: - get: - return _button_group.get_buttons().size() - -func _get_configuration_warnings() -> PackedStringArray: - var warnings := PackedStringArray() - var children := get_children() - - if not(children.is_empty()): - var self_class_name := get_class() - - for child in get_children(): - warnings.append( - "{0} can only have Button children, but {1} is of type {2}".format( - [self_class_name, child.name, child.get_class()])) - - return warnings - -## -## Adds a new item with no text and only [code]icon[/code] as the icon to the selection. -## -func add_icon_item(icon: Texture2D) -> void: - var child_count := get_child_count() - var button := Button.new() - - button.icon = icon - button.icon_alignment = HORIZONTAL_ALIGNMENT_CENTER - button.toggle_mode = true - button.button_group = _button_group - button.button_pressed = child_count == 0 - - button.pressed.connect(func () -> void: select_item(child_count)) - add_child(button) - -## -## Returns the icon used by the item at [code]index[/code]. -## -## An assertion is raised if [code]index[/code] is out of bounds from the item count. -## -func get_item_icon(index: int) -> Texture2D: - var buttons := _button_group.get_buttons() - - assert(index < buttons.size(), "index out of range") - - var button := buttons[index] as Button - - return null if (button == null) else button.icon - -## -## Returns the currently selected item index or [code]-1[/code] if no item is selected. -## -func get_selected_item() -> int: - var pressed_button := _button_group.get_pressed_button() - - return -1 if (pressed_button == null) else pressed_button.get_index() - -## -## Selects the item at [code]index[/code], emitting [signal item_selected] at the end. -## -## An assertion is raised if [code]index[/code] is out of bounds from the item count. -## -func select_item(index: int) -> void: - var buttons := _button_group.get_buttons() - - assert(index < buttons.size(), "index out of range") - - var pressed_button := _button_group.get_pressed_button() - - if pressed_button != null: - pressed_button.set_pressed_no_signal(false) - - buttons[index].set_pressed_no_signal(true) - item_selected.emit(index) -- 2.34.1 From f87cc4f996b6b27da928ade680e02e78a2025e7d Mon Sep 17 00:00:00 2001 From: kayomn Date: Thu, 26 Jan 2023 00:08:37 +0000 Subject: [PATCH 10/30] Remove debug print --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 9a25dd8..e31b394 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a2def289ce26e4987f7d26f54923bfdebe247282b6c8f1277701af6fb4828e74 -size 8664 +oid sha256:37ec7d06fc6cdc7a3d5a3fb8b4821c47e7265f1d781fcca50a7bae3bc1cc28e6 +size 8629 -- 2.34.1 From 42c3a53b24ebe40bc353cb486a10542ff7385e69 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 14:15:59 +0000 Subject: [PATCH 11/30] Refactor code quality and squash bugs in MeshGrid --- map_editor.scn | 4 +- map_editor/camera_boundary_mesh.res | 4 +- mesh_grid.gd | 189 ++++++++++++++++++---------- project.godot | 5 + 4 files changed, 133 insertions(+), 69 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index e31b394..d597e3d 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:37ec7d06fc6cdc7a3d5a3fb8b4821c47e7265f1d781fcca50a7bae3bc1cc28e6 -size 8629 +oid sha256:b8de9c0cb07eadedbfd24cfa384a72d55c4f44d26665163e8de8e147d97e5df9 +size 9103 diff --git a/map_editor/camera_boundary_mesh.res b/map_editor/camera_boundary_mesh.res index 673c51f..c478941 100644 --- a/map_editor/camera_boundary_mesh.res +++ b/map_editor/camera_boundary_mesh.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ce40e96135058eaaf87b5188862dc31e71c6e11a53f5afce3cffccf4320208d6 -size 645 +oid sha256:28046c63a066c0a2119714133b8aae4216b3dbd694749d3e8467d362c2cf74c5 +size 643 diff --git a/mesh_grid.gd b/mesh_grid.gd index aca0ea2..950e0ae 100644 --- a/mesh_grid.gd +++ b/mesh_grid.gd @@ -1,25 +1,78 @@ class_name MeshGrid extends Node3D -const _CELL_COUNT := 8 +const _CHUNK_SIZE := 32 -class _Chunk: - var multimesh_instances: Array[_MultimeshInstance] = [] +const _GRID_ORIGIN := Vector2(0.5, 0.5) + +## +## +## +class Chunk: + var multimesh_instances: Array[MultiMeshInstance] = [] var meshes: Array[Mesh] = [] func _init() -> void: - self.meshes.resize(_CELL_COUNT * _CELL_COUNT) + meshes.resize(_CHUNK_SIZE * _CHUNK_SIZE) -class _MultimeshInstance: + ## + ## + ## + func invalidate(mesh_grid: MeshGrid, coordinate: Vector2i) -> void: + # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. + for multimesh_instance in multimesh_instances: + RenderingServer.free_rid(multimesh_instance._instance_rid) + RenderingServer.free_rid(multimesh_instance._multimesh_rid) + + multimesh_instances.clear() + + # Normalize mesh instance data for the chunk. + var transforms_by_mesh := {} + var grid_size := mesh_grid.size + + for i in meshes.size(): + var mesh := meshes[i] + + if mesh != null: + if not(mesh in transforms_by_mesh): + transforms_by_mesh[mesh] = [] + + transforms_by_mesh[mesh].append(Transform3D(Basis.IDENTITY, Vector3( + (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - + (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, + (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - + (float(grid_size.y) * _GRID_ORIGIN.y)))) + + # Bake into multimesh instances for the chunk. + var scenario_rid := mesh_grid.get_world_3d().scenario + var global_transform := mesh_grid.global_transform + + for chunk_mesh in transforms_by_mesh: + var multimesh_instance := MultiMeshInstance.new( + scenario_rid, chunk_mesh.get_rid(), transforms_by_mesh[chunk_mesh]) + + multimesh_instance.set_offset(global_transform) + multimesh_instances.append(multimesh_instance) + + ## + ## + ## + func set_mesh(coordinate: Vector2i, mesh: Mesh) -> void: + meshes[(_CHUNK_SIZE * coordinate.y) + coordinate.x] = mesh + +## +## +## +class MultiMeshInstance: var _instance_rid := RID() var _multimesh_rid := RID() - func _init(scenario_rid: RID, mesh: Mesh, transforms: Array) -> void: + func _init(scenario_rid: RID, mesh_rid: RID, transforms: Array) -> void: _multimesh_rid = RenderingServer.multimesh_create() _instance_rid = RenderingServer.instance_create2(_multimesh_rid, scenario_rid) - RenderingServer.multimesh_set_mesh(_multimesh_rid, mesh.get_rid()) + RenderingServer.multimesh_set_mesh(_multimesh_rid, mesh_rid) var transform_count := transforms.size() @@ -29,88 +82,94 @@ class _MultimeshInstance: for i in transform_count: RenderingServer.multimesh_instance_set_transform(_multimesh_rid, i, transforms[i]) -var _chunks: Array[_Chunk] = [] + ## + ## + ## + func set_offset(offset: Transform3D) -> void: + RenderingServer.instance_set_transform(_instance_rid, offset) -var _grid_origin := Vector2(0.5, 0.5) +var _chunks: Array[Chunk] = [] + +var _chunks_size := Vector2i.ZERO ## -## The number of horizontal and vertical cells in the current grid. ## -## Setting this value will result in the current grid data being completely overwritten to return -## it to a sensible default. ## @export var size: Vector2i: set(value): - self._chunks.resize(int(ceil((value.x * value.y) / float(_CELL_COUNT)))) + var chunk_size_factor := float(_CHUNK_SIZE) - for i in self._chunks.size(): - self._chunks[i] = _Chunk.new() + _chunks.resize(int(ceilf(value.x / chunk_size_factor) * ceilf(value.y / chunk_size_factor))) + for i in _chunks.size(): + _chunks[i] = Chunk.new() + + _chunks_size = Vector2i((value / float(_CHUNK_SIZE)).ceil()) size = value +func _get_chunk(chunk_coordinate: Vector2i) -> Chunk: + return _chunks[(_chunks_size.x * chunk_coordinate.y) + chunk_coordinate.x] + func _notification(what: int) -> void: match what: NOTIFICATION_TRANSFORM_CHANGED: for chunk in _chunks: for multimesh_instance in chunk.multimesh_instances: - RenderingServer.instance_set_transform( - multimesh_instance._instance_rid, multimesh_instance.global_transform) + multimesh_instance.set_offset_transform(global_transform) ## -## Sets the cell at [code]coordinate[/code] to display [code]mesh[/code]. ## -## Note that this function assumes [code]coordinate[/code] is within the bounds of the grid -## coordinate space. ## -## Note that changes to a cell result in the chunk it resides in being completely regenerated as -## part of its modification, and therefore has an implicitly higher overhead to other setter -## operations defined by [MeshGrid]. +func clear_mesh(mesh: Mesh) -> void: + for y in size.y: + for x in size.x: + var coordinate := Vector2i(x, y) + + _get_chunk(coordinate / _CHUNK_SIZE).set_mesh(coordinate % _CHUNK_SIZE, mesh) + + for y in _chunks_size.y: + for x in _chunks_size.x: + var chunk_coordinate := Vector2i(x, y) + + _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) + ## -func set_mesh(coordinate: Vector2i, mesh: Mesh) -> void: +## +## +func fill_mesh(area: Rect2i, mesh: Mesh) -> void: + assert(Rect2i(Vector2i.ZERO, size).encloses(area), "area must be within grid") + + var filled_chunks := BitMap.new() + + filled_chunks.resize(_chunks_size) + + for y in range(area.position.y, area.end.y): + for x in range(area.position.x, area.end.x): + var coordinate := Vector2i(x, y) + var chunk_coordinate := coordinate / _CHUNK_SIZE + + _get_chunk(chunk_coordinate).set_mesh(coordinate % _CHUNK_SIZE, mesh) + filled_chunks.set_bitv(chunk_coordinate, true) + + for y in _chunks_size.y: + for x in _chunks_size.x: + if filled_chunks.get_bit(x, y): + var chunk_coordinate := Vector2i(x, y) + + _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) + +## +## +## +func plot_mesh(coordinate: Vector2i, mesh: Mesh) -> void: assert(Rect2i(Vector2i.ZERO, size).has_point(coordinate), "coordinate must be within grid") - # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. - var chunk_coordinate := coordinate / _CELL_COUNT - var cell_coordinate := coordinate % _CELL_COUNT - var chunk := _chunks[(size.x * chunk_coordinate.y) + chunk_coordinate.x] - var chunk_meshes := chunk.meshes + var chunk_coordinate := coordinate / _CHUNK_SIZE + var chunk := _get_chunk(chunk_coordinate) - chunk_meshes[(_CELL_COUNT * cell_coordinate.y) + cell_coordinate.x] = mesh - - # Invalide any existing baked multimeshes in the chunk. - for multimesh_instance in chunk.multimesh_instances: - RenderingServer.free_rid(multimesh_instance._instance_rid) - RenderingServer.free_rid(multimesh_instance._multimesh_rid) - - chunk.multimesh_instances.clear() - - # Normalize mesh instance data for the chunk. - var mesh_transform_sets := {} - - for i in chunk_meshes.size(): - var chunk_mesh := chunk_meshes[i] - - if chunk_mesh != null: - if not(chunk_mesh in mesh_transform_sets): - mesh_transform_sets[chunk_mesh] = [] - - mesh_transform_sets[chunk_mesh].push_back(Transform3D(Basis.IDENTITY, Vector3( - (float(chunk_coordinate.x * _CELL_COUNT) + (i % _CELL_COUNT)) - - (float(size.x) * _grid_origin.x), 0.0, - (float(chunk_coordinate.y * _CELL_COUNT) + (i / _CELL_COUNT)) - - (float(size.y) * _grid_origin.y)))) - - # Bake into multimesh instances for the chunk. - var scenario_rid := get_world_3d().scenario - - for chunk_mesh in mesh_transform_sets: - var multimesh_instance :=\ - _MultimeshInstance.new(scenario_rid, chunk_mesh, mesh_transform_sets[chunk_mesh]) - - RenderingServer.instance_set_transform(multimesh_instance._instance_rid, global_transform) - - chunk.multimesh_instances.push_back(multimesh_instance) + chunk.set_mesh(coordinate % _CHUNK_SIZE, mesh) + chunk.invalidate(self, chunk_coordinate) ## ## Returns [code]world_position[/code] converted into a coordinate aligned with the [MeshGrid]. @@ -119,4 +178,4 @@ func set_mesh(coordinate: Vector2i, mesh: Mesh) -> void: ## coordinates outside of the [MeshGrid] bounds as well. ## func world_to_grid(world_position: Vector2) -> Vector2i: - return Vector2i((world_position + (Vector2(size) * _grid_origin)).floor()) + return Vector2i((world_position + (Vector2(size) * _GRID_ORIGIN)).floor()) diff --git a/project.godot b/project.godot index 986754a..c52661e 100644 --- a/project.godot +++ b/project.godot @@ -23,6 +23,7 @@ LocalPlayer="*res://local_player.scn" [debug] +gdscript/warnings/integer_division=0 gdscript/warnings/assert_always_true=0 gdscript/warnings/assert_always_false=0 @@ -80,6 +81,10 @@ editor_paint={ ] } +[physics] + +common/physics_ticks_per_second=30 + [rendering] lights_and_shadows/directional_shadow/soft_shadow_filter_quality=3 -- 2.34.1 From 499cfe84efc9a6f28e487acf4432e4e47eaddb30 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 15:49:56 +0000 Subject: [PATCH 12/30] Clean up MeshGrid logic --- map_editor.scn | 4 +-- mesh_grid.gd | 78 ++++++++++++++++++++++++++++++++++---------------- 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index d597e3d..108fd93 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b8de9c0cb07eadedbfd24cfa384a72d55c4f44d26665163e8de8e147d97e5df9 -size 9103 +oid sha256:8e1b8150dd960e318a4d296f32ea0a7e28445a0a64eac5471a56e31ffda78a5f +size 9102 diff --git a/mesh_grid.gd b/mesh_grid.gd index 950e0ae..de70774 100644 --- a/mesh_grid.gd +++ b/mesh_grid.gd @@ -5,33 +5,33 @@ const _CHUNK_SIZE := 32 const _GRID_ORIGIN := Vector2(0.5, 0.5) ## -## +## Baked block of meshes making up a segment of the grid. ## class Chunk: - var multimesh_instances: Array[MultiMeshInstance] = [] + var _multimesh_instances: Array[MultiMeshInstance] = [] - var meshes: Array[Mesh] = [] + var _meshes: Array[Mesh] = [] func _init() -> void: - meshes.resize(_CHUNK_SIZE * _CHUNK_SIZE) + _meshes.resize(_CHUNK_SIZE * _CHUNK_SIZE) ## - ## + ## Invalidates the mesh block, re-baking its contents from the current mesh data set. ## func invalidate(mesh_grid: MeshGrid, coordinate: Vector2i) -> void: # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. - for multimesh_instance in multimesh_instances: + for multimesh_instance in _multimesh_instances: RenderingServer.free_rid(multimesh_instance._instance_rid) RenderingServer.free_rid(multimesh_instance._multimesh_rid) - multimesh_instances.clear() - + _multimesh_instances.clear() + # Normalize mesh instance data for the chunk. var transforms_by_mesh := {} var grid_size := mesh_grid.size - for i in meshes.size(): - var mesh := meshes[i] + for i in _meshes.size(): + var mesh := _meshes[i] if mesh != null: if not(mesh in transforms_by_mesh): @@ -43,7 +43,7 @@ class Chunk: (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - (float(grid_size.y) * _GRID_ORIGIN.y)))) - # Bake into multimesh instances for the chunk. + # (Re)-bake into multimesh instances for the chunk. var scenario_rid := mesh_grid.get_world_3d().scenario var global_transform := mesh_grid.global_transform @@ -52,16 +52,20 @@ class Chunk: scenario_rid, chunk_mesh.get_rid(), transforms_by_mesh[chunk_mesh]) multimesh_instance.set_offset(global_transform) - multimesh_instances.append(multimesh_instance) + _multimesh_instances.append(multimesh_instance) ## + ## Sets the mesh location in the chunk at the relative [code]coordinatess[/code] to + ## [code]mesh[/code]. ## + ## *Note* that [method Chunk.invalidate] must be called at some point after to visually update + ## the chunk. ## - func set_mesh(coordinate: Vector2i, mesh: Mesh) -> void: - meshes[(_CHUNK_SIZE * coordinate.y) + coordinate.x] = mesh + func set_mesh(coordinates: Vector2i, mesh: Mesh) -> void: + _meshes[(_CHUNK_SIZE * coordinates.y) + coordinates.x] = mesh ## -## +## Specialized multi-mesh instance convenience for use within the mesh grid and its chunks. ## class MultiMeshInstance: var _instance_rid := RID() @@ -83,7 +87,7 @@ class MultiMeshInstance: RenderingServer.multimesh_instance_set_transform(_multimesh_rid, i, transforms[i]) ## - ## + ## Sets the parent transform of all mesh instances under it to [code]offset[/code]. ## func set_offset(offset: Transform3D) -> void: RenderingServer.instance_set_transform(_instance_rid, offset) @@ -93,7 +97,7 @@ var _chunks: Array[Chunk] = [] var _chunks_size := Vector2i.ZERO ## -## +## Size of the mesh grid (in engine units). ## @export var size: Vector2i: @@ -108,6 +112,9 @@ var size: Vector2i: _chunks_size = Vector2i((value / float(_CHUNK_SIZE)).ceil()) size = value +func _get_area() -> Rect2i: + return Rect2i(Vector2i.ZERO, size) + func _get_chunk(chunk_coordinate: Vector2i) -> Chunk: return _chunks[(_chunks_size.x * chunk_coordinate.y) + chunk_coordinate.x] @@ -115,11 +122,15 @@ func _notification(what: int) -> void: match what: NOTIFICATION_TRANSFORM_CHANGED: for chunk in _chunks: - for multimesh_instance in chunk.multimesh_instances: + for multimesh_instance in chunk._multimesh_instances: multimesh_instance.set_offset_transform(global_transform) ## +## Clears the entire mesh grid to only contain [code]mesh[/code]. ## +## [code]null[/code] may be past to [code]mesh[/code] for clearing the mesh grid to nothing. +## +## For clearing a specific region of the mesh grid, see [method fill_mesh]. ## func clear_mesh(mesh: Mesh) -> void: for y in size.y: @@ -135,10 +146,18 @@ func clear_mesh(mesh: Mesh) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) ## +## Clears the region of the mesh grid at [code]area[/code] to only contain [code]mesh[/code]. ## +## [code]null[/code] may be past to [code]mesh[/code] for filling the region to nothing. +## +## *Note* that [code]area[/code] *must* be within the area of the of the mesh grid, where +## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom- +## right. +## +## For clearing the whole of the mesh grid, see [method clear_mesh]. ## func fill_mesh(area: Rect2i, mesh: Mesh) -> void: - assert(Rect2i(Vector2i.ZERO, size).encloses(area), "area must be within grid") + assert(_get_area().encloses(area), "area must be within grid") var filled_chunks := BitMap.new() @@ -160,16 +179,25 @@ func fill_mesh(area: Rect2i, mesh: Mesh) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) ## +## Plots a single mesh at [code]coordinates[/code] to be [code]mesh[/code], overwriting whatever it +## previously contained. ## +## [code]null[/code] may be past to [code]mesh[/code] for clearing the mesh grid to nothing. ## -func plot_mesh(coordinate: Vector2i, mesh: Mesh) -> void: - assert(Rect2i(Vector2i.ZERO, size).has_point(coordinate), "coordinate must be within grid") +## *Note* that [code]coordinates[/code] *must* be within the area of the of the mesh grid, where +## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom- +## right. +## +## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh]. +## +func plot_mesh(coordinates: Vector2i, mesh: Mesh) -> void: + assert(_get_area().has_point(coordinates), "coordinate must be within grid") - var chunk_coordinate := coordinate / _CHUNK_SIZE - var chunk := _get_chunk(chunk_coordinate) + var chunk_coordinates := coordinates / _CHUNK_SIZE + var chunk := _get_chunk(chunk_coordinates) - chunk.set_mesh(coordinate % _CHUNK_SIZE, mesh) - chunk.invalidate(self, chunk_coordinate) + chunk.set_mesh(coordinates % _CHUNK_SIZE, mesh) + chunk.invalidate(self, chunk_coordinates) ## ## Returns [code]world_position[/code] converted into a coordinate aligned with the [MeshGrid]. -- 2.34.1 From f6e3408d0ecf08235ea83ab80d064407acfffd03 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 15:57:16 +0000 Subject: [PATCH 13/30] Make map edit activation signal more flexible --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 108fd93..951424f 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8e1b8150dd960e318a4d296f32ea0a7e28445a0a64eac5471a56e31ffda78a5f -size 9102 +oid sha256:b55b5cb6575b2283a305f610469f143d0fabe700b8a88f4e60e18615a872928c +size 9302 -- 2.34.1 From 4963f7b355f377ae0b184b370b97c6c43edfc975 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 19:36:54 +0000 Subject: [PATCH 14/30] Add basic functionality for plotting meshes of interiors --- local_player.scn | 4 ++-- map_editor.scn | 4 ++-- map_editor/map_editor_menu.gd | 7 ++++--- map_editor/menus_theme.res | 4 ++-- map_editor/tile_selector_button_group.res | 3 +++ mesh_grid.gd | 10 +++++----- project.godot | 6 ++++++ 7 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 map_editor/tile_selector_button_group.res diff --git a/local_player.scn b/local_player.scn index d169f96..876b659 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a4fe7961f0b6694c50311a199915c2acf0b1297a8bb1cb460dbab0e0c375cd2 -size 668 +oid sha256:4361765e205d45ccecaeb578065b3eec5aefab8f9a2484631bbd7004fa9eddf4 +size 679 diff --git a/map_editor.scn b/map_editor.scn index 951424f..a257138 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b55b5cb6575b2283a305f610469f143d0fabe700b8a88f4e60e18615a872928c -size 9302 +oid sha256:8fe669ee1b4a2d2d023be4203cd3b694fcdad8be388ff4d97309cf5fa377918b +size 10446 diff --git a/map_editor/map_editor_menu.gd b/map_editor/map_editor_menu.gd index c84d4ae..f4c15ca 100644 --- a/map_editor/map_editor_menu.gd +++ b/map_editor/map_editor_menu.gd @@ -1,18 +1,19 @@ class_name MapEditorMenu extends VBoxContainer ## -## +## [code]edit_action[/code] has been activated for use when the player interacts with the map +## editor. ## signal edit_activated(edit_action: Callable) ## -## +## Emits [signal edit_activated]. ## func activate_editor(edit_action: Callable) -> void: edit_activated.emit(edit_action) ## -## +## Resets the state of the menu. ## func reset() -> void: pass diff --git a/map_editor/menus_theme.res b/map_editor/menus_theme.res index d240659..57edacb 100644 --- a/map_editor/menus_theme.res +++ b/map_editor/menus_theme.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16a64c4d989cb97515aeb631c435db2c29388fb701e9e513d26692d3bba10f65 -size 847 +oid sha256:313a4fd4690a9521a50eda4bb8e1776031c27d1a0ee411c31185c9ea6f84aedc +size 886 diff --git a/map_editor/tile_selector_button_group.res b/map_editor/tile_selector_button_group.res new file mode 100644 index 0000000..15ec28f --- /dev/null +++ b/map_editor/tile_selector_button_group.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac378ba65f50a7aef2a17925716d12bc0d5074d063f6e6a42de46e8a1c36a846 +size 209 diff --git a/mesh_grid.gd b/mesh_grid.gd index de70774..06b1c3e 100644 --- a/mesh_grid.gd +++ b/mesh_grid.gd @@ -112,9 +112,6 @@ var size: Vector2i: _chunks_size = Vector2i((value / float(_CHUNK_SIZE)).ceil()) size = value -func _get_area() -> Rect2i: - return Rect2i(Vector2i.ZERO, size) - func _get_chunk(chunk_coordinate: Vector2i) -> Chunk: return _chunks[(_chunks_size.x * chunk_coordinate.y) + chunk_coordinate.x] @@ -157,7 +154,7 @@ func clear_mesh(mesh: Mesh) -> void: ## For clearing the whole of the mesh grid, see [method clear_mesh]. ## func fill_mesh(area: Rect2i, mesh: Mesh) -> void: - assert(_get_area().encloses(area), "area must be within grid") + assert(get_area().encloses(area), "area must be within grid") var filled_chunks := BitMap.new() @@ -178,6 +175,9 @@ func fill_mesh(area: Rect2i, mesh: Mesh) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) +func get_area() -> Rect2i: + return Rect2i(Vector2i.ZERO, size) + ## ## Plots a single mesh at [code]coordinates[/code] to be [code]mesh[/code], overwriting whatever it ## previously contained. @@ -191,7 +191,7 @@ func fill_mesh(area: Rect2i, mesh: Mesh) -> void: ## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh]. ## func plot_mesh(coordinates: Vector2i, mesh: Mesh) -> void: - assert(_get_area().has_point(coordinates), "coordinate must be within grid") + assert(get_area().has_point(coordinates), "coordinate must be within grid") var chunk_coordinates := coordinates / _CHUNK_SIZE var chunk := _get_chunk(chunk_coordinates) diff --git a/project.godot b/project.godot index c52661e..230da9b 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,7 @@ config/name="Protectorate" run/main_scene="res://map_editor.scn" config/use_custom_user_dir=true config/features=PackedStringArray("4.0", "Forward Plus") +boot_splash/show_image=false config/icon="res://icon.png" [autoload] @@ -81,6 +82,11 @@ editor_paint={ ] } +[layer_names] + +3d_render/layer_1="Physical" +3d_render/layer_2="Interface" + [physics] common/physics_ticks_per_second=30 -- 2.34.1 From e2ccaa469e9d64418c8e3899425a8dfc68754240 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 20:20:24 +0000 Subject: [PATCH 15/30] Add clear tiles button to map editor --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index a257138..53714ad 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8fe669ee1b4a2d2d023be4203cd3b694fcdad8be388ff4d97309cf5fa377918b -size 10446 +oid sha256:b44428f80d4eedb57d08f8bc39c5649b22f7f2d5335661575c821c58c4344db5 +size 10534 -- 2.34.1 From 1ccb0400dcab0ae5febab515d28f4e6b136dce40 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 20:34:39 +0000 Subject: [PATCH 16/30] Rename tile menu options to be clearer --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 53714ad..be7e50c 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b44428f80d4eedb57d08f8bc39c5649b22f7f2d5335661575c821c58c4344db5 -size 10534 +oid sha256:68750f91463548b5d57b6c96322ba6a0a3b33f1b7948b8bed812b369f46c64af +size 10540 -- 2.34.1 From a175b22377ccf7422cab5928f181e3996a4f29b3 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 22:44:28 +0000 Subject: [PATCH 17/30] Replace placeholder meshes with tiles for interior map editing --- local_player.scn | 2 +- map_editor.scn | 4 +- map_editor/tile_cursor.gdshader | 12 ++ map_editor/tile_cursor.res | 3 + tiling/tile.gd | 21 +++ mesh_grid.gd => tiling/tile_grid.gd | 174 +++++++++++++----- tiling/tiles/dungeon_01_pipehole_tile.res | 3 + tiling/tiles/dungeon_01_tiling_tile.res | 3 + .../tiles/limestone_dungeon/hole_albedo.png | 3 + .../limestone_dungeon/hole_albedo.png.import | 36 ++++ .../tiles/limestone_dungeon/hole_height.png | 3 + .../limestone_dungeon/hole_height.png.import | 36 ++++ .../tiles/limestone_dungeon/hole_material.res | 3 + .../tiles/limestone_dungeon/hole_normal.png | 3 + .../limestone_dungeon/hole_normal.png.import | 36 ++++ tiling/tiles/limestone_dungeon/hole_orm.png | 3 + .../limestone_dungeon/hole_orm.png.import | 36 ++++ .../tiles/limestone_dungeon/piping_albedo.png | 3 + .../piping_albedo.png.import | 36 ++++ .../tiles/limestone_dungeon/piping_height.png | 3 + .../piping_height.png.import | 36 ++++ .../limestone_dungeon/piping_material.res | 3 + .../tiles/limestone_dungeon/piping_normal.png | 3 + .../piping_normal.png.import | 36 ++++ tiling/tiles/limestone_dungeon/piping_orm.png | 3 + .../limestone_dungeon/piping_orm.png.import | 36 ++++ .../tiles/limestone_dungeon/tiling_albedo.png | 3 + .../tiling_albedo.png.import | 36 ++++ .../tiles/limestone_dungeon/tiling_height.png | 3 + .../tiling_height.png.import | 36 ++++ .../limestone_dungeon/tiling_material.res | 3 + .../tiles/limestone_dungeon/tiling_normal.png | 3 + .../tiling_normal.png.import | 36 ++++ tiling/tiles/limestone_dungeon/tiling_orm.png | 3 + .../limestone_dungeon/tiling_orm.png.import | 36 ++++ 35 files changed, 650 insertions(+), 49 deletions(-) create mode 100644 map_editor/tile_cursor.gdshader create mode 100644 map_editor/tile_cursor.res create mode 100644 tiling/tile.gd rename mesh_grid.gd => tiling/tile_grid.gd (51%) create mode 100644 tiling/tiles/dungeon_01_pipehole_tile.res create mode 100644 tiling/tiles/dungeon_01_tiling_tile.res create mode 100755 tiling/tiles/limestone_dungeon/hole_albedo.png create mode 100644 tiling/tiles/limestone_dungeon/hole_albedo.png.import create mode 100755 tiling/tiles/limestone_dungeon/hole_height.png create mode 100644 tiling/tiles/limestone_dungeon/hole_height.png.import create mode 100644 tiling/tiles/limestone_dungeon/hole_material.res create mode 100755 tiling/tiles/limestone_dungeon/hole_normal.png create mode 100644 tiling/tiles/limestone_dungeon/hole_normal.png.import create mode 100644 tiling/tiles/limestone_dungeon/hole_orm.png create mode 100644 tiling/tiles/limestone_dungeon/hole_orm.png.import create mode 100755 tiling/tiles/limestone_dungeon/piping_albedo.png create mode 100644 tiling/tiles/limestone_dungeon/piping_albedo.png.import create mode 100755 tiling/tiles/limestone_dungeon/piping_height.png create mode 100644 tiling/tiles/limestone_dungeon/piping_height.png.import create mode 100644 tiling/tiles/limestone_dungeon/piping_material.res create mode 100755 tiling/tiles/limestone_dungeon/piping_normal.png create mode 100644 tiling/tiles/limestone_dungeon/piping_normal.png.import create mode 100644 tiling/tiles/limestone_dungeon/piping_orm.png create mode 100644 tiling/tiles/limestone_dungeon/piping_orm.png.import create mode 100755 tiling/tiles/limestone_dungeon/tiling_albedo.png create mode 100644 tiling/tiles/limestone_dungeon/tiling_albedo.png.import create mode 100755 tiling/tiles/limestone_dungeon/tiling_height.png create mode 100644 tiling/tiles/limestone_dungeon/tiling_height.png.import create mode 100644 tiling/tiles/limestone_dungeon/tiling_material.res create mode 100755 tiling/tiles/limestone_dungeon/tiling_normal.png create mode 100644 tiling/tiles/limestone_dungeon/tiling_normal.png.import create mode 100644 tiling/tiles/limestone_dungeon/tiling_orm.png create mode 100644 tiling/tiles/limestone_dungeon/tiling_orm.png.import diff --git a/local_player.scn b/local_player.scn index 876b659..b10cd97 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:4361765e205d45ccecaeb578065b3eec5aefab8f9a2484631bbd7004fa9eddf4 +oid sha256:cdc150f7614a20d1a925aebcbba25105d3cf046f2f70deb2b68951fa6bc46dc8 size 679 diff --git a/map_editor.scn b/map_editor.scn index be7e50c..e6f4a04 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:68750f91463548b5d57b6c96322ba6a0a3b33f1b7948b8bed812b369f46c64af -size 10540 +oid sha256:35daad0fb39d23f098b2849489292c5e5a5dccbffffb2a866e74d82d64085cdd +size 10675 diff --git a/map_editor/tile_cursor.gdshader b/map_editor/tile_cursor.gdshader new file mode 100644 index 0000000..e41f94c --- /dev/null +++ b/map_editor/tile_cursor.gdshader @@ -0,0 +1,12 @@ +shader_type spatial; +render_mode unshaded, blend_add, cull_disabled; + +uniform sampler2D source_texture; + +uniform vec4 modulate: source_color = vec4(1.0); + +void fragment() { + vec4 source = texture(source_texture, UV); + ALBEDO = (source.rgb * modulate.rgb); + ALPHA = source.a; +} \ No newline at end of file diff --git a/map_editor/tile_cursor.res b/map_editor/tile_cursor.res new file mode 100644 index 0000000..2d23433 --- /dev/null +++ b/map_editor/tile_cursor.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b9240206e13ccff017900a7262637147f1931f9e950e2c1b0efb45523e03bd5 +size 901 diff --git a/tiling/tile.gd b/tiling/tile.gd new file mode 100644 index 0000000..2b172a5 --- /dev/null +++ b/tiling/tile.gd @@ -0,0 +1,21 @@ +class_name Tile extends Resource + +## +## +## +enum Kind { + FLOOR, + WALL, +} + +## +## +## +@export +var kind := Kind.FLOOR + +## +## +## +@export +var mesh: Mesh = null diff --git a/mesh_grid.gd b/tiling/tile_grid.gd similarity index 51% rename from mesh_grid.gd rename to tiling/tile_grid.gd index 06b1c3e..f22a672 100644 --- a/mesh_grid.gd +++ b/tiling/tile_grid.gd @@ -1,4 +1,4 @@ -class_name MeshGrid extends Node3D +class_name TileGrid extends Node3D const _CHUNK_SIZE := 32 @@ -8,17 +8,22 @@ const _GRID_ORIGIN := Vector2(0.5, 0.5) ## Baked block of meshes making up a segment of the grid. ## class Chunk: + var _floor_meshes: Array[Mesh] = [] + var _multimesh_instances: Array[MultiMeshInstance] = [] - var _meshes: Array[Mesh] = [] + var _wall_meshes: Array[Mesh] = [] func _init() -> void: - _meshes.resize(_CHUNK_SIZE * _CHUNK_SIZE) + var buffer_size := _CHUNK_SIZE * _CHUNK_SIZE + + _floor_meshes.resize(buffer_size) + _wall_meshes.resize(buffer_size) ## ## Invalidates the mesh block, re-baking its contents from the current mesh data set. ## - func invalidate(mesh_grid: MeshGrid, coordinate: Vector2i) -> void: + func invalidate(tile_grid: TileGrid, coordinate: Vector2i) -> void: # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. for multimesh_instance in _multimesh_instances: RenderingServer.free_rid(multimesh_instance._instance_rid) @@ -28,10 +33,23 @@ class Chunk: # Normalize mesh instance data for the chunk. var transforms_by_mesh := {} - var grid_size := mesh_grid.size + var grid_size := tile_grid.size - for i in _meshes.size(): - var mesh := _meshes[i] + for i in _floor_meshes.size(): + var mesh := _floor_meshes[i] + + if mesh != null: + if not(mesh in transforms_by_mesh): + transforms_by_mesh[mesh] = [] + + transforms_by_mesh[mesh].append(Transform3D(Basis.IDENTITY, Vector3( + (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - + (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, + (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - + (float(grid_size.y) * _GRID_ORIGIN.y)))) + + for i in _wall_meshes.size(): + var mesh := _wall_meshes[i] if mesh != null: if not(mesh in transforms_by_mesh): @@ -44,8 +62,8 @@ class Chunk: (float(grid_size.y) * _GRID_ORIGIN.y)))) # (Re)-bake into multimesh instances for the chunk. - var scenario_rid := mesh_grid.get_world_3d().scenario - var global_transform := mesh_grid.global_transform + var scenario_rid := tile_grid.get_world_3d().scenario + var global_transform := tile_grid.global_transform for chunk_mesh in transforms_by_mesh: var multimesh_instance := MultiMeshInstance.new( @@ -55,17 +73,27 @@ class Chunk: _multimesh_instances.append(multimesh_instance) ## - ## Sets the mesh location in the chunk at the relative [code]coordinatess[/code] to + ## Sets the floor mesh in the chunk at the location relative [code]coordinatess[/code] to ## [code]mesh[/code]. ## ## *Note* that [method Chunk.invalidate] must be called at some point after to visually update ## the chunk. ## - func set_mesh(coordinates: Vector2i, mesh: Mesh) -> void: - _meshes[(_CHUNK_SIZE * coordinates.y) + coordinates.x] = mesh + func set_floor_mesh(coordinates: Vector2i, mesh: Mesh) -> void: + _floor_meshes[(_CHUNK_SIZE * coordinates.y) + coordinates.x] = mesh + + ## + ## Sets the wall mesh in the chunk at the location relative [code]coordinatess[/code] to + ## [code]mesh[/code]. + ## + ## *Note* that [method Chunk.invalidate] must be called at some point after to visually update + ## the chunk. + ## + func set_wall_mesh(coordinates: Vector2i, mesh: Mesh) -> void: + _wall_meshes[(_CHUNK_SIZE * coordinates.y) + coordinates.x] = mesh ## -## Specialized multi-mesh instance convenience for use within the mesh grid and its chunks. +## Specialized multi-mesh instance convenience for use within the tile grid and its chunks. ## class MultiMeshInstance: var _instance_rid := RID() @@ -97,7 +125,7 @@ var _chunks: Array[Chunk] = [] var _chunks_size := Vector2i.ZERO ## -## Size of the mesh grid (in engine units). +## Size of the tile grid (in engine units). ## @export var size: Vector2i: @@ -123,18 +151,40 @@ func _notification(what: int) -> void: multimesh_instance.set_offset_transform(global_transform) ## -## Clears the entire mesh grid to only contain [code]mesh[/code]. -## -## [code]null[/code] may be past to [code]mesh[/code] for clearing the mesh grid to nothing. +## Clears the entirety of the tile grid to only contain [code]tile[/code]. ## ## For clearing a specific region of the mesh grid, see [method fill_mesh]. ## -func clear_mesh(mesh: Mesh) -> void: - for y in size.y: - for x in size.x: - var coordinate := Vector2i(x, y) +func clear_tiles(tile: Tile) -> void: + if tile == null: + for y in size.y: + for x in size.x: + var coordinates := Vector2i(x, y) + var chunk := _get_chunk(coordinates / _CHUNK_SIZE) + var chunk_coordinates := coordinates % _CHUNK_SIZE - _get_chunk(coordinate / _CHUNK_SIZE).set_mesh(coordinate % _CHUNK_SIZE, mesh) + chunk.set_floor_mesh(chunk_coordinates, null) + chunk.set_wall_mesh(chunk_coordinates, null) + + else: + var mesh := tile.mesh + + match tile.kind: + Tile.Kind.FLOOR: + for y in size.y: + for x in size.x: + var coordinate := Vector2i(x, y) + + _get_chunk(coordinate / _CHUNK_SIZE).\ + set_floor_mesh(coordinate % _CHUNK_SIZE, mesh) + + Tile.Kind.WALL: + for y in size.y: + for x in size.x: + var coordinate := Vector2i(x, y) + + _get_chunk(coordinate / _CHUNK_SIZE).\ + set_floor_mesh(coordinate % _CHUNK_SIZE, mesh) for y in _chunks_size.y: for x in _chunks_size.x: @@ -143,9 +193,7 @@ func clear_mesh(mesh: Mesh) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) ## -## Clears the region of the mesh grid at [code]area[/code] to only contain [code]mesh[/code]. -## -## [code]null[/code] may be past to [code]mesh[/code] for filling the region to nothing. +## Clears the region of the tile grid at [code]area[/code] to only contain [code]tile[/code]. ## ## *Note* that [code]area[/code] *must* be within the area of the of the mesh grid, where ## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom- @@ -153,20 +201,46 @@ func clear_mesh(mesh: Mesh) -> void: ## ## For clearing the whole of the mesh grid, see [method clear_mesh]. ## -func fill_mesh(area: Rect2i, mesh: Mesh) -> void: +func fill_tiles(area: Rect2i, tile: Tile) -> void: assert(get_area().encloses(area), "area must be within grid") var filled_chunks := BitMap.new() filled_chunks.resize(_chunks_size) - for y in range(area.position.y, area.end.y): - for x in range(area.position.x, area.end.x): - var coordinate := Vector2i(x, y) - var chunk_coordinate := coordinate / _CHUNK_SIZE + if tile == null: + for y in range(area.position.y, area.end.y): + for x in range(area.position.x, area.end.x): + var coordinates := Vector2i(x, y) + var chunk_coordinates := coordinates / _CHUNK_SIZE + var chunk := _get_chunk(coordinates / _CHUNK_SIZE) + var local_coordinates := coordinates % _CHUNK_SIZE - _get_chunk(chunk_coordinate).set_mesh(coordinate % _CHUNK_SIZE, mesh) - filled_chunks.set_bitv(chunk_coordinate, true) + chunk.set_floor_mesh(local_coordinates, null) + chunk.set_wall_mesh(local_coordinates, null) + filled_chunks.set_bitv(chunk_coordinates, true) + + else: + var mesh := tile.mesh + + match tile.kind: + Tile.Kind.FLOOR: + for y in range(area.position.y, area.end.y): + for x in range(area.position.x, area.end.x): + var coordinate := Vector2i(x, y) + var chunk_coordinate := coordinate / _CHUNK_SIZE + + _get_chunk(chunk_coordinate).set_floor_mesh(coordinate % _CHUNK_SIZE, mesh) + filled_chunks.set_bitv(chunk_coordinate, true) + + Tile.Kind.WALL: + for y in range(area.position.y, area.end.y): + for x in range(area.position.x, area.end.x): + var coordinate := Vector2i(x, y) + var chunk_coordinate := coordinate / _CHUNK_SIZE + + _get_chunk(chunk_coordinate).set_wall_mesh(coordinate % _CHUNK_SIZE, mesh) + filled_chunks.set_bitv(chunk_coordinate, true) for y in _chunks_size.y: for x in _chunks_size.x: @@ -175,35 +249,43 @@ func fill_mesh(area: Rect2i, mesh: Mesh) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) +## +## +## func get_area() -> Rect2i: return Rect2i(Vector2i.ZERO, size) ## -## Plots a single mesh at [code]coordinates[/code] to be [code]mesh[/code], overwriting whatever it +## Plots a single tile at [code]coordinates[/code] to be [code]tile[/code], overwriting whatever it ## previously contained. ## -## [code]null[/code] may be past to [code]mesh[/code] for clearing the mesh grid to nothing. -## ## *Note* that [code]coordinates[/code] *must* be within the area of the of the mesh grid, where ## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom- ## right. ## ## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh]. ## -func plot_mesh(coordinates: Vector2i, mesh: Mesh) -> void: +func plot_tile(coordinates: Vector2i, tile: Tile) -> void: assert(get_area().has_point(coordinates), "coordinate must be within grid") var chunk_coordinates := coordinates / _CHUNK_SIZE var chunk := _get_chunk(chunk_coordinates) - chunk.set_mesh(coordinates % _CHUNK_SIZE, mesh) - chunk.invalidate(self, chunk_coordinates) + if tile == null: + var local_coordinates := coordinates % _CHUNK_SIZE -## -## Returns [code]world_position[/code] converted into a coordinate aligned with the [MeshGrid]. -## -## Note that [code]world_position[/code] values not within the [MeshGrid] will produce grid -## coordinates outside of the [MeshGrid] bounds as well. -## -func world_to_grid(world_position: Vector2) -> Vector2i: - return Vector2i((world_position + (Vector2(size) * _GRID_ORIGIN)).floor()) + chunk.set_floor_mesh(local_coordinates, null) + chunk.set_wall_mesh(local_coordinates, null) + chunk.invalidate(self, chunk_coordinates) + + else: + var mesh := tile.mesh + + match tile.kind: + Tile.Kind.FLOOR: + chunk.set_floor_mesh(coordinates % _CHUNK_SIZE, mesh) + chunk.invalidate(self, chunk_coordinates) + + Tile.Kind.WALL: + chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, mesh) + chunk.invalidate(self, chunk_coordinates) diff --git a/tiling/tiles/dungeon_01_pipehole_tile.res b/tiling/tiles/dungeon_01_pipehole_tile.res new file mode 100644 index 0000000..86cfdae --- /dev/null +++ b/tiling/tiles/dungeon_01_pipehole_tile.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e5c0e60900e9e99ba19aa91bd4ae3480f793612edb55d8d99d0fac69c00f0d67 +size 131934 diff --git a/tiling/tiles/dungeon_01_tiling_tile.res b/tiling/tiles/dungeon_01_tiling_tile.res new file mode 100644 index 0000000..5615154 --- /dev/null +++ b/tiling/tiles/dungeon_01_tiling_tile.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bc799687c0d79256370e57b1b005fe4bcf989e17f88bbf72eb275b7d0f0dfd01 +size 456 diff --git a/tiling/tiles/limestone_dungeon/hole_albedo.png b/tiling/tiles/limestone_dungeon/hole_albedo.png new file mode 100755 index 0000000..9522f38 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65be5005d966729b3249802ba1ee1b075c7f03b14376e2e6a81a3b015d85e884 +size 144301 diff --git a/tiling/tiles/limestone_dungeon/hole_albedo.png.import b/tiling/tiles/limestone_dungeon/hole_albedo.png.import new file mode 100644 index 0000000..7a9cc55 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_albedo.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://3m7gvnsmb4g" +path.s3tc="res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.s3tc.ctex" +path.etc2="res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/hole_albedo.png" +dest_files=["res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.s3tc.ctex", "res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/hole_height.png b/tiling/tiles/limestone_dungeon/hole_height.png new file mode 100755 index 0000000..22ac595 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_height.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f37d7351c25c1d701726f311957dccd380f74dd918f12f328674467a3a552044 +size 113592 diff --git a/tiling/tiles/limestone_dungeon/hole_height.png.import b/tiling/tiles/limestone_dungeon/hole_height.png.import new file mode 100644 index 0000000..7c740fb --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_height.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8p7qvcrfsio7" +path.s3tc="res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.s3tc.ctex" +path.etc2="res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/hole_height.png" +dest_files=["res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.s3tc.ctex", "res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/hole_material.res b/tiling/tiles/limestone_dungeon/hole_material.res new file mode 100644 index 0000000..d2918a2 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e83ce69c0fbddff9183f20a73d7880a73cafc6454d4a829215ddb17224f73a9 +size 1096 diff --git a/tiling/tiles/limestone_dungeon/hole_normal.png b/tiling/tiles/limestone_dungeon/hole_normal.png new file mode 100755 index 0000000..fac6c12 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4db5e7fa31cc065fa3fbac525c04ddf74824d5e4f7a891c5aa84689fb530ffb9 +size 343721 diff --git a/tiling/tiles/limestone_dungeon/hole_normal.png.import b/tiling/tiles/limestone_dungeon/hole_normal.png.import new file mode 100644 index 0000000..18a1ddc --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_normal.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c4eby3i7q2wts" +path.s3tc="res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.s3tc.ctex" +path.etc2="res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/hole_normal.png" +dest_files=["res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.s3tc.ctex", "res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=1 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=1 +roughness/src_normal="res://tiles/tiles/limestone_dungeon/hole_normal.png" +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 diff --git a/tiling/tiles/limestone_dungeon/hole_orm.png b/tiling/tiles/limestone_dungeon/hole_orm.png new file mode 100644 index 0000000..b7800a2 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_orm.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9bd0e2cf8d124f047a835fc143563107b41b0a45a427d1f767d8be5d7470db24 +size 56105 diff --git a/tiling/tiles/limestone_dungeon/hole_orm.png.import b/tiling/tiles/limestone_dungeon/hole_orm.png.import new file mode 100644 index 0000000..4013c77 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/hole_orm.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dvqqmbf6r1jfm" +path.s3tc="res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.s3tc.ctex" +path.etc2="res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/hole_orm.png" +dest_files=["res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.s3tc.ctex", "res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/piping_albedo.png b/tiling/tiles/limestone_dungeon/piping_albedo.png new file mode 100755 index 0000000..ff4666c --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d289f998cf9317afa37ed8519a2a7ab06638aa92a8ce57dc242cf20b60066b36 +size 623939 diff --git a/tiling/tiles/limestone_dungeon/piping_albedo.png.import b/tiling/tiles/limestone_dungeon/piping_albedo.png.import new file mode 100644 index 0000000..ceadb5d --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_albedo.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://yu0p5ryoh7gr" +path.s3tc="res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.s3tc.ctex" +path.etc2="res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/piping_albedo.png" +dest_files=["res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.s3tc.ctex", "res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/piping_height.png b/tiling/tiles/limestone_dungeon/piping_height.png new file mode 100755 index 0000000..5469c2e --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_height.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:da8a57606972d7c93e21f14d20b08a35f3af7618fd76cc27db650f789db013f2 +size 241457 diff --git a/tiling/tiles/limestone_dungeon/piping_height.png.import b/tiling/tiles/limestone_dungeon/piping_height.png.import new file mode 100644 index 0000000..b40aae7 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_height.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://byw6qkgod61ip" +path.s3tc="res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.s3tc.ctex" +path.etc2="res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/piping_height.png" +dest_files=["res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.s3tc.ctex", "res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/piping_material.res b/tiling/tiles/limestone_dungeon/piping_material.res new file mode 100644 index 0000000..49b0f8a --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:acbc392315b2a7eb7b98524556b3243bd30c51a9b8a35657d6e686ffeaca22b8 +size 1094 diff --git a/tiling/tiles/limestone_dungeon/piping_normal.png b/tiling/tiles/limestone_dungeon/piping_normal.png new file mode 100755 index 0000000..fca4ab2 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:028cb62c715456b29a27a5b306e7c66b61525f5fd90799df79587f8381499030 +size 755707 diff --git a/tiling/tiles/limestone_dungeon/piping_normal.png.import b/tiling/tiles/limestone_dungeon/piping_normal.png.import new file mode 100644 index 0000000..d4a5564 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_normal.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bypqkn1tm036p" +path.s3tc="res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.s3tc.ctex" +path.etc2="res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/piping_normal.png" +dest_files=["res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.s3tc.ctex", "res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=1 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=1 +roughness/src_normal="res://tiles/tiles/limestone_dungeon/piping_normal.png" +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 diff --git a/tiling/tiles/limestone_dungeon/piping_orm.png b/tiling/tiles/limestone_dungeon/piping_orm.png new file mode 100644 index 0000000..50c5416 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_orm.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d453be063b9e2f82aca00deb9ac54df40ffe4fe55fd59b8078be7417f354e7d6 +size 109618 diff --git a/tiling/tiles/limestone_dungeon/piping_orm.png.import b/tiling/tiles/limestone_dungeon/piping_orm.png.import new file mode 100644 index 0000000..950835d --- /dev/null +++ b/tiling/tiles/limestone_dungeon/piping_orm.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bkpucv0ydae5v" +path.s3tc="res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.s3tc.ctex" +path.etc2="res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/piping_orm.png" +dest_files=["res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.s3tc.ctex", "res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/tiling_albedo.png b/tiling/tiles/limestone_dungeon/tiling_albedo.png new file mode 100755 index 0000000..8ff1619 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_albedo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:770bae54ae4a1152791a26dfd1f38e0a0201cf3ec36ed85fe6f8122de4e76ed0 +size 1488729 diff --git a/tiling/tiles/limestone_dungeon/tiling_albedo.png.import b/tiling/tiles/limestone_dungeon/tiling_albedo.png.import new file mode 100644 index 0000000..003b1bc --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_albedo.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bydc62557j2d0" +path.s3tc="res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/tiling_albedo.png" +dest_files=["res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.s3tc.ctex", "res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/tiling/tiles/limestone_dungeon/tiling_height.png b/tiling/tiles/limestone_dungeon/tiling_height.png new file mode 100755 index 0000000..44b0087 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_height.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c43403b399253578c9e2bfd1b686d4f45fe45712be7de31405fbd53c40b70c43 +size 419947 diff --git a/tiling/tiles/limestone_dungeon/tiling_height.png.import b/tiling/tiles/limestone_dungeon/tiling_height.png.import new file mode 100644 index 0000000..f6c0938 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_height.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://didp3nfacohwd" +path.s3tc="res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/tiling_height.png" +dest_files=["res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.s3tc.ctex", "res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=7 +roughness/src_normal="res://tiles/tiles/limestone_dungeon/tiling_normal.png" +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 diff --git a/tiling/tiles/limestone_dungeon/tiling_material.res b/tiling/tiles/limestone_dungeon/tiling_material.res new file mode 100644 index 0000000..a7545e6 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f3cb64bcceb9fb42ca25497863766b4aa17af678cae11b396253c7ebc54d18bc +size 1091 diff --git a/tiling/tiles/limestone_dungeon/tiling_normal.png b/tiling/tiles/limestone_dungeon/tiling_normal.png new file mode 100755 index 0000000..329738b --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_normal.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa6c031538c5459b5394d5e8ef7bfe5a58d8e5da62013ea4b3c9c5c54cdbeebd +size 1264636 diff --git a/tiling/tiles/limestone_dungeon/tiling_normal.png.import b/tiling/tiles/limestone_dungeon/tiling_normal.png.import new file mode 100644 index 0000000..aad3f5b --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_normal.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cv8yiluvc6mol" +path.s3tc="res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/tiling_normal.png" +dest_files=["res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.s3tc.ctex", "res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +compress/normal_map=1 +compress/channel_pack=0 +mipmaps/generate=true +mipmaps/limit=-1 +roughness/mode=1 +roughness/src_normal="res://tiles/tiles/limestone_dungeon/tiling_normal.png" +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 diff --git a/tiling/tiles/limestone_dungeon/tiling_orm.png b/tiling/tiles/limestone_dungeon/tiling_orm.png new file mode 100644 index 0000000..5a4878f --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_orm.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:94cc0c47f71b977eaa12a70147cf85b48b51cbf0106e984d6e62a056a9e1c0d4 +size 431771 diff --git a/tiling/tiles/limestone_dungeon/tiling_orm.png.import b/tiling/tiles/limestone_dungeon/tiling_orm.png.import new file mode 100644 index 0000000..b7f9248 --- /dev/null +++ b/tiling/tiles/limestone_dungeon/tiling_orm.png.import @@ -0,0 +1,36 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://leoab2fjmxgk" +path.s3tc="res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.etc2.ctex" +metadata={ +"imported_formats": ["s3tc", "etc2"], +"vram_texture": true +} + +[deps] + +source_file="res://tiling/tiles/limestone_dungeon/tiling_orm.png" +dest_files=["res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.s3tc.ctex", "res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.etc2.ctex"] + +[params] + +compress/mode=2 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 -- 2.34.1 From 300f1db0d5add4cb0dbe689254ed539372700e07 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 23:52:10 +0000 Subject: [PATCH 18/30] Add support for tile orientation in map editor --- local_player.scn | 2 +- map_editor.scn | 4 +- tiling/tile.gd | 6 ++ tiling/tile_grid.gd | 93 +++++++++++++++++-------- tiling/tiles/dungeon_01_tiling_tile.res | 4 +- 5 files changed, 75 insertions(+), 34 deletions(-) diff --git a/local_player.scn b/local_player.scn index b10cd97..6e357be 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cdc150f7614a20d1a925aebcbba25105d3cf046f2f70deb2b68951fa6bc46dc8 +oid sha256:ee55ead59320730db7e2a7a301107fcf35900e9398f8f51e690849c51d59c295 size 679 diff --git a/map_editor.scn b/map_editor.scn index e6f4a04..72f8168 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35daad0fb39d23f098b2849489292c5e5a5dccbffffb2a866e74d82d64085cdd -size 10675 +oid sha256:0ba76d6fec225724ee1822d1cceaf41eba72051c84aa03e4c0d149fdabc2a0e0 +size 10986 diff --git a/tiling/tile.gd b/tiling/tile.gd index 2b172a5..14ae89a 100644 --- a/tiling/tile.gd +++ b/tiling/tile.gd @@ -8,6 +8,12 @@ enum Kind { WALL, } +## +## +## +@export +var fixed_orientation := false + ## ## ## diff --git a/tiling/tile_grid.gd b/tiling/tile_grid.gd index f22a672..b591939 100644 --- a/tiling/tile_grid.gd +++ b/tiling/tile_grid.gd @@ -4,21 +4,37 @@ const _CHUNK_SIZE := 32 const _GRID_ORIGIN := Vector2(0.5, 0.5) +## +## +## +enum Orientation { + NORTH, + EAST, + SOUTH, + WEST, +} + ## ## Baked block of meshes making up a segment of the grid. ## class Chunk: var _floor_meshes: Array[Mesh] = [] + var _floor_orientation := PackedInt32Array() + var _multimesh_instances: Array[MultiMeshInstance] = [] var _wall_meshes: Array[Mesh] = [] + var _wall_orientation := PackedInt32Array() + func _init() -> void: var buffer_size := _CHUNK_SIZE * _CHUNK_SIZE _floor_meshes.resize(buffer_size) + _floor_orientation.resize(buffer_size) _wall_meshes.resize(buffer_size) + _wall_orientation.resize(buffer_size) ## ## Invalidates the mesh block, re-baking its contents from the current mesh data set. @@ -34,6 +50,7 @@ class Chunk: # Normalize mesh instance data for the chunk. var transforms_by_mesh := {} var grid_size := tile_grid.size + var half_pi := PI / 2 for i in _floor_meshes.size(): var mesh := _floor_meshes[i] @@ -42,11 +59,12 @@ class Chunk: if not(mesh in transforms_by_mesh): transforms_by_mesh[mesh] = [] - transforms_by_mesh[mesh].append(Transform3D(Basis.IDENTITY, Vector3( - (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - - (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, - (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - - (float(grid_size.y) * _GRID_ORIGIN.y)))) + transforms_by_mesh[mesh].append(Transform3D( + Basis.IDENTITY.rotated(Vector3.UP, half_pi * _floor_orientation[i]), Vector3( + (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - + (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, + (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - + (float(grid_size.y) * _GRID_ORIGIN.y)))) for i in _wall_meshes.size(): var mesh := _wall_meshes[i] @@ -55,11 +73,12 @@ class Chunk: if not(mesh in transforms_by_mesh): transforms_by_mesh[mesh] = [] - transforms_by_mesh[mesh].append(Transform3D(Basis.IDENTITY, Vector3( - (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - - (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, - (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - - (float(grid_size.y) * _GRID_ORIGIN.y)))) + transforms_by_mesh[mesh].append(Transform3D( + Basis.IDENTITY.rotated(Vector3.UP, half_pi * _wall_orientation[i]), Vector3( + (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - + (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, + (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - + (float(grid_size.y) * _GRID_ORIGIN.y)))) # (Re)-bake into multimesh instances for the chunk. var scenario_rid := tile_grid.get_world_3d().scenario @@ -79,8 +98,11 @@ class Chunk: ## *Note* that [method Chunk.invalidate] must be called at some point after to visually update ## the chunk. ## - func set_floor_mesh(coordinates: Vector2i, mesh: Mesh) -> void: - _floor_meshes[(_CHUNK_SIZE * coordinates.y) + coordinates.x] = mesh + func set_floor_mesh(coordinates: Vector2i, orientation: Orientation, mesh: Mesh) -> void: + var index := (_CHUNK_SIZE * coordinates.y) + coordinates.x + + _floor_orientation[index] = orientation + _floor_meshes[index] = mesh ## ## Sets the wall mesh in the chunk at the location relative [code]coordinatess[/code] to @@ -89,8 +111,11 @@ class Chunk: ## *Note* that [method Chunk.invalidate] must be called at some point after to visually update ## the chunk. ## - func set_wall_mesh(coordinates: Vector2i, mesh: Mesh) -> void: - _wall_meshes[(_CHUNK_SIZE * coordinates.y) + coordinates.x] = mesh + func set_wall_mesh(coordinates: Vector2i, orientation: Orientation, mesh: Mesh) -> void: + var index := (_CHUNK_SIZE * coordinates.y) + coordinates.x + + _wall_orientation[index] = orientation + _wall_meshes[index] = mesh ## ## Specialized multi-mesh instance convenience for use within the tile grid and its chunks. @@ -155,7 +180,7 @@ func _notification(what: int) -> void: ## ## For clearing a specific region of the mesh grid, see [method fill_mesh]. ## -func clear_tiles(tile: Tile) -> void: +func clear_tiles(orientation: Orientation, tile: Tile) -> void: if tile == null: for y in size.y: for x in size.x: @@ -163,8 +188,8 @@ func clear_tiles(tile: Tile) -> void: var chunk := _get_chunk(coordinates / _CHUNK_SIZE) var chunk_coordinates := coordinates % _CHUNK_SIZE - chunk.set_floor_mesh(chunk_coordinates, null) - chunk.set_wall_mesh(chunk_coordinates, null) + chunk.set_floor_mesh(chunk_coordinates, orientation, null) + chunk.set_wall_mesh(chunk_coordinates, orientation, null) else: var mesh := tile.mesh @@ -176,7 +201,7 @@ func clear_tiles(tile: Tile) -> void: var coordinate := Vector2i(x, y) _get_chunk(coordinate / _CHUNK_SIZE).\ - set_floor_mesh(coordinate % _CHUNK_SIZE, mesh) + set_floor_mesh(coordinate % _CHUNK_SIZE, orientation, mesh) Tile.Kind.WALL: for y in size.y: @@ -184,7 +209,7 @@ func clear_tiles(tile: Tile) -> void: var coordinate := Vector2i(x, y) _get_chunk(coordinate / _CHUNK_SIZE).\ - set_floor_mesh(coordinate % _CHUNK_SIZE, mesh) + set_floor_mesh(coordinate % _CHUNK_SIZE, orientation, mesh) for y in _chunks_size.y: for x in _chunks_size.x: @@ -201,7 +226,7 @@ func clear_tiles(tile: Tile) -> void: ## ## For clearing the whole of the mesh grid, see [method clear_mesh]. ## -func fill_tiles(area: Rect2i, tile: Tile) -> void: +func fill_tiles(area: Rect2i, orientation: Orientation, tile: Tile) -> void: assert(get_area().encloses(area), "area must be within grid") var filled_chunks := BitMap.new() @@ -216,13 +241,16 @@ func fill_tiles(area: Rect2i, tile: Tile) -> void: var chunk := _get_chunk(coordinates / _CHUNK_SIZE) var local_coordinates := coordinates % _CHUNK_SIZE - chunk.set_floor_mesh(local_coordinates, null) - chunk.set_wall_mesh(local_coordinates, null) + chunk.set_floor_mesh(local_coordinates, orientation, null) + chunk.set_wall_mesh(local_coordinates, orientation, null) filled_chunks.set_bitv(chunk_coordinates, true) else: var mesh := tile.mesh + if tile.fixed_orientation: + orientation = Orientation.NORTH + match tile.kind: Tile.Kind.FLOOR: for y in range(area.position.y, area.end.y): @@ -230,7 +258,9 @@ func fill_tiles(area: Rect2i, tile: Tile) -> void: var coordinate := Vector2i(x, y) var chunk_coordinate := coordinate / _CHUNK_SIZE - _get_chunk(chunk_coordinate).set_floor_mesh(coordinate % _CHUNK_SIZE, mesh) + _get_chunk(chunk_coordinate).set_floor_mesh( + coordinate % _CHUNK_SIZE, orientation, mesh) + filled_chunks.set_bitv(chunk_coordinate, true) Tile.Kind.WALL: @@ -239,7 +269,9 @@ func fill_tiles(area: Rect2i, tile: Tile) -> void: var coordinate := Vector2i(x, y) var chunk_coordinate := coordinate / _CHUNK_SIZE - _get_chunk(chunk_coordinate).set_wall_mesh(coordinate % _CHUNK_SIZE, mesh) + _get_chunk(chunk_coordinate).set_wall_mesh( + coordinate % _CHUNK_SIZE, orientation, mesh) + filled_chunks.set_bitv(chunk_coordinate, true) for y in _chunks_size.y: @@ -265,7 +297,7 @@ func get_area() -> Rect2i: ## ## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh]. ## -func plot_tile(coordinates: Vector2i, tile: Tile) -> void: +func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: Tile) -> void: assert(get_area().has_point(coordinates), "coordinate must be within grid") var chunk_coordinates := coordinates / _CHUNK_SIZE @@ -274,18 +306,21 @@ func plot_tile(coordinates: Vector2i, tile: Tile) -> void: if tile == null: var local_coordinates := coordinates % _CHUNK_SIZE - chunk.set_floor_mesh(local_coordinates, null) - chunk.set_wall_mesh(local_coordinates, null) + chunk.set_floor_mesh(local_coordinates, orientation, null) + chunk.set_wall_mesh(local_coordinates, orientation, null) chunk.invalidate(self, chunk_coordinates) else: var mesh := tile.mesh + if tile.fixed_orientation: + orientation = Orientation.NORTH + match tile.kind: Tile.Kind.FLOOR: - chunk.set_floor_mesh(coordinates % _CHUNK_SIZE, mesh) + chunk.set_floor_mesh(coordinates % _CHUNK_SIZE, orientation, mesh) chunk.invalidate(self, chunk_coordinates) Tile.Kind.WALL: - chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, mesh) + chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, orientation, mesh) chunk.invalidate(self, chunk_coordinates) diff --git a/tiling/tiles/dungeon_01_tiling_tile.res b/tiling/tiles/dungeon_01_tiling_tile.res index 5615154..a83e0db 100644 --- a/tiling/tiles/dungeon_01_tiling_tile.res +++ b/tiling/tiles/dungeon_01_tiling_tile.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bc799687c0d79256370e57b1b005fe4bcf989e17f88bbf72eb275b7d0f0dfd01 -size 456 +oid sha256:9025b3e769094aea76dc1638ace7338eeb3b72cfccdb1b1f2615798a160fdcdc +size 469 -- 2.34.1 From a9f7437d01b807fdd7e7e77eeb000210c2e9c85e Mon Sep 17 00:00:00 2001 From: kayomn Date: Sat, 28 Jan 2023 00:13:49 +0000 Subject: [PATCH 19/30] Add logic to right-click delete tiles --- local_player.scn | 2 +- map_editor.scn | 4 ++-- player_controller.gd | 39 +++++++++++++++++++++++++++++---------- 3 files changed, 32 insertions(+), 13 deletions(-) diff --git a/local_player.scn b/local_player.scn index 6e357be..870c0e9 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ee55ead59320730db7e2a7a301107fcf35900e9398f8f51e690849c51d59c295 +oid sha256:15a2f8163652823e89dab5479d8d6c1ad1270cbb2fbd612c120c5ea1fdfdb275 size 679 diff --git a/map_editor.scn b/map_editor.scn index 72f8168..2356e63 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0ba76d6fec225724ee1822d1cceaf41eba72051c84aa03e4c0d149fdabc2a0e0 -size 10986 +oid sha256:087dc406cd7608983cdc48a7e702b252d8576d102b8cbdac11dc83a8799b9cda +size 11169 diff --git a/player_controller.gd b/player_controller.gd index e9acec7..6e0185a 100644 --- a/player_controller.gd +++ b/player_controller.gd @@ -1,5 +1,14 @@ class_name PlayerController extends Node3D +## +## +## +enum SelectAction { + NONE, + PRIMARY, + SECONDARY, +} + ## ## Supported selection input devices. ## @@ -54,7 +63,7 @@ var _cursor_point := Vector2.ZERO var _is_drag_panning := false -var _is_selecting := false +var _select_action := SelectAction.NONE var _select_mode := SelectMode.NONE @@ -77,12 +86,25 @@ func _input(event: InputEvent) -> void: _is_drag_panning else Input.MOUSE_MODE_VISIBLE MOUSE_BUTTON_LEFT: - _is_selecting = event.is_pressed() + if event.is_pressed(): + _select_action = SelectAction.PRIMARY - if _is_selecting: selection_started.emit() else: + _select_action = SelectAction.NONE + + selection_stopped.emit() + + MOUSE_BUTTON_RIGHT: + if event.is_pressed(): + _select_action = SelectAction.SECONDARY + + selection_started.emit() + + else: + _select_action = SelectAction.NONE + selection_stopped.emit() return @@ -173,14 +195,11 @@ func in_select_area() -> bool: return _select_mode != SelectMode.NONE ## -## Returns [code]true[/code] if the player controller is currently selecting a location on the -## screen, otherwise [code]false[/code]. +## Returns the [code]SelectAction[/code] currently being performed, or +## [code]SelectAction.NONE[/code] if no action is currently being performed. ## -## *Note* that it is discouraged that this be continuously polled for single-fire events. Instead, -## see [signal selection_started] and [signal selection_stopped]. -## -func is_selecting() -> bool: - return _is_selecting +func get_select_action() -> SelectAction: + return _select_action ## ## -- 2.34.1 From 176b18866f00b5bcd9fef613263591e9bff63efa Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 00:07:44 +0000 Subject: [PATCH 20/30] Add fill rect tool to interior map editor --- local_player.scn | 2 +- map_editor.scn | 4 +- map_editor/map_editor_menu.gd | 12 -- map_editor/selection_area_mesh.res | 3 + map_editor/tile_cursor.gdshader | 12 -- map_editor/tile_cursor.res | 3 - map_editor/tile_cursor_object_material.res | 3 + player_controller.gd | 136 ++++++++------------- 8 files changed, 63 insertions(+), 112 deletions(-) create mode 100644 map_editor/selection_area_mesh.res delete mode 100644 map_editor/tile_cursor.gdshader delete mode 100644 map_editor/tile_cursor.res create mode 100644 map_editor/tile_cursor_object_material.res diff --git a/local_player.scn b/local_player.scn index 870c0e9..f21c4f3 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:15a2f8163652823e89dab5479d8d6c1ad1270cbb2fbd612c120c5ea1fdfdb275 +oid sha256:b4f0319e09b163eb3c6519b5c72c18ebfa85aac35304cf6b3530f2c0d679c73b size 679 diff --git a/map_editor.scn b/map_editor.scn index 2356e63..2cca5f0 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:087dc406cd7608983cdc48a7e702b252d8576d102b8cbdac11dc83a8799b9cda -size 11169 +oid sha256:50a5242649107880385206657657a9e77a285eef6a1c683e22210646cd97b7de +size 12700 diff --git a/map_editor/map_editor_menu.gd b/map_editor/map_editor_menu.gd index f4c15ca..38eddfd 100644 --- a/map_editor/map_editor_menu.gd +++ b/map_editor/map_editor_menu.gd @@ -1,17 +1,5 @@ class_name MapEditorMenu extends VBoxContainer -## -## [code]edit_action[/code] has been activated for use when the player interacts with the map -## editor. -## -signal edit_activated(edit_action: Callable) - -## -## Emits [signal edit_activated]. -## -func activate_editor(edit_action: Callable) -> void: - edit_activated.emit(edit_action) - ## ## Resets the state of the menu. ## diff --git a/map_editor/selection_area_mesh.res b/map_editor/selection_area_mesh.res new file mode 100644 index 0000000..d0f15ee --- /dev/null +++ b/map_editor/selection_area_mesh.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d30d1595da7c7bab44c9e72b88f8e0bfe946dff33e1a4903ab772104cd43657d +size 894 diff --git a/map_editor/tile_cursor.gdshader b/map_editor/tile_cursor.gdshader deleted file mode 100644 index e41f94c..0000000 --- a/map_editor/tile_cursor.gdshader +++ /dev/null @@ -1,12 +0,0 @@ -shader_type spatial; -render_mode unshaded, blend_add, cull_disabled; - -uniform sampler2D source_texture; - -uniform vec4 modulate: source_color = vec4(1.0); - -void fragment() { - vec4 source = texture(source_texture, UV); - ALBEDO = (source.rgb * modulate.rgb); - ALPHA = source.a; -} \ No newline at end of file diff --git a/map_editor/tile_cursor.res b/map_editor/tile_cursor.res deleted file mode 100644 index 2d23433..0000000 --- a/map_editor/tile_cursor.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1b9240206e13ccff017900a7262637147f1931f9e950e2c1b0efb45523e03bd5 -size 901 diff --git a/map_editor/tile_cursor_object_material.res b/map_editor/tile_cursor_object_material.res new file mode 100644 index 0000000..b053994 --- /dev/null +++ b/map_editor/tile_cursor_object_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be95f7bcacaedc1e942b999a970ce648cb7e4efdf04a16b5c9c4f6ff95039f54 +size 708 diff --git a/player_controller.gd b/player_controller.gd index 6e0185a..5f16ecc 100644 --- a/player_controller.gd +++ b/player_controller.gd @@ -4,7 +4,6 @@ class_name PlayerController extends Node3D ## ## enum SelectAction { - NONE, PRIMARY, SECONDARY, } @@ -25,7 +24,7 @@ signal select_mode_changed(mode: SelectMode) ## ## Selection of a point on screenspace has started happening. ## -signal selection_started() +signal selection_started(select_action: SelectAction) ## ## Selection of a point on screenspace has stopped happening. @@ -63,8 +62,6 @@ var _cursor_point := Vector2.ZERO var _is_drag_panning := false -var _select_action := SelectAction.NONE - var _select_mode := SelectMode.NONE @export @@ -76,58 +73,6 @@ var _target_position := position @onready var _target_orientation := global_rotation.y -func _input(event: InputEvent) -> void: - if event is InputEventMouseButton: - match event.button_index: - MOUSE_BUTTON_MIDDLE: - _is_drag_panning = event.is_pressed() and not(is_frozen()) - - Input.mouse_mode = Input.MOUSE_MODE_CAPTURED if\ - _is_drag_panning else Input.MOUSE_MODE_VISIBLE - - MOUSE_BUTTON_LEFT: - if event.is_pressed(): - _select_action = SelectAction.PRIMARY - - selection_started.emit() - - else: - _select_action = SelectAction.NONE - - selection_stopped.emit() - - MOUSE_BUTTON_RIGHT: - if event.is_pressed(): - _select_action = SelectAction.SECONDARY - - selection_started.emit() - - else: - _select_action = SelectAction.NONE - - selection_stopped.emit() - - return - - if (event is InputEventMouseMotion) and _is_drag_panning: - var global_basis := global_transform.basis - var camera_settings := GameSettings.camera_settings - var dampened_speed := camera_settings.movement_speed_modifier * _DRAG_SPEED_BASE_MODIFIER - - _target_position += dampened_speed.y * (-global_basis.z) *\ - event.relative.y * (-1.0 if camera_settings.is_y_inverted else 1.0) - - _target_position += dampened_speed.x * (-global_basis.x) *\ - event.relative.x * (-1.0 if camera_settings.is_x_inverted else 1.0) - - return - - if event is InputEventScreenDrag: - return - - if event is InputEventScreenTouch: - return - func _process(delta: float) -> void: if not(is_frozen()): var global_basis := global_transform.basis @@ -173,6 +118,50 @@ func _ready() -> void: select_mode_changed.emit(SelectMode.NONE)) + _selection_area.gui_input.connect(func (event: InputEvent) -> void: + if event is InputEventMouseButton: + match event.button_index: + MOUSE_BUTTON_MIDDLE: + _is_drag_panning = event.is_pressed() and not(is_frozen()) + + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED if\ + _is_drag_panning else Input.MOUSE_MODE_VISIBLE + + MOUSE_BUTTON_LEFT: + if event.is_pressed(): + selection_started.emit(SelectAction.PRIMARY) + + else: + selection_stopped.emit() + + MOUSE_BUTTON_RIGHT: + if event.is_pressed(): + selection_started.emit(SelectAction.SECONDARY) + + else: + selection_stopped.emit() + + return + + if (event is InputEventMouseMotion) and _is_drag_panning: + var global_basis := global_transform.basis + var camera_settings := GameSettings.camera_settings + var dampened_speed := camera_settings.movement_speed_modifier * _DRAG_SPEED_BASE_MODIFIER + + _target_position += dampened_speed.y * (-global_basis.z) *\ + event.relative.y * (-1.0 if camera_settings.is_y_inverted else 1.0) + + _target_position += dampened_speed.x * (-global_basis.x) *\ + event.relative.x * (-1.0 if camera_settings.is_x_inverted else 1.0) + + return + + if event is InputEventScreenDrag: + return + + if event is InputEventScreenTouch: + return) + ## ## Returns the position of the selection cursor with respect to the select current mode being used. ## @@ -180,8 +169,15 @@ func _ready() -> void: ## touchscreen interactions, this will be the location of an active gesture. Finally, for all other ## states - including gamepad - this will be the middle of screenspace at all times. ## -func get_cursor_point() -> Vector2: - return _cursor_point +func get_plane_cursor() -> Vector2: + if _camera != null: + var plane_cursor = Plane(Vector3.UP, 0.0).intersects_ray( + _camera.global_position, _camera.project_ray_normal(_cursor_point)) + + if plane_cursor is Vector3: + return Vector2(plane_cursor.x, plane_cursor.z) + + return Vector2.ZERO func is_frozen() -> bool: assert(_control_override_count > -1, "control override count cannot be less than 0") @@ -194,13 +190,6 @@ func is_frozen() -> bool: func in_select_area() -> bool: return _select_mode != SelectMode.NONE -## -## Returns the [code]SelectAction[/code] currently being performed, or -## [code]SelectAction.NONE[/code] if no action is currently being performed. -## -func get_select_action() -> SelectAction: - return _select_action - ## ## ## @@ -212,20 +201,3 @@ func override_controls(unlock_signal: Signal) -> void: unlock_signal.connect(func () -> void: assert(_control_override_count > 0, "control override count cannot be less than 1") _control_override_count -= 1, Object.CONNECT_ONE_SHOT) - -## -## Attempts to convert the screen coordinates in [code]screen_point[/code] into 2D worldspace -## coordinate relative to an infinite ground plane at y offset [code]0.0[/code]. -## -## Successful point intersection will return the plane coordinates in a [class Vector2], otherwise -## [code]null[/code] is returned. -## -func screen_to_plane(screen_point: Vector2) -> Variant: - if _camera != null: - var plane_target = Plane(Vector3.UP, 0.0).intersects_ray( - _camera.global_position, _camera.project_ray_normal(screen_point)) - - if plane_target is Vector3: - return Vector2(plane_target.x, plane_target.z) - - return null -- 2.34.1 From 647ac60ce7a9cf92a9f85003418ba4d898287c54 Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 22:29:30 +0000 Subject: [PATCH 21/30] Fix tile grid alignment issues --- map_editor.scn | 4 ++-- tiling/tile_grid.gd | 14 ++++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 2cca5f0..8c0b516 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:50a5242649107880385206657657a9e77a285eef6a1c683e22210646cd97b7de -size 12700 +oid sha256:144f8810b56cc89b593e8a78fbef8e4970bc82c1dbcd49b636a98a7e51af4464 +size 13347 diff --git a/tiling/tile_grid.gd b/tiling/tile_grid.gd index b591939..fbd2d63 100644 --- a/tiling/tile_grid.gd +++ b/tiling/tile_grid.gd @@ -62,9 +62,9 @@ class Chunk: transforms_by_mesh[mesh].append(Transform3D( Basis.IDENTITY.rotated(Vector3.UP, half_pi * _floor_orientation[i]), Vector3( (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - - (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, + (float(grid_size.x) * _GRID_ORIGIN.x) + 0.5, 0.0, (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - - (float(grid_size.y) * _GRID_ORIGIN.y)))) + (float(grid_size.y) * _GRID_ORIGIN.y) + 0.5))) for i in _wall_meshes.size(): var mesh := _wall_meshes[i] @@ -76,9 +76,9 @@ class Chunk: transforms_by_mesh[mesh].append(Transform3D( Basis.IDENTITY.rotated(Vector3.UP, half_pi * _wall_orientation[i]), Vector3( (float(coordinate.x * _CHUNK_SIZE) + (i % _CHUNK_SIZE)) - - (float(grid_size.x) * _GRID_ORIGIN.x), 0.0, + (float(grid_size.x) * _GRID_ORIGIN.x) + 0.5, 0.0, (float(coordinate.y * _CHUNK_SIZE) + (i / _CHUNK_SIZE)) - - (float(grid_size.y) * _GRID_ORIGIN.y)))) + (float(grid_size.y) * _GRID_ORIGIN.y) + 0.5))) # (Re)-bake into multimesh instances for the chunk. var scenario_rid := tile_grid.get_world_3d().scenario @@ -324,3 +324,9 @@ func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: Tile) -> v Tile.Kind.WALL: chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, orientation, mesh) chunk.invalidate(self, chunk_coordinates) + +## +## +## +func world_to_grid(world_position: Vector2) -> Vector2i: + return Vector2i((world_position + (Vector2(size) * _GRID_ORIGIN)).round()) -- 2.34.1 From b0a76f5fd3e61363b5f106aaa8abca44634f003e Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 22:33:14 +0000 Subject: [PATCH 22/30] Rename TileGrid to Interior --- tiling/tile_grid.gd => interior/interior.gd | 28 +++++++++---------- tiling/tile.gd => interior/interior_tile.gd | 2 +- interior/tiles/dungeon_01_pipehole_tile.res | 3 ++ interior/tiles/dungeon_01_tiling_tile.res | 3 ++ .../tiles/limestone_dungeon/hole_albedo.png | 0 .../limestone_dungeon/hole_albedo.png.import | 8 +++--- .../tiles/limestone_dungeon/hole_height.png | 0 .../limestone_dungeon/hole_height.png.import | 8 +++--- .../tiles/limestone_dungeon/hole_material.res | 3 ++ .../tiles/limestone_dungeon/hole_normal.png | 0 .../limestone_dungeon/hole_normal.png.import | 8 +++--- .../tiles/limestone_dungeon/hole_orm.png | 0 .../limestone_dungeon/hole_orm.png.import | 8 +++--- .../tiles/limestone_dungeon/piping_albedo.png | 0 .../piping_albedo.png.import | 8 +++--- .../tiles/limestone_dungeon/piping_height.png | 0 .../piping_height.png.import | 8 +++--- .../limestone_dungeon/piping_material.res | 3 ++ .../tiles/limestone_dungeon/piping_normal.png | 0 .../piping_normal.png.import | 8 +++--- .../tiles/limestone_dungeon/piping_orm.png | 0 .../limestone_dungeon/piping_orm.png.import | 8 +++--- .../tiles/limestone_dungeon/tiling_albedo.png | 0 .../tiling_albedo.png.import | 8 +++--- .../tiles/limestone_dungeon/tiling_height.png | 0 .../tiling_height.png.import | 8 +++--- .../limestone_dungeon/tiling_material.res | 3 ++ .../tiles/limestone_dungeon/tiling_normal.png | 0 .../tiling_normal.png.import | 8 +++--- .../tiles/limestone_dungeon/tiling_orm.png | 0 .../limestone_dungeon/tiling_orm.png.import | 8 +++--- map_editor.scn | 4 +-- tiling/tiles/dungeon_01_pipehole_tile.res | 3 -- tiling/tiles/dungeon_01_tiling_tile.res | 3 -- .../tiles/limestone_dungeon/hole_material.res | 3 -- .../limestone_dungeon/piping_material.res | 3 -- .../limestone_dungeon/tiling_material.res | 3 -- 37 files changed, 80 insertions(+), 80 deletions(-) rename tiling/tile_grid.gd => interior/interior.gd (94%) rename tiling/tile.gd => interior/interior_tile.gd (80%) create mode 100644 interior/tiles/dungeon_01_pipehole_tile.res create mode 100644 interior/tiles/dungeon_01_tiling_tile.res rename {tiling => interior}/tiles/limestone_dungeon/hole_albedo.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/hole_albedo.png.import (57%) rename {tiling => interior}/tiles/limestone_dungeon/hole_height.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/hole_height.png.import (57%) create mode 100644 interior/tiles/limestone_dungeon/hole_material.res rename {tiling => interior}/tiles/limestone_dungeon/hole_normal.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/hole_normal.png.import (59%) rename {tiling => interior}/tiles/limestone_dungeon/hole_orm.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/hole_orm.png.import (58%) rename {tiling => interior}/tiles/limestone_dungeon/piping_albedo.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/piping_albedo.png.import (56%) rename {tiling => interior}/tiles/limestone_dungeon/piping_height.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/piping_height.png.import (56%) create mode 100644 interior/tiles/limestone_dungeon/piping_material.res rename {tiling => interior}/tiles/limestone_dungeon/piping_normal.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/piping_normal.png.import (58%) rename {tiling => interior}/tiles/limestone_dungeon/piping_orm.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/piping_orm.png.import (57%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_albedo.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_albedo.png.import (56%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_height.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_height.png.import (58%) create mode 100644 interior/tiles/limestone_dungeon/tiling_material.res rename {tiling => interior}/tiles/limestone_dungeon/tiling_normal.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_normal.png.import (58%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_orm.png (100%) rename {tiling => interior}/tiles/limestone_dungeon/tiling_orm.png.import (57%) delete mode 100644 tiling/tiles/dungeon_01_pipehole_tile.res delete mode 100644 tiling/tiles/dungeon_01_tiling_tile.res delete mode 100644 tiling/tiles/limestone_dungeon/hole_material.res delete mode 100644 tiling/tiles/limestone_dungeon/piping_material.res delete mode 100644 tiling/tiles/limestone_dungeon/tiling_material.res diff --git a/tiling/tile_grid.gd b/interior/interior.gd similarity index 94% rename from tiling/tile_grid.gd rename to interior/interior.gd index fbd2d63..f29c626 100644 --- a/tiling/tile_grid.gd +++ b/interior/interior.gd @@ -1,4 +1,4 @@ -class_name TileGrid extends Node3D +class_name Interior extends Node3D const _CHUNK_SIZE := 32 @@ -39,7 +39,7 @@ class Chunk: ## ## Invalidates the mesh block, re-baking its contents from the current mesh data set. ## - func invalidate(tile_grid: TileGrid, coordinate: Vector2i) -> void: + func invalidate(interior: Interior, coordinate: Vector2i) -> void: # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. for multimesh_instance in _multimesh_instances: RenderingServer.free_rid(multimesh_instance._instance_rid) @@ -49,7 +49,7 @@ class Chunk: # Normalize mesh instance data for the chunk. var transforms_by_mesh := {} - var grid_size := tile_grid.size + var grid_size := interior.size var half_pi := PI / 2 for i in _floor_meshes.size(): @@ -81,8 +81,8 @@ class Chunk: (float(grid_size.y) * _GRID_ORIGIN.y) + 0.5))) # (Re)-bake into multimesh instances for the chunk. - var scenario_rid := tile_grid.get_world_3d().scenario - var global_transform := tile_grid.global_transform + var scenario_rid := interior.get_world_3d().scenario + var global_transform := interior.global_transform for chunk_mesh in transforms_by_mesh: var multimesh_instance := MultiMeshInstance.new( @@ -180,7 +180,7 @@ func _notification(what: int) -> void: ## ## For clearing a specific region of the mesh grid, see [method fill_mesh]. ## -func clear_tiles(orientation: Orientation, tile: Tile) -> void: +func clear_tiles(orientation: Orientation, tile: InteriorTile) -> void: if tile == null: for y in size.y: for x in size.x: @@ -195,7 +195,7 @@ func clear_tiles(orientation: Orientation, tile: Tile) -> void: var mesh := tile.mesh match tile.kind: - Tile.Kind.FLOOR: + InteriorTile.Kind.FLOOR: for y in size.y: for x in size.x: var coordinate := Vector2i(x, y) @@ -203,7 +203,7 @@ func clear_tiles(orientation: Orientation, tile: Tile) -> void: _get_chunk(coordinate / _CHUNK_SIZE).\ set_floor_mesh(coordinate % _CHUNK_SIZE, orientation, mesh) - Tile.Kind.WALL: + InteriorTile.Kind.WALL: for y in size.y: for x in size.x: var coordinate := Vector2i(x, y) @@ -226,7 +226,7 @@ func clear_tiles(orientation: Orientation, tile: Tile) -> void: ## ## For clearing the whole of the mesh grid, see [method clear_mesh]. ## -func fill_tiles(area: Rect2i, orientation: Orientation, tile: Tile) -> void: +func fill_tiles(area: Rect2i, orientation: Orientation, tile: InteriorTile) -> void: assert(get_area().encloses(area), "area must be within grid") var filled_chunks := BitMap.new() @@ -252,7 +252,7 @@ func fill_tiles(area: Rect2i, orientation: Orientation, tile: Tile) -> void: orientation = Orientation.NORTH match tile.kind: - Tile.Kind.FLOOR: + InteriorTile.Kind.FLOOR: for y in range(area.position.y, area.end.y): for x in range(area.position.x, area.end.x): var coordinate := Vector2i(x, y) @@ -263,7 +263,7 @@ func fill_tiles(area: Rect2i, orientation: Orientation, tile: Tile) -> void: filled_chunks.set_bitv(chunk_coordinate, true) - Tile.Kind.WALL: + InteriorTile.Kind.WALL: for y in range(area.position.y, area.end.y): for x in range(area.position.x, area.end.x): var coordinate := Vector2i(x, y) @@ -297,7 +297,7 @@ func get_area() -> Rect2i: ## ## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh]. ## -func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: Tile) -> void: +func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: InteriorTile) -> void: assert(get_area().has_point(coordinates), "coordinate must be within grid") var chunk_coordinates := coordinates / _CHUNK_SIZE @@ -317,11 +317,11 @@ func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: Tile) -> v orientation = Orientation.NORTH match tile.kind: - Tile.Kind.FLOOR: + InteriorTile.Kind.FLOOR: chunk.set_floor_mesh(coordinates % _CHUNK_SIZE, orientation, mesh) chunk.invalidate(self, chunk_coordinates) - Tile.Kind.WALL: + InteriorTile.Kind.WALL: chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, orientation, mesh) chunk.invalidate(self, chunk_coordinates) diff --git a/tiling/tile.gd b/interior/interior_tile.gd similarity index 80% rename from tiling/tile.gd rename to interior/interior_tile.gd index 14ae89a..a654d86 100644 --- a/tiling/tile.gd +++ b/interior/interior_tile.gd @@ -1,4 +1,4 @@ -class_name Tile extends Resource +class_name InteriorTile extends Resource ## ## diff --git a/interior/tiles/dungeon_01_pipehole_tile.res b/interior/tiles/dungeon_01_pipehole_tile.res new file mode 100644 index 0000000..f684c7c --- /dev/null +++ b/interior/tiles/dungeon_01_pipehole_tile.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50d1e57c78aa55883394de1f91ff5aa507a2e3a68c4289dd9c3c4294dd0aa6dc +size 131987 diff --git a/interior/tiles/dungeon_01_tiling_tile.res b/interior/tiles/dungeon_01_tiling_tile.res new file mode 100644 index 0000000..2cafb06 --- /dev/null +++ b/interior/tiles/dungeon_01_tiling_tile.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:935de0b7ca77b8e921044bda3ad3db0de8eaee338719927a39a782e0579bc16c +size 479 diff --git a/tiling/tiles/limestone_dungeon/hole_albedo.png b/interior/tiles/limestone_dungeon/hole_albedo.png similarity index 100% rename from tiling/tiles/limestone_dungeon/hole_albedo.png rename to interior/tiles/limestone_dungeon/hole_albedo.png diff --git a/tiling/tiles/limestone_dungeon/hole_albedo.png.import b/interior/tiles/limestone_dungeon/hole_albedo.png.import similarity index 57% rename from tiling/tiles/limestone_dungeon/hole_albedo.png.import rename to interior/tiles/limestone_dungeon/hole_albedo.png.import index 7a9cc55..48d5411 100644 --- a/tiling/tiles/limestone_dungeon/hole_albedo.png.import +++ b/interior/tiles/limestone_dungeon/hole_albedo.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://3m7gvnsmb4g" -path.s3tc="res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.s3tc.ctex" -path.etc2="res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.etc2.ctex" +path.s3tc="res://.godot/imported/hole_albedo.png-ef88dfc602c85c58e849d6654804eb67.s3tc.ctex" +path.etc2="res://.godot/imported/hole_albedo.png-ef88dfc602c85c58e849d6654804eb67.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/hole_albedo.png" -dest_files=["res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.s3tc.ctex", "res://.godot/imported/hole_albedo.png-397908bd54a00ad5ae5c4ebd2e6a6712.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/hole_albedo.png" +dest_files=["res://.godot/imported/hole_albedo.png-ef88dfc602c85c58e849d6654804eb67.s3tc.ctex", "res://.godot/imported/hole_albedo.png-ef88dfc602c85c58e849d6654804eb67.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/hole_height.png b/interior/tiles/limestone_dungeon/hole_height.png similarity index 100% rename from tiling/tiles/limestone_dungeon/hole_height.png rename to interior/tiles/limestone_dungeon/hole_height.png diff --git a/tiling/tiles/limestone_dungeon/hole_height.png.import b/interior/tiles/limestone_dungeon/hole_height.png.import similarity index 57% rename from tiling/tiles/limestone_dungeon/hole_height.png.import rename to interior/tiles/limestone_dungeon/hole_height.png.import index 7c740fb..69b8b57 100644 --- a/tiling/tiles/limestone_dungeon/hole_height.png.import +++ b/interior/tiles/limestone_dungeon/hole_height.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://c8p7qvcrfsio7" -path.s3tc="res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.s3tc.ctex" -path.etc2="res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.etc2.ctex" +path.s3tc="res://.godot/imported/hole_height.png-875fd265b9470b3f52656ba603fc8eae.s3tc.ctex" +path.etc2="res://.godot/imported/hole_height.png-875fd265b9470b3f52656ba603fc8eae.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/hole_height.png" -dest_files=["res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.s3tc.ctex", "res://.godot/imported/hole_height.png-33e0c22a7ec549d3b4415f6535e75389.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/hole_height.png" +dest_files=["res://.godot/imported/hole_height.png-875fd265b9470b3f52656ba603fc8eae.s3tc.ctex", "res://.godot/imported/hole_height.png-875fd265b9470b3f52656ba603fc8eae.etc2.ctex"] [params] diff --git a/interior/tiles/limestone_dungeon/hole_material.res b/interior/tiles/limestone_dungeon/hole_material.res new file mode 100644 index 0000000..3f994c5 --- /dev/null +++ b/interior/tiles/limestone_dungeon/hole_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac4a618b5ae0291a16ed9b957943e273ed841076bc48cb3df7d2f206de528b25 +size 1098 diff --git a/tiling/tiles/limestone_dungeon/hole_normal.png b/interior/tiles/limestone_dungeon/hole_normal.png similarity index 100% rename from tiling/tiles/limestone_dungeon/hole_normal.png rename to interior/tiles/limestone_dungeon/hole_normal.png diff --git a/tiling/tiles/limestone_dungeon/hole_normal.png.import b/interior/tiles/limestone_dungeon/hole_normal.png.import similarity index 59% rename from tiling/tiles/limestone_dungeon/hole_normal.png.import rename to interior/tiles/limestone_dungeon/hole_normal.png.import index 18a1ddc..bf6c59b 100644 --- a/tiling/tiles/limestone_dungeon/hole_normal.png.import +++ b/interior/tiles/limestone_dungeon/hole_normal.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://c4eby3i7q2wts" -path.s3tc="res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.s3tc.ctex" -path.etc2="res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.etc2.ctex" +path.s3tc="res://.godot/imported/hole_normal.png-9c2f1eac05804bab609d1c67adcf7dba.s3tc.ctex" +path.etc2="res://.godot/imported/hole_normal.png-9c2f1eac05804bab609d1c67adcf7dba.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/hole_normal.png" -dest_files=["res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.s3tc.ctex", "res://.godot/imported/hole_normal.png-48d612f86efe0b8b5c20262f0d4e848a.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/hole_normal.png" +dest_files=["res://.godot/imported/hole_normal.png-9c2f1eac05804bab609d1c67adcf7dba.s3tc.ctex", "res://.godot/imported/hole_normal.png-9c2f1eac05804bab609d1c67adcf7dba.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/hole_orm.png b/interior/tiles/limestone_dungeon/hole_orm.png similarity index 100% rename from tiling/tiles/limestone_dungeon/hole_orm.png rename to interior/tiles/limestone_dungeon/hole_orm.png diff --git a/tiling/tiles/limestone_dungeon/hole_orm.png.import b/interior/tiles/limestone_dungeon/hole_orm.png.import similarity index 58% rename from tiling/tiles/limestone_dungeon/hole_orm.png.import rename to interior/tiles/limestone_dungeon/hole_orm.png.import index 4013c77..39cf7c3 100644 --- a/tiling/tiles/limestone_dungeon/hole_orm.png.import +++ b/interior/tiles/limestone_dungeon/hole_orm.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://dvqqmbf6r1jfm" -path.s3tc="res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.s3tc.ctex" -path.etc2="res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.etc2.ctex" +path.s3tc="res://.godot/imported/hole_orm.png-00b1427da2cca528c854a97655dfff24.s3tc.ctex" +path.etc2="res://.godot/imported/hole_orm.png-00b1427da2cca528c854a97655dfff24.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/hole_orm.png" -dest_files=["res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.s3tc.ctex", "res://.godot/imported/hole_orm.png-4f40ed9d2832b8b97cb8bb14a110f509.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/hole_orm.png" +dest_files=["res://.godot/imported/hole_orm.png-00b1427da2cca528c854a97655dfff24.s3tc.ctex", "res://.godot/imported/hole_orm.png-00b1427da2cca528c854a97655dfff24.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/piping_albedo.png b/interior/tiles/limestone_dungeon/piping_albedo.png similarity index 100% rename from tiling/tiles/limestone_dungeon/piping_albedo.png rename to interior/tiles/limestone_dungeon/piping_albedo.png diff --git a/tiling/tiles/limestone_dungeon/piping_albedo.png.import b/interior/tiles/limestone_dungeon/piping_albedo.png.import similarity index 56% rename from tiling/tiles/limestone_dungeon/piping_albedo.png.import rename to interior/tiles/limestone_dungeon/piping_albedo.png.import index ceadb5d..ba5e271 100644 --- a/tiling/tiles/limestone_dungeon/piping_albedo.png.import +++ b/interior/tiles/limestone_dungeon/piping_albedo.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://yu0p5ryoh7gr" -path.s3tc="res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.s3tc.ctex" -path.etc2="res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.etc2.ctex" +path.s3tc="res://.godot/imported/piping_albedo.png-e55409f9baf27938796d954b957086ac.s3tc.ctex" +path.etc2="res://.godot/imported/piping_albedo.png-e55409f9baf27938796d954b957086ac.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/piping_albedo.png" -dest_files=["res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.s3tc.ctex", "res://.godot/imported/piping_albedo.png-d117bd6aedaaed5af7d5b88d016dd068.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/piping_albedo.png" +dest_files=["res://.godot/imported/piping_albedo.png-e55409f9baf27938796d954b957086ac.s3tc.ctex", "res://.godot/imported/piping_albedo.png-e55409f9baf27938796d954b957086ac.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/piping_height.png b/interior/tiles/limestone_dungeon/piping_height.png similarity index 100% rename from tiling/tiles/limestone_dungeon/piping_height.png rename to interior/tiles/limestone_dungeon/piping_height.png diff --git a/tiling/tiles/limestone_dungeon/piping_height.png.import b/interior/tiles/limestone_dungeon/piping_height.png.import similarity index 56% rename from tiling/tiles/limestone_dungeon/piping_height.png.import rename to interior/tiles/limestone_dungeon/piping_height.png.import index b40aae7..2bf651a 100644 --- a/tiling/tiles/limestone_dungeon/piping_height.png.import +++ b/interior/tiles/limestone_dungeon/piping_height.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://byw6qkgod61ip" -path.s3tc="res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.s3tc.ctex" -path.etc2="res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.etc2.ctex" +path.s3tc="res://.godot/imported/piping_height.png-d458ffb714345b35977ee0de9b01359f.s3tc.ctex" +path.etc2="res://.godot/imported/piping_height.png-d458ffb714345b35977ee0de9b01359f.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/piping_height.png" -dest_files=["res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.s3tc.ctex", "res://.godot/imported/piping_height.png-f888453774e014a184ce92a9b1a3c1ba.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/piping_height.png" +dest_files=["res://.godot/imported/piping_height.png-d458ffb714345b35977ee0de9b01359f.s3tc.ctex", "res://.godot/imported/piping_height.png-d458ffb714345b35977ee0de9b01359f.etc2.ctex"] [params] diff --git a/interior/tiles/limestone_dungeon/piping_material.res b/interior/tiles/limestone_dungeon/piping_material.res new file mode 100644 index 0000000..e6bc1cc --- /dev/null +++ b/interior/tiles/limestone_dungeon/piping_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:67ef7e571aa11cd7b9e57a14977af2fcc656aefb5ed8c0f2de3fb7969565be16 +size 1097 diff --git a/tiling/tiles/limestone_dungeon/piping_normal.png b/interior/tiles/limestone_dungeon/piping_normal.png similarity index 100% rename from tiling/tiles/limestone_dungeon/piping_normal.png rename to interior/tiles/limestone_dungeon/piping_normal.png diff --git a/tiling/tiles/limestone_dungeon/piping_normal.png.import b/interior/tiles/limestone_dungeon/piping_normal.png.import similarity index 58% rename from tiling/tiles/limestone_dungeon/piping_normal.png.import rename to interior/tiles/limestone_dungeon/piping_normal.png.import index d4a5564..1ed7908 100644 --- a/tiling/tiles/limestone_dungeon/piping_normal.png.import +++ b/interior/tiles/limestone_dungeon/piping_normal.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://bypqkn1tm036p" -path.s3tc="res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.s3tc.ctex" -path.etc2="res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.etc2.ctex" +path.s3tc="res://.godot/imported/piping_normal.png-4b6b5fc6d6cbc5e05f054f9e19463644.s3tc.ctex" +path.etc2="res://.godot/imported/piping_normal.png-4b6b5fc6d6cbc5e05f054f9e19463644.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/piping_normal.png" -dest_files=["res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.s3tc.ctex", "res://.godot/imported/piping_normal.png-0c487b0c66ff253b09c1ba11ef156621.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/piping_normal.png" +dest_files=["res://.godot/imported/piping_normal.png-4b6b5fc6d6cbc5e05f054f9e19463644.s3tc.ctex", "res://.godot/imported/piping_normal.png-4b6b5fc6d6cbc5e05f054f9e19463644.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/piping_orm.png b/interior/tiles/limestone_dungeon/piping_orm.png similarity index 100% rename from tiling/tiles/limestone_dungeon/piping_orm.png rename to interior/tiles/limestone_dungeon/piping_orm.png diff --git a/tiling/tiles/limestone_dungeon/piping_orm.png.import b/interior/tiles/limestone_dungeon/piping_orm.png.import similarity index 57% rename from tiling/tiles/limestone_dungeon/piping_orm.png.import rename to interior/tiles/limestone_dungeon/piping_orm.png.import index 950835d..7f8fade 100644 --- a/tiling/tiles/limestone_dungeon/piping_orm.png.import +++ b/interior/tiles/limestone_dungeon/piping_orm.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://bkpucv0ydae5v" -path.s3tc="res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.s3tc.ctex" -path.etc2="res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.etc2.ctex" +path.s3tc="res://.godot/imported/piping_orm.png-7131df07403ecb346d6a4793ca7929cb.s3tc.ctex" +path.etc2="res://.godot/imported/piping_orm.png-7131df07403ecb346d6a4793ca7929cb.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/piping_orm.png" -dest_files=["res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.s3tc.ctex", "res://.godot/imported/piping_orm.png-e22115d9c1ce0eff6ab03d386d564a38.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/piping_orm.png" +dest_files=["res://.godot/imported/piping_orm.png-7131df07403ecb346d6a4793ca7929cb.s3tc.ctex", "res://.godot/imported/piping_orm.png-7131df07403ecb346d6a4793ca7929cb.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/tiling_albedo.png b/interior/tiles/limestone_dungeon/tiling_albedo.png similarity index 100% rename from tiling/tiles/limestone_dungeon/tiling_albedo.png rename to interior/tiles/limestone_dungeon/tiling_albedo.png diff --git a/tiling/tiles/limestone_dungeon/tiling_albedo.png.import b/interior/tiles/limestone_dungeon/tiling_albedo.png.import similarity index 56% rename from tiling/tiles/limestone_dungeon/tiling_albedo.png.import rename to interior/tiles/limestone_dungeon/tiling_albedo.png.import index 003b1bc..5238382 100644 --- a/tiling/tiles/limestone_dungeon/tiling_albedo.png.import +++ b/interior/tiles/limestone_dungeon/tiling_albedo.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://bydc62557j2d0" -path.s3tc="res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.s3tc.ctex" -path.etc2="res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.etc2.ctex" +path.s3tc="res://.godot/imported/tiling_albedo.png-1570a8acdedf3400258f8b15e49e5d5b.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_albedo.png-1570a8acdedf3400258f8b15e49e5d5b.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/tiling_albedo.png" -dest_files=["res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.s3tc.ctex", "res://.godot/imported/tiling_albedo.png-335e15cc73fb0bac27ce85e385dd7ecf.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/tiling_albedo.png" +dest_files=["res://.godot/imported/tiling_albedo.png-1570a8acdedf3400258f8b15e49e5d5b.s3tc.ctex", "res://.godot/imported/tiling_albedo.png-1570a8acdedf3400258f8b15e49e5d5b.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/tiling_height.png b/interior/tiles/limestone_dungeon/tiling_height.png similarity index 100% rename from tiling/tiles/limestone_dungeon/tiling_height.png rename to interior/tiles/limestone_dungeon/tiling_height.png diff --git a/tiling/tiles/limestone_dungeon/tiling_height.png.import b/interior/tiles/limestone_dungeon/tiling_height.png.import similarity index 58% rename from tiling/tiles/limestone_dungeon/tiling_height.png.import rename to interior/tiles/limestone_dungeon/tiling_height.png.import index f6c0938..7090396 100644 --- a/tiling/tiles/limestone_dungeon/tiling_height.png.import +++ b/interior/tiles/limestone_dungeon/tiling_height.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://didp3nfacohwd" -path.s3tc="res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.s3tc.ctex" -path.etc2="res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.etc2.ctex" +path.s3tc="res://.godot/imported/tiling_height.png-2ead72b43d4a6de847e50bcbd8e8c7f7.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_height.png-2ead72b43d4a6de847e50bcbd8e8c7f7.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/tiling_height.png" -dest_files=["res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.s3tc.ctex", "res://.godot/imported/tiling_height.png-db37ee0c7501cd36b201bbde42feaaab.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/tiling_height.png" +dest_files=["res://.godot/imported/tiling_height.png-2ead72b43d4a6de847e50bcbd8e8c7f7.s3tc.ctex", "res://.godot/imported/tiling_height.png-2ead72b43d4a6de847e50bcbd8e8c7f7.etc2.ctex"] [params] diff --git a/interior/tiles/limestone_dungeon/tiling_material.res b/interior/tiles/limestone_dungeon/tiling_material.res new file mode 100644 index 0000000..49762db --- /dev/null +++ b/interior/tiles/limestone_dungeon/tiling_material.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e917b37d179fb8c78deaf4a2003fa07e8d023aab38fa84119e9af9bcab09422c +size 1096 diff --git a/tiling/tiles/limestone_dungeon/tiling_normal.png b/interior/tiles/limestone_dungeon/tiling_normal.png similarity index 100% rename from tiling/tiles/limestone_dungeon/tiling_normal.png rename to interior/tiles/limestone_dungeon/tiling_normal.png diff --git a/tiling/tiles/limestone_dungeon/tiling_normal.png.import b/interior/tiles/limestone_dungeon/tiling_normal.png.import similarity index 58% rename from tiling/tiles/limestone_dungeon/tiling_normal.png.import rename to interior/tiles/limestone_dungeon/tiling_normal.png.import index aad3f5b..bcc28d9 100644 --- a/tiling/tiles/limestone_dungeon/tiling_normal.png.import +++ b/interior/tiles/limestone_dungeon/tiling_normal.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://cv8yiluvc6mol" -path.s3tc="res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.s3tc.ctex" -path.etc2="res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.etc2.ctex" +path.s3tc="res://.godot/imported/tiling_normal.png-877f08b7359b5aba3ea7d5681fd4e5a9.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_normal.png-877f08b7359b5aba3ea7d5681fd4e5a9.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/tiling_normal.png" -dest_files=["res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.s3tc.ctex", "res://.godot/imported/tiling_normal.png-7e412b02fac9515815ce4cb07e3cb04b.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/tiling_normal.png" +dest_files=["res://.godot/imported/tiling_normal.png-877f08b7359b5aba3ea7d5681fd4e5a9.s3tc.ctex", "res://.godot/imported/tiling_normal.png-877f08b7359b5aba3ea7d5681fd4e5a9.etc2.ctex"] [params] diff --git a/tiling/tiles/limestone_dungeon/tiling_orm.png b/interior/tiles/limestone_dungeon/tiling_orm.png similarity index 100% rename from tiling/tiles/limestone_dungeon/tiling_orm.png rename to interior/tiles/limestone_dungeon/tiling_orm.png diff --git a/tiling/tiles/limestone_dungeon/tiling_orm.png.import b/interior/tiles/limestone_dungeon/tiling_orm.png.import similarity index 57% rename from tiling/tiles/limestone_dungeon/tiling_orm.png.import rename to interior/tiles/limestone_dungeon/tiling_orm.png.import index b7f9248..cd95373 100644 --- a/tiling/tiles/limestone_dungeon/tiling_orm.png.import +++ b/interior/tiles/limestone_dungeon/tiling_orm.png.import @@ -3,8 +3,8 @@ importer="texture" type="CompressedTexture2D" uid="uid://leoab2fjmxgk" -path.s3tc="res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.s3tc.ctex" -path.etc2="res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.etc2.ctex" +path.s3tc="res://.godot/imported/tiling_orm.png-48bc1a5d8b2eae43d49ed818fa664d0d.s3tc.ctex" +path.etc2="res://.godot/imported/tiling_orm.png-48bc1a5d8b2eae43d49ed818fa664d0d.etc2.ctex" metadata={ "imported_formats": ["s3tc", "etc2"], "vram_texture": true @@ -12,8 +12,8 @@ metadata={ [deps] -source_file="res://tiling/tiles/limestone_dungeon/tiling_orm.png" -dest_files=["res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.s3tc.ctex", "res://.godot/imported/tiling_orm.png-d4a1309df6c98d9d7a8bcda0e97488e6.etc2.ctex"] +source_file="res://interior/tiles/limestone_dungeon/tiling_orm.png" +dest_files=["res://.godot/imported/tiling_orm.png-48bc1a5d8b2eae43d49ed818fa664d0d.s3tc.ctex", "res://.godot/imported/tiling_orm.png-48bc1a5d8b2eae43d49ed818fa664d0d.etc2.ctex"] [params] diff --git a/map_editor.scn b/map_editor.scn index 8c0b516..9b2d21f 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:144f8810b56cc89b593e8a78fbef8e4970bc82c1dbcd49b636a98a7e51af4464 -size 13347 +oid sha256:ef2181437d2bfc14a73418b5bbf2b1e26f23cf6772cfb167915ce964544b0586 +size 13351 diff --git a/tiling/tiles/dungeon_01_pipehole_tile.res b/tiling/tiles/dungeon_01_pipehole_tile.res deleted file mode 100644 index 86cfdae..0000000 --- a/tiling/tiles/dungeon_01_pipehole_tile.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5c0e60900e9e99ba19aa91bd4ae3480f793612edb55d8d99d0fac69c00f0d67 -size 131934 diff --git a/tiling/tiles/dungeon_01_tiling_tile.res b/tiling/tiles/dungeon_01_tiling_tile.res deleted file mode 100644 index a83e0db..0000000 --- a/tiling/tiles/dungeon_01_tiling_tile.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9025b3e769094aea76dc1638ace7338eeb3b72cfccdb1b1f2615798a160fdcdc -size 469 diff --git a/tiling/tiles/limestone_dungeon/hole_material.res b/tiling/tiles/limestone_dungeon/hole_material.res deleted file mode 100644 index d2918a2..0000000 --- a/tiling/tiles/limestone_dungeon/hole_material.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0e83ce69c0fbddff9183f20a73d7880a73cafc6454d4a829215ddb17224f73a9 -size 1096 diff --git a/tiling/tiles/limestone_dungeon/piping_material.res b/tiling/tiles/limestone_dungeon/piping_material.res deleted file mode 100644 index 49b0f8a..0000000 --- a/tiling/tiles/limestone_dungeon/piping_material.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:acbc392315b2a7eb7b98524556b3243bd30c51a9b8a35657d6e686ffeaca22b8 -size 1094 diff --git a/tiling/tiles/limestone_dungeon/tiling_material.res b/tiling/tiles/limestone_dungeon/tiling_material.res deleted file mode 100644 index a7545e6..0000000 --- a/tiling/tiles/limestone_dungeon/tiling_material.res +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f3cb64bcceb9fb42ca25497863766b4aa17af678cae11b396253c7ebc54d18bc -size 1091 -- 2.34.1 From 4ca2cf2511420b7aaeb28f8af4533656c797e6f3 Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 22:34:23 +0000 Subject: [PATCH 23/30] Remove testing mesh from map editor --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 9b2d21f..71b004f 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ef2181437d2bfc14a73418b5bbf2b1e26f23cf6772cfb167915ce964544b0586 -size 13351 +oid sha256:682c6b35fbe9cf522fbad41ded3ca819e30fbb9cf3e750247ad189fd97ccc3b9 +size 13288 -- 2.34.1 From 10148638e9cb67f8a29e4292c80fcdc3b47546e3 Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 22:36:06 +0000 Subject: [PATCH 24/30] Rename 'exterior' to 'terrain' in map editor UI --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 71b004f..d9624e6 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:682c6b35fbe9cf522fbad41ded3ca819e30fbb9cf3e750247ad189fd97ccc3b9 -size 13288 +oid sha256:8d7b612c02d05555f0c7dc782bdb0f2380f29b8d0d9467d7567aa795d74c7166 +size 13290 -- 2.34.1 From ccb44fe1182367dfea388820499eb542df5788b7 Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 22:43:21 +0000 Subject: [PATCH 25/30] Fix crash in map editor --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index d9624e6..7c8f041 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8d7b612c02d05555f0c7dc782bdb0f2380f29b8d0d9467d7567aa795d74c7166 -size 13290 +oid sha256:9e49b7f146c0b707f27415bda7a52a461acf95efaef11503c46f451f230868ed +size 13268 -- 2.34.1 From 08bcb54daa16a6ff12afa763b35cb5cf6a8d6eaa Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 22:48:12 +0000 Subject: [PATCH 26/30] Rename 'Interior' to 'InteriorMap' --- interior/{interior.gd => interior_map.gd} | 10 +++++----- map_editor.scn | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) rename interior/{interior.gd => interior_map.gd} (97%) diff --git a/interior/interior.gd b/interior/interior_map.gd similarity index 97% rename from interior/interior.gd rename to interior/interior_map.gd index f29c626..1e2fd89 100644 --- a/interior/interior.gd +++ b/interior/interior_map.gd @@ -1,4 +1,4 @@ -class_name Interior extends Node3D +class_name InteriorMap extends Node3D const _CHUNK_SIZE := 32 @@ -39,7 +39,7 @@ class Chunk: ## ## Invalidates the mesh block, re-baking its contents from the current mesh data set. ## - func invalidate(interior: Interior, coordinate: Vector2i) -> void: + func invalidate(interior_map: InteriorMap, coordinate: Vector2i) -> void: # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. for multimesh_instance in _multimesh_instances: RenderingServer.free_rid(multimesh_instance._instance_rid) @@ -49,7 +49,7 @@ class Chunk: # Normalize mesh instance data for the chunk. var transforms_by_mesh := {} - var grid_size := interior.size + var grid_size := interior_map.size var half_pi := PI / 2 for i in _floor_meshes.size(): @@ -81,8 +81,8 @@ class Chunk: (float(grid_size.y) * _GRID_ORIGIN.y) + 0.5))) # (Re)-bake into multimesh instances for the chunk. - var scenario_rid := interior.get_world_3d().scenario - var global_transform := interior.global_transform + var scenario_rid := interior_map.get_world_3d().scenario + var global_transform := interior_map.global_transform for chunk_mesh in transforms_by_mesh: var multimesh_instance := MultiMeshInstance.new( diff --git a/map_editor.scn b/map_editor.scn index 7c8f041..6d06505 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e49b7f146c0b707f27415bda7a52a461acf95efaef11503c46f451f230868ed -size 13268 +oid sha256:90902c279cf400e849d43792914f05a5a8407127a00dba2be0e725cc36946538 +size 13294 -- 2.34.1 From 3af575298db2ae9ce6e139c61840dbceddc5eb39 Mon Sep 17 00:00:00 2001 From: kayomn Date: Tue, 31 Jan 2023 23:24:40 +0000 Subject: [PATCH 27/30] Fix glitchy interior map editor behaviors --- map_editor.scn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map_editor.scn b/map_editor.scn index 6d06505..a2f3041 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:90902c279cf400e849d43792914f05a5a8407127a00dba2be0e725cc36946538 -size 13294 +oid sha256:7fe7f05f0ecf9b18338fc90e47b3d25fb54d22e8ec15b610358228e203a80b10 +size 13275 -- 2.34.1 From 821c1ac8c420694a5366a46090c5e2bf56fce369 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 1 Feb 2023 00:05:48 +0000 Subject: [PATCH 28/30] Amend code review comments --- interior/interior_map.gd | 20 ++++++++------------ interior/interior_tile.gd | 8 +++++--- player_controller.gd | 21 +++++++++++++-------- user_interface/action_prompt.gd | 9 +++++++-- user_interface/selection_prompt.gd | 4 ++-- user_interface/worker_prompt.gd | 10 ++++++---- 6 files changed, 41 insertions(+), 31 deletions(-) diff --git a/interior/interior_map.gd b/interior/interior_map.gd index 1e2fd89..f3d9758 100644 --- a/interior/interior_map.gd +++ b/interior/interior_map.gd @@ -5,7 +5,7 @@ const _CHUNK_SIZE := 32 const _GRID_ORIGIN := Vector2(0.5, 0.5) ## -## +## Cardinal orientation referencing the direction of a tile. ## enum Orientation { NORTH, @@ -176,7 +176,8 @@ func _notification(what: int) -> void: multimesh_instance.set_offset_transform(global_transform) ## -## Clears the entirety of the tile grid to only contain [code]tile[/code]. +## Clears the entirety of the tile grid to only contain tiles of instance [code]tile[/code] pointing +## in the orientation of [code]orientation[/code]. ## ## For clearing a specific region of the mesh grid, see [method fill_mesh]. ## @@ -218,7 +219,8 @@ func clear_tiles(orientation: Orientation, tile: InteriorTile) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) ## -## Clears the region of the tile grid at [code]area[/code] to only contain [code]tile[/code]. +## Clears the region of the tile grid at [code]area[/code] to only contain instances of +## [code]tile[/code] pointing in the orientation of [code]orientation[/code]. ## ## *Note* that [code]area[/code] *must* be within the area of the of the mesh grid, where ## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom- @@ -282,14 +284,14 @@ func fill_tiles(area: Rect2i, orientation: Orientation, tile: InteriorTile) -> v _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) ## -## +## Returns the area of the interior map based on its current size. ## func get_area() -> Rect2i: return Rect2i(Vector2i.ZERO, size) ## -## Plots a single tile at [code]coordinates[/code] to be [code]tile[/code], overwriting whatever it -## previously contained. +## Plots a single tile at [code]coordinates[/code] to be an instance of [code]tile[/code] pointing +## in the orientation of [code]orientation[/code], overwriting whatever it previously contained. ## ## *Note* that [code]coordinates[/code] *must* be within the area of the of the mesh grid, where ## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom- @@ -324,9 +326,3 @@ func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: InteriorTi InteriorTile.Kind.WALL: chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, orientation, mesh) chunk.invalidate(self, chunk_coordinates) - -## -## -## -func world_to_grid(world_position: Vector2) -> Vector2i: - return Vector2i((world_position + (Vector2(size) * _GRID_ORIGIN)).round()) diff --git a/interior/interior_tile.gd b/interior/interior_tile.gd index a654d86..7668d34 100644 --- a/interior/interior_tile.gd +++ b/interior/interior_tile.gd @@ -1,7 +1,7 @@ class_name InteriorTile extends Resource ## -## +## Identifier for the kind of interior tile. ## enum Kind { FLOOR, @@ -9,19 +9,21 @@ enum Kind { } ## -## +## Flag for determining if the tile is affected by orientations specified in an [InteriorMap]. ## @export var fixed_orientation := false ## +## See [enum Kind]. ## +## Interior tiles of different kinds will not conflict when placing them. ## @export var kind := Kind.FLOOR ## -## +## Used to visualize the interior tile. ## @export var mesh: Mesh = null diff --git a/player_controller.gd b/player_controller.gd index 5f16ecc..4d62cbb 100644 --- a/player_controller.gd +++ b/player_controller.gd @@ -1,7 +1,10 @@ class_name PlayerController extends Node3D ## +## Selection action performed. ## +## [code]PRIMARY[/code] refers to the default selection action, while [code]SECONDARY[/code] refers +## to the secondary selection action. ## enum SelectAction { PRIMARY, @@ -22,7 +25,10 @@ enum SelectMode { signal select_mode_changed(mode: SelectMode) ## -## Selection of a point on screenspace has started happening. +## Selection of a point on the screen space has started happening, with [code]select_action[/code] +## as selection action performed. +## +## See [enum SelectAction] for more details. ## signal selection_started(select_action: SelectAction) @@ -179,19 +185,18 @@ func get_plane_cursor() -> Vector2: return Vector2.ZERO +## +## Returns [code]true[/code] if the player controller is currently frozen, otherwise +## [code]false[/code]. +## func is_frozen() -> bool: assert(_control_override_count > -1, "control override count cannot be less than 0") return _control_override_count != 0 ## -## -## -func in_select_area() -> bool: - return _select_mode != SelectMode.NONE - -## -## +## Overrides the controls of the player controller. When [code]unlock_signal[/code] is emitted, the +## override is released. ## func override_controls(unlock_signal: Signal) -> void: assert(_control_override_count > -1, "control override count cannot be less than 0") diff --git a/user_interface/action_prompt.gd b/user_interface/action_prompt.gd index ded869a..ca662d6 100644 --- a/user_interface/action_prompt.gd +++ b/user_interface/action_prompt.gd @@ -2,18 +2,21 @@ class_name ActionPrompt extends Control ## -## +## The prompt accept button has been pressed. ## signal prompt_accepted() ## -## +## The prompt has been started. ## signal prompted() @export var _accept_button: BaseButton = null +## +## The initial control focused on when it is prompted or [code]null[/code] for no default. +## @export var initial_focus: Control = null @@ -33,7 +36,9 @@ func _ready() -> void: hide()) ## +## Starts the prompt, emitting [signal prompted]. ## +## [signal prompt_accepted] is emitted when the accept button in the action prompt is pressed. ## func prompt() -> void: LocalPlayer.override_controls(hidden) diff --git a/user_interface/selection_prompt.gd b/user_interface/selection_prompt.gd index f9d0c41..3262c04 100644 --- a/user_interface/selection_prompt.gd +++ b/user_interface/selection_prompt.gd @@ -2,12 +2,12 @@ class_name SelectionPrompt extends Control ## -## +## The prompt has been started. ## signal prompted() ## -## +## The item at index [code]selected_item[/code] has been selected in the prompt. ## signal prompt_selected(selected_item: int) diff --git a/user_interface/worker_prompt.gd b/user_interface/worker_prompt.gd index 8b037dc..112ffa0 100644 --- a/user_interface/worker_prompt.gd +++ b/user_interface/worker_prompt.gd @@ -1,31 +1,33 @@ class_name WorkerPrompt extends Control ## -## +## The work being performed by the prompt has ended. ## signal prompt_completed() ## -## +## The prompt has been started. ## signal prompted() var _worker_thread := Thread.new() ## -## +## Used to display a message from the prompt or [code]null[/code] to not display anything. ## @export var label: Label = null ## -## +## Used to display the progress of the prompt or [code]null[/code] to not display anything. ## @export var progress: Range = null ## +## Starts the prompt, emitting [signal prompted]. ## +## [signal prompt_completed] is emitted when the work being performed by the prompt has ended. ## func prompt(display_message: String, steps: Array) -> void: LocalPlayer.override_controls(hidden) -- 2.34.1 From 8d014d69a9471c6fdc0fd99116c95fb08d0392fe Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 1 Feb 2023 00:11:14 +0000 Subject: [PATCH 29/30] Fix InteriorMap not hiding its multi-mesh instances when hidden --- interior/interior_map.gd | 29 ++++++++++++++++++++--------- map_editor.scn | 4 ++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/interior/interior_map.gd b/interior/interior_map.gd index f3d9758..0d32504 100644 --- a/interior/interior_map.gd +++ b/interior/interior_map.gd @@ -41,9 +41,9 @@ class Chunk: ## func invalidate(interior_map: InteriorMap, coordinate: Vector2i) -> void: # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. - for multimesh_instance in _multimesh_instances: - RenderingServer.free_rid(multimesh_instance._instance_rid) - RenderingServer.free_rid(multimesh_instance._multimesh_rid) + for multi_mesh_instance in _multimesh_instances: + RenderingServer.free_rid(multi_mesh_instance._instance_rid) + RenderingServer.free_rid(multi_mesh_instance._multimesh_rid) _multimesh_instances.clear() @@ -85,11 +85,11 @@ class Chunk: var global_transform := interior_map.global_transform for chunk_mesh in transforms_by_mesh: - var multimesh_instance := MultiMeshInstance.new( + var multi_mesh_instance := MultiMeshInstance.new( scenario_rid, chunk_mesh.get_rid(), transforms_by_mesh[chunk_mesh]) - multimesh_instance.set_offset(global_transform) - _multimesh_instances.append(multimesh_instance) + multi_mesh_instance.set_offset(global_transform) + _multimesh_instances.append(multi_mesh_instance) ## ## Sets the floor mesh in the chunk at the location relative [code]coordinatess[/code] to @@ -140,11 +140,17 @@ class MultiMeshInstance: RenderingServer.multimesh_instance_set_transform(_multimesh_rid, i, transforms[i]) ## - ## Sets the parent transform of all mesh instances under it to [code]offset[/code]. + ## Sets the transform of the instance to [code]offset[/code]. ## func set_offset(offset: Transform3D) -> void: RenderingServer.instance_set_transform(_instance_rid, offset) + ## + ## Sets the visibility of the instance to [code]is_visible[/code]. + ## + func set_visible(is_visible: bool) -> void: + RenderingServer.instance_set_visible(_instance_rid, is_visible) + var _chunks: Array[Chunk] = [] var _chunks_size := Vector2i.ZERO @@ -172,8 +178,13 @@ func _notification(what: int) -> void: match what: NOTIFICATION_TRANSFORM_CHANGED: for chunk in _chunks: - for multimesh_instance in chunk._multimesh_instances: - multimesh_instance.set_offset_transform(global_transform) + for multi_mesh_instance in chunk._multimesh_instances: + multi_mesh_instance.set_offset_transform(global_transform) + + NOTIFICATION_VISIBILITY_CHANGED: + for chunk in _chunks: + for multi_mesh_instance in chunk._multimesh_instances: + multi_mesh_instance.set_visible(visible) ## ## Clears the entirety of the tile grid to only contain tiles of instance [code]tile[/code] pointing diff --git a/map_editor.scn b/map_editor.scn index a2f3041..3540e8e 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7fe7f05f0ecf9b18338fc90e47b3d25fb54d22e8ec15b610358228e203a80b10 -size 13275 +oid sha256:021482d14d5f8718d812861f27ffc883b19ae1561b78bd9589ecd8483019aff6 +size 13278 -- 2.34.1 From 6bf34c13c53fa3cc65a21dbef50607522510e988 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 1 Feb 2023 00:12:11 +0000 Subject: [PATCH 30/30] Fix naming convention inconsistency --- interior/interior_map.gd | 12 ++++++------ map_editor.scn | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/interior/interior_map.gd b/interior/interior_map.gd index 0d32504..09c9b3a 100644 --- a/interior/interior_map.gd +++ b/interior/interior_map.gd @@ -22,7 +22,7 @@ class Chunk: var _floor_orientation := PackedInt32Array() - var _multimesh_instances: Array[MultiMeshInstance] = [] + var _multi_mesh_instances: Array[MultiMeshInstance] = [] var _wall_meshes: Array[Mesh] = [] @@ -41,11 +41,11 @@ class Chunk: ## func invalidate(interior_map: InteriorMap, coordinate: Vector2i) -> void: # TODO: Once this is all lowered into native code, look for ways to parallelize the loops. - for multi_mesh_instance in _multimesh_instances: + for multi_mesh_instance in _multi_mesh_instances: RenderingServer.free_rid(multi_mesh_instance._instance_rid) RenderingServer.free_rid(multi_mesh_instance._multimesh_rid) - _multimesh_instances.clear() + _multi_mesh_instances.clear() # Normalize mesh instance data for the chunk. var transforms_by_mesh := {} @@ -89,7 +89,7 @@ class Chunk: scenario_rid, chunk_mesh.get_rid(), transforms_by_mesh[chunk_mesh]) multi_mesh_instance.set_offset(global_transform) - _multimesh_instances.append(multi_mesh_instance) + _multi_mesh_instances.append(multi_mesh_instance) ## ## Sets the floor mesh in the chunk at the location relative [code]coordinatess[/code] to @@ -178,12 +178,12 @@ func _notification(what: int) -> void: match what: NOTIFICATION_TRANSFORM_CHANGED: for chunk in _chunks: - for multi_mesh_instance in chunk._multimesh_instances: + for multi_mesh_instance in chunk._multi_mesh_instances: multi_mesh_instance.set_offset_transform(global_transform) NOTIFICATION_VISIBILITY_CHANGED: for chunk in _chunks: - for multi_mesh_instance in chunk._multimesh_instances: + for multi_mesh_instance in chunk._multi_mesh_instances: multi_mesh_instance.set_visible(visible) ## diff --git a/map_editor.scn b/map_editor.scn index 3540e8e..75269bf 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:021482d14d5f8718d812861f27ffc883b19ae1561b78bd9589ecd8483019aff6 -size 13278 +oid sha256:d40ab3a5c636b299cab66b325eebee44880a13467cd078577f39a72a9a7f05ab +size 13276 -- 2.34.1