mirror of
https://github.com/AntoineHX/LivingMachine.git
synced 2025-05-05 06:10:45 +02:00
Ajout de la bibli SFML (A)
This commit is contained in:
parent
73704e5139
commit
cca7498ca2
204 changed files with 26813 additions and 0 deletions
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
|
@ -0,0 +1,11 @@
|
|||
#version 150
|
||||
|
||||
uniform sampler2D texture;
|
||||
|
||||
in vec2 tex_coord;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Read and apply a color from the texture
|
||||
gl_FragColor = texture2D(texture, tex_coord);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
#version 150
|
||||
|
||||
// The render target's resolution (used for scaling)
|
||||
uniform vec2 resolution;
|
||||
|
||||
// The billboards' size
|
||||
uniform vec2 size;
|
||||
|
||||
// Input is the passed point cloud
|
||||
layout (points) in;
|
||||
|
||||
// The output will consist of triangle strips with four vertices each
|
||||
layout (triangle_strip, max_vertices = 4) out;
|
||||
|
||||
// Output texture coordinates
|
||||
out vec2 tex_coord;
|
||||
|
||||
// Main entry point
|
||||
void main()
|
||||
{
|
||||
// Caculate the half width/height of the billboards
|
||||
vec2 half_size = size / 2.f;
|
||||
|
||||
// Scale the size based on resolution (1 would be full width/height)
|
||||
half_size /= resolution;
|
||||
|
||||
// Iterate over all vertices
|
||||
for (int i = 0; i < gl_in.length(); i++)
|
||||
{
|
||||
// Retrieve the passed vertex position
|
||||
vec2 pos = gl_in[i].gl_Position.xy;
|
||||
|
||||
// Bottom left vertex
|
||||
gl_Position = vec4(pos - half_size, 0.f, 1.f);
|
||||
tex_coord = vec2(1.f, 1.f);
|
||||
EmitVertex();
|
||||
|
||||
// Bottom right vertex
|
||||
gl_Position = vec4(pos.x + half_size.x, pos.y - half_size.y, 0.f, 1.f);
|
||||
tex_coord = vec2(0.f, 1.f);
|
||||
EmitVertex();
|
||||
|
||||
// Top left vertex
|
||||
gl_Position = vec4(pos.x - half_size.x, pos.y + half_size.y, 0.f, 1.f);
|
||||
tex_coord = vec2(1.f, 0.f);
|
||||
EmitVertex();
|
||||
|
||||
// Top right vertex
|
||||
gl_Position = vec4(pos + half_size, 0.f, 1.f);
|
||||
tex_coord = vec2(0.f, 0.f);
|
||||
EmitVertex();
|
||||
|
||||
// And finalize the primitive
|
||||
EndPrimitive();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
void main()
|
||||
{
|
||||
// Transform the vertex position
|
||||
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
uniform sampler2D texture;
|
||||
uniform float blink_alpha;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pixel = gl_Color;
|
||||
pixel.a = blink_alpha;
|
||||
gl_FragColor = pixel;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
uniform sampler2D texture;
|
||||
uniform float blur_radius;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 offx = vec2(blur_radius, 0.0);
|
||||
vec2 offy = vec2(0.0, blur_radius);
|
||||
|
||||
vec4 pixel = texture2D(texture, gl_TexCoord[0].xy) * 4.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx) * 2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offy) * 2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;
|
||||
|
||||
gl_FragColor = gl_Color * (pixel / 16.0);
|
||||
}
|
BIN
code/SFML-2.4.2/share/SFML/examples/shader/resources/devices.png
Normal file
BIN
code/SFML-2.4.2/share/SFML/examples/shader/resources/devices.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 50 KiB |
|
@ -0,0 +1,32 @@
|
|||
uniform sampler2D texture;
|
||||
uniform float edge_threshold;
|
||||
|
||||
void main()
|
||||
{
|
||||
const float offset = 1.0 / 512.0;
|
||||
vec2 offx = vec2(offset, 0.0);
|
||||
vec2 offy = vec2(0.0, offset);
|
||||
|
||||
vec4 hEdge = texture2D(texture, gl_TexCoord[0].xy - offy) * -2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offy) * 2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx - offy) * -1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx + offy) * 1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx - offy) * -1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx + offy) * 1.0;
|
||||
|
||||
vec4 vEdge = texture2D(texture, gl_TexCoord[0].xy - offx) * 2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx) * -2.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx - offy) * 1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy - offx + offy) * -1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx - offy) * 1.0 +
|
||||
texture2D(texture, gl_TexCoord[0].xy + offx + offy) * -1.0;
|
||||
|
||||
vec3 result = sqrt(hEdge.rgb * hEdge.rgb + vEdge.rgb * vEdge.rgb);
|
||||
float edge = length(result);
|
||||
vec4 pixel = gl_Color * texture2D(texture, gl_TexCoord[0].xy);
|
||||
if (edge > (edge_threshold * 8.0))
|
||||
pixel.rgb = vec3(0.0, 0.0, 0.0);
|
||||
else
|
||||
pixel.a = edge_threshold;
|
||||
gl_FragColor = pixel;
|
||||
}
|
BIN
code/SFML-2.4.2/share/SFML/examples/shader/resources/logo.png
Normal file
BIN
code/SFML-2.4.2/share/SFML/examples/shader/resources/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
|
@ -0,0 +1,9 @@
|
|||
uniform sampler2D texture;
|
||||
uniform float pixel_threshold;
|
||||
|
||||
void main()
|
||||
{
|
||||
float factor = 1.0 / (pixel_threshold + 0.001);
|
||||
vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor;
|
||||
gl_FragColor = texture2D(texture, pos) * gl_Color;
|
||||
}
|
Binary file not shown.
BIN
code/SFML-2.4.2/share/SFML/examples/shader/resources/sfml.png
Normal file
BIN
code/SFML-2.4.2/share/SFML/examples/shader/resources/sfml.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
|
@ -0,0 +1,19 @@
|
|||
uniform vec2 storm_position;
|
||||
uniform float storm_total_radius;
|
||||
uniform float storm_inner_radius;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 vertex = gl_ModelViewMatrix * gl_Vertex;
|
||||
vec2 offset = vertex.xy - storm_position;
|
||||
float len = length(offset);
|
||||
if (len < storm_total_radius)
|
||||
{
|
||||
float push_distance = storm_inner_radius + len / storm_total_radius * (storm_total_radius - storm_inner_radius);
|
||||
vertex.xy = storm_position + normalize(offset) * push_distance;
|
||||
}
|
||||
|
||||
gl_Position = gl_ProjectionMatrix * vertex;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 745 B |
|
@ -0,0 +1,15 @@
|
|||
uniform float wave_phase;
|
||||
uniform vec2 wave_amplitude;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 vertex = gl_Vertex;
|
||||
vertex.x += cos(gl_Vertex.y * 0.02 + wave_phase * 3.8) * wave_amplitude.x
|
||||
+ sin(gl_Vertex.y * 0.02 + wave_phase * 6.3) * wave_amplitude.x * 0.3;
|
||||
vertex.y += sin(gl_Vertex.x * 0.02 + wave_phase * 2.4) * wave_amplitude.y
|
||||
+ cos(gl_Vertex.x * 0.02 + wave_phase * 5.2) * wave_amplitude.y * 0.3;
|
||||
|
||||
gl_Position = gl_ModelViewProjectionMatrix * vertex;
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
gl_FrontColor = gl_Color;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue