add cell-span grid with resize handles, 3d water surface effect, and shader preset system with double-click popup menu
This commit is contained in:
parent
7cfbf72ca5
commit
9cbb54cc39
3 changed files with 721 additions and 252 deletions
128
scripts/shader_presets.gd
Normal file
128
scripts/shader_presets.gd
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
class_name ShaderPresets
|
||||
# Collection of vial_fill shader presets.
|
||||
# Each preset is a Dictionary with a "name" key and shader-parameter key/value pairs.
|
||||
# Use apply_preset(module, preset_name) to set parameters on a module's ShaderMaterial.
|
||||
|
||||
static var presets: Array[Dictionary] = [
|
||||
{
|
||||
"name": "Vivid Vial",
|
||||
"liquid_color": Color(0.2, 0.5, 0.8, 1.0),
|
||||
"wave_amp": 0.012,
|
||||
"wave_freq": 4.0,
|
||||
"wave_strength": 0.05,
|
||||
"ripple_speed": 1.0,
|
||||
"edge_color": Color(0.3, 0.6, 1.0, 1.0),
|
||||
"glow_intensity": 1.5,
|
||||
"edge_pulse": 1.0,
|
||||
"noise_scale": 1.0,
|
||||
"swirl_strength": 0.5,
|
||||
"hue_shift_speed": 0.0,
|
||||
},
|
||||
{
|
||||
"name": "Emerald Deep",
|
||||
"liquid_color": Color(0.1, 0.6, 0.3, 1.0),
|
||||
"wave_amp": 0.015,
|
||||
"wave_freq": 5.0,
|
||||
"wave_strength": 0.08,
|
||||
"ripple_speed": 0.8,
|
||||
"edge_color": Color(0.2, 0.8, 0.5, 1.0),
|
||||
"glow_intensity": 1.2,
|
||||
"edge_pulse": 0.8,
|
||||
"noise_scale": 1.2,
|
||||
"swirl_strength": 0.3,
|
||||
"hue_shift_speed": 0.0,
|
||||
},
|
||||
{
|
||||
"name": "Lava Flow",
|
||||
"liquid_color": Color(0.8, 0.2, 0.05, 1.0),
|
||||
"wave_amp": 0.025,
|
||||
"wave_freq": 3.0,
|
||||
"wave_strength": 0.15,
|
||||
"ripple_speed": 0.5,
|
||||
"edge_color": Color(1.0, 0.5, 0.1, 1.0),
|
||||
"glow_intensity": 2.0,
|
||||
"edge_pulse": 1.5,
|
||||
"noise_scale": 0.8,
|
||||
"swirl_strength": 1.0,
|
||||
"hue_shift_speed": 0.0,
|
||||
},
|
||||
{
|
||||
"name": "Neon Dream",
|
||||
"liquid_color": Color(0.6, 0.2, 0.9, 1.0),
|
||||
"wave_amp": 0.01,
|
||||
"wave_freq": 6.0,
|
||||
"wave_strength": 0.06,
|
||||
"ripple_speed": 2.0,
|
||||
"edge_color": Color(0.7, 0.3, 1.0, 1.0),
|
||||
"glow_intensity": 2.5,
|
||||
"edge_pulse": 1.2,
|
||||
"noise_scale": 1.5,
|
||||
"swirl_strength": 0.8,
|
||||
"hue_shift_speed": 0.0,
|
||||
},
|
||||
{
|
||||
"name": "Deep Purple",
|
||||
"liquid_color": Color(0.3, 0.1, 0.5, 1.0),
|
||||
"wave_amp": 0.008,
|
||||
"wave_freq": 3.5,
|
||||
"wave_strength": 0.04,
|
||||
"ripple_speed": 0.6,
|
||||
"edge_color": Color(0.5, 0.2, 0.8, 1.0),
|
||||
"glow_intensity": 1.0,
|
||||
"edge_pulse": 0.7,
|
||||
"noise_scale": 1.0,
|
||||
"swirl_strength": 0.4,
|
||||
"hue_shift_speed": 0.0,
|
||||
},
|
||||
{
|
||||
"name": "Rainbow Swirl",
|
||||
"liquid_color": Color(0.3, 0.5, 0.8, 1.0),
|
||||
"wave_amp": 0.012,
|
||||
"wave_freq": 4.0,
|
||||
"wave_strength": 0.1,
|
||||
"ripple_speed": 1.5,
|
||||
"edge_color": Color(0.5, 0.7, 1.0, 1.0),
|
||||
"glow_intensity": 1.5,
|
||||
"edge_pulse": 1.0,
|
||||
"noise_scale": 1.5,
|
||||
"swirl_strength": 1.2,
|
||||
"hue_shift_speed": 1.5,
|
||||
},
|
||||
{
|
||||
"name": "Frostbite",
|
||||
"liquid_color": Color(0.5, 0.8, 1.0, 1.0),
|
||||
"wave_amp": 0.006,
|
||||
"wave_freq": 7.0,
|
||||
"wave_strength": 0.03,
|
||||
"ripple_speed": 2.5,
|
||||
"edge_color": Color(0.7, 0.9, 1.0, 1.0),
|
||||
"glow_intensity": 0.8,
|
||||
"edge_pulse": 0.5,
|
||||
"noise_scale": 2.0,
|
||||
"swirl_strength": 0.2,
|
||||
"hue_shift_speed": 0.0,
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
static func get_preset_names() -> PackedStringArray:
|
||||
var names: PackedStringArray = []
|
||||
for p in presets:
|
||||
names.append(p["name"])
|
||||
return names
|
||||
|
||||
|
||||
static func apply_preset(module: Control, preset_name: String) -> void:
|
||||
var vial_fill: ColorRect = module.find_child("VialFill", true, false)
|
||||
if vial_fill == null:
|
||||
return
|
||||
var mat := vial_fill.material as ShaderMaterial
|
||||
if mat == null:
|
||||
return
|
||||
for p in presets:
|
||||
if p["name"] == preset_name:
|
||||
for key in p:
|
||||
if key == "name":
|
||||
continue
|
||||
mat.set_shader_parameter(key, p[key])
|
||||
return
|
||||
Loading…
Add table
Add a link
Reference in a new issue