|
@@ -18,6 +18,7 @@ att vec3 properties;
|
|
|
att vec2 zBias;
|
|
|
att vec4 transformX;
|
|
|
att vec4 transformY;
|
|
|
+att vec3 renderingInfo;
|
|
|
att float opacity;
|
|
|
|
|
|
// Uniforms
|
|
@@ -30,11 +31,17 @@ void main(void) {
|
|
|
vec4 p = vec4(pos.xy, 1.0, 1.0);
|
|
|
vColor = vec4(col.xyz, col.w*opacity);
|
|
|
|
|
|
- vec4 pp = vec4(dot(p, transformX), dot(p, transformY), zBias.x, 1);
|
|
|
-
|
|
|
- if (properties.x == 1.0) {
|
|
|
- pp.xy = pp.xy - mod(pp.xy, properties.yz) + (properties.yz*0.5);
|
|
|
+ float x = dot(p, transformX);
|
|
|
+ float y = dot(p, transformY);
|
|
|
+ if (renderingInfo.z == 1.0) {
|
|
|
+ float rw = renderingInfo.x;
|
|
|
+ float rh = renderingInfo.y;
|
|
|
+ float irw = 2.0 / rw;
|
|
|
+ float irh = 2.0 / rh;
|
|
|
+
|
|
|
+ x = (floor((x / irw) + 0.5) * irw) + irw/2.0;
|
|
|
+ y = (floor((y / irh) + 0.5) * irh) + irh/2.0;
|
|
|
}
|
|
|
|
|
|
- gl_Position = pp;
|
|
|
-}
|
|
|
+ gl_Position = vec4(x, y, zBias.x, 1);
|
|
|
+}
|