-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@ctype mat4 hmm_mat4 | ||
|
||
@vs vs | ||
uniform vs_params { | ||
mat4 mvp; | ||
}; | ||
|
||
in vec4 pos; | ||
in vec2 texcoord0; | ||
|
||
out vec2 uv; | ||
|
||
void main() { | ||
gl_Position = mvp * pos; | ||
uv = texcoord0 * 5.0; | ||
} | ||
@end | ||
|
||
@fs fs | ||
uniform texture2D u_atlas_texture; | ||
uniform texture2D u_atlas_outline; | ||
uniform sampler u_atlas_sampler; | ||
|
||
in vec2 uv; | ||
out vec4 frag_color; | ||
|
||
void main() { | ||
vec2 atlas_size = vec2(textureSize(sampler2D(u_atlas_texture, u_atlas_sampler), 0)); | ||
vec2 v_texture_coord = uv / atlas_size; | ||
vec4 fill = texture(sampler2D(u_atlas_texture, u_atlas_sampler), v_texture_coord); | ||
vec4 outline = texture(sampler2D(u_atlas_outline, u_atlas_sampler), v_texture_coord); | ||
frag_color = fill + outline * (1.0 - fill.a); | ||
} | ||
@end | ||
|
||
@program texcube vs fs |