Added support for vertex shaders in sf::Shader
Rewrote the Shader example
This commit is contained in:
parent
4d0a6a299a
commit
c9b87ec8a9
20 changed files with 893 additions and 486 deletions
19
examples/shader/resources/storm.vert
Normal file
19
examples/shader/resources/storm.vert
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue