feat(art): add storybook meadow and woodland villagers

This commit is contained in:
Rijad Zuzo
2026-09-05 18:56:44 +02:00
parent 6aae41d36f
commit da3bed67a0
60 changed files with 1222 additions and 373 deletions
+27
View File
@@ -1,18 +1,45 @@
extends Node
const SHADER_INTERACTOR_LIMIT := 8
const CLEARING_LIMIT := 4
@export var grass_material: ShaderMaterial
@export_range(1, SHADER_INTERACTOR_LIMIT, 1) var max_interactors := 8
@export_range(0.02, 0.5, 0.01) var update_interval := 0.08
@export var path_clearings: Array[NodePath] = []
var _elapsed := 0.0
func _ready() -> void:
# JajceWorld first isolates its mutable materials in the parent's _ready().
call_deferred("_configure_path_clearings")
_refresh_interactors()
func _configure_path_clearings() -> void:
if grass_material == null:
return
var segments := PackedVector4Array()
segments.resize(CLEARING_LIMIT)
var widths := Vector4.ZERO
var count := 0
for path in path_clearings.slice(0, CLEARING_LIMIT):
var strip := get_node_or_null(path) as MeshInstance3D
if strip == null or not strip.mesh is BoxMesh:
continue
var box := strip.mesh as BoxMesh
var half_length := strip.global_basis.z * box.size.z * 0.5
var start := strip.global_position - half_length
var end := strip.global_position + half_length
segments[count] = Vector4(start.x, start.z, end.x, end.z)
widths[count] = strip.global_basis.x.length() * box.size.x * 0.5 + 0.12
count += 1
grass_material.set_shader_parameter("clearing_count", count)
grass_material.set_shader_parameter("clearing_segments", segments)
grass_material.set_shader_parameter("clearing_half_widths", widths)
func _process(delta: float) -> void:
_elapsed += delta
if _elapsed < update_interval: