-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
205 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@tool | ||
@icon("noise_painter.svg") | ||
class_name NoisePainter | ||
extends Modifier | ||
## Replaces the tiles in the map with [param tile] based on a noise texture. | ||
## | ||
## Useful for placing ores or decorations. | ||
|
||
|
||
@export var noise: FastNoiseLite = FastNoiseLite.new() | ||
@export var random_noise_seed := true | ||
@export var tile: TileInfo | ||
## Any values in the noise texture that go above this threshold | ||
## will be replaced with [param tile]. (-1.0 is black, 1.0 is white) | ||
@export var threshold: float = 0.6 | ||
@export_group("Bounds") | ||
## Leave any or both axis as [code]inf[/code] to not have any limits. | ||
@export var max := Vector2(INF, INF) | ||
## Leave any or both axis as [code]-inf[/code] to not have any limits. | ||
@export var min := Vector2(-INF, -INF) | ||
|
||
|
||
func apply(grid: Dictionary, _generator: GaeaGenerator) -> Dictionary: | ||
if random_noise_seed: | ||
noise.seed = randi() | ||
|
||
for tile_pos in grid.keys(): | ||
if _is_out_of_bounds(tile_pos): | ||
continue | ||
if noise.get_noise_2dv(tile_pos) > threshold: | ||
grid[tile_pos] = tile | ||
return grid | ||
|
||
|
||
func _is_out_of_bounds(tile_pos: Vector2) -> bool: | ||
return tile_pos.x > max.x or tile_pos.y > max.y or tile_pos.x < min.x or tile_pos.y < min.y |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[remap] | ||
|
||
importer="texture" | ||
type="CompressedTexture2D" | ||
uid="uid://b8v10j7odcypp" | ||
path="res://.godot/imported/noise_painter.svg-96075148f66f2f08ed38499ed61359ae.ctex" | ||
metadata={ | ||
"has_editor_variant": true, | ||
"vram_texture": false | ||
} | ||
|
||
[deps] | ||
|
||
source_file="res://addons/gaea/modifiers/noise_painter.svg" | ||
dest_files=["res://.godot/imported/noise_painter.svg-96075148f66f2f08ed38499ed61359ae.ctex"] | ||
|
||
[params] | ||
|
||
compress/mode=0 | ||
compress/high_quality=false | ||
compress/lossy_quality=0.7 | ||
compress/hdr_compression=1 | ||
compress/normal_map=0 | ||
compress/channel_pack=0 | ||
mipmaps/generate=false | ||
mipmaps/limit=-1 | ||
roughness/mode=0 | ||
roughness/src_normal="" | ||
process/fix_alpha_border=true | ||
process/premult_alpha=false | ||
process/normal_map_invert_y=false | ||
process/hdr_as_srgb=false | ||
process/hdr_clamp_exposure=false | ||
process/size_limit=0 | ||
detect_3d/compress_to=1 | ||
svg/scale=1.0 | ||
editor/scale_with_editor_scale=true | ||
editor/convert_colors_with_editor_theme=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.