Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
437623c9
Unverified
Commit
437623c9
authored
Aug 04, 2022
by
Zachary Anderson
Committed by
GitHub
Aug 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't duplicate SkSL builtin function 'saturate' (#108946)
parent
f5cecd04
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
ink_sparkle.frag
packages/flutter/lib/src/material/shaders/ink_sparkle.frag
+3
-7
No files found.
packages/flutter/lib/src/material/shaders/ink_sparkle.frag
View file @
437623c9
...
@@ -34,10 +34,6 @@ const float PI_ROTATE_LEFT = PI * -0.0078125;
...
@@ -34,10 +34,6 @@ const float PI_ROTATE_LEFT = PI * -0.0078125;
const
float
ONE_THIRD
=
1
.
/
3
.;
const
float
ONE_THIRD
=
1
.
/
3
.;
const
vec2
TURBULENCE_SCALE
=
vec2
(
0
.
8
);
const
vec2
TURBULENCE_SCALE
=
vec2
(
0
.
8
);
float
saturate
(
float
x
)
{
return
clamp
(
x
,
0
.
0
,
1
.
0
);
}
float
triangle_noise
(
highp
vec2
n
)
{
float
triangle_noise
(
highp
vec2
n
)
{
n
=
fract
(
n
*
vec2
(
5
.
3987
,
5
.
4421
));
n
=
fract
(
n
*
vec2
(
5
.
3987
,
5
.
4421
));
n
+=
dot
(
n
.
yx
,
n
.
xy
+
vec2
(
21
.
5351
,
14
.
3137
));
n
+=
dot
(
n
.
yx
,
n
.
xy
+
vec2
(
21
.
5351
,
14
.
3137
));
...
@@ -62,7 +58,7 @@ float soft_circle(vec2 uv, vec2 xy, float radius, float blur) {
...
@@ -62,7 +58,7 @@ float soft_circle(vec2 uv, vec2 xy, float radius, float blur) {
float
soft_ring
(
vec2
uv
,
vec2
xy
,
float
radius
,
float
thickness
,
float
blur
)
{
float
soft_ring
(
vec2
uv
,
vec2
xy
,
float
radius
,
float
thickness
,
float
blur
)
{
float
circle_outer
=
soft_circle
(
uv
,
xy
,
radius
+
thickness
,
blur
);
float
circle_outer
=
soft_circle
(
uv
,
xy
,
radius
+
thickness
,
blur
);
float
circle_inner
=
soft_circle
(
uv
,
xy
,
max
(
radius
-
thickness
,
0
.
0
),
blur
);
float
circle_inner
=
soft_circle
(
uv
,
xy
,
max
(
radius
-
thickness
,
0
.
0
),
blur
);
return
saturate
(
circle_outer
-
circle_inner
);
return
clamp
(
circle_outer
-
circle_inner
,
0
.
0
,
1
.
0
);
}
}
float
circle_grid
(
vec2
resolution
,
vec2
p
,
vec2
xy
,
vec2
rotation
,
float
cell_diameter
)
{
float
circle_grid
(
vec2
resolution
,
vec2
p
,
vec2
xy
,
vec2
rotation
,
float
cell_diameter
)
{
...
@@ -79,7 +75,7 @@ float sparkle(vec2 uv, float t) {
...
@@ -79,7 +75,7 @@ float sparkle(vec2 uv, float t) {
s
+=
threshold
(
n
+
sin
(
PI
*
(
t
+
0
.
35
)),
0
.
1
,
0
.
15
);
s
+=
threshold
(
n
+
sin
(
PI
*
(
t
+
0
.
35
)),
0
.
1
,
0
.
15
);
s
+=
threshold
(
n
+
sin
(
PI
*
(
t
+
0
.
7
)),
0
.
2
,
0
.
25
);
s
+=
threshold
(
n
+
sin
(
PI
*
(
t
+
0
.
7
)),
0
.
2
,
0
.
25
);
s
+=
threshold
(
n
+
sin
(
PI
*
(
t
+
1
.
05
)),
0
.
3
,
0
.
35
);
s
+=
threshold
(
n
+
sin
(
PI
*
(
t
+
1
.
05
)),
0
.
3
,
0
.
35
);
return
saturate
(
s
)
*
0
.
55
;
return
clamp
(
s
,
0
.
0
,
1
.
0
)
*
0
.
55
;
}
}
float
turbulence
(
vec2
uv
)
{
float
turbulence
(
vec2
uv
)
{
...
@@ -88,7 +84,7 @@ float turbulence(vec2 uv) {
...
@@ -88,7 +84,7 @@ float turbulence(vec2 uv) {
float
g2
=
circle_grid
(
TURBULENCE_SCALE
,
uv_scale
,
u_circle2
,
u_rotation2
,
0
.
2
);
float
g2
=
circle_grid
(
TURBULENCE_SCALE
,
uv_scale
,
u_circle2
,
u_rotation2
,
0
.
2
);
float
g3
=
circle_grid
(
TURBULENCE_SCALE
,
uv_scale
,
u_circle3
,
u_rotation3
,
0
.
275
);
float
g3
=
circle_grid
(
TURBULENCE_SCALE
,
uv_scale
,
u_circle3
,
u_rotation3
,
0
.
275
);
float
v
=
(
g1
*
g1
+
g2
-
g3
)
*
0
.
5
;
float
v
=
(
g1
*
g1
+
g2
-
g3
)
*
0
.
5
;
return
saturate
(
0
.
45
+
0
.
8
*
v
);
return
clamp
(
0
.
45
+
0
.
8
*
v
,
0
.
0
,
1
.
0
);
}
}
void
main
()
{
void
main
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment