Ported to godot 4.6

This commit is contained in:
Rendo 2026-01-28 20:45:54 +05:00
commit cc7c6af33f
3 changed files with 9 additions and 6 deletions

View file

@ -20,7 +20,6 @@ func update_material(substances: Array[RuntimeSubstanceData]) -> void:
for sub in substances:
total_weight += sub.amount
var alpha: float = 0
var pH: float = 0
var color: Color = Color(0,0,0,0)
@ -31,15 +30,14 @@ func update_material(substances: Array[RuntimeSubstanceData]) -> void:
for sub: RuntimeSubstanceData in substances:
var weight: float = sub.amount/total_weight
if display_type == DisplayType.Fluid:
alpha += sub.substance.liquid_transparency * weight
pass
if sub.substance.pHColor != null:
color += sub.substance.pHColor.sample(pH/14.0) * weight
else:
color += sub.substance.color * weight
if display_type == DisplayType.Fluid:
alpha /= len(substances)
color.a = alpha
pass
mat.albedo_color = color