feat: scale village queries and enrich Jajce center
This commit is contained in:
+84
-20
@@ -7,9 +7,9 @@ enum CanopyVariant {
|
||||
}
|
||||
|
||||
const COLORS := {
|
||||
CanopyVariant.GREEN: Color(0.19, 0.38, 0.17),
|
||||
CanopyVariant.DARK_GREEN: Color(0.12, 0.30, 0.12),
|
||||
CanopyVariant.YELLOW_GREEN: Color(0.30, 0.42, 0.15),
|
||||
CanopyVariant.GREEN: Color(0.18, 0.39, 0.16),
|
||||
CanopyVariant.DARK_GREEN: Color(0.10, 0.28, 0.12),
|
||||
CanopyVariant.YELLOW_GREEN: Color(0.34, 0.47, 0.16),
|
||||
}
|
||||
|
||||
const WIND_SHADER := preload("res://world/jajce/materials/wind.gdshader")
|
||||
@@ -25,13 +25,14 @@ func _ready() -> void:
|
||||
var rng := RandomNumberGenerator.new()
|
||||
rng.seed = hash_seed
|
||||
var canopy_variant := rng.randi() % COLORS.size() as CanopyVariant
|
||||
var canopy_radius := 1.0 + rng.randf() * 0.8
|
||||
var canopy_radius := 1.0 + rng.randf() * 0.55
|
||||
var wind_phase := rng.randf_range(0.0, TAU)
|
||||
|
||||
var trunk_mesh := CylinderMesh.new()
|
||||
trunk_mesh.top_radius = 0.22
|
||||
trunk_mesh.bottom_radius = 0.32
|
||||
trunk_mesh.height = 2.8
|
||||
trunk_mesh.height = 3.4
|
||||
trunk_mesh.radial_segments = 9
|
||||
|
||||
var trunk_mat := StandardMaterial3D.new()
|
||||
trunk_mat.albedo_color = Color(0.27, 0.16, 0.09)
|
||||
@@ -41,24 +42,87 @@ func _ready() -> void:
|
||||
var trunk := MeshInstance3D.new()
|
||||
trunk.name = "Trunk"
|
||||
trunk.mesh = trunk_mesh
|
||||
trunk.position = Vector3(0, 1.4, 0)
|
||||
trunk.position = Vector3(0, 1.7, 0)
|
||||
add_child(trunk)
|
||||
|
||||
var canopy_mesh := SphereMesh.new()
|
||||
canopy_mesh.radius = canopy_radius
|
||||
canopy_mesh.height = 2.4
|
||||
_add_branch(Vector3(-0.18, 2.45, 0.0), Vector3(0.0, 0.0, 42.0), 1.45, trunk_mat)
|
||||
_add_branch(Vector3(0.2, 2.6, 0.08), Vector3(24.0, 0.0, -38.0), 1.25, trunk_mat)
|
||||
|
||||
var canopy_mat := ShaderMaterial.new()
|
||||
canopy_mat.shader = WIND_SHADER
|
||||
canopy_mat.set_shader_parameter("albedo", COLORS[canopy_variant])
|
||||
canopy_mat.set_shader_parameter("roughness", 0.9)
|
||||
canopy_mat.set_shader_parameter("wind_strength", WIND_STRENGTH)
|
||||
canopy_mat.set_shader_parameter("wind_speed", WIND_SPEED)
|
||||
canopy_mat.set_shader_parameter("wind_phase", wind_phase)
|
||||
canopy_mesh.material = canopy_mat
|
||||
var canopy_color: Color = COLORS[canopy_variant]
|
||||
var crown_height := 3.7 + (canopy_radius - 1.2) * 0.45
|
||||
_add_canopy(
|
||||
"Canopy",
|
||||
Vector3(0.0, crown_height, 0.0),
|
||||
Vector3(canopy_radius * 1.12, canopy_radius, canopy_radius),
|
||||
canopy_color,
|
||||
wind_phase
|
||||
)
|
||||
_add_canopy(
|
||||
"CanopyLeft",
|
||||
Vector3(-0.82, crown_height - 0.15, 0.1),
|
||||
Vector3(canopy_radius * 0.78, canopy_radius * 0.72, canopy_radius * 0.76),
|
||||
canopy_color.lightened(0.05),
|
||||
wind_phase + 0.12
|
||||
)
|
||||
_add_canopy(
|
||||
"CanopyRight",
|
||||
Vector3(0.78, crown_height - 0.05, -0.12),
|
||||
Vector3(canopy_radius * 0.74, canopy_radius * 0.68, canopy_radius * 0.72),
|
||||
canopy_color.darkened(0.04),
|
||||
wind_phase - 0.1
|
||||
)
|
||||
_add_canopy(
|
||||
"CanopyTop",
|
||||
Vector3(0.08, crown_height + 0.72, 0.04),
|
||||
Vector3(canopy_radius * 0.72, canopy_radius * 0.66, canopy_radius * 0.7),
|
||||
canopy_color.lightened(0.08),
|
||||
wind_phase + 0.05
|
||||
)
|
||||
|
||||
|
||||
func _add_branch(
|
||||
branch_position: Vector3,
|
||||
branch_rotation_degrees: Vector3,
|
||||
branch_height: float,
|
||||
material: StandardMaterial3D
|
||||
) -> void:
|
||||
var mesh := CylinderMesh.new()
|
||||
mesh.top_radius = 0.08
|
||||
mesh.bottom_radius = 0.14
|
||||
mesh.height = branch_height
|
||||
mesh.radial_segments = 7
|
||||
mesh.material = material
|
||||
var branch := MeshInstance3D.new()
|
||||
branch.name = "Branch"
|
||||
branch.mesh = mesh
|
||||
branch.position = branch_position
|
||||
branch.rotation_degrees = branch_rotation_degrees
|
||||
add_child(branch)
|
||||
|
||||
|
||||
func _add_canopy(
|
||||
canopy_name: String,
|
||||
canopy_position: Vector3,
|
||||
canopy_scale: Vector3,
|
||||
canopy_color: Color,
|
||||
wind_phase: float
|
||||
) -> void:
|
||||
var mesh := SphereMesh.new()
|
||||
mesh.radius = 1.0
|
||||
mesh.height = 2.0
|
||||
mesh.radial_segments = 12
|
||||
mesh.rings = 6
|
||||
var material := ShaderMaterial.new()
|
||||
material.shader = WIND_SHADER
|
||||
material.set_shader_parameter("albedo", canopy_color)
|
||||
material.set_shader_parameter("roughness", 0.9)
|
||||
material.set_shader_parameter("wind_strength", WIND_STRENGTH)
|
||||
material.set_shader_parameter("wind_speed", WIND_SPEED)
|
||||
material.set_shader_parameter("wind_phase", wind_phase)
|
||||
mesh.material = material
|
||||
var canopy := MeshInstance3D.new()
|
||||
canopy.name = "Canopy"
|
||||
canopy.mesh = canopy_mesh
|
||||
canopy.position = Vector3(0, 3.2 + (canopy_radius - 1.35) * 0.5, 0)
|
||||
canopy.name = canopy_name
|
||||
canopy.mesh = mesh
|
||||
canopy.position = canopy_position
|
||||
canopy.scale = canopy_scale
|
||||
add_child(canopy)
|
||||
|
||||
Reference in New Issue
Block a user