Interior Maps #13
|
@ -1,4 +1,4 @@
|
||||||
class_name Interior extends Node3D
|
class_name InteriorMap extends Node3D
|
||||||
|
|
||||||
const _CHUNK_SIZE := 32
|
const _CHUNK_SIZE := 32
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Chunk:
|
||||||
##
|
##
|
||||||
## Invalidates the mesh block, re-baking its contents from the current mesh data set.
|
## 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.
|
# 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._instance_rid)
|
||||||
|
@ -49,7 +49,7 @@ class Chunk:
|
||||||
|
|
||||||
# Normalize mesh instance data for the chunk.
|
# Normalize mesh instance data for the chunk.
|
||||||
var transforms_by_mesh := {}
|
var transforms_by_mesh := {}
|
||||||
var grid_size := interior.size
|
var grid_size := interior_map.size
|
||||||
var half_pi := PI / 2
|
var half_pi := PI / 2
|
||||||
|
|
||||||
for i in _floor_meshes.size():
|
for i in _floor_meshes.size():
|
||||||
|
@ -81,8 +81,8 @@ class Chunk:
|
||||||
(float(grid_size.y) * _GRID_ORIGIN.y) + 0.5)))
|
(float(grid_size.y) * _GRID_ORIGIN.y) + 0.5)))
|
||||||
|
|
||||||
# (Re)-bake into multimesh instances for the chunk.
|
# (Re)-bake into multimesh instances for the chunk.
|
||||||
var scenario_rid := interior.get_world_3d().scenario
|
var scenario_rid := interior_map.get_world_3d().scenario
|
||||||
var global_transform := interior.global_transform
|
var global_transform := interior_map.global_transform
|
||||||
|
|
||||||
for chunk_mesh in transforms_by_mesh:
|
for chunk_mesh in transforms_by_mesh:
|
||||||
var multimesh_instance := MultiMeshInstance.new(
|
var multimesh_instance := MultiMeshInstance.new(
|
BIN
map_editor.scn (Stored with Git LFS)
BIN
map_editor.scn (Stored with Git LFS)
Binary file not shown.
Loading…
Reference in New Issue