gl_atlas_glsl.h (653B)
1 static const char *gl_atlas_glsl = R"( 2 uniform sampler2D u_atlas_tex; 3 uniform ivec4 u_atlas_info; 4 5 #define GLYPHY_TEXTURE1D_EXTRA_DECLS , sampler2D _tex, ivec4 _atlas_info, ivec2 _atlas_pos 6 #define GLYPHY_TEXTURE1D_EXTRA_ARGS , _tex, _atlas_info, _atlas_pos 7 #define GLYPHY_DEMO_EXTRA_ARGS , u_atlas_tex, u_atlas_info, gi.atlas_pos 8 9 vec4 10 glyphy_texture1D_func (int offset GLYPHY_TEXTURE1D_EXTRA_DECLS) 11 { 12 ivec2 item_geom = _atlas_info.zw; 13 vec2 pos = (vec2 (_atlas_pos.xy * item_geom + 14 ivec2 (mod (float (offset), float (item_geom.x)), offset / item_geom.x)) + 15 + vec2 (.5, .5)) / vec2(_atlas_info.xy); 16 return texture2D (_tex, pos); 17 } 18 )";