Updated some examples with inconsistencies

This commit is contained in:
Ray
2025-09-04 18:57:00 +02:00
parent fb42819eab
commit 7646d08751
12 changed files with 71 additions and 39 deletions

View File

@ -0,0 +1,18 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
void main()
{
vec4 texelColor = texture2D(texture0, fragTexCoord);
if (texelColor.a == 0.0) discard;
gl_FragColor = texelColor*fragColor*colDiffuse;
}

View File

@ -0,0 +1,23 @@
#version 120
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
// NOTE: Add your custom variables here
const float smoothing = 1.0/16.0;
void main()
{
// Texel color fetching from texture sampler
// NOTE: Calculate alpha using signed distance field (SDF)
float distance = texture2D(texture0, fragTexCoord).a;
float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance);
// Calculate final fragment color
gl_FragColor = vec4(fragColor.rgb, fragColor.a*alpha);
}

View File

@ -17,7 +17,7 @@
#include "raylib.h"
#include <stdlib.h>
#include <stdlib.h> // Required for: calloc(), free()
//--------------------------------------------------------------------------------------
// Module Functions Declaration
@ -199,5 +199,6 @@ static void AddCodepointRange(Font *font, const char *fontPath, int start, int s
UnloadFont(*font);
*font = LoadFontEx(fontPath, 32, updatedCodepoints, updatedCodepointCount);
RL_FREE(updatedCodepoints);
}