Skip to content

Commit

Permalink
Displacement layer size update.
Browse files Browse the repository at this point in the history
  • Loading branch information
iwatkot committed Dec 20, 2024
1 parent 98bf549 commit 4c764c5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions maps4fs/generator/i3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from maps4fs.generator.component import Component

DEFAULT_HEIGHT_SCALE = 2000
DISPLACEMENT_LAYER_SIZE_FOR_BIG_MAPS = 32768
DEFAULT_MAX_LOD_DISTANCE = 10000
DEFAULT_MAX_LOD_OCCLUDER_DISTANCE = 10000
NODE_ID_STARTING_VALUE = 500
Expand Down Expand Up @@ -84,6 +85,16 @@ def _update_i3d_file(self) -> None:

self.logger.debug("TerrainTransformGroup element updated in I3D file.")

if self.map_size > 4096:
print("Map size is greater than 4096")
displacement_layer = terrain_elem.find(".//DisplacementLayer") # pylint: disable=W0631

if displacement_layer is not None:
displacement_layer.set("size", str(DISPLACEMENT_LAYER_SIZE_FOR_BIG_MAPS))
self.logger.debug(
"Map size is greater than 4096, DisplacementLayer size set to %s.",
)

tree.write(self._map_i3d_path) # type: ignore
self.logger.info("Map I3D file saved to: %s.", self._map_i3d_path)

Expand Down

0 comments on commit 4c764c5

Please sign in to comment.