mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
intro screen flipped correctly, build passes
This commit is contained in:
@@ -1,14 +1,58 @@
|
||||
#version 120
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
|
||||
|
||||
varying vec4 v_color;
|
||||
varying vec2 v_texCoords;
|
||||
uniform sampler2D u_texture;
|
||||
|
||||
|
||||
// "steps" of R, G and B. Must be integer && equal or greater than 2
|
||||
uniform float rcount = 64.0;
|
||||
uniform float gcount = 64.0;
|
||||
uniform float bcount = 64.0;
|
||||
uniform float acount = 1.0;
|
||||
|
||||
int bayer[14 * 14] = int[](131,187,8,78,50,18,134,89,155,102,29,95,184,73,22,86,113,171,142,105,34,166,9,60,151,128,40,110,168,137,45,28,64,188,82,54,124,189,80,13,156,56,7,61,186,121,154,6,108,177,24,100,38,176,93,123,83,148,96,17,88,133,44,145,69,161,139,72,30,181,115,27,163,47,178,65,164,14,120,48,5,127,153,52,190,58,126,81,116,21,106,77,173,92,191,63,99,12,76,144,4,185,37,149,192,39,135,23,117,31,170,132,35,172,103,66,129,79,3,97,57,159,70,141,53,94,114,20,49,158,19,146,169,122,183,11,104,180,2,165,152,87,182,118,91,42,67,25,84,147,43,85,125,68,16,136,71,10,193,112,160,138,51,111,162,26,194,46,174,107,41,143,33,74,1,101,195,15,75,140,109,90,32,62,157,98,167,119,179,59,36,130,175,55,0,150);
|
||||
float bayerSize = 14.0;
|
||||
|
||||
|
||||
float bayerDivider = bayerSize * bayerSize;
|
||||
|
||||
|
||||
vec4 gammaIn(vec4 col) {
|
||||
return pow(col, vec4(2.2));
|
||||
}
|
||||
|
||||
vec4 gammaOut(vec4 col) {
|
||||
return pow(col, vec4(1.0 / 2.2));
|
||||
}
|
||||
|
||||
vec4 nearestColour(vec4 incolor) {
|
||||
vec4 rgbaCounts = vec4(rcount, gcount, bcount, acount);
|
||||
|
||||
|
||||
vec4 color = incolor;
|
||||
|
||||
color.r = floor((rgbaCounts.r - 1.0) * color.r + 0.5) / (rgbaCounts.r - 1.0);
|
||||
color.g = floor((rgbaCounts.g - 1.0) * color.g + 0.5) / (rgbaCounts.g - 1.0);
|
||||
color.b = floor((rgbaCounts.b - 1.0) * color.b + 0.5) / (rgbaCounts.b - 1.0);
|
||||
color.a = 1.0;//floor((rgbaCounts.a - 1.0) * color.a + 0.5) / (rgbaCounts.a - 1.0);
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec4 color = texture2D(u_texture, v_texCoords).rgba;
|
||||
float spread = 1.0 / (0.299 * (rcount - 1.0) + 0.587 * (gcount - 1.0) + 0.114 * (bcount - 1.0)); // this spread value is optimised one -- try your own values for various effects!
|
||||
|
||||
color.r = floor(63.0 * color.r + 0.5) / 63.0;
|
||||
color.g = floor(63.0 * color.g + 0.5) / 63.0;
|
||||
color.b = floor(63.0 * color.b + 0.5) / 63.0;
|
||||
// a: passthrough
|
||||
|
||||
gl_FragColor = vec4(color.rgb, 1);
|
||||
// create texture coordinates based on pixelSize //
|
||||
vec4 inColor = (texture2D(u_texture, v_texCoords));
|
||||
|
||||
vec2 entry = mod(gl_FragCoord.xy, vec2(bayerSize, bayerSize));
|
||||
|
||||
gl_FragColor = nearestColour(inColor + spread * (bayer[int(entry.y) * int(bayerSize) + int(entry.x)] / bayerDivider - 0.5));
|
||||
|
||||
}
|
||||
@@ -5,5 +5,5 @@ Class-Path: lib/commons-codec-1.10.jar lib/commons-csv-1.2.jar lib/gdx
|
||||
.jar lib/gson-2.5.jar lib/jnlp.jar lib/jogg-0.0.7.jar lib/jopus.jar l
|
||||
ib/jorbis-0.0.17.jar lib/kotlin-reflect.jar lib/kotlin-stdlib.jar lib
|
||||
/luaj-jse-3.0.1.jar lib/Terrarum_Joise.jar lib/TerrarumSansBitmap.jar
|
||||
Main-Class: net.torvald.terrarum.TerrarumKt
|
||||
Main-Class: net.torvald.terrarum.AppLoader
|
||||
|
||||
|
||||
@@ -94,6 +94,8 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
ShaderProgram.pedantic = false;
|
||||
|
||||
appConfig = new LwjglApplicationConfiguration();
|
||||
appConfig.vSyncEnabled = false;
|
||||
appConfig.resizable = false;//true;
|
||||
@@ -114,8 +116,8 @@ public class AppLoader implements ApplicationListener {
|
||||
private SpriteBatch logoBatch;
|
||||
public static TextureRegion logo;
|
||||
|
||||
private Color gradWhiteTop = new Color(0xd8d8d8ff);
|
||||
private Color gradWhiteBottom = new Color(0xf8f8f8ff);
|
||||
private Color gradWhiteTop = new Color(0xf8f8f8ff);
|
||||
private Color gradWhiteBottom = new Color(0xd8d8d8ff);
|
||||
|
||||
public Screen screen;
|
||||
|
||||
@@ -131,7 +133,7 @@ public class AppLoader implements ApplicationListener {
|
||||
}
|
||||
|
||||
private float loadTimer = 0f;
|
||||
private final float showupTime = 50f / 1000f;
|
||||
private final float showupTime = 100f / 1000f;
|
||||
|
||||
private FrameBuffer renderFBO;
|
||||
|
||||
@@ -168,6 +170,7 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
|
||||
logo = new TextureRegion(new Texture(Gdx.files.internal("assets/graphics/logo_placeholder.tga")));
|
||||
logo.flip(false, true);
|
||||
|
||||
|
||||
TextureRegionPack.Companion.setGlobalFlipY(true);
|
||||
@@ -177,6 +180,18 @@ public class AppLoader implements ApplicationListener {
|
||||
@Override
|
||||
public void render() {
|
||||
|
||||
FrameBufferManager.begin(renderFBO);
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D);
|
||||
Gdx.gl.glEnable(GL20.GL_BLEND);
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD);
|
||||
FrameBufferManager.end();
|
||||
|
||||
|
||||
FrameBufferManager.begin(renderFBO);
|
||||
setCameraPosition(0, 0);
|
||||
|
||||
if (screen == null) {
|
||||
shaderBayerSkyboxFill.begin();
|
||||
@@ -209,29 +224,15 @@ public class AppLoader implements ApplicationListener {
|
||||
}
|
||||
}
|
||||
else {
|
||||
FrameBufferManager.begin(renderFBO);
|
||||
Gdx.gl.glClearColor(.094f, .094f, .094f, 0f);
|
||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
||||
Gdx.gl.glEnable(GL20.GL_TEXTURE_2D);
|
||||
Gdx.gl.glEnable(GL20.GL_BLEND);
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Gdx.gl.glBlendEquation(GL20.GL_FUNC_ADD);
|
||||
FrameBufferManager.end();
|
||||
|
||||
|
||||
|
||||
// nested FBOs are just not a thing in GL!
|
||||
|
||||
FrameBufferManager.begin(renderFBO);
|
||||
setCameraPosition(0, 0);
|
||||
screen.render(Gdx.graphics.getDeltaTime());
|
||||
FrameBufferManager.end();
|
||||
|
||||
|
||||
|
||||
PostProcessor.INSTANCE.draw(camera.combined, renderFBO);
|
||||
}
|
||||
|
||||
// nested FBOs are just not a thing in GL!
|
||||
FrameBufferManager.end();
|
||||
|
||||
PostProcessor.INSTANCE.draw(camera.combined, renderFBO);
|
||||
|
||||
|
||||
|
||||
GLOBAL_RENDER_TIMER += 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user