渲染后端加入

This commit is contained in:
2026-02-17 13:28:38 +08:00
commit a5379b3816
49 changed files with 44512 additions and 0 deletions

21
shaders/sprite.frag Normal file
View File

@@ -0,0 +1,21 @@
#version 300 es
precision highp float;
in vec2 vTexCoord;
in vec4 vColor;
uniform sampler2D uTexture;
uniform int uUseSDF;
out vec4 fragColor;
void main() {
if (uUseSDF == 1) {
float dist = texture(uTexture, vTexCoord).a;
float sd = (dist - 0.502) * 3.98;
float w = fwidth(sd);
float alpha = smoothstep(-w, w, sd);
fragColor = vec4(vColor.rgb, vColor.a * alpha);
} else {
fragColor = texture(uTexture, vTexCoord) * vColor;
}
}