parent
c1d0a422fb
commit
04321706ab
@ -1,5 +1,27 @@ |
||||
extends Spatial |
||||
|
||||
var rng = RandomNumberGenerator.new() |
||||
|
||||
func _ready(): |
||||
var mi = Global.terrain.get_data("mesh") |
||||
add_child(mi) |
||||
add_trees() |
||||
|
||||
func add_trees(): |
||||
rng.randomize() |
||||
var treescene = load("res://entities/environment/birchtree/birchtree.tscn") |
||||
var poisson_disc_sampling: PoissonDiscSampling = PoissonDiscSampling.new() |
||||
|
||||
for center in Global.terrain.get_centers(): |
||||
if not center.get_data("water") and not center.get_data("coast") and not center.get_data("mountain"): |
||||
var num = rng.randi_range(0,10) |
||||
if num == 1: |
||||
var points2d = poisson_disc_sampling.generate_points(3, center.polygon(), 2) |
||||
for point in points2d: |
||||
# print(point) |
||||
var tree = treescene.instance() |
||||
var scaling = rng.randi_range(0.8, 1.2) |
||||
tree.scale = Vector3(scaling, scaling, scaling) |
||||
tree.rotate_y(rng.randi_range(0, 2*PI)) |
||||
tree.translation = Vector3(point.x, center.get_elevation() * 120, point.y) |
||||
add_child(tree) |
||||
|
||||
|
After Width: | Height: | Size: 489 B |
@ -0,0 +1,35 @@ |
||||
[remap] |
||||
|
||||
importer="texture" |
||||
type="StreamTexture" |
||||
path="res://.import/colors.png-904d72771a067b8e29c211e8b0822e27.stex" |
||||
metadata={ |
||||
"vram_texture": false |
||||
} |
||||
|
||||
[deps] |
||||
|
||||
source_file="res://world/materials/colors.png" |
||||
dest_files=[ "res://.import/colors.png-904d72771a067b8e29c211e8b0822e27.stex" ] |
||||
|
||||
[params] |
||||
|
||||
compress/mode=0 |
||||
compress/lossy_quality=0.7 |
||||
compress/hdr_mode=0 |
||||
compress/bptc_ldr=0 |
||||
compress/normal_map=0 |
||||
flags/repeat=0 |
||||
flags/filter=false |
||||
flags/mipmaps=false |
||||
flags/anisotropic=false |
||||
flags/srgb=2 |
||||
process/fix_alpha_border=true |
||||
process/premult_alpha=false |
||||
process/HDR_as_SRGB=false |
||||
process/invert_color=false |
||||
process/normal_map_invert_y=false |
||||
stream=false |
||||
size_limit=0 |
||||
detect_3d=false |
||||
svg/scale=1.0 |
||||
Binary file not shown.
@ -1,4 +1,5 @@ |
||||
[gd_resource type="SpatialMaterial" format=2] |
||||
|
||||
[resource] |
||||
params_diffuse_mode = 1 |
||||
albedo_color = Color( 0.125, 0.5, 0.275, 1 ) |
||||
|
||||
Loading…
Reference in new issue