retored previous shader functions
This commit is contained in:
parent
f37c2693ae
commit
17b65ed5d6
@ -32,9 +32,12 @@ public class GamePlayArea extends Stage {
|
|||||||
private int score;
|
private int score;
|
||||||
|
|
||||||
private ShaderProgram invert;
|
private ShaderProgram invert;
|
||||||
|
private ShaderProgram bgShader;
|
||||||
|
|
||||||
private Texture background;
|
private Texture background;
|
||||||
|
|
||||||
|
private float time;
|
||||||
|
|
||||||
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
|
public GamePlayArea(AssetManager assetManager, Preferences prefs) {
|
||||||
super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT));
|
super(new FitViewport(Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT));
|
||||||
Gdx.app.debug("Game Area", "new area created");
|
Gdx.app.debug("Game Area", "new area created");
|
||||||
@ -48,6 +51,7 @@ public class GamePlayArea extends Stage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setAudioMap(GamePlayMap audioMap) {
|
public void setAudioMap(GamePlayMap audioMap) {
|
||||||
|
time = 0;
|
||||||
this.audioMap = audioMap;
|
this.audioMap = audioMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,6 +75,23 @@ public class GamePlayArea extends Stage {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (prefs.getBoolean("bg shader")) {
|
||||||
|
Gdx.app.debug("Shader", "using background shader");
|
||||||
|
|
||||||
|
bgShader = new ShaderProgram(Gdx.files.internal("shaders/star_vert.glsl").readString(), Gdx.files.internal("shaders/star_frag.glsl").readString());
|
||||||
|
|
||||||
|
if (!bgShader.isCompiled()) {
|
||||||
|
System.err.println(bgShader.getLog());
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
if (bgShader.getLog().length()!=0) {
|
||||||
|
System.out.println(bgShader.getLog());
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//TODO prepare background rendering without shader
|
||||||
|
}
|
||||||
|
|
||||||
ShaderProgram.pedantic = false;
|
ShaderProgram.pedantic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +99,18 @@ public class GamePlayArea extends Stage {
|
|||||||
public void draw() {
|
public void draw() {
|
||||||
//TODO batch draw background
|
//TODO batch draw background
|
||||||
getBatch().begin();
|
getBatch().begin();
|
||||||
|
|
||||||
|
if (bgShader != null) {
|
||||||
|
getBatch().setShader(bgShader);
|
||||||
|
bgShader.setUniformf("resolution", background.getWidth(), background.getHeight());
|
||||||
|
bgShader.setUniformf("time", time);
|
||||||
|
}
|
||||||
getBatch().draw(background, 0f, 0f, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
getBatch().draw(background, 0f, 0f, Polyjet.GAME_AREA_WIDTH, Polyjet.GAME_AREA_HEIGHT);
|
||||||
getBatch().end();
|
getBatch().end();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
getBatch().setShader(null);
|
||||||
super.draw();
|
super.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +119,7 @@ public class GamePlayArea extends Stage {
|
|||||||
MapWindowData mwd;
|
MapWindowData mwd;
|
||||||
if (audioMap != null && audioMap.getPlayableClip().isPlaying()) {
|
if (audioMap != null && audioMap.getPlayableClip().isPlaying()) {
|
||||||
audioMap.getMusicData().readIndexUpdate();
|
audioMap.getMusicData().readIndexUpdate();
|
||||||
|
time = audioMap.getPlayableClip().getPosition();
|
||||||
if ((mwd = audioMap.nextWindowData()) != null) {
|
if ((mwd = audioMap.nextWindowData()) != null) {
|
||||||
EntitySpawnInfo[] currentSpawnInfo = mwd.getArray();
|
EntitySpawnInfo[] currentSpawnInfo = mwd.getArray();
|
||||||
if (currentSpawnInfo != null) {
|
if (currentSpawnInfo != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user