minor progress on background shader
This commit is contained in:
parent
7a0a7c9b14
commit
fe6bd86632
@ -1,8 +1,8 @@
|
||||
#extension GL_OES_standard_derivatives : enable
|
||||
|
||||
varying float vTime;
|
||||
varying vec2 vResolution;
|
||||
#define M_PI 3.1415926535897932384626433832795
|
||||
varying vec2 vTexCoord;
|
||||
|
||||
//#define vTime (vTime * vTime * 0.05)
|
||||
|
||||
@ -42,10 +42,7 @@ float stars(in vec2 x, float numCells, float size, float br)
|
||||
|
||||
void main()
|
||||
{
|
||||
|
||||
float res = max(vResolution.y, vResolution.y);
|
||||
|
||||
vec2 coord = gl_FragCoord.xy / vResolution;
|
||||
vec2 coord = vTexCoord;
|
||||
|
||||
vec2 tmp = coord;
|
||||
|
||||
@ -64,7 +61,8 @@ void main()
|
||||
|
||||
|
||||
|
||||
gl_FragColor = vec4(result,1.);
|
||||
gl_FragColor = vec4(result, 1.0);
|
||||
// gl_FragColor = vec4(1.0*(vTexCoord.x/vResolution.x), 0.0, 0.0, 1.0);
|
||||
|
||||
|
||||
|
||||
@ -72,7 +70,4 @@ void main()
|
||||
// vec2 bl = gl_FragCoord.xy / vResolution.xy;
|
||||
|
||||
// if(bl.y>.50-min(vTime/20.,0.4) ^^ bl.y<0.50+min(vTime/20.0,.4)) gl_FragColor = vec4(0.0,sqrt(coord.y+0.1),0.3,1.0);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -4,17 +4,14 @@ attribute vec2 a_texCoord0;
|
||||
|
||||
uniform mat4 u_projTrans;
|
||||
uniform float time;
|
||||
uniform vec2 resolution;
|
||||
|
||||
varying vec4 vColor;
|
||||
varying vec2 vTexCoord;
|
||||
varying float vTime;
|
||||
varying vec2 vResolution;
|
||||
void main() {
|
||||
vColor = a_color;
|
||||
vTexCoord = a_texCoord0;
|
||||
vTime = time;
|
||||
vResolution = resolution;
|
||||
|
||||
gl_Position = u_projTrans * a_position;
|
||||
}
|
||||
|
@ -128,6 +128,8 @@ public class Polyjet extends Game {
|
||||
assetManager.load("shard.png", Texture.class);
|
||||
assetManager.load("bar.png", Texture.class);
|
||||
assetManager.load("flake.png", Texture.class);
|
||||
assetManager.load("star_bg.png", Texture.class);
|
||||
// assetManager.load("");
|
||||
}
|
||||
public void generateFonts() {
|
||||
initComplete = true;
|
||||
|
@ -32,8 +32,6 @@ public class GamePlayArea extends Stage {
|
||||
private ShaderProgram invert;
|
||||
private ShaderProgram bgShader;
|
||||
|
||||
private Vector2 resolution;
|
||||
|
||||
private float timePassed;
|
||||
|
||||
private Texture background;
|
||||
@ -83,7 +81,6 @@ public class GamePlayArea extends Stage {
|
||||
if (bgShader.getLog().length()!=0) {
|
||||
System.out.println(bgShader.getLog());
|
||||
}
|
||||
resolution = new Vector2(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
|
||||
} else {
|
||||
//TODO prepare background rendering without shader
|
||||
}
|
||||
@ -110,8 +107,8 @@ public class GamePlayArea extends Stage {
|
||||
if (bgShader != null) {
|
||||
timePassed += delta;
|
||||
bgShader.setUniformf("time", timePassed);
|
||||
bgShader.setUniformf("resolution", resolution);
|
||||
}
|
||||
|
||||
collisionDetector.collisionCheck();
|
||||
ec.deathClean();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user