style: apply gdformat formatting across the entire project
Auto-format all GDScript files using gdformat from gdtoolkit. This is a baseline formatting pass to ensure consistent style: - Normalizes indentation and spacing - Wraps long lines to 100 characters - Removes trailing whitespace - Standardizes blank lines between functions 68 files reformatted, 8 files left unchanged (3rd-party addon files with parse errors excluded).
This commit is contained in:
@@ -6,13 +6,13 @@ const HEIGHT_SCALE := 40.0
|
||||
const DATA_DIRECTORY := "res://terrain/jajce/data"
|
||||
const TEXTURE_DIRECTORY := "res://terrain/jajce/textures"
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
call_deferred("_generate")
|
||||
|
||||
|
||||
func _generate() -> void:
|
||||
DirAccess.make_dir_recursive_absolute(
|
||||
ProjectSettings.globalize_path(TEXTURE_DIRECTORY)
|
||||
)
|
||||
DirAccess.make_dir_recursive_absolute(ProjectSettings.globalize_path(TEXTURE_DIRECTORY))
|
||||
_generate_texture("grass_albedo.png", Color("#516f36"), Color("#79924c"), 17)
|
||||
_generate_texture("soil_albedo.png", Color("#65513b"), Color("#92734d"), 29)
|
||||
_generate_texture("rock_albedo.png", Color("#55534f"), Color("#89847b"), 43)
|
||||
@@ -22,12 +22,7 @@ func _generate() -> void:
|
||||
root.add_child(terrain)
|
||||
await process_frame
|
||||
|
||||
var height_map := Image.create_empty(
|
||||
MAP_SIZE,
|
||||
MAP_SIZE,
|
||||
false,
|
||||
Image.FORMAT_RF
|
||||
)
|
||||
var height_map := Image.create_empty(MAP_SIZE, MAP_SIZE, false, Image.FORMAT_RF)
|
||||
var noise := FastNoiseLite.new()
|
||||
noise.seed = 1943
|
||||
noise.frequency = 0.018
|
||||
@@ -40,79 +35,36 @@ func _generate() -> void:
|
||||
var world_z := float(image_z - HALF_SIZE)
|
||||
var distance := Vector2(world_x, world_z).length()
|
||||
var outside_play_area := smoothstep(20.0, 52.0, distance)
|
||||
var ridge := 28.0 * _elliptical_peak(
|
||||
world_x,
|
||||
world_z,
|
||||
-72.0,
|
||||
18.0,
|
||||
72.0,
|
||||
48.0
|
||||
)
|
||||
var eastern_hill := 15.0 * _elliptical_peak(
|
||||
world_x,
|
||||
world_z,
|
||||
105.0,
|
||||
65.0,
|
||||
110.0,
|
||||
90.0
|
||||
)
|
||||
var southern_hill := 11.0 * _elliptical_peak(
|
||||
world_x,
|
||||
world_z,
|
||||
-35.0,
|
||||
-125.0,
|
||||
130.0,
|
||||
85.0
|
||||
)
|
||||
var river_trench := -5.0 * exp(
|
||||
-pow((world_x - 25.0) / 18.0, 2.0)
|
||||
var ridge := 28.0 * _elliptical_peak(world_x, world_z, -72.0, 18.0, 72.0, 48.0)
|
||||
var eastern_hill := 15.0 * _elliptical_peak(world_x, world_z, 105.0, 65.0, 110.0, 90.0)
|
||||
var southern_hill := (
|
||||
11.0 * _elliptical_peak(world_x, world_z, -35.0, -125.0, 130.0, 85.0)
|
||||
)
|
||||
var river_trench := -5.0 * exp(-pow((world_x - 25.0) / 18.0, 2.0))
|
||||
var broad_slope := maxf(0.0, (-world_x - 30.0) * 0.035)
|
||||
var detail := noise.get_noise_2d(world_x, world_z) * 2.4
|
||||
var height := (
|
||||
ridge
|
||||
+ eastern_hill
|
||||
+ southern_hill
|
||||
+ river_trench
|
||||
+ broad_slope
|
||||
+ detail
|
||||
) * outside_play_area
|
||||
height_map.set_pixel(
|
||||
image_x,
|
||||
image_z,
|
||||
Color(height / HEIGHT_SCALE, 0.0, 0.0, 1.0)
|
||||
(ridge + eastern_hill + southern_hill + river_trench + broad_slope + detail)
|
||||
* outside_play_area
|
||||
)
|
||||
height_map.set_pixel(image_x, image_z, Color(height / HEIGHT_SCALE, 0.0, 0.0, 1.0))
|
||||
|
||||
terrain.data.import_images(
|
||||
[height_map, null, null],
|
||||
Vector3(-HALF_SIZE, 0.0, -HALF_SIZE),
|
||||
0.0,
|
||||
HEIGHT_SCALE
|
||||
[height_map, null, null], Vector3(-HALF_SIZE, 0.0, -HALF_SIZE), 0.0, HEIGHT_SCALE
|
||||
)
|
||||
terrain.data.save_directory(DATA_DIRECTORY)
|
||||
print("[TerrainGenerator] Generated bounded Jajce terrain and textures")
|
||||
quit(0)
|
||||
|
||||
|
||||
func _elliptical_peak(
|
||||
x: float,
|
||||
z: float,
|
||||
center_x: float,
|
||||
center_z: float,
|
||||
width: float,
|
||||
depth: float
|
||||
x: float, z: float, center_x: float, center_z: float, width: float, depth: float
|
||||
) -> float:
|
||||
return exp(
|
||||
-(
|
||||
pow((x - center_x) / width, 2.0)
|
||||
+ pow((z - center_z) / depth, 2.0)
|
||||
)
|
||||
)
|
||||
return exp(-(pow((x - center_x) / width, 2.0) + pow((z - center_z) / depth, 2.0)))
|
||||
|
||||
|
||||
func _generate_texture(
|
||||
file_name: String,
|
||||
dark_color: Color,
|
||||
light_color: Color,
|
||||
seed_value: int
|
||||
file_name: String, dark_color: Color, light_color: Color, seed_value: int
|
||||
) -> void:
|
||||
var noise := FastNoiseLite.new()
|
||||
noise.seed = seed_value
|
||||
|
||||
Reference in New Issue
Block a user