diff --git a/core/src/zero1hd/rhythmbullet/screens/GameScreen.java b/core/src/zero1hd/rhythmbullet/screens/GameScreen.java index f21846d..8c950ad 100755 --- a/core/src/zero1hd/rhythmbullet/screens/GameScreen.java +++ b/core/src/zero1hd/rhythmbullet/screens/GameScreen.java @@ -38,6 +38,8 @@ public class GameScreen extends ScreenAdapter { private TextureRegion fboRegion; private int fboSize; + private int blurlvl = 4; + /** * The game screen where the game play area, and hud are placed. * @param core The game context object @@ -156,6 +158,7 @@ public class GameScreen extends ScreenAdapter { } gameArea.getViewport().apply(); + blurlvl = 4; if (gaussianBlurShader != null) { //Begin drawing a normal version of screen normalBuffer.begin(); @@ -210,6 +213,34 @@ public class GameScreen extends ScreenAdapter { gameArea.getViewport().getScreenWidth(), gameArea.getViewport().getScreenHeight()); + for (int i = 0; i < blurlvl; i++) { + //Horizontal gaussian blur + hBlur.begin(); + fboRegion.setRegion(vBlur.getColorBufferTexture()); + gameArea.getBatch().setShader(gaussianBlurShader); + gaussianBlurShader.setUniformi("horizontal", 1); + gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT); + gameArea.getBatch().flush(); + hBlur.end( + gameArea.getViewport().getScreenX(), + gameArea.getViewport().getScreenY(), + gameArea.getViewport().getScreenWidth(), + gameArea.getViewport().getScreenHeight()); + + //Vertical gaussian blur + vBlur.begin(); + fboRegion.setRegion(hBlur.getColorBufferTexture()); + gameArea.getBatch().setShader(gaussianBlurShader); + gaussianBlurShader.setUniformi("horizontal", 0); + gameArea.getBatch().draw(fboRegion, 0f, 0f, RhythmBullet.GAME_AREA_WIDTH, RhythmBullet.GAME_AREA_HEIGHT); + gameArea.getBatch().flush(); + vBlur.end( + gameArea.getViewport().getScreenX(), + gameArea.getViewport().getScreenY(), + gameArea.getViewport().getScreenWidth(), + gameArea.getViewport().getScreenHeight()); + } + //Draw everything to screen gameArea.getBatch().setShader(combineShader); fboRegion.setRegion(normalBuffer.getColorBufferTexture());