mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-21 18:58:14 +00:00
Remove trailing spaces
This commit is contained in:
@@ -20,7 +20,7 @@ void main()
|
|||||||
|
|
||||||
vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z);
|
vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z);
|
||||||
|
|
||||||
if (doGamma)// Apply gamma correction
|
if (doGamma) // Apply gamma correction
|
||||||
{
|
{
|
||||||
color = color/(color + vec3(1.0));
|
color = color/(color + vec3(1.0));
|
||||||
color = pow(color, vec3(1.0/2.2));
|
color = pow(color, vec3(1.0/2.2));
|
||||||
|
@@ -14,24 +14,21 @@ uniform vec2 textureSize;
|
|||||||
uniform float outlineSize;
|
uniform float outlineSize;
|
||||||
uniform vec4 outlineColor;
|
uniform vec4 outlineColor;
|
||||||
|
|
||||||
// Output fragment color
|
|
||||||
out vec4 finalColor;
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 texel = texture2D(texture0, fragTexCoord); // Get texel color
|
vec4 texel = texture2D(texture0, fragTexCoord); // Get texel color
|
||||||
vec2 texelScale = vec2(0.0);
|
vec2 texelScale = vec2(0.0);
|
||||||
texelScale.x = outlineSize/textureSize.x;
|
texelScale.x = outlineSize/textureSize.x;
|
||||||
texelScale.y = outlineSize/textureSize.y;
|
texelScale.y = outlineSize/textureSize.y;
|
||||||
|
|
||||||
// We sample four corner texels, but only for the alpha channel (this is for the outline)
|
// We sample four corner texels, but only for the alpha channel (this is for the outline)
|
||||||
vec4 corners = vec4(0.0);
|
vec4 corners = vec4(0.0);
|
||||||
corners.x = texture2D(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a;
|
corners.x = texture2D(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a;
|
||||||
corners.y = texture2D(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a;
|
corners.y = texture2D(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a;
|
||||||
corners.z = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a;
|
corners.z = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a;
|
||||||
corners.w = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a;
|
corners.w = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a;
|
||||||
|
|
||||||
float outline = min(dot(corners, vec4(1.0)), 1.0);
|
float outline = min(dot(corners, vec4(1.0)), 1.0);
|
||||||
vec4 color = mix(vec4(0.0), outlineColor, outline);
|
vec4 color = mix(vec4(0.0), outlineColor, outline);
|
||||||
gl_FragColor = mix(color, texel, texel.a);
|
gl_FragColor = mix(color, texel, texel.a);
|
||||||
}
|
}
|
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
|
#extension GL_OES_standard_derivatives : enable
|
||||||
|
|
||||||
// Input vertex attributes (from vertex shader)
|
// Input vertex attributes (from vertex shader)
|
||||||
varying vec2 fragTexCoord;
|
varying vec2 fragTexCoord;
|
||||||
varying vec4 fragColor;
|
varying vec4 fragColor;
|
||||||
|
@@ -14,26 +14,26 @@ uniform float time; // Total run time (in secods)
|
|||||||
// Draw circle
|
// Draw circle
|
||||||
vec4 DrawCircle(vec2 fragCoord, vec2 position, float radius, vec3 color)
|
vec4 DrawCircle(vec2 fragCoord, vec2 position, float radius, vec3 color)
|
||||||
{
|
{
|
||||||
float d = length(position - fragCoord) - radius;
|
float d = length(position - fragCoord) - radius;
|
||||||
float t = clamp(d, 0.0, 1.0);
|
float t = clamp(d, 0.0, 1.0);
|
||||||
return vec4(color, 1.0 - t);
|
return vec4(color, 1.0 - t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec2 fragCoord = gl_FragCoord.xy;
|
vec2 fragCoord = gl_FragCoord.xy;
|
||||||
vec2 position = vec2(mouse.x, resolution.y - mouse.y);
|
vec2 position = vec2(mouse.x, resolution.y - mouse.y);
|
||||||
float radius = 40.0;
|
float radius = 40.0;
|
||||||
|
|
||||||
// Draw background layer
|
// Draw background layer
|
||||||
vec4 colorA = vec4(0.2,0.2,0.8, 1.0);
|
vec4 colorA = vec4(0.2,0.2,0.8, 1.0);
|
||||||
vec4 colorB = vec4(1.0,0.7,0.2, 1.0);
|
vec4 colorB = vec4(1.0,0.7,0.2, 1.0);
|
||||||
vec4 layer1 = mix(colorA, colorB, abs(sin(time*0.1)));
|
vec4 layer1 = mix(colorA, colorB, abs(sin(time*0.1)));
|
||||||
|
|
||||||
// Draw circle layer
|
// Draw circle layer
|
||||||
vec3 color = vec3(0.9, 0.16, 0.21);
|
vec3 color = vec3(0.9, 0.16, 0.21);
|
||||||
vec4 layer2 = DrawCircle(fragCoord, position, radius, color);
|
vec4 layer2 = DrawCircle(fragCoord, position, radius, color);
|
||||||
|
|
||||||
// Blend the two layers
|
// Blend the two layers
|
||||||
gl_FragColor = mix(layer1, layer2, layer2.a);
|
gl_FragColor = mix(layer1, layer2, layer2.a);
|
||||||
}
|
}
|
||||||
|
@@ -10,9 +10,9 @@ uniform vec4 colDiffuse;
|
|||||||
|
|
||||||
// NOTE: Add here your custom variables
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
const vec2 size = vec2(800, 450); // render size
|
const vec2 size = vec2(800, 450); // Framebuffer size
|
||||||
const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance
|
const float samples = 5.0; // Pixels per axis; higher = bigger glow, worse performance
|
||||||
const float quality = 2.5; // lower = smaller glow, better quality
|
const float quality = 2.5; // Defines size factor: Lower = smaller glow, better quality
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@@ -13,9 +13,9 @@ out vec4 finalColor;
|
|||||||
|
|
||||||
// NOTE: Add here your custom variables
|
// NOTE: Add here your custom variables
|
||||||
|
|
||||||
const vec2 size = vec2(800, 450); // render size
|
const vec2 size = vec2(800, 450); // Framebuffer size
|
||||||
const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance
|
const float samples = 5.0; // Pixels per axis; higher = bigger glow, worse performance
|
||||||
const float quality = 2.5; // lower = smaller glow, better quality
|
const float quality = 2.5; // Defines size factor: Lower = smaller glow, better quality
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
@@ -17,19 +17,19 @@ out vec4 finalColor;
|
|||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 texel = texture(texture0, fragTexCoord); // Get texel color
|
vec4 texel = texture(texture0, fragTexCoord); // Get texel color
|
||||||
vec2 texelScale = vec2(0.0);
|
vec2 texelScale = vec2(0.0);
|
||||||
texelScale.x = outlineSize/textureSize.x;
|
texelScale.x = outlineSize/textureSize.x;
|
||||||
texelScale.y = outlineSize/textureSize.y;
|
texelScale.y = outlineSize/textureSize.y;
|
||||||
|
|
||||||
// We sample four corner texels, but only for the alpha channel (this is for the outline)
|
// We sample four corner texels, but only for the alpha channel (this is for the outline)
|
||||||
vec4 corners = vec4(0.0);
|
vec4 corners = vec4(0.0);
|
||||||
corners.x = texture(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a;
|
corners.x = texture(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a;
|
||||||
corners.y = texture(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a;
|
corners.y = texture(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a;
|
||||||
corners.z = texture(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a;
|
corners.z = texture(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a;
|
||||||
corners.w = texture(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a;
|
corners.w = texture(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a;
|
||||||
|
|
||||||
float outline = min(dot(corners, vec4(1.0)), 1.0);
|
float outline = min(dot(corners, vec4(1.0)), 1.0);
|
||||||
vec4 color = mix(vec4(0.0), outlineColor, outline);
|
vec4 color = mix(vec4(0.0), outlineColor, outline);
|
||||||
finalColor = mix(color, texel, texel.a);
|
finalColor = mix(color, texel, texel.a);
|
||||||
}
|
}
|
Reference in New Issue
Block a user