Interior Maps #13

Merged
kayomn merged 30 commits from interior-maps into main 2023-02-01 01:16:16 +01:00
2 changed files with 8 additions and 8 deletions
Showing only changes of commit 6bf34c13c5 - Show all commits

View File

@ -22,7 +22,7 @@ class Chunk:
var _floor_orientation := PackedInt32Array() var _floor_orientation := PackedInt32Array()
var _multimesh_instances: Array[MultiMeshInstance] = [] var _multi_mesh_instances: Array[MultiMeshInstance] = []
var _wall_meshes: Array[Mesh] = [] var _wall_meshes: Array[Mesh] = []
@ -41,11 +41,11 @@ class Chunk:
## ##
func invalidate(interior_map: InteriorMap, 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. # 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._instance_rid)
RenderingServer.free_rid(multi_mesh_instance._multimesh_rid) RenderingServer.free_rid(multi_mesh_instance._multimesh_rid)
_multimesh_instances.clear() _multi_mesh_instances.clear()
# Normalize mesh instance data for the chunk. # Normalize mesh instance data for the chunk.
var transforms_by_mesh := {} var transforms_by_mesh := {}
@ -89,7 +89,7 @@ class Chunk:
scenario_rid, chunk_mesh.get_rid(), transforms_by_mesh[chunk_mesh]) scenario_rid, chunk_mesh.get_rid(), transforms_by_mesh[chunk_mesh])
multi_mesh_instance.set_offset(global_transform) 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 ## 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: match what:
NOTIFICATION_TRANSFORM_CHANGED: NOTIFICATION_TRANSFORM_CHANGED:
for chunk in _chunks: 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) multi_mesh_instance.set_offset_transform(global_transform)
NOTIFICATION_VISIBILITY_CHANGED: NOTIFICATION_VISIBILITY_CHANGED:
for chunk in _chunks: 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) multi_mesh_instance.set_visible(visible)
## ##

BIN
map_editor.scn (Stored with Git LFS)

Binary file not shown.