mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-09 07:20:04 -04:00
improve fog color transition
This commit is contained in:
parent
3fada12014
commit
b6b106ef83
@ -94,13 +94,17 @@ class FogManager(
|
||||
val progress = delta / INTERPOLATE_DURATION.toFloat()
|
||||
state.start = interpolateLinear(progress, interpolation.start, options?.start ?: 0.0f)
|
||||
state.end = interpolateLinear(progress, interpolation.end, options?.end ?: 0.0f)
|
||||
var color: RGBColor? = interpolateSine(progress, interpolation.color ?: Colors.TRANSPARENT, options?.color ?: Colors.TRANSPARENT)
|
||||
|
||||
val sourceColor = interpolation.color ?: options?.color ?: Colors.TRANSPARENT
|
||||
val targetColor = options?.color ?: RGBColor(sourceColor.red, sourceColor.green, sourceColor.blue, 0x00)
|
||||
var color: RGBColor? = interpolateSine(progress, sourceColor, targetColor)
|
||||
if (color == Colors.TRANSPARENT) {
|
||||
color = null
|
||||
}
|
||||
state.color = color
|
||||
if (progress >= 1.0f) {
|
||||
interpolation.change = 1L // this avoid further interpolations with the same data
|
||||
interpolation.color = options?.color
|
||||
}
|
||||
|
||||
state.revision++
|
||||
|
@ -60,7 +60,7 @@ void fog_mix_alpha(float alpha) {
|
||||
}
|
||||
|
||||
void fog_mix_color(float alpha) {
|
||||
foutColor.rgb = mix(uFogColor.rgb, foutColor.rgb, foutColor.a * alpha);
|
||||
foutColor.rgb = mix(uFogColor.rgb, foutColor.rgb, foutColor.a * alpha);// uFogColor.a *
|
||||
foutColor.a = 1.0f;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user