mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Add simple_shader (#1668)
* Add `simple_shader` * Add NL at EOF * Adopt `analysis_defaults` * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Update simple_shader/shaders/simple.frag Co-authored-by: Jonah Williams <jonahwilliams@google.com> * Apply `clang-format` to `shaders/simple.frag` --------- Co-authored-by: Jonah Williams <jonahwilliams@google.com>
This commit is contained in:
25
simple_shader/shaders/simple.frag
Normal file
25
simple_shader/shaders/simple.frag
Normal file
@@ -0,0 +1,25 @@
|
||||
#version 460 core
|
||||
|
||||
#include <flutter/runtime_effect.glsl>
|
||||
|
||||
precision mediump float;
|
||||
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
layout(location = 0) uniform vec2 resolution;
|
||||
|
||||
vec3 flutterNavy = vec3(4, 43, 89) / 255;
|
||||
vec3 flutterBlue = vec3(5, 83, 177) / 255;
|
||||
vec3 flutterSky = vec3(2, 125, 253) / 255;
|
||||
|
||||
void main() {
|
||||
vec2 st = FlutterFragCoord().xy / resolution.xy;
|
||||
|
||||
vec3 color = vec3(0.0);
|
||||
vec3 percent = vec3((st.x + st.y) / 2);
|
||||
|
||||
color =
|
||||
mix(mix(flutterSky, flutterBlue, percent * 2),
|
||||
mix(flutterBlue, flutterNavy, percent * 2 - 1), step(0.5, percent));
|
||||
|
||||
fragColor = vec4(color, 1);
|
||||
}
|
||||
Reference in New Issue
Block a user