Made the UI easier to see after post-processing and added a slight
"darkness" effect around the corners of the screen
This commit is contained in:
parent
2057d78cd0
commit
197a753558
|
|
@ -6,8 +6,9 @@
|
|||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/mainloop.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v3.0.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/GlEngine.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/mainloop.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-glfw-javadoc.jar"/>
|
||||
|
|
@ -42,6 +43,5 @@
|
|||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-macos.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-natives-windows.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/lwjgl-3.2.2-lightweight/lwjgl-stb-sources.jar"/>
|
||||
<classpathentry kind="lib" path="/home/josua/code/Java Libraries/binary-data-format-v3.0.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import projectzombie.init.Tiles;
|
|||
import projectzombie.input.JoystickCallback;
|
||||
import projectzombie.input.KeyCallback;
|
||||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.mainloop.MainloopHelpers;
|
||||
import projectzombie.menu.Menu;
|
||||
import projectzombie.menu.MenuMain;
|
||||
import projectzombie.settings.Cheats;
|
||||
|
|
@ -135,7 +134,6 @@ public class Main
|
|||
mainloop.register(EntityEventHandler.ENTITY_EVENT_HANDLER);
|
||||
mainloop.register(ChunkEventHandler.CHUNK_EVENT_HANDLER);
|
||||
mainloop.register(JoystickCallback.JOYSTICK_CALLBACK);
|
||||
mainloop.register(new MainloopHelpers());
|
||||
mainloop.register(new KeyCallback());
|
||||
mainloop.register(new GameTimer());
|
||||
mainloop.register(new NoSleep());
|
||||
|
|
|
|||
|
|
@ -164,9 +164,8 @@ public class DisplayRender
|
|||
}
|
||||
|
||||
// Set to the players perspective and render
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_projection, true,
|
||||
Camera.camera.projection.getArray());
|
||||
GL33.glUniform1i(Main.window.glsl_mode, 0);
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_projection, true, camera.projection.getArray());
|
||||
|
||||
Main.world.render(camera);
|
||||
|
||||
|
|
@ -175,8 +174,5 @@ public class DisplayRender
|
|||
GL33.glUniform1i(Main.window.glsl_do_lighting, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Render the user interface
|
||||
DisplayRenderUI.render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -279,6 +279,18 @@ public class DisplayWindow implements IMainloopTask
|
|||
GL33.glBindVertexArray(effect_vao);
|
||||
GL33.glDrawArrays(GL33.GL_TRIANGLES, 0, 6);
|
||||
|
||||
environmentRenderer.use();
|
||||
DisplayLighting.updateLighting();
|
||||
|
||||
GL33.glUniform1i(glsl_do_texture, 1);
|
||||
|
||||
// Bind the texture atlas
|
||||
GL33.glActiveTexture(GL33.GL_TEXTURE0);
|
||||
Resources.ATLAS.bind();
|
||||
|
||||
// Render the user interface
|
||||
DisplayRenderUI.render();
|
||||
|
||||
// Swap the framebuffers and poll events
|
||||
GLFW.glfwSwapBuffers(window);
|
||||
GLFW.glfwPollEvents();
|
||||
|
|
|
|||
|
|
@ -1,83 +0,0 @@
|
|||
package projectzombie.mainloop;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mainloop.task.IMainloopTask;
|
||||
|
||||
class AsyncTask
|
||||
{
|
||||
int i, max;
|
||||
MainloopEnd end;
|
||||
MainloopIterator iterator;
|
||||
|
||||
AsyncTask(int min, int max, MainloopIterator iterator, MainloopEnd end) {
|
||||
this.i = min;
|
||||
this.max = max;
|
||||
this.end = end;
|
||||
this.iterator = iterator;
|
||||
}
|
||||
|
||||
void update() {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
while(i < max && System.currentTimeMillis() - start < 2) {
|
||||
iterator.iterate(i);
|
||||
i += 1;
|
||||
}
|
||||
|
||||
if(i == max) {
|
||||
end.end();
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
boolean done() {
|
||||
return i > max;
|
||||
}
|
||||
}
|
||||
|
||||
public class MainloopHelpers implements IMainloopTask
|
||||
{
|
||||
private static ArrayList<AsyncTask> tasks = new ArrayList<AsyncTask>();
|
||||
|
||||
public static void loopAsync(int min, int max, MainloopIterator iterator, MainloopEnd end) {
|
||||
tasks.add(new AsyncTask(min, max, iterator, end));
|
||||
}
|
||||
|
||||
public static void loopSync(int min, int max, MainloopIterator iterator, MainloopEnd end) {
|
||||
for(int i=min;i<max;i++) {
|
||||
iterator.iterate(i);
|
||||
}
|
||||
end.end();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MainLoopDelay(long millis) {
|
||||
return millis > 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean MainLoopRepeat() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void MainLoopUpdate()
|
||||
{
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
for(int i=0;i<tasks.size();i++) {
|
||||
AsyncTask t = tasks.get(i);
|
||||
if(t.done()) {
|
||||
tasks.remove(i);
|
||||
i -= 1;
|
||||
return;
|
||||
}
|
||||
t.update();
|
||||
}
|
||||
|
||||
if(System.currentTimeMillis() > start + 5) {
|
||||
tasks.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -44,5 +44,5 @@ void main()
|
|||
|
||||
chill_v = (chill_v < 0.25 ? 0 : 1) * chill;
|
||||
|
||||
FragColor = vec4(red_v, 0, 0, red_v) + vec4(0, 0, 0, vortex_v) + vec4(chill_v, chill_v, chill_v, chill_v);
|
||||
FragColor = vec4(red_v, 0, 0, red_v) + vec4(0, 0, 0, vortex_v) + vec4(chill_v, chill_v, chill_v, chill_v) + vec4(0, 0, 0, 0.125) * distance;
|
||||
}
|
||||
Loading…
Reference in New Issue