| 1170 | } |
| 1171 | |
| 1172 | public void drawPixelatedWarp(TextureRegion image, float x, float y, float w, float h, float amount) { |
| 1173 | if (image == null) |
| 1174 | return; |
| 1175 | if (amount > 0) { |
| 1176 | batch.end(); |
| 1177 | shaderPixelateWarp.bind(); |
| 1178 | shaderPixelateWarp.setUniformf("u_resolution", image.getRegionWidth(), image.getRegionHeight()); |
| 1179 | shaderPixelateWarp.setUniformf("u_cellSize", amount); |
| 1180 | shaderPixelateWarp.setUniformf("u_amount", 0.2f * amount); |
| 1181 | shaderPixelateWarp.setUniformf("u_speed", 0.5f); |
| 1182 | shaderPixelateWarp.setUniformf("u_time", 0.8f); |
| 1183 | batch.setShader(shaderPixelateWarp); |
| 1184 | batch.begin(); |
| 1185 | //draw |
| 1186 | batch.draw(image, x, y, w, h); |
| 1187 | //reset |
| 1188 | batch.end(); |
| 1189 | batch.setShader(null); |
| 1190 | batch.begin(); |
| 1191 | } else { |
| 1192 | drawImage(image, x, y, w, h); |
| 1193 | } |
| 1194 | } |
| 1195 | |
| 1196 | public void drawWarpImage(Texture image, float x, float y, float w, float h, float time) { |
| 1197 | batch.end(); |