Adds bushes and flowers to ground tiles

Implements bush and flower spawning on ground tiles based on vegetation density.
Adds new assets for bushes and flowers, and introduces multi-mesh rendering for optimized performance.
Introduces seasonal color variations for vegetation using a shader for bushes and materials for flowers and grass.
Refactors material application into a MaterialManager to handle material assignments over multiple frames.
Moves ground tile scripts into a subfolder.
Adds floating particles to test scene.
This commit is contained in:
Dan Baker 2025-06-29 10:58:18 +01:00
parent ea5006e8a2
commit 3959333534
46 changed files with 559 additions and 77 deletions

View file

@ -25,6 +25,8 @@ func setup_multimesh() -> void:
mm = MultiMesh.new()
mm.transform_format = MultiMesh.TRANSFORM_3D
mm.mesh = grass_mesh
update_shader_parameter('top_color', ColorData.grass_materials[Season.current]['top'])
update_shader_parameter('bottom_color', ColorData.grass_materials[Season.current]['base'])
# Configure instance count
mm.instance_count = parent_node.grass_instance_range
@ -51,3 +53,18 @@ func setup_multimesh() -> void:
multimesh = mm
cast_shadow = GeometryInstance3D.SHADOW_CASTING_SETTING_OFF
func update_shader_parameter(param_name: String, value) -> void:
if material_override == null:
Log.pr("Error: No material override found")
return
# Check if it's a ShaderMaterial
if material_override is ShaderMaterial:
var shader_material = material_override as ShaderMaterial
shader_material.set_shader_parameter(param_name, value)
else:
Log.pr("Error: Material override is not a ShaderMaterial")
return