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