1d simple perlin noise

This commit is contained in:
Antoine 2021-05-27 19:02:46 +02:00
parent 8d039a1828
commit 809c9e5be7
3 changed files with 37 additions and 27 deletions

View File

@ -1,21 +0,0 @@
#version 410
out vec4 FragColor;
in vec4 color;
in vec2 fragCoord;
in vec2 texCoord;
uniform sampler2D texture1;
uniform float time;
void main()
{ // Pas fini c'est moche
vec4 colorPoweredUp = abs(vec4(color.xyz * sin(fragCoord.y + time*20), 1.0));
vec4 tex = texture(texture1, texCoord);
if (tex.a == 0.0){
FragColor = tex;
} else{
FragColor = mix(tex, colorPoweredUp, 0.5);
}
}

View File

@ -0,0 +1,31 @@
#version 410
// Source = https://www.shadertoy.com/view/MlsXDr
out vec4 FragColor;
in vec4 color;
in vec2 fragCoord;
in vec2 texCoord;
uniform sampler2D texture1;
uniform float time;
void main()
{ // Pas fini c'est moche
vec4 perlinNoise;
vec2 fragCoordTemp = fragCoord;
fragCoordTemp = 8. * fragCoordTemp / fragCoordTemp.y-vec2(7,4);
perlinNoise = sin(perlinNoise + time);
perlinNoise = mix(perlinNoise,color,0.5f);
vec4 tex = texture(texture1, texCoord);
if (tex.a == 0.0){
FragColor = tex;
} else{
FragColor = mix(tex, perlinNoise, 0.5);
FragColor.a = 1.0f;
}
}

View File

@ -172,11 +172,11 @@ public class Engine {
zangief.translate(new Vector3f(-5000.0f,500.0f,10.0f));
zangief.setColor(new Vector3f(0.0f, 0.0f, 1.0f));
zangief.useTime = true;
zangief.setShader("shaders/StylishShaders/BasicVert.glsl","shaders/StylishShaders/EnergyWave.glsl");
zangief.setShader("shaders/StylishShaders/BasicVert.glsl","shaders/StylishShaders/PerlinNoise.glsl");
// ObjectGl smiley2 = new ObjectGl(0.0f,500.0f,500.0f, 1f, path2, null);
// engine.add_objectGl(smiley2);
// smiley2.translate(new Vector3f(0.0f,0.0f,5.0f));
ObjectGl smiley2 = new ObjectGl(0.0f,500.0f,500.0f, 1f, path2, null);
engine.add_objectGl(smiley2);
smiley2.translate(new Vector3f(0.0f,0.0f,5.0f));
long timer = System.currentTimeMillis();
long lastFrame;
@ -191,7 +191,7 @@ public class Engine {
gamepadInput(zangief, speed);
}
input(zangief, speed);
keyboardInput(zangief, speed);
// input(smiley2, speed);
/*
@ -278,7 +278,7 @@ public class Engine {
}
public static void input(ObjectGl token, int speed) {
public static void keyboardInput(ObjectGl token, int speed) {
boolean keyPressed = false;
if (Input.isKeyDown(GLFW.GLFW_KEY_S)) {
token.setTextureWrap(161,260,56,59, ObjectGl.STICK_BOTTOM);