pH
This commit is contained in:
parent
bd87ccf871
commit
6fcca904a1
11 changed files with 92 additions and 9 deletions
|
|
@ -21,17 +21,27 @@ func update_material(substances: Array[RuntimeSubstanceData]) -> void:
|
|||
total_weight += sub.amount
|
||||
|
||||
var alpha: float = 0
|
||||
var color: Color = Color.WHITE
|
||||
var pH: float = 0
|
||||
var color: Color = Color(0,0,0,0)
|
||||
|
||||
for sub in substances:
|
||||
for sub: RuntimeSubstanceData in substances:
|
||||
var weight: float = sub.amount/total_weight
|
||||
pH += sub.substance.pH * weight
|
||||
|
||||
for sub: RuntimeSubstanceData in substances:
|
||||
var weight: float = sub.amount/total_weight
|
||||
if display_type == DisplayType.Fluid:
|
||||
alpha += sub.substance.liquid_transparency
|
||||
color = color.lerp(sub.substance.color,sub.amount/total_weight
|
||||
)
|
||||
alpha += sub.substance.liquid_transparency * weight
|
||||
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
|
||||
|
||||
|
||||
mat.albedo_color = color
|
||||
|
||||
func update_material_unfiltered(substances: Array[RuntimeSubstanceData]):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue