Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack253-png committed Sep 21, 2024
1 parent 5b53017 commit 03ce246
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ package com.primogemstudio.advancedfmk.flutter
data class FlutterComposeData(
var blurRadius: Int = 0,
var blurType: Int = 0,
var noise: Float = 0f
var noise: Float = 0f,
var opacity: Float = 1f
)
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class FlutterInstance(assets: String?, val rect: FlutterRect, var width: Int, va
private val cleaner: Cleaner.Cleanable
val handle: Long = FlutterNative.createInstance(assets)
var pressed: Boolean = false
val composeData = FlutterComposeData()
val composeData = FlutterComposeData(blurRadius = 8)

init {
sendSizeEvent()
Expand Down Expand Up @@ -88,6 +88,7 @@ class FlutterInstance(assets: String?, val rect: FlutterRect, var width: Int, va
POST_BLUR.setUniformValue("Radius", composeData.blurRadius)
POST_BLUR.setUniformValue("DigType", composeData.blurType)
POST_BLUR.setUniformValue("NoiseStrength", composeData.noise)
POST_BLUR.setUniformValue("Opacity", composeData.opacity)
POST_BLUR.render(0f)
// -Dorg.lwjgl.glfw.libname=/usr/lib/libglfw.so
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ private void flipFrame(DeltaTracker deltaTracker, boolean renderLevel, CallbackI
instance.getComposeData().setBlurType(1);
instance.getComposeData().setBlurRadius(8);
instance.getComposeData().setNoise(0.005f);
instance.getComposeData().setOpacity(0.8f);
}
instance.pollEvents();
instance.renderToScreen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ uniform vec4 ColorModulate;
uniform int Radius;
uniform int DigType;
uniform float NoiseStrength;
uniform float Opacity;

in vec2 texCoord;
in vec2 oneTexel;
Expand Down Expand Up @@ -68,9 +69,7 @@ void main() {
return;
}

col.a = 0.88;

fragColor = mix(DigType == 0 ? blur(Radius) : blur_dig2(Radius), vec4(col.xyz, 1.0), col.a);
fragColor = mix(DigType == 0 ? blur(Radius) : blur_dig2(Radius), vec4(col.xyz, 1.0), col.a * Opacity);
fragColor.x += random(dst.xy * 0.03125 * texCoord) * NoiseStrength;
fragColor.y += random(dst.xz * 0.03125 * texCoord) * NoiseStrength;
fragColor.z += random(dst.yz * 0.03125 * texCoord) * NoiseStrength;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@
"values": [
0
]
},
{
"name": "Opacity",
"type": "float",
"count": 1,
"values": [
1
]
}
]
}

0 comments on commit 03ce246

Please sign in to comment.