proto herbe + forêt

herbe
Valentin Stark 3 years ago
parent abe2611f29
commit de366eb096
  1. 22
      world/World3d.gd
  2. 21
      world/game.tscn
  3. BIN
      world/materials/colors.png

@ -29,14 +29,14 @@ func add_trees():
var poisson_disc_sampling: PoissonDiscSampling = PoissonDiscSampling.new() var poisson_disc_sampling: PoissonDiscSampling = PoissonDiscSampling.new()
for center in Global.terrain.get_centers(): 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"): if not center.get_data("water"):
var num = rng.randi_range(0,10) var num = rng.randi_range(0,100)
if num == 1: if center.get_data("forest") or num == 1:
var points2d = poisson_disc_sampling.generate_points(3, center.polygon(), 2) var points2d = poisson_disc_sampling.generate_points(3, center.polygon(), 2)
for point in points2d: for point in points2d:
var tree = treescene.instance() var tree = treescene.instance()
var scaling = rng.randi_range(0.8, 1.2) var scaling = rng.randi_range(0.8, 1.2)
tree.scale = Vector3(scaling, scaling, scaling) tree.scale = Vector3(scaling, scaling, scaling)
tree.rotate_y(rng.randi_range(0, 2*PI)) tree.rotate_y(rng.randi_range(0, 2*PI))
tree.translation = Vector3(point.x, center.get_elevation() * 120, point.y) tree.translation = Vector3(point.x, center.get_elevation() * 120, point.y)
add_child(tree) add_child(tree)

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Loading…
Cancel
Save