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 12 additions and 6 deletions
Showing only changes of commit 647ac60ce7 - Show all commits

BIN
map_editor.scn (Stored with Git LFS)

Binary file not shown.

View File

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