background changed, pellet resized, other minor cleanups and adjustments

This commit is contained in:
Harrison Deng 2017-07-16 21:33:10 -05:00
parent a02e5565ff
commit a90fea5a46
21 changed files with 2 additions and 134 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 177 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 KiB

After

Width:  |  Height:  |  Size: 745 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 734 KiB

After

Width:  |  Height:  |  Size: 954 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 694 KiB

After

Width:  |  Height:  |  Size: 895 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 189 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 938 KiB

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 216 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 337 B

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 577 B

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 B

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 KiB

After

Width:  |  Height:  |  Size: 399 KiB

View File

@ -9,6 +9,7 @@ varying LOWP vec4 vColor;
varying vec2 vTexCoord; varying vec2 vTexCoord;
uniform sampler2D u_texture; uniform sampler2D u_texture;
void main() { void main() {
vec4 texColor = texture2D(u_texture, vTexCoord); vec4 texColor = texture2D(u_texture, vTexCoord);
texColor.rgb = 1.0 - texColor.rgb; texColor.rgb = 1.0 - texColor.rgb;

View File

@ -1,89 +0,0 @@
// from https://www.shadertoy.com/view/Msf3Wr
#define GLSLSANDBOX
#ifdef GLSLSANDBOX
#ifdef GL_ES
precision mediump float;
#endif
uniform float time;
#ifndef GLSLSANDBOXTOYNOTCOMPATIBLE
uniform vec4 iMouse;
uniform int iFrame;
#else /*GLSLSANDBOXTOYNOTCOMPATIBLE*/
uniform vec2 mouse;
#define iMouse mouse
#endif /*GLSLSANDBOXTOYNOTCOMPATIBLE*/
uniform vec2 resolution;
#define iGlobalTime time
#define iResolution (vec3(resolution, 1.))
#endif /*GLSLSANDBOX*/
#define iterations 17
#define formuparam 0.53
#define volsteps 20
#define stepsize 0.1
#define zoom 0.800
#define tile 0.850
#define speed 0.010
#define brightness 0.0015
#define darkmatter 0.300
#define distfading 0.730
#define saturation 0.850
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
//get coords and direction
vec2 uv=fragCoord.xy/iResolution.xy-.5;
uv.y*=iResolution.y/iResolution.x;
vec3 dir=vec3(uv*zoom,1.);
float time=iGlobalTime*speed+.25;
float a1=.5+time/iResolution.x*2.;
float a2=.8+time/iResolution.y*2.;
mat2 rot1=mat2(cos(a1),sin(a1),-sin(a1),cos(a1));
mat2 rot2=mat2(cos(a2),sin(a2),-sin(a2),cos(a2));
dir.xz*=rot1;
dir.xy*=rot2;
vec3 from=vec3(1.,.5,0.5);
from+=vec3(time*2.,time,-2.);
from.xz*=rot1;
from.xy*=rot2;
//volumetric rendering
float s=0.1,fade=1.;
vec3 v=vec3(0.);
for (int r=0; r<volsteps; r++) {
vec3 p=from+s*dir*.5;
p = abs(vec3(tile)-mod(p,vec3(tile*2.))); // tiling fold
float pa,a=pa=0.;
for (int i=0; i<iterations; i++) {
p=abs(p)/dot(p,p)-formuparam; // the magic formula
a+=abs(length(p)-pa); // absolute sum of average change
pa=length(p);
}
float dm=max(0.,darkmatter-a*a*.001); //dark matter
a*=a*a; // add contrast
if (r>6) fade*=1.-dm; // dark matter, don't render near
//v+=vec3(dm,dm*.5,0.);
v+=fade;
v+=vec3(s,s*s,s*s*s*s)*a*brightness*fade; // coloring based on distance
fade*=distfading; // distance fading
s+=stepsize;
}
v=mix(vec3(length(v)),v,saturation); //color adjust
fragColor = vec4(v*.01,1.);
}
void main (void)
{
vec4 color = vec4 (0.0, 0.0, 0.0, 1.0);
mainImage (color, gl_FragCoord.xy);
color.w = 1.0;
gl_FragColor = color;
}

View File

@ -1,12 +0,0 @@
attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;
uniform mat4 u_projTrans;
varying vec2 vTexCoord;
void main() {
vTexCoord = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

View File

@ -29,7 +29,7 @@ public class Pellet extends Actor implements Entity, Poolable {
public void init(float x, float y, float angle, float rate) { public void init(float x, float y, float angle, float rate) {
setPosition(x, y); setPosition(x, y);
direction.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle)); direction.set(MathUtils.sinDeg(angle), MathUtils.cosDeg(angle));
setSize(0.75f, 0.75f); setSize(0.5f, 0.5f);
hitBox.setSize(getWidth(), getHeight()); hitBox.setSize(getWidth(), getHeight());
this.rate = rate; this.rate = rate;
} }

View File

@ -32,12 +32,9 @@ 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");
@ -51,7 +48,6 @@ public class GamePlayArea extends Stage {
} }
public void setAudioMap(GamePlayMap audioMap) { public void setAudioMap(GamePlayMap audioMap) {
time = 0;
this.audioMap = audioMap; this.audioMap = audioMap;
} }
@ -75,23 +71,6 @@ 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;
} }
@ -99,18 +78,8 @@ 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();
} }
@ -119,7 +88,6 @@ 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) {