invert shader added
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 54 KiB |
Before Width: | Height: | Size: 58 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 61 KiB After Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 120 KiB |
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 133 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@ -1,16 +0,0 @@
|
|||||||
#ifdef GL_ES
|
|
||||||
#define LOWP lowp
|
|
||||||
precision mediump float;
|
|
||||||
#else
|
|
||||||
#define LOWP
|
|
||||||
#endif
|
|
||||||
|
|
||||||
varying LOWP vec4 v_color;
|
|
||||||
varying vec2 v_texCoords;
|
|
||||||
|
|
||||||
uniform sampler2D u_texture;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_FragColor = v_color * texture2D(u_texture, v_texCoords);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
attribute vec4 a_position;
|
|
||||||
attribute vec4 a_color;
|
|
||||||
attribute vec2 a_texCoord;
|
|
||||||
|
|
||||||
uniform mat4 u_projTrans;
|
|
||||||
|
|
||||||
varying vec4 v_color;
|
|
||||||
varying vec2 v_texCoords;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_Position = u_projTrans * a_position;
|
|
||||||
}
|
|
16
android/assets/shaders/invert_frag.glsl
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
#ifdef GL_ES
|
||||||
|
#define LOWP lowp
|
||||||
|
precision mediump float;
|
||||||
|
#else
|
||||||
|
#define LOWP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
varying LOWP vec4 vColor;
|
||||||
|
varying vec2 vTexCoord;
|
||||||
|
|
||||||
|
uniform sampler2D u_texture;
|
||||||
|
void main() {
|
||||||
|
vec4 texColor = texture2D(u_texture, vTexCoord);
|
||||||
|
texColor.rgb = 1.0 - texColor.rgb;
|
||||||
|
gl_FragColor = texColor * vColor;
|
||||||
|
}
|
15
android/assets/shaders/invert_vert.glsl
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
attribute vec4 a_position;
|
||||||
|
attribute vec4 a_color;
|
||||||
|
attribute vec2 a_texCoord0;
|
||||||
|
|
||||||
|
uniform mat4 u_projTrans;
|
||||||
|
|
||||||
|
varying vec4 vColor;
|
||||||
|
varying vec2 vTexCoord;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
vColor = a_color;
|
||||||
|
vTexCoord = a_texCoord0;
|
||||||
|
|
||||||
|
gl_Position = u_projTrans * a_position;
|
||||||
|
}
|
@ -18,7 +18,6 @@ import com.badlogic.gdx.graphics.g2d.ParticleEffect;
|
|||||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;
|
||||||
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter;
|
||||||
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
|
||||||
import com.badlogic.gdx.math.MathUtils;
|
import com.badlogic.gdx.math.MathUtils;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle;
|
import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle;
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle;
|
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle;
|
||||||
@ -51,7 +50,6 @@ public class Polyjet extends Game {
|
|||||||
TextureAtlas skinAtlas;
|
TextureAtlas skinAtlas;
|
||||||
private Preferences prefs;
|
private Preferences prefs;
|
||||||
|
|
||||||
public ShaderProgram defaultShader;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() {
|
public void create() {
|
||||||
@ -89,8 +87,6 @@ public class Polyjet extends Game {
|
|||||||
assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder));
|
assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder));
|
||||||
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder));
|
||||||
|
|
||||||
defaultShader = new ShaderProgram(Gdx.files.internal("shaders/default_vertex.glsl").readString(), Gdx.files.internal("shaders/default_frag.glsl").readString());
|
|
||||||
|
|
||||||
default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf"));
|
default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf"));
|
||||||
darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf"));
|
darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf"));
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.badlogic.gdx.Input.Keys;
|
|||||||
import com.badlogic.gdx.Screen;
|
import com.badlogic.gdx.Screen;
|
||||||
import com.badlogic.gdx.ScreenAdapter;
|
import com.badlogic.gdx.ScreenAdapter;
|
||||||
import com.badlogic.gdx.graphics.GL20;
|
import com.badlogic.gdx.graphics.GL20;
|
||||||
|
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
import com.badlogic.gdx.scenes.scene2d.InputEvent;
|
||||||
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
import com.badlogic.gdx.scenes.scene2d.InputListener;
|
||||||
@ -30,11 +31,23 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
private CreditsPage creditsPage;
|
private CreditsPage creditsPage;
|
||||||
private MoreOptionsPage moreOptionsPage;
|
private MoreOptionsPage moreOptionsPage;
|
||||||
|
|
||||||
Polyjet core;
|
private Polyjet core;
|
||||||
|
|
||||||
|
private ShaderProgram invert;
|
||||||
public MainMenu(final Polyjet core) {
|
public MainMenu(final Polyjet core) {
|
||||||
this.core = core;
|
this.core = core;
|
||||||
stage = new Stage(new ScreenViewport());
|
stage = new Stage(new ScreenViewport());
|
||||||
targetPosition = new Vector3(stage.getCamera().position);
|
targetPosition = new Vector3(stage.getCamera().position);
|
||||||
|
invert = new ShaderProgram(Gdx.files.internal("shaders/invert_vert.glsl").readString(), Gdx.files.internal("shaders/invert_frag.glsl").readString());
|
||||||
|
ShaderProgram.pedantic = false;
|
||||||
|
if (!invert.isCompiled()) {
|
||||||
|
System.err.println(invert.getLog());
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
if (invert.getLog().length()!=0)
|
||||||
|
System.out.println(invert.getLog());
|
||||||
|
|
||||||
|
stage.getBatch().setShader(invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Screen postTransition() {
|
public Screen postTransition() {
|
||||||
@ -108,7 +121,6 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter {
|
|||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||||
stage.act();
|
stage.act();
|
||||||
|
|
||||||
stage.getBatch().setShader(core.defaultShader);
|
|
||||||
stage.draw();
|
stage.draw();
|
||||||
if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) {
|
if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) {
|
||||||
stage.getCamera().position.lerp(targetPosition, 0.25f);
|
stage.getCamera().position.lerp(targetPosition, 0.25f);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package zero1hd.polyjet.ui.pages;
|
package zero1hd.polyjet.ui.pages;
|
||||||
|
|
||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
|
import com.badlogic.gdx.graphics.Color;
|
||||||
import com.badlogic.gdx.graphics.Texture;
|
import com.badlogic.gdx.graphics.Texture;
|
||||||
import com.badlogic.gdx.math.Vector3;
|
import com.badlogic.gdx.math.Vector3;
|
||||||
import com.badlogic.gdx.scenes.scene2d.Actor;
|
import com.badlogic.gdx.scenes.scene2d.Actor;
|
||||||
@ -39,7 +40,6 @@ public class MainPage extends Page {
|
|||||||
options.addListener(new ChangeListener() {
|
options.addListener(new ChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void changed(ChangeEvent event, Actor actor) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
// TODO Options screen
|
|
||||||
targetPosition.x = 1.5f * getWidth();
|
targetPosition.x = 1.5f * getWidth();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -77,13 +77,11 @@ public class MainPage extends Page {
|
|||||||
|
|
||||||
cyberCircle = new Image(core.getAssetManager().get("Tech-Circle1.png", Texture.class));
|
cyberCircle = new Image(core.getAssetManager().get("Tech-Circle1.png", Texture.class));
|
||||||
cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2);
|
cyberCircle.setOrigin(cyberCircle.getWidth() / 2, cyberCircle.getHeight() / 2);
|
||||||
cyberCircle.setColor(0.7f, 0.7f, 0.7f, 0.8f);
|
|
||||||
cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f)));
|
cyberCircle.addAction(Actions.forever(Actions.rotateBy(-360f, 10f)));
|
||||||
playButton.addActor(cyberCircle);
|
playButton.addActor(cyberCircle);
|
||||||
playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight());
|
playButton.setSize(cyberCircle.getWidth(), cyberCircle.getHeight());
|
||||||
|
|
||||||
begin = new Label("Play", core.getDefaultSkin(), "special-font", core.getDefaultSkin().getColor("default"));
|
begin = new Label("Play", core.getDefaultSkin(), "special-font", core.getDefaultSkin().getColor("default"));
|
||||||
begin.setColor(1f, 1f, 1f, 1f);
|
|
||||||
playButton.addActor(begin);
|
playButton.addActor(begin);
|
||||||
begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10,
|
begin.setPosition(((playButton.getWidth() - begin.getWidth()) / 2)-10,
|
||||||
(playButton.getHeight() - begin.getHeight()) / 2);
|
(playButton.getHeight() - begin.getHeight()) / 2);
|
||||||
|