Update wr + shaders for local clip rect changes.

This commit is contained in:
Glenn Watson 2016-08-24 06:22:07 +10:00
parent 6f22251e65
commit b646c57230
12 changed files with 83 additions and 25 deletions

View file

@ -15,9 +15,16 @@ layout(std140) uniform Items {
void main(void) {
Glyph glyph = glyphs[gl_InstanceID];
VertexInfo vi = write_vertex(glyph.info);
#ifdef WR_FEATURE_TRANSFORM
TransformVertexInfo vi = write_transform_vertex(glyph.info);
vLocalRect = vi.clipped_local_rect;
vLocalPos = vi.local_pos;
vec2 f = (vi.local_pos.xy - glyph.info.local_rect.xy) / glyph.info.local_rect.zw;
#else
VertexInfo vi = write_vertex(glyph.info);
vec2 f = (vi.local_clamped_pos - vi.local_rect.p0) / (vi.local_rect.p1 - vi.local_rect.p0);
#endif
vec2 texture_size = textureSize(sDiffuse, 0);
vec2 st0 = glyph.uv_rect.xy / texture_size;