diff options
author | metamuffin <metamuffin@disroot.org> | 2024-09-27 15:06:25 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-09-27 15:06:32 +0200 |
commit | efb1bdf2440b02438082c91caf67d3a9b7b5d55d (patch) | |
tree | 274c5effaef44486627a268fa7cdfb630d09622e /client | |
parent | 70b463b5d11d4dbcef9631776bc69a00c30e7aee (diff) | |
download | hurrycurry-efb1bdf2440b02438082c91caf67d3a9b7b5d55d.tar hurrycurry-efb1bdf2440b02438082c91caf67d3a9b7b5d55d.tar.bz2 hurrycurry-efb1bdf2440b02438082c91caf67d3a9b7b5d55d.tar.zst |
disable floor optimization in menu background
Diffstat (limited to 'client')
-rw-r--r-- | client/map/map.gd | 6 | ||||
-rw-r--r-- | client/map/tile_factory.gd | 6 | ||||
-rw-r--r-- | client/map/tiles/floor.gd | 7 | ||||
-rw-r--r-- | client/map/tiles/floor.tscn | 1 | ||||
-rw-r--r-- | client/menu/menu_background.gd | 1 | ||||
-rw-r--r-- | client/menu/menu_background.tscn | 1 |
6 files changed, 13 insertions, 9 deletions
diff --git a/client/map/map.gd b/client/map/map.gd index 40451c57..4b15d55b 100644 --- a/client/map/map.gd +++ b/client/map/map.gd @@ -18,10 +18,12 @@ class_name Map extends Node3D +@export var optimize: bool = true + var tile_by_pos: Dictionary = {} var autobake = false var currently_baked = false -var floor_mesher := FloorMesher.new() +@onready var floor_mesher = FloorMesher.new() if optimize else null var floor_node := MeshInstance3D.new() func get_tile_name(pos: Vector2i): @@ -56,7 +58,7 @@ func _ready(): add_child(floor_node) func flush() -> void: - floor_node.mesh = floor_mesher.flush() + if floor_mesher != null: floor_node.mesh = floor_mesher.flush() gi_bake() func apply_gi_setting(state): diff --git a/client/map/tile_factory.gd b/client/map/tile_factory.gd index 8483c744..079c2d19 100644 --- a/client/map/tile_factory.gd +++ b/client/map/tile_factory.gd @@ -20,11 +20,9 @@ class TileCC: var tile_name: String var position: Vector2i var neighbors: Array - var floor_mesher: FloorMesher - var portal_type: bool + var floor_mesher # FloorMesher or null - -static func produce(tile_name: String, position: Vector2i, neighbors: Array, floor_mesher: FloorMesher) -> Tile: +static func produce(tile_name: String, position: Vector2i, neighbors: Array, floor_mesher) -> Tile: var ctx := TileCC.new() ctx.tile_name = tile_name ctx.position = position diff --git a/client/map/tiles/floor.gd b/client/map/tiles/floor.gd index ac4b0c15..8e75834b 100644 --- a/client/map/tiles/floor.gd +++ b/client/map/tiles/floor.gd @@ -16,9 +16,12 @@ class_name Floor extends Tile +var opt func _init(ctx: TileFactory.TileCC): + opt = ctx.floor_mesher != null super(ctx) - ctx.floor_mesher.add_tile(ctx.position) + if opt: ctx.floor_mesher.add_tile(ctx.position) func get_base_mesh(): - return preload("res://map/tiles/floor.tscn").instantiate() + if opt: return null + else: return preload("res://map/tiles/floor.tscn").instantiate() diff --git a/client/map/tiles/floor.tscn b/client/map/tiles/floor.tscn index 5132f15b..61299e3a 100644 --- a/client/map/tiles/floor.tscn +++ b/client/map/tiles/floor.tscn @@ -6,6 +6,5 @@ [node name="Mesh" type="MeshInstance3D" parent="."] transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0) -visible = false mesh = ExtResource("1_8pd6m") skeleton = NodePath("") diff --git a/client/menu/menu_background.gd b/client/menu/menu_background.gd index de5cafea..33ec6e43 100644 --- a/client/menu/menu_background.gd +++ b/client/menu/menu_background.gd @@ -35,3 +35,4 @@ func _ready(): if bucket.size() == 0: continue var tile_name = bucket[randi() % bucket.size()] map.set_tile(Vector2i(x,y), tile_name) + map.flush() diff --git a/client/menu/menu_background.tscn b/client/menu/menu_background.tscn index 19f0d506..26fe102a 100644 --- a/client/menu/menu_background.tscn +++ b/client/menu/menu_background.tscn @@ -69,3 +69,4 @@ mesh = SubResource("QuadMesh_fvp2p") surface_material_override/0 = SubResource("ShaderMaterial_gd87g") [node name="Map" parent="." instance=ExtResource("3_p80a7")] +optimize = false |