@ -1,22 +0,0 @@ |
|||||||
|
|
||||||
The MIT License (MIT) |
|
||||||
|
|
||||||
Copyright (c) 2021 João Marinheiro |
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
||||||
of this software and associated documentation files (the "Software"), to deal |
|
||||||
in the Software without restriction, including without limitation the rights |
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
||||||
copies of the Software, and to permit persons to whom the Software is |
|
||||||
furnished to do so, subject to the following conditions: |
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all |
|
||||||
copies or substantial portions of the Software. |
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
||||||
SOFTWARE. |
|
||||||
@ -1,5 +1,27 @@ |
|||||||
extends Spatial |
extends Spatial |
||||||
|
|
||||||
|
var rng = RandomNumberGenerator.new() |
||||||
|
|
||||||
func _ready(): |
func _ready(): |
||||||
var mi = Global.terrain.get_data("mesh") |
var mi = Global.terrain.get_data("mesh") |
||||||
add_child(mi) |
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 |
||||||
@ -0,0 +1,5 @@ |
|||||||
|
{ |
||||||
|
"grass": 0, |
||||||
|
"stone": 1, |
||||||
|
"sand": 2 |
||||||
|
} |
||||||
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@ |
|||||||
[gd_resource type="SpatialMaterial" format=2] |
|
||||||
|
|
||||||
[resource] |
|
||||||
albedo_color = Color( 0.125, 0.5, 0.275, 1 ) |
|
||||||
Loading…
Reference in new issue