Created a functional world renderer
This commit is contained in:
parent
95bd4df7ef
commit
b553923a3d
|
|
@ -1 +1,2 @@
|
|||
/bin/
|
||||
hs_err_pid*
|
||||
|
|
|
|||
BIN
settings.bdf
BIN
settings.bdf
Binary file not shown.
|
|
@ -2,11 +2,9 @@ package projectzombie;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import bdf.file.BdfCompressedFileManager;
|
||||
import mainloop.manager.MainloopManager;
|
||||
import projectzombie.audio.AudioEngine;
|
||||
import projectzombie.audio.AudioSources;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.display.DisplayStatsEventHandler;
|
||||
import projectzombie.display.DisplayWindow;
|
||||
import projectzombie.display.bossbar.BossBars;
|
||||
|
|
@ -18,7 +16,6 @@ import projectzombie.init.LayerGenerators;
|
|||
import projectzombie.init.Layers;
|
||||
import projectzombie.init.Resources;
|
||||
import projectzombie.init.Sounds;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.input.JoystickCallback;
|
||||
import projectzombie.input.KeyCallback;
|
||||
|
|
|
|||
|
|
@ -20,13 +20,10 @@ import java.nio.ShortBuffer;
|
|||
import org.lwjgl.stb.STBVorbis;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
import projectzombie.Main;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.resources.Resource;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
|
||||
public class AudioObject
|
||||
{
|
||||
|
|
@ -88,8 +85,9 @@ public class AudioObject
|
|||
return;
|
||||
}
|
||||
|
||||
// Calculate the rotation
|
||||
Vec3d vec = Matrix4.multiply(Camera.camera.getMatrix(), pos);
|
||||
// Calculate the position relative to the player
|
||||
Matrix4 matrix = Camera.camera.getMatrix();
|
||||
Vec3d vec = Matrix4.multiply(matrix, pos.add(new Vec3d(-0.5, 0, -0.5)));
|
||||
|
||||
// Play the sound with a new source
|
||||
int source = AudioSources.getSource();
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ package projectzombie.display;
|
|||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
|
||||
public class Camera
|
||||
{
|
||||
public double angle = 45;
|
||||
public int renderDistance = 3;
|
||||
private Matrix4 matrix;
|
||||
|
||||
public static Camera camera;
|
||||
|
|
@ -19,10 +17,10 @@ public class Camera
|
|||
Vec2d pos = Main.player.pos;
|
||||
angle = Main.player.angle;
|
||||
|
||||
identity = Matrix4.multiply(identity, Matrix4.translate(-pos.x, 0, -pos.y));
|
||||
identity = Matrix4.multiply(identity, Matrix4.rotate(angle, 0, 1, 0));
|
||||
identity = Matrix4.multiply(identity, Matrix4.rotate(-50, 1, 0, 0));
|
||||
identity = Matrix4.multiply(identity, Matrix4.translate(0, 0, -12));
|
||||
identity = Matrix4.multiply(identity, Matrix4.translate(-pos.x + 0.5, 0, -pos.y + 0.5));
|
||||
identity = Matrix4.multiply(identity, Matrix4.rotate(angle + 180, 0, 1, 0));
|
||||
identity = Matrix4.multiply(identity, Matrix4.rotate(-45, 1, 0, 0));
|
||||
identity = Matrix4.multiply(identity, Matrix4.translate(0, 0, -16));
|
||||
|
||||
matrix = identity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,30 +2,15 @@ package projectzombie.display;
|
|||
|
||||
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
|
||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_BUFFER_BIT;
|
||||
import static org.lwjgl.opengl.GL11.GL_MODELVIEW;
|
||||
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
|
||||
import static org.lwjgl.opengl.GL11.glBlendFunc;
|
||||
import static org.lwjgl.opengl.GL11.glClear;
|
||||
import static org.lwjgl.opengl.GL11.glLoadMatrixf;
|
||||
import static org.lwjgl.opengl.GL11.glMatrixMode;
|
||||
import static org.lwjgl.opengl.GL11.glViewport;
|
||||
|
||||
import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
import org.lwjgl.system.MemoryStack;
|
||||
|
||||
import gl_engine.graphics.GraphicsShader;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.lighting.DynamicLighting;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
|
||||
public class DisplayRender
|
||||
|
|
@ -55,20 +40,24 @@ public class DisplayRender
|
|||
GL33.glUniformMatrix4fv(Main.window.glsl_camera, true, camera.getMatrix().getArray());
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_projection, true, projection.getArray());
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_rotated, true, rotated.getArray());
|
||||
GL33.glUniform1i(Main.window.glsl_time, (int)((System.currentTimeMillis() / 10) % 1000));
|
||||
|
||||
// Render the world and the player
|
||||
Main.world.render(camera);
|
||||
player.chunk = Main.world.getLayer().getChunk(player.pos);
|
||||
|
||||
if(!Main.player.dead)
|
||||
{
|
||||
Model model = player.getModel();
|
||||
Matrix4 matrix = Matrix4.translate(player.pos.x, 0, player.pos.y);
|
||||
Matrix4 matrix = Matrix4.translate(player.pos.x - 0.5, player.getHeight(), player.pos.y - 0.5);
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_model, true, matrix.getArray());
|
||||
model.bind();
|
||||
model.render();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Render the user interface
|
||||
//DisplayRenderUI.render();
|
||||
DisplayRenderUI.render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,16 +1,5 @@
|
|||
package projectzombie.display;
|
||||
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.bossbar.BossBars;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.inventory.Inventory;
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class DisplayRenderUI
|
||||
{
|
||||
public static boolean showFPS = false;
|
||||
|
|
@ -19,173 +8,9 @@ public class DisplayRenderUI
|
|||
|
||||
public static void render()
|
||||
{
|
||||
/*double s = GlHelpers.getScale() / 10.0;
|
||||
|
||||
// Get some text settings
|
||||
Vec2d text_size = new Vec2d(0.5, 0.5);
|
||||
|
||||
// Render the fps
|
||||
if(showFPS) {
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(-10*s + 0.5, 10*s - 0.5);
|
||||
GlHelpers.color3(1, 1, 0);
|
||||
Text.render("FPS: " + DisplayStatsEventHandler.fps, text_size);
|
||||
GlHelpers.popMatrix();
|
||||
}
|
||||
|
||||
// Get the player
|
||||
EntityPlayer player = Main.player;
|
||||
|
||||
// Disable some opengl options
|
||||
GlHelpers.disableDepthTest();
|
||||
GlHelpers.color4(1, 1, 1, 1);
|
||||
|
||||
// Get the aspect ratio
|
||||
double aspect_ratio = (
|
||||
((double) Main.window.getWidth()) /
|
||||
((double) Main.window.getHeight()));
|
||||
|
||||
if(Main.menu.doGameRender && Main.menu.showIngameGUI)
|
||||
{
|
||||
// Render the position
|
||||
if(showPos) {
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(-10*s + 0.5, 10*s - 1);
|
||||
GlHelpers.color3(1, 1, 0);
|
||||
Text.render("x: " + (int) player.pos.x + ", y: " + (int) player.pos.y, text_size);
|
||||
GlHelpers.color3(1, 1, 1);
|
||||
GlHelpers.popMatrix();
|
||||
}
|
||||
|
||||
// Render the healthbar
|
||||
double max_health = player.maxHealth();
|
||||
double a = 1 - (player.getHealth() / max_health);
|
||||
TextureReference health_fg = Models.UI_HEALTH_FG;
|
||||
TextureReference health_bg = Models.UI_HEALTH_BG;
|
||||
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(-2*s, -9*s);
|
||||
GlHelpers.begin();
|
||||
|
||||
health_bg.texCoord(0, 1); GlHelpers.vertex2(-8, 1);
|
||||
health_bg.texCoord(0, 0); GlHelpers.vertex2(-8, 0);
|
||||
health_bg.texCoord(1, 0); GlHelpers.vertex2(8, 0);
|
||||
health_bg.texCoord(1, 1); GlHelpers.vertex2(8, 1);
|
||||
|
||||
health_fg.texCoord(0, 1); GlHelpers.vertex2(-8, 1);
|
||||
health_fg.texCoord(0, 0); GlHelpers.vertex2(-8, 0);
|
||||
health_fg.texCoord(1-a, 0); GlHelpers.vertex2(8-a*16, 0);
|
||||
health_fg.texCoord(1-a, 1); GlHelpers.vertex2(8-a*16, 1);
|
||||
|
||||
GlHelpers.end();
|
||||
GlHelpers.popMatrix();
|
||||
|
||||
// Display the amount of ammo left, and the defence and gun level
|
||||
GlHelpers.pushMatrix();
|
||||
TextureReference ammo_tex = Models.ITEM_AMMO_BOX;
|
||||
TextureReference gunlevel_tex = Models.UI_GUN_LEVEL;
|
||||
TextureReference deflevel_tex = Models.UI_DEFENCE_LEVEL;
|
||||
|
||||
GlHelpers.translate2(-9.5*s, -9*s);
|
||||
GlHelpers.begin();
|
||||
ammo_tex.texCoord(0, 1); GlHelpers.vertex2(0, 0);
|
||||
ammo_tex.texCoord(0, 0); GlHelpers.vertex2(0, 2);
|
||||
ammo_tex.texCoord(1, 0); GlHelpers.vertex2(2, 2);
|
||||
ammo_tex.texCoord(1, 1); GlHelpers.vertex2(2, 0);
|
||||
GlHelpers.end();
|
||||
|
||||
GlHelpers.translate2(0, 2.5);
|
||||
GlHelpers.begin();
|
||||
gunlevel_tex.texCoord(0, 1); GlHelpers.vertex2(0, 0);
|
||||
gunlevel_tex.texCoord(0, 0); GlHelpers.vertex2(0, 2);
|
||||
gunlevel_tex.texCoord(1, 0); GlHelpers.vertex2(2, 2);
|
||||
gunlevel_tex.texCoord(1, 1); GlHelpers.vertex2(2, 0);
|
||||
GlHelpers.end();
|
||||
|
||||
GlHelpers.translate2(0, 2.5);
|
||||
GlHelpers.begin();
|
||||
deflevel_tex.texCoord(0, 1); GlHelpers.vertex2(0, 0);
|
||||
deflevel_tex.texCoord(0, 0); GlHelpers.vertex2(0, 2);
|
||||
deflevel_tex.texCoord(1, 0); GlHelpers.vertex2(2, 2);
|
||||
deflevel_tex.texCoord(1, 1); GlHelpers.vertex2(2, 0);
|
||||
GlHelpers.end();
|
||||
|
||||
GlHelpers.popMatrix();
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(-8.5*s, -9.25*s);
|
||||
Text.render(Integer.toString(player.ammo), text_size);
|
||||
GlHelpers.translate2(0, 3);
|
||||
Text.render(Integer.toString(player.gun_level), text_size);
|
||||
GlHelpers.translate2(0, 2);
|
||||
Text.render(Integer.toString(player.defence_level), text_size);
|
||||
GlHelpers.popMatrix();
|
||||
|
||||
// Display all the items in the players inventory
|
||||
TextureReference slots_tex = Models.UI_ITEM_SLOTS;
|
||||
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(3*s, -9.5*s);
|
||||
|
||||
GlHelpers.begin();
|
||||
slots_tex.texCoord(0, 1); GlHelpers.vertex2(12, 2);
|
||||
slots_tex.texCoord(0, 0); GlHelpers.vertex2(12, 0);
|
||||
slots_tex.texCoord(1, 0); GlHelpers.vertex2(0, 0);
|
||||
slots_tex.texCoord(1, 1); GlHelpers.vertex2(0, 2);
|
||||
GlHelpers.end();
|
||||
|
||||
// Render the players active slot
|
||||
TextureReference hotbar_slot_tex = Models.UI_ACTIVE_SLOT;
|
||||
GlHelpers.begin();
|
||||
|
||||
hotbar_slot_tex.texCoord(0, 1); GlHelpers.vertex2(2.1 + player.inventory_hand*2, 2.1);
|
||||
hotbar_slot_tex.texCoord(0, 0); GlHelpers.vertex2(2.1 + player.inventory_hand*2, -0.1);
|
||||
hotbar_slot_tex.texCoord(1, 0); GlHelpers.vertex2(-0.1 + player.inventory_hand*2, -0.1);
|
||||
hotbar_slot_tex.texCoord(1, 1); GlHelpers.vertex2(-0.1 + player.inventory_hand*2, 2.1);
|
||||
|
||||
GlHelpers.end();
|
||||
|
||||
GlHelpers.popMatrix();
|
||||
|
||||
// Get the players inventory
|
||||
Inventory player_inv = player.getInventory();
|
||||
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(3.12*s, -9.5*s);
|
||||
|
||||
// Render the players inventory
|
||||
for(int i=0;i<6;i++)
|
||||
{
|
||||
ItemStack player_item = player_inv.getItem(i);
|
||||
|
||||
if(!player_item.isEmpty())
|
||||
{
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(i * 2 / aspect_ratio, 0.3);
|
||||
player_item.item.render(new Vec2d(0, 0), new Vec2d(1.5, 1.5));
|
||||
GlHelpers.translate2(0, -0.1);
|
||||
Text.render(Integer.toString(player_item.count), text_size);
|
||||
GlHelpers.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
GlHelpers.popMatrix();
|
||||
|
||||
// Render the active slots text
|
||||
ItemStack item_active = player_inv.getItem(player.inventory_hand);
|
||||
if(!item_active.isEmpty())
|
||||
{
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.translate2(3.12*s, -9.5*s);
|
||||
GlHelpers.translate2(-0.08, 2.24);
|
||||
Text.render(item_active.item.getName(item_active.meta), text_size);
|
||||
GlHelpers.popMatrix();
|
||||
}
|
||||
|
||||
// Render the boss bars
|
||||
BossBars.render();
|
||||
}
|
||||
|
||||
// Render the loaded menu
|
||||
Main.menu.render();*/
|
||||
//Main.menu.render();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package projectzombie.display;
|
||||
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.Main;
|
||||
|
||||
public class DisplayStatsEventHandler implements IMainloopTask
|
||||
{
|
||||
|
|
@ -22,9 +22,11 @@ public class DisplayStatsEventHandler implements IMainloopTask
|
|||
@Override
|
||||
public void MainLoopUpdate()
|
||||
{
|
||||
// Set the fps from mspf every second
|
||||
long mspf = MainloopEventHandler.MAINLOOP_EVENT_HANDLER.mspf;
|
||||
fps = (int)(1000 / mspf);
|
||||
// Display the fps
|
||||
Main.window.setTitle("Project Zombie (" + DisplayWindow.fps + " fps)");
|
||||
|
||||
fps = DisplayWindow.fps;
|
||||
DisplayWindow.fps = 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,22 +1,14 @@
|
|||
package projectzombie.display;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_DOUBLEBUFFER;
|
||||
import static org.lwjgl.glfw.GLFW.GLFW_FALSE;
|
||||
import static org.lwjgl.glfw.GLFW.glfwWindowHint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import gl_engine.graphics.GraphicsHelpers;
|
||||
import gl_engine.graphics.GraphicsShader;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Resources;
|
||||
import projectzombie.input.CursorEnterCallback;
|
||||
import projectzombie.input.CursorPosCallback;
|
||||
|
|
@ -26,7 +18,6 @@ import projectzombie.input.KeyCharCallback;
|
|||
import projectzombie.input.MouseButtonCallback;
|
||||
import projectzombie.input.ScrollWheelCallback;
|
||||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
|
||||
public class DisplayWindow implements IMainloopTask
|
||||
{
|
||||
|
|
@ -38,12 +29,15 @@ public class DisplayWindow implements IMainloopTask
|
|||
private boolean fullscreen = true;
|
||||
private boolean mouseVisibility_last = false;
|
||||
|
||||
public static int fps = 0;
|
||||
|
||||
public GraphicsShader environmentRenderer;
|
||||
|
||||
public int glsl_model;
|
||||
public int glsl_projection;
|
||||
public int glsl_rotated;
|
||||
public int glsl_camera;
|
||||
public int glsl_time;
|
||||
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
|
|
@ -80,6 +74,8 @@ public class DisplayWindow implements IMainloopTask
|
|||
width = w.get()*4;
|
||||
height = h.get()*4;
|
||||
|
||||
//GLFW.glfwWindowHint(GLFW.GLFW_DOUBLEBUFFER, GLFW.GLFW_FALSE);
|
||||
|
||||
// Create the window
|
||||
window = GraphicsHelpers.initWindow("Project Zombie", width, height, monitor);
|
||||
|
||||
|
|
@ -102,6 +98,7 @@ public class DisplayWindow implements IMainloopTask
|
|||
//GLFW.glfwShowWindow(this.window);
|
||||
|
||||
GL33.glEnable(GL33.GL_DEPTH_TEST);
|
||||
GL33.glEnable(GL33.GL_BLEND);
|
||||
|
||||
environmentRenderer = new GraphicsShader("/resources/shader/environmentRenderer");
|
||||
environmentRenderer.use();
|
||||
|
|
@ -110,6 +107,7 @@ public class DisplayWindow implements IMainloopTask
|
|||
glsl_camera = GL33.glGetUniformLocation(environmentRenderer.program, "camera");
|
||||
glsl_rotated = GL33.glGetUniformLocation(environmentRenderer.program, "rotated");
|
||||
glsl_projection = GL33.glGetUniformLocation(environmentRenderer.program, "projection");
|
||||
glsl_time = GL33.glGetUniformLocation(environmentRenderer.program, "time");
|
||||
}
|
||||
|
||||
public void render()
|
||||
|
|
@ -133,6 +131,8 @@ public class DisplayWindow implements IMainloopTask
|
|||
// Swap the framebuffers and poll events
|
||||
GLFW.glfwSwapBuffers(window);
|
||||
GLFW.glfwPollEvents();
|
||||
|
||||
fps += 1;
|
||||
}
|
||||
|
||||
public void toggleFullscreen() {
|
||||
|
|
@ -157,7 +157,11 @@ public class DisplayWindow implements IMainloopTask
|
|||
}
|
||||
|
||||
public boolean shouldClose() {
|
||||
return GLFW.glfwWindowShouldClose(this.window);
|
||||
return GLFW.glfwWindowShouldClose(window);
|
||||
}
|
||||
|
||||
public void makeContextCurrent() {
|
||||
GLFW.glfwMakeContextCurrent(window);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -174,4 +178,8 @@ public class DisplayWindow implements IMainloopTask
|
|||
public void MainLoopUpdate() {
|
||||
this.render();
|
||||
}
|
||||
|
||||
public void setTitle(String string) {
|
||||
GLFW.glfwSetWindowTitle(window, string);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@ package projectzombie.display.bossbar;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
|
||||
public class BossBars
|
||||
{
|
||||
private static final ArrayList<IBossBar> bossbars = new ArrayList<IBossBar>();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
package projectzombie.display.lighting;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.map.IMap2D;
|
||||
import projectzombie.util.math.map.Map2D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.util.math.map.IMap2D;
|
||||
import projectzombie.util.math.map.Map2D;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
||||
public class ChunkLightingCollection implements IMap2D<ChunkLightingTemp>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
package projectzombie.display.lighting;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -18,7 +17,7 @@ public class DynamicLighting
|
|||
public static void update()
|
||||
{
|
||||
if(!ChunkEventHandler.loaded) return;
|
||||
int r = Camera.camera.renderDistance;
|
||||
int r = Chunk.RENDER_DISTANCE;
|
||||
Layer layer = Main.world.getLayer();
|
||||
EntityPlayer player = Main.player;
|
||||
|
||||
|
|
@ -84,7 +83,7 @@ public class DynamicLighting
|
|||
MathHelpers.floor(lpos.squareDistance(new Vec2i(
|
||||
MathHelpers.floor(Main.player.pos.x),
|
||||
MathHelpers.floor(Main.player.pos.y))) / 16)
|
||||
> Camera.camera.renderDistance) {
|
||||
> Chunk.RENDER_DISTANCE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
package projectzombie.display.lighting;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.range.Range4i;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec4i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.mainloop.MainloopHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.range.Range4i;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec4i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -123,7 +123,7 @@ public class TileLighting implements IMainloopTask
|
|||
MathHelpers.floor(lpos.squareDistance(new Vec2i(
|
||||
MathHelpers.floor(Main.player.pos.x),
|
||||
MathHelpers.floor(Main.player.pos.y))) / 16)
|
||||
> Camera.camera.renderDistance
|
||||
> Chunk.RENDER_DISTANCE
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ public class TileLighting implements IMainloopTask
|
|||
|
||||
@Override
|
||||
public boolean MainLoopRepeat() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -8,17 +8,15 @@ import bdf.classes.IBdfClassManager;
|
|||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.init.Entities;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.tiles.Tile;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,11 @@ import java.util.Random;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.display.bossbar.BossBars;
|
||||
import projectzombie.display.bossbar.IBossBar;
|
||||
import projectzombie.init.Items;
|
||||
|
|
@ -13,14 +16,9 @@ import projectzombie.init.Models;
|
|||
import projectzombie.init.Tiles;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.time.GameTimer;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,20 +2,17 @@ package projectzombie.entity;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.particle.ParticleBlood;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Sounds;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.tiles.Tile;
|
||||
import projectzombie.tiles.TileBulletBreakable;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -75,7 +72,7 @@ public class EntityBullet extends EntityParticle
|
|||
Math.toRadians(this.angle), Math.toRadians(this.height_angle)));
|
||||
|
||||
// Play the gun sound
|
||||
Sounds.GUN.play(new Vec3d(pos.x, pos.y, 0.4), 2);
|
||||
Sounds.GUN.play(new Vec3d(pos.x, 0.4, pos.y), 2);
|
||||
}
|
||||
|
||||
public EntityBullet withHeight(double angle, double height) {
|
||||
|
|
@ -157,7 +154,7 @@ public class EntityBullet extends EntityParticle
|
|||
e.push(1, angle);
|
||||
|
||||
// Spawn some blood particles
|
||||
if(EntityParticle.MODE != SettingQuality.OFF) {
|
||||
if(!EntityParticle.DISABLED) {
|
||||
for(int i=0;i<ea.bloodParticles();i++) {
|
||||
chunk.spawnEntity(new ParticleBlood(rand, pos.copy(), angle));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class EntityDummy extends Entity implements EntityAlive
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,19 +2,20 @@ package projectzombie.entity;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.particle.ParticleBlood;
|
||||
import projectzombie.entity.particle.ParticleBreak;
|
||||
import projectzombie.entity.particle.ParticleSmoke;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Sounds;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.texture.IHasTexture;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -108,13 +109,13 @@ public class EntityExplosion extends Entity
|
|||
if(!bts.tile.unbreakable) {
|
||||
l.setBackTile(ets, tpos);
|
||||
if(fts.tile instanceof IHasTexture)
|
||||
l.spawnEntity(new ParticleBreak(new Vec2d(tpos.x+rand.nextDouble(), tpos.y+rand.nextDouble()), bts));
|
||||
l.spawnEntity(new ParticleBreak(new Vec2d(tpos.x+rand.nextDouble(), tpos.y+rand.nextDouble()), bts, 1));
|
||||
}
|
||||
|
||||
if(!fts.tile.unbreakable) {
|
||||
l.setFrontTile(Tiles.VOID.getDefaultState(), tpos);
|
||||
if(fts.tile instanceof IHasTexture)
|
||||
l.spawnEntity(new ParticleBreak(new Vec2d(tpos.x+rand.nextDouble(), tpos.y+rand.nextDouble()), fts));
|
||||
l.spawnEntity(new ParticleBreak(new Vec2d(tpos.x+rand.nextDouble(), tpos.y+rand.nextDouble()), fts, 1));
|
||||
}
|
||||
|
||||
// Spawn some blood if entities were killed
|
||||
|
|
@ -136,6 +137,6 @@ public class EntityExplosion extends Entity
|
|||
|
||||
@Override
|
||||
public Model getModel() {
|
||||
return null;
|
||||
return Models.EMPTY;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -26,7 +23,7 @@ public class EntityFlare extends EntityTnt
|
|||
|
||||
@Override
|
||||
public double getLightLevel() {
|
||||
return getLightWithHeight(1 - (this.height * (1/12.0))) * ( rand.nextDouble() / 10.0 + 0.9 );
|
||||
return getLightWithHeight(1 - (this.pos.y * (1/12.0))) * ( rand.nextDouble() / 10.0 + 0.9 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,13 +2,11 @@ package projectzombie.entity;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
import projectzombie.world.layer.layergen.LayerGenRememberPlayerPos;
|
||||
|
|
|
|||
|
|
@ -2,18 +2,14 @@ package projectzombie.entity;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.init.Models;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class EntityItem extends Entity
|
||||
public class EntityItem extends Entity implements EntityHeight
|
||||
{
|
||||
private ItemStack stack;
|
||||
private double height = 0;
|
||||
|
|
@ -23,6 +19,16 @@ public class EntityItem extends Entity
|
|||
|
||||
public double angle;
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public EntityItem(BdfObject bdf) {
|
||||
super(bdf);
|
||||
}
|
||||
|
|
@ -134,7 +140,7 @@ public class EntityItem extends Entity
|
|||
|
||||
@Override
|
||||
public Model getModel() {
|
||||
return stack.item.getModel(stack.meta);
|
||||
return stack.item.getModel(stack.meta).getItemModel();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,15 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public abstract class EntityParticle extends Entity
|
||||
{
|
||||
public static SettingQuality MODE = SettingQuality.FANCY;
|
||||
public static boolean DISABLED = false;
|
||||
protected TextureRef3D tex;
|
||||
|
||||
public EntityParticle(BdfObject bdf) {
|
||||
|
|
@ -28,6 +25,6 @@ public abstract class EntityParticle extends Entity
|
|||
super.tick(chunk, layer);
|
||||
|
||||
// Kill the particle if the player can't see it to reduce lag
|
||||
if(Main.player.pos.squareDistance(pos) > Camera.camera.renderDistance * 16) this.kill();
|
||||
if(Main.player.pos.squareDistance(pos) > Chunk.RENDER_DISTANCE * 16) this.kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,14 +2,12 @@ package projectzombie.entity;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.particle.ParticleSpark;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.particle.ParticleSpark;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -127,8 +125,7 @@ public class EntityTnt extends Entity
|
|||
|
||||
@Override
|
||||
public Model getModel() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
return Models.EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,15 +4,14 @@ import java.util.Random;
|
|||
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.util.math.astar.AStar;
|
||||
import projectzombie.util.math.astar.AStarSearcher;
|
||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package projectzombie.entity;
|
||||
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class EntityZombieArmored extends EntityZombie
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,27 +2,34 @@ package projectzombie.entity.particle;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.EntityHeight;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ParticleBlood extends EntityParticle
|
||||
public class ParticleBlood extends EntityParticle implements EntityHeight
|
||||
{
|
||||
private double r_color;
|
||||
private double time = 1000;
|
||||
private double height = 0;
|
||||
private Vec3d velocity;
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public ParticleBlood(Random rand, Vec2d pos, double angle) {
|
||||
super(pos);
|
||||
|
||||
|
|
@ -60,7 +67,7 @@ public class ParticleBlood extends EntityParticle
|
|||
// Should this particle too old; destroy it
|
||||
if(time < 0) chunk.killEntity(this);
|
||||
|
||||
if(MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,60 +1,59 @@
|
|||
package projectzombie.entity.particle;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityHeight;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.IHasTexture;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ParticleBreak extends EntityParticle
|
||||
public class ParticleBreak extends EntityParticle implements EntityHeight
|
||||
{
|
||||
private double height = 0;
|
||||
private Vec3d velocity;
|
||||
private int time = 0;
|
||||
private boolean landed = false;
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public static void spawnParticles(Chunk chunk, Vec2d pos, Entity e)
|
||||
{
|
||||
if(EntityParticle.MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
int height = 1;
|
||||
|
||||
/*if(e instanceof EntityVertical) {
|
||||
height = MathHelpers.floor(((EntityVertical)e).size.y);
|
||||
}
|
||||
double height = e.getModel().getHeight();
|
||||
|
||||
for(int i=0;i<50 * height;i++) {
|
||||
chunk.spawnEntity(new ParticleBreak(pos.copy(), e));
|
||||
}*/
|
||||
chunk.spawnEntity(new ParticleBreak(pos.copy(), e, height));
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnParticles(Chunk chunk, Vec2d pos, TileState s)
|
||||
{
|
||||
if(EntityParticle.MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
return;
|
||||
}
|
||||
|
||||
int height = 1;
|
||||
|
||||
|
||||
double height = s.tile.getModel(s.meta).getHeight();
|
||||
|
||||
for(int i=0;i<50 * height;i++) {
|
||||
chunk.spawnEntity(new ParticleBreak(pos.copy(), s));
|
||||
chunk.spawnEntity(new ParticleBreak(pos.copy(), s, height));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,7 +89,7 @@ public class ParticleBreak extends EntityParticle
|
|||
}
|
||||
}*/
|
||||
|
||||
public ParticleBreak(Vec2d pos, TileState ts) {
|
||||
public ParticleBreak(Vec2d pos, TileState ts, double height) {
|
||||
super(pos);
|
||||
|
||||
double angle = RandomHelpers.randrange(rand, 360);
|
||||
|
|
@ -100,10 +99,11 @@ public class ParticleBreak extends EntityParticle
|
|||
side_v.x, side_v.y,
|
||||
RandomHelpers.randrange(rand, 10000) / 200000.0);
|
||||
|
||||
this.height = RandomHelpers.randrange(rand, 0, (int)(height * 1000)) / 1000.0;
|
||||
time = RandomHelpers.randrange(rand, 800, 1200);
|
||||
}
|
||||
|
||||
public ParticleBreak(Vec2d pos, Entity entity) {
|
||||
public ParticleBreak(Vec2d pos, Entity entity, double height) {
|
||||
super(pos);
|
||||
double angle = RandomHelpers.randrange(rand, 360);
|
||||
|
||||
|
|
@ -112,6 +112,7 @@ public class ParticleBreak extends EntityParticle
|
|||
side_v.x, side_v.y,
|
||||
RandomHelpers.randrange(rand, 10000) / 200000.0);
|
||||
|
||||
this.height = RandomHelpers.randrange(rand, 0, (int)(height * 1000)) / 1000.0;
|
||||
time = RandomHelpers.randrange(rand, 500, 1500);
|
||||
|
||||
/*if(entity instanceof EntityVertical) {
|
||||
|
|
@ -154,7 +155,7 @@ public class ParticleBreak extends EntityParticle
|
|||
pos.y += velocity.y;
|
||||
}
|
||||
|
||||
if(EntityParticle.MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,25 +2,33 @@ package projectzombie.entity.particle;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.EntityHeight;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ParticleLava extends EntityParticle
|
||||
public class ParticleLava extends EntityParticle implements EntityHeight
|
||||
{
|
||||
private static Random rand = new Random();
|
||||
private Vec3d velocity;
|
||||
private double height = 0;
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public ParticleLava(Vec2d pos) {
|
||||
super(pos);
|
||||
|
||||
|
|
@ -44,7 +52,7 @@ public class ParticleLava extends EntityParticle
|
|||
kill();
|
||||
}
|
||||
|
||||
if(MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
package projectzombie.entity.particle;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.EntityHeight;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ParticleSmoke extends EntityParticle
|
||||
public class ParticleSmoke extends EntityParticle implements EntityHeight
|
||||
{
|
||||
double height = 0;
|
||||
double opacity = 1;
|
||||
|
|
@ -21,6 +19,16 @@ public class ParticleSmoke extends EntityParticle
|
|||
|
||||
private Model model;
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public ParticleSmoke(Vec2d pos) {
|
||||
super(pos);
|
||||
|
||||
|
|
@ -44,7 +52,7 @@ public class ParticleSmoke extends EntityParticle
|
|||
height += height_speed;
|
||||
opacity -= disappear_speed;
|
||||
|
||||
if(EntityParticle.MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,9 @@
|
|||
package projectzombie.entity.particle;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -32,7 +29,7 @@ public class ParticleSpark extends EntityParticle
|
|||
kill();
|
||||
}
|
||||
|
||||
if(MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,24 +1,31 @@
|
|||
package projectzombie.entity.particle;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.EntityHeight;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ParticleWater extends EntityParticle
|
||||
public class ParticleWater extends EntityParticle implements EntityHeight
|
||||
{
|
||||
private Vec3d velocity;
|
||||
private double height = 0;
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(double height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public ParticleWater(Vec2d pos) {
|
||||
super(pos);
|
||||
|
||||
|
|
@ -42,7 +49,7 @@ public class ParticleWater extends EntityParticle
|
|||
kill();
|
||||
}
|
||||
|
||||
if(MODE == SettingQuality.OFF) {
|
||||
if(DISABLED) {
|
||||
kill();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
package projectzombie.entity.player;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
import bdf.types.BdfIndent;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityAlive;
|
||||
import projectzombie.entity.EntityBullet;
|
||||
|
|
@ -22,16 +19,8 @@ import projectzombie.inventory.Inventory;
|
|||
import projectzombie.menu.MenuDeath;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.settings.Cheats;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.World;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class EntityPlayer extends Entity implements EntityAlive, EntityInventory, EntityHeight
|
||||
|
|
|
|||
|
|
@ -38,6 +38,8 @@ public class Items
|
|||
register(GRAPPLING_HOOK);
|
||||
|
||||
register(SPAWN_ZOMBIE);
|
||||
register(SPAWN_DUMMY);
|
||||
|
||||
register(ROCK);
|
||||
|
||||
register(AMMO);
|
||||
|
|
@ -54,6 +56,7 @@ public class Items
|
|||
public static final Item GRAPPLING_HOOK = new ItemGrapplingHook();
|
||||
|
||||
public static final Item SPAWN_ZOMBIE = new ItemSpawnZombie();
|
||||
public static final Item SPAWN_DUMMY = new ItemSpawnZombie();
|
||||
|
||||
public static final Item ROCK = new ItemRock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,13 @@
|
|||
package projectzombie.init;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.lwjgl.opengl.GL;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.display.DisplayWindow;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelEmpty;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.model.ModelRandom;
|
||||
import projectzombie.model.ModelTile;
|
||||
import projectzombie.model.ModelVertical;
|
||||
import projectzombie.util.gl.texture.TextureMap;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.util.gl.texture.TextureReferenceRandom;
|
||||
|
||||
public class Models
|
||||
{
|
||||
|
|
@ -27,31 +20,30 @@ public class Models
|
|||
public static final Model TILE_TREE = new ModelVertical(Resources.ATLAS.get("/tile/tree.png"), new Vec2d(1, 4));
|
||||
public static final Model TILE_ROCK = new ModelVertical(Resources.ATLAS.get("/tile/rock.png"));
|
||||
public static final Model TILE_LADDER = new ModelVertical(Resources.ATLAS.get("/tile/ladder.png"));
|
||||
public static final Model TILE_PORTAL = new ModelVertical(Resources.ATLAS.get("/tile/portal.png"));
|
||||
public static final Model TILE_PORTAL = new ModelTile(Resources.ATLAS.get("/tile/tunnel_down.png"));
|
||||
public static final Model TILE_WALL = new ModelTile(Resources.ATLAS.get("/tile/wall.png"));
|
||||
public static final Model TILE_LADDER_UP = new ModelVertical(Resources.ATLAS.get("/tile/ladder_up.png"));
|
||||
public static final Model TILE_LADDER_UP = new ModelVertical(Resources.ATLAS.get("/tile/ladder_up.png"), new Vec2d(1, 16));
|
||||
public static final Model TILE_CHEST = new ModelVertical(Resources.ATLAS.get("/tile/chest.png"));
|
||||
public static final Model TILE_BOSS_PORTAL = new ModelVertical(Resources.ATLAS.get("/tile/boss_portal.png"));
|
||||
public static final Model TILE_WATER = new ModelTile(Resources.ATLAS.get("/tile/water.png"));
|
||||
public static final Model TILE_LAVA = new ModelTile(Resources.ATLAS.get("/tile/lava.png"));
|
||||
public static final Model TILE_LAVA_FLOW = new ModelTile(Resources.ATLAS.get("/tile/lava_flow.png"));
|
||||
public static final Model TILE_BOSS_PORTAL = new ModelVertical(Resources.ATLAS.get("/tile/boss_portal.png"), new Vec2d(2, 2));
|
||||
public static final Model TILE_WATER = new ModelTile(Resources.ATLAS.get("/tile/water.png"), 16, 10);
|
||||
public static final Model TILE_LAVA = new ModelTile(Resources.ATLAS.get("/tile/lava.png"), 16, 50);
|
||||
public static final Model TILE_LAVA_FLOW = new ModelTile(Resources.ATLAS.get("/tile/lava_flow.png"), 16, 50);
|
||||
public static final Model TILE_LANTERN = new ModelVertical(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
||||
|
||||
public static final Model ENTITY_BOSS_IDLE = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_idle.png"));
|
||||
public static final Model ENTITY_BOSS_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_firing.png"), 4, 10);
|
||||
public static final Model ENTITY_BOSS_WALKING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_walking.png"), 4, 10);
|
||||
public static final Model ENTITY_BOSS_WALKING_AND_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_walking_firing.png"), 4, 10);
|
||||
public static final Model ENTITY_BOSS_IDLE = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_idle.png"), new Vec2d(4, 4));
|
||||
public static final Model ENTITY_BOSS_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_firing.png"), new Vec2d(4, 4), 4, 10);
|
||||
public static final Model ENTITY_BOSS_WALKING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_walking.png"), new Vec2d(4, 4), 4, 10);
|
||||
public static final Model ENTITY_BOSS_WALKING_AND_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_walking_firing.png"), new Vec2d(4, 4), 4, 10);
|
||||
public static final Model ENTITY_TNT = new ModelVertical(Resources.ATLAS.get("/entity/tnt.png"));
|
||||
public static final Model ENTITY_FLARE = new ModelVertical(Resources.ATLAS.get("/entity/flare.png"));
|
||||
public static final Model ENTITY_DUMMY = new ModelVertical(Resources.ATLAS.get("/entity/dummy.png"));
|
||||
public static final Model ENTITY_GRAPPLING_HOOK = new ModelVertical(Resources.ATLAS.get("/entity/grappling_hook.png"));
|
||||
|
||||
public static final Model TILE_LANTERN = new ModelVertical(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
||||
|
||||
public static final Model PARTICLE_BLOOD = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||
public static final Model PARTICLE_LAVA = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||
public static final Model PARTICLE_WATER = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||
public static final Model PARTICLE_SMOKE_TRAIL = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||
public static final Model PARTICLE_BULLET = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||
public static final Model PARTICLE_BLOOD = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"), new Vec2d(0.1, 0.1));
|
||||
public static final Model PARTICLE_LAVA = new ModelVertical(Resources.ATLAS.get("/particle/lava.png"), new Vec2d(0.1, 0.1));
|
||||
public static final Model PARTICLE_WATER = new ModelVertical(Resources.ATLAS.get("/particle/water.png"), new Vec2d(0.1, 0.1));
|
||||
public static final Model PARTICLE_SMOKE_TRAIL = new ModelVertical(Resources.ATLAS.get("/particle/smoke_trail.png"), new Vec2d(0.1, 0.1));
|
||||
public static final Model PARTICLE_BULLET = new ModelVertical(Resources.ATLAS.get("/particle/bullet.png"), new Vec2d(0.1, 0.1));
|
||||
|
||||
public static final ModelRandom PARTICLE_SMOKE_RANDOM = new ModelRandom(
|
||||
new ModelVertical(Resources.ATLAS.get("/particle/smoke_0.png")),
|
||||
|
|
@ -72,12 +64,18 @@ public class Models
|
|||
public static final Model UI_DEFENCE_LEVEL = new ModelGui(Resources.ATLAS.get("/gui/shield.png"));
|
||||
public static final Model UI_GUN_LEVEL = new ModelGui(Resources.ATLAS.get("/gui/gun.png"));
|
||||
|
||||
public static final Model ITEM_GRAPPLING_HOOK = new ModelGui(Resources.ATLAS.get("/item/grappling_hook.png"));
|
||||
public static final Model ITEM_HEALTH_POTION = new ModelGui(Resources.ATLAS.get("/item/health_potion.png"));
|
||||
public static final Model ITEM_AMMO_BOX = new ModelGui(Resources.ATLAS.get("/item/ammo_box.png"));
|
||||
public static final Model ITEM_GUN_UPGRADE = new ModelGui(Resources.ATLAS.get("/item/gun_upgrade.png"));
|
||||
public static final Model ITEM_DEFENCE_UPGRADE = new ModelGui(Resources.ATLAS.get("/item/shield_upgrade.png"));
|
||||
public static final Model ITEM_ROCK = new ModelGui(Resources.ATLAS.get("/item/rock.png"));
|
||||
public static final ModelItem ITEM_EMPTY = ModelItem.createEmpty();
|
||||
public static final ModelItem ITEM_GRAPPLING_HOOK = new ModelItem(Resources.ATLAS.get("/item/grappling_hook.png"));
|
||||
public static final ModelItem ITEM_HEALTH_POTION = new ModelItem(Resources.ATLAS.get("/item/health_potion.png"));
|
||||
public static final ModelItem ITEM_AMMO_BOX = new ModelItem(Resources.ATLAS.get("/item/ammo_box.png"));
|
||||
public static final ModelItem ITEM_GUN_UPGRADE = new ModelItem(Resources.ATLAS.get("/item/gun_upgrade.png"));
|
||||
public static final ModelItem ITEM_DEFENCE_UPGRADE = new ModelItem(Resources.ATLAS.get("/item/shield_upgrade.png"));
|
||||
public static final ModelItem ITEM_ROCK = new ModelItem(Resources.ATLAS.get("/tile/rock.png"));
|
||||
public static final ModelItem ITEM_TNT = new ModelItem(Resources.ATLAS.get("/entity/tnt.png"));
|
||||
public static final ModelItem ITEM_FLARE = new ModelItem(Resources.ATLAS.get("/entity/flare.png"));
|
||||
public static final ModelItem ITEM_LANTERN = new ModelItem(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
||||
public static final ModelItem ITEM_SPAWN_ZOMBIE = new ModelItem(Resources.ATLAS.get("/entity/zombie_back_moving.png"), 4, 10);
|
||||
public static final ModelItem ITEM_SPAWN_DUMMY = new ModelItem(Resources.ATLAS.get("/entity/dummy.png"));
|
||||
|
||||
// Player Back White Varient
|
||||
public static final Model ENTITY_PLAYER_B_W_STILL = new ModelVertical(Resources.ATLAS.get("/player/player_white_back_still.png"));
|
||||
|
|
|
|||
|
|
@ -30,20 +30,20 @@ public class Resources
|
|||
|
||||
public static TextureAtlas3D ATLAS;
|
||||
|
||||
public static final Resource GUN_OGG_0 = new Resource("sound/gun0.ogg");
|
||||
public static final Resource GUN_OGG_1 = new Resource("sound/gun1.ogg");
|
||||
public static final Resource GUN_OGG_2 = new Resource("sound/gun2.ogg");
|
||||
public static final Resource GUN_OGG_3 = new Resource("sound/gun3.ogg");
|
||||
public static final Resource GUN_OGG_4 = new Resource("sound/gun4.ogg");
|
||||
public static final Resource GUN_OGG_5 = new Resource("sound/gun5.ogg");
|
||||
public static final Resource GUN_OGG_6 = new Resource("sound/gun6.ogg");
|
||||
public static final Resource GUN_OGG_7 = new Resource("sound/gun7.ogg");
|
||||
public static final Resource GUN_OGG_8 = new Resource("sound/gun8.ogg");
|
||||
public static final Resource GUN_OGG_9 = new Resource("sound/gun9.ogg");
|
||||
public static final Resource GUN_OGG_0 = new Resource("/sound/gun0.ogg");
|
||||
public static final Resource GUN_OGG_1 = new Resource("/sound/gun1.ogg");
|
||||
public static final Resource GUN_OGG_2 = new Resource("/sound/gun2.ogg");
|
||||
public static final Resource GUN_OGG_3 = new Resource("/sound/gun3.ogg");
|
||||
public static final Resource GUN_OGG_4 = new Resource("/sound/gun4.ogg");
|
||||
public static final Resource GUN_OGG_5 = new Resource("/sound/gun5.ogg");
|
||||
public static final Resource GUN_OGG_6 = new Resource("/sound/gun6.ogg");
|
||||
public static final Resource GUN_OGG_7 = new Resource("/sound/gun7.ogg");
|
||||
public static final Resource GUN_OGG_8 = new Resource("/sound/gun8.ogg");
|
||||
public static final Resource GUN_OGG_9 = new Resource("/sound/gun9.ogg");
|
||||
|
||||
public static final Resource HIT_OGG_0 = new Resource("sound/hit0.ogg");
|
||||
public static final Resource HIT_OGG_1 = new Resource("sound/hit1.ogg");
|
||||
public static final Resource HIT_OGG_2 = new Resource("sound/hit2.ogg");
|
||||
public static final Resource HIT_OGG_0 = new Resource("/sound/hit0.ogg");
|
||||
public static final Resource HIT_OGG_1 = new Resource("/sound/hit1.ogg");
|
||||
public static final Resource HIT_OGG_2 = new Resource("/sound/hit2.ogg");
|
||||
|
||||
public static final Resource EXPLOSION_OGG = new Resource("sound/explosion.ogg");
|
||||
public static final Resource EXPLOSION_OGG = new Resource("/sound/explosion.ogg");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ package projectzombie.input;
|
|||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.glfw.GLFWCursorPosCallbackI;
|
||||
|
||||
import projectzombie.Main;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
|
||||
public class CursorPosCallback implements GLFWCursorPosCallbackI
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ import static projectzombie.input.GameInput.move_last;
|
|||
|
||||
import org.lwjgl.glfw.GLFWKeyCallbackI;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.input.types.Input;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
||||
{
|
||||
|
|
@ -165,11 +165,11 @@ public class KeyCallback implements GLFWKeyCallbackI, IMainloopTask
|
|||
}
|
||||
|
||||
if(moveLeft) {
|
||||
move_point.y -= 1;
|
||||
move_point.y += 1;
|
||||
}
|
||||
|
||||
if(moveRight) {
|
||||
move_point.y += 1;
|
||||
move_point.y -= 1;
|
||||
}
|
||||
|
||||
if(move_point.x != 0 || move_point.y != 0) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package projectzombie.input.types;
|
||||
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
|
||||
public class InputGUI implements Input
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package projectzombie.input.types;
|
||||
|
||||
import projectzombie.Main;
|
||||
import projectzombie.menu.MenuGamePause;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.menu.MenuGamePause;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
|
||||
public class InputGame implements Input
|
||||
|
|
@ -40,7 +40,7 @@ public class InputGame implements Input
|
|||
|
||||
@Override
|
||||
public void camera(boolean state, double amount) {
|
||||
Main.player.angle += amount;
|
||||
Main.player.angle -= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,17 +4,13 @@ import projectzombie.entity.Entity;
|
|||
import projectzombie.entity.EntityInventory;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.inventory.Inventory;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public abstract class Item
|
||||
{
|
||||
public TextureReference texture;
|
||||
public int id;
|
||||
|
||||
public void onPlayerAction(ItemStack stack, Layer layer, Chunk chunk, EntityPlayer player) {
|
||||
|
|
@ -29,7 +25,7 @@ public abstract class Item
|
|||
return 0;
|
||||
}
|
||||
|
||||
public abstract Model getModel(short meta);
|
||||
public abstract ModelItem getModel(short meta);
|
||||
|
||||
public void onPickedUp(ItemStack stack, Layer layer, Chunk chunk, Entity entity)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package projectzombie.items;
|
|||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -12,7 +12,7 @@ public class ItemAmmo extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_AMMO_BOX;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package projectzombie.items;
|
|||
import projectzombie.Main;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -12,7 +12,7 @@ public class ItemDefenceUpgrade extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_DEFENCE_UPGRADE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@ package projectzombie.items;
|
|||
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ public class ItemEmpty extends Item
|
|||
}
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
return null;
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_EMPTY;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package projectzombie.items;
|
|||
import projectzombie.entity.EntityFlare;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -12,8 +12,8 @@ public class ItemFlare extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
return Models.ENTITY_FLARE;
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_FLARE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.entity.EntityGrapplingHook;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ public class ItemGrapplingHook extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_GRAPPLING_HOOK;
|
||||
}
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ public class ItemGrapplingHook extends Item
|
|||
super.onPlayerAction(stack, layer, chunk, player);
|
||||
|
||||
Vec2d pos = player.pos.add(MathHelpers.moveTowards2(0.01, Math.toRadians(player.angle)));
|
||||
layer.spawnEntity(new EntityGrapplingHook(pos, stack.meta, player));
|
||||
layer.spawnEntity(new EntityGrapplingHook(new Vec2d(pos.x, pos.y), stack.meta, player));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package projectzombie.items;
|
|||
import projectzombie.Main;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -12,7 +12,7 @@ public class ItemGunUpgrade extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_GUN_UPGRADE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
|||
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -11,7 +11,7 @@ public class ItemHealthPotion extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_HEALTH_POTION;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -14,8 +14,8 @@ public class ItemLantern extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
return Models.TILE_LANTERN;
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_LANTERN;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package projectzombie.items;
|
|||
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -11,7 +11,7 @@ public class ItemRock extends Item
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_ROCK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package projectzombie.items;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -12,7 +12,7 @@ public abstract class ItemSpawn extends Item
|
|||
public void onPlayerAction(ItemStack stack, Layer layer, Chunk chunk, EntityPlayer player) {
|
||||
super.onPlayerAction(stack, layer, chunk, player);
|
||||
|
||||
this.spawnEntity(layer, chunk, player.pos.copy());
|
||||
this.spawnEntity(layer, chunk, player.pos);
|
||||
}
|
||||
|
||||
public void spawnEntity(Layer layer, Chunk chunk, Vec2d pos) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package projectzombie.items;
|
|||
import projectzombie.entity.EntityTnt;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
|
@ -11,8 +11,8 @@ import projectzombie.world.layer.Layer;
|
|||
public class ItemTnt extends Item
|
||||
{
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
return Models.ENTITY_TNT;
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_TNT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package projectzombie.items.spawner;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.entity.EntityDummy;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.items.ItemSpawn;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ItemSpawnDummy extends ItemSpawn
|
||||
{
|
||||
|
||||
@Override
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_SPAWN_DUMMY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnEntity(Layer layer, Chunk chunk, Vec2d pos) {
|
||||
chunk.spawnEntity(new EntityDummy(new Vec2d(pos.x, pos.y)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package projectzombie.items.spawner;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.entity.EntityZombie;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.items.ItemSpawn;
|
||||
import projectzombie.model.Model;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.model.ModelItem;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -12,13 +12,13 @@ public class ItemSpawnZombie extends ItemSpawn
|
|||
{
|
||||
|
||||
@Override
|
||||
public Model getModel(short meta) {
|
||||
return Models.ENTITY_ZOMBIE_B;
|
||||
public ModelItem getModel(short meta) {
|
||||
return Models.ITEM_SPAWN_ZOMBIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnEntity(Layer layer, Chunk chunk, Vec2d pos) {
|
||||
chunk.spawnEntity(new EntityZombie(pos));
|
||||
chunk.spawnEntity(new EntityZombie(new Vec2d(pos.x, pos.y)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,11 +3,9 @@ package projectzombie.menu;
|
|||
import java.io.FileOutputStream;
|
||||
import java.util.zip.DeflaterOutputStream;
|
||||
|
||||
import bdf.types.BdfIndent;
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.input.types.InputGUI;
|
||||
import projectzombie.menu.gui.Button;
|
||||
import projectzombie.menu.gui.ButtonGroup;
|
||||
import projectzombie.menu.gui.GUI;
|
||||
import projectzombie.menu.gui.components.ButtonBasic;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package projectzombie.menu;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.DisplayRenderUI;
|
||||
import projectzombie.entity.EntityParticle;
|
||||
|
|
@ -13,8 +14,6 @@ import projectzombie.menu.gui.components.ButtonBasic;
|
|||
import projectzombie.menu.gui.components.ButtonSetting;
|
||||
import projectzombie.menu.gui.components.GUIBackToMenu;
|
||||
import projectzombie.menu.gui.components.OverlayBackground;
|
||||
import projectzombie.settings.SettingQuality;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
|
||||
public class MenuSettings extends Menu
|
||||
|
|
@ -22,10 +21,8 @@ public class MenuSettings extends Menu
|
|||
private GUI gui;
|
||||
private Menu menuOld;
|
||||
|
||||
private String qualitySettingToString(SettingQuality sq) {
|
||||
return sq == SettingQuality.OFF ? "Off" :
|
||||
sq == SettingQuality.FAST ? "Fast" :
|
||||
sq == SettingQuality.FANCY ? "Fancy" : null;
|
||||
private String qualitySettingToString(boolean status) {
|
||||
return status ? "On" : "Off";
|
||||
}
|
||||
|
||||
public MenuSettings(Menu menuOld) {
|
||||
|
|
@ -55,8 +52,8 @@ public class MenuSettings extends Menu
|
|||
|
||||
group.add(new ButtonSetting("Render Distance: "+Chunk.RENDER_DISTANCE, button -> {
|
||||
Chunk.RENDER_DISTANCE += 1;
|
||||
if(Chunk.RENDER_DISTANCE > 5) {
|
||||
Chunk.RENDER_DISTANCE = 1;
|
||||
if(Chunk.RENDER_DISTANCE > 8) {
|
||||
Chunk.RENDER_DISTANCE = 2;
|
||||
}
|
||||
button.setText("Render Distance: "+Chunk.RENDER_DISTANCE);
|
||||
}));
|
||||
|
|
@ -69,32 +66,10 @@ public class MenuSettings extends Menu
|
|||
button.setText("GUI Scale: " + DisplayRenderUI.guiScale);
|
||||
}));
|
||||
|
||||
group.add(new ButtonSetting("Particles: " + qualitySettingToString(EntityParticle.MODE), button -> {
|
||||
|
||||
switch(EntityParticle.MODE) {
|
||||
|
||||
case OFF: {
|
||||
EntityParticle.MODE = SettingQuality.FAST;
|
||||
break;
|
||||
}
|
||||
|
||||
case FAST: {
|
||||
EntityParticle.MODE = SettingQuality.FANCY;
|
||||
break;
|
||||
}
|
||||
|
||||
case FANCY: {
|
||||
EntityParticle.MODE = SettingQuality.OFF;
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
button.setText("Particles: " + qualitySettingToString(EntityParticle.MODE));
|
||||
group.add(new ButtonSetting("Particles: " + qualitySettingToString(EntityParticle.DISABLED), button ->
|
||||
{
|
||||
EntityParticle.DISABLED = !EntityParticle.DISABLED;
|
||||
button.setText("Particles: " + qualitySettingToString(EntityParticle.DISABLED));
|
||||
}));
|
||||
|
||||
/*group.add(new ButtonSetting("Dynamic Lighting: " + (LightingManager.lightingMode == 0 ? "Fast" : "Fancy"),
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
package projectzombie.menu.gui;
|
||||
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.input.InputMode;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class Button implements GUIComponent, GUISelectable
|
||||
{
|
||||
|
|
@ -74,6 +73,7 @@ public class Button implements GUIComponent, GUISelectable
|
|||
Matrix4 matrix = Matrix4.translate(pos.x, pos.y, 0);
|
||||
|
||||
model.bind();
|
||||
model.render();
|
||||
|
||||
if(mouseHover) {
|
||||
//GlHelpers.color3(0.8, 0.8, 0.8);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package projectzombie.menu.gui;
|
||||
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.text.Text;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
|
||||
public class Label implements GUIComponent
|
||||
{
|
||||
|
|
@ -35,18 +35,6 @@ public class Label implements GUIComponent
|
|||
|
||||
@Override
|
||||
public void render(Vec2d mousePos) {
|
||||
double a = GlHelpers.getAspectRatio();
|
||||
GlHelpers.pushMatrix();
|
||||
GlHelpers.color3(color.x, color.y, color.z);
|
||||
GlHelpers.translate2(pos.x / a, pos.y - size.y / 2);
|
||||
if(this.alignment == Alignment.CENTRE) {
|
||||
GlHelpers.translate2(-size.y * text.length() / 2 / a, 0);
|
||||
}
|
||||
if(this.alignment == Alignment.RIGHT) {
|
||||
GlHelpers.translate2(-size.y * text.length() / a, 0);
|
||||
}
|
||||
Text.render(text, size);
|
||||
GlHelpers.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package projectzombie.menu.gui;
|
||||
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import gl_engine.vec.Vec4d;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
|
||||
public class Overlay implements GUIComponent
|
||||
{
|
||||
|
|
@ -19,17 +19,6 @@ public class Overlay implements GUIComponent
|
|||
|
||||
@Override
|
||||
public void render(Vec2d mousePos) {
|
||||
int s = GlHelpers.getScale();
|
||||
GlHelpers.disableTexture2d();
|
||||
GlHelpers.color4(color.x, color.y, color.z, color.m);
|
||||
GlHelpers.begin();
|
||||
GlHelpers.vertex3(-s, -s, 0);
|
||||
GlHelpers.vertex3(-s, s, 0);
|
||||
GlHelpers.vertex3(s, s, 0);
|
||||
GlHelpers.vertex3(s, -s, 0);
|
||||
GlHelpers.end();
|
||||
GlHelpers.color4(1, 1, 1, 1);
|
||||
GlHelpers.enableTexture2d();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import projectzombie.menu.gui.Button;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.menu.gui.Button;
|
||||
|
||||
public class ButtonBasic extends Button {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.menu.MenuMain;
|
||||
import projectzombie.menu.MenuSettings;
|
||||
import projectzombie.menu.gui.ButtonGroup;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class ButtonGroupPause extends ButtonGroup
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.menu.gui.Alignment;
|
||||
import projectzombie.settings.Settings;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class ButtonSetting extends ButtonBasic
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import projectzombie.menu.gui.Label;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.menu.gui.Label;
|
||||
|
||||
public class LabelMain extends Label
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import projectzombie.menu.gui.Label;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.menu.gui.Label;
|
||||
|
||||
public class LabelPause extends Label
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package projectzombie.menu.gui.components;
|
||||
|
||||
import projectzombie.menu.gui.Overlay;
|
||||
import gl_engine.vec.Vec4d;
|
||||
import projectzombie.menu.gui.Overlay;
|
||||
|
||||
public class OverlayBackground extends Overlay
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,49 +1,51 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.GL_FLOAT;
|
||||
import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER;
|
||||
import static org.lwjgl.opengl.GL15.GL_STATIC_DRAW;
|
||||
import static org.lwjgl.opengl.GL15.glBindBuffer;
|
||||
import static org.lwjgl.opengl.GL15.glBufferData;
|
||||
import static org.lwjgl.opengl.GL15.glGenBuffers;
|
||||
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
|
||||
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
|
||||
import static org.lwjgl.opengl.GL30.glBindVertexArray;
|
||||
import static org.lwjgl.opengl.GL30.glGenVertexArrays;
|
||||
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
|
||||
import static org.lwjgl.opengl.GL33.*;
|
||||
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
public abstract class Model
|
||||
{
|
||||
int vao, size;
|
||||
int vao, vbo;
|
||||
boolean loaded = false;
|
||||
private static final int SIZE = 9;
|
||||
private float[] verticies;
|
||||
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
public static final int SIZE = 14;
|
||||
|
||||
// px, py, pz, tx, ty
|
||||
protected abstract float[] getVerticies();
|
||||
protected abstract TextureRef3D[] getTextures();
|
||||
public abstract float[] getVerticies();
|
||||
public abstract TextureRef3D[] getTextures();
|
||||
public abstract double getHeight();
|
||||
public abstract int getSize();
|
||||
|
||||
public float[] getLoadedVerticies() {
|
||||
return verticies;
|
||||
}
|
||||
private TextureRef3D tex;
|
||||
|
||||
public void bind()
|
||||
private void generate()
|
||||
{
|
||||
if(loaded) {
|
||||
glBindVertexArray(vao);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
verticies = this.getVerticies();
|
||||
float[] verticies = this.getVerticies();
|
||||
TextureRef3D[] refs = this.getTextures();
|
||||
|
||||
if(refs.length != 0) {
|
||||
tex = refs[0];
|
||||
}
|
||||
|
||||
if(verticies.length % SIZE != 0 || refs.length * 3 != verticies.length / SIZE) {
|
||||
System.err.println("Invalid model");
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
size = verticies.length/SIZE;
|
||||
int size = verticies.length/SIZE;
|
||||
double k = 0.001;
|
||||
|
||||
for(int i=0;i<size;i++) {
|
||||
|
|
@ -56,7 +58,7 @@ public abstract class Model
|
|||
vao = glGenVertexArrays();
|
||||
glBindVertexArray(vao);
|
||||
|
||||
int vbo = glGenBuffers();
|
||||
vbo = glGenBuffers();
|
||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, verticies, GL_STATIC_DRAW);
|
||||
|
||||
|
|
@ -66,14 +68,49 @@ public abstract class Model
|
|||
glVertexAttribPointer(1, 3, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 3);
|
||||
glEnableVertexAttribArray(1);
|
||||
|
||||
glVertexAttribPointer(2, 3, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 6);
|
||||
glVertexAttribPointer(2, 2, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 6);
|
||||
glEnableVertexAttribArray(2);
|
||||
|
||||
glVertexAttribPointer(3, 3, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 8);
|
||||
glEnableVertexAttribArray(3);
|
||||
|
||||
glVertexAttribPointer(4, 3, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 11);
|
||||
glEnableVertexAttribArray(4);
|
||||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
public void bind()
|
||||
{
|
||||
if(loaded) {
|
||||
glBindVertexArray(vao);
|
||||
}
|
||||
|
||||
else {
|
||||
generate();
|
||||
}
|
||||
}
|
||||
|
||||
public void texCoord(double x, double y)
|
||||
{
|
||||
if(!loaded) {
|
||||
generate();
|
||||
}
|
||||
|
||||
double k = 0.001;
|
||||
x = MathHelpers.map(x, 0, 1, tex.sx + k, tex.ex - k);
|
||||
y = MathHelpers.map(y, 0, 1, tex.sy + k, tex.ey - k);
|
||||
|
||||
GL33.glTexCoord2d(x, y);
|
||||
}
|
||||
|
||||
public void render() {
|
||||
GL33.glDrawArrays(GL33.GL_TRIANGLES, 0, getSize());
|
||||
}
|
||||
|
||||
public void free()
|
||||
{
|
||||
GL33.glDeleteVertexArrays(vao);
|
||||
GL33.glDeleteBuffers(vbo);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
|
||||
public class ModelChunk extends Model
|
||||
{
|
||||
private int size;
|
||||
private float[] verticies;
|
||||
private TextureRef3D[] textures;
|
||||
|
||||
public ModelChunk(float[] verticies, TextureRef3D[] textures, int size) {
|
||||
this.verticies = verticies;
|
||||
this.textures = textures;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getVerticies() {
|
||||
return verticies;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRef3D[] getTextures() {
|
||||
return textures;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return size;
|
||||
}
|
||||
}
|
||||
|
|
@ -5,12 +5,12 @@ import gl_engine.texture.TextureRef3D;
|
|||
public class ModelEmpty extends Model
|
||||
{
|
||||
@Override
|
||||
protected TextureRef3D[] getTextures() {
|
||||
public TextureRef3D[] getTextures() {
|
||||
return new TextureRef3D[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float[] getVerticies() {
|
||||
public float[] getVerticies() {
|
||||
return new float[0];
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ public class ModelEmpty extends Model
|
|||
public void render() {}
|
||||
|
||||
@Override
|
||||
public float[] getLoadedVerticies() {
|
||||
return new float[0];
|
||||
public double getHeight() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +1,74 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class ModelGui extends Model
|
||||
{
|
||||
private int animationSize;
|
||||
private int animationSpeed;
|
||||
private double height;
|
||||
private TextureRef3D ref;
|
||||
private Vec2d size;
|
||||
|
||||
public ModelGui(TextureRef3D ref, int animationSize, int animationSpeed)
|
||||
public ModelGui(TextureRef3D ref, Vec2d size, int animationSize, int animationSpeed)
|
||||
{
|
||||
this.ref = ref;
|
||||
this.size = size;
|
||||
|
||||
this.animationSize = animationSize;
|
||||
this.animationSpeed = animationSpeed;
|
||||
}
|
||||
|
||||
public ModelGui(TextureRef3D ref) {
|
||||
this.ref = ref;
|
||||
public ModelGui(TextureRef3D tex, int animationSize, int animationSpeed) {
|
||||
this(tex, new Vec2d(1, 1), animationSize, animationSpeed);
|
||||
}
|
||||
|
||||
public ModelGui(TextureRef3D tex, Vec2d size) {
|
||||
this(tex, size, 1, 1);
|
||||
}
|
||||
|
||||
public ModelGui(TextureRef3D tex) {
|
||||
this(tex, new Vec2d(1, 1), 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float[] getVerticies()
|
||||
public int getSize() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getVerticies()
|
||||
{
|
||||
float x = (float)size.x;
|
||||
float y = (float)size.y;
|
||||
|
||||
int asi = animationSize;
|
||||
int asp = animationSpeed;
|
||||
|
||||
return new float[] {
|
||||
0, 0, 0, 0, 0, 0, asi, asp, 0,
|
||||
1, 0, 0, 1, 0, 0, asi, asp, 0,
|
||||
1, 1, 0, 1, 1, 0, asi, asp, 0,
|
||||
height = y;
|
||||
|
||||
1, 1, 0, 1, 1, 0, asi, asp, 0,
|
||||
0, 1, 0, 0, 1, 0, asi, asp, 0,
|
||||
0, 0, 0, 0, 0, 0, asi, asp, 0,
|
||||
return new float[] {
|
||||
0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11,
|
||||
x, 0, 0, 1, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11,
|
||||
x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11,
|
||||
|
||||
x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11,
|
||||
0, y, 0, 0, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11,
|
||||
0, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0x11,
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextureRef3D[] getTextures() {
|
||||
return new TextureRef3D[] {ref, ref};
|
||||
public TextureRef3D[] getTextures()
|
||||
{
|
||||
return new TextureRef3D[] {
|
||||
ref, ref
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.init.Models;
|
||||
|
||||
public class ModelItem
|
||||
{
|
||||
private Model gui, item;
|
||||
|
||||
public ModelItem(TextureRef3D tex, int animationSize, int animationSpeed)
|
||||
{
|
||||
this.gui = new ModelGui(tex, animationSize, animationSpeed);
|
||||
this.item = new ModelVertical(tex, new Vec2d(0.5, 0.5), animationSize, animationSpeed);
|
||||
}
|
||||
|
||||
private ModelItem() {
|
||||
|
||||
}
|
||||
|
||||
public static ModelItem createEmpty()
|
||||
{
|
||||
ModelItem model = new ModelItem();
|
||||
model.gui = Models.EMPTY;
|
||||
model.item = Models.EMPTY;
|
||||
return model;
|
||||
}
|
||||
|
||||
public ModelItem(TextureRef3D tex) {
|
||||
this(tex, 1, 1);
|
||||
}
|
||||
|
||||
public Model getItemModel() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
public Model getGuiModel() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,17 +1,16 @@
|
|||
package projectzombie.model;
|
||||
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class ModelTile extends Model
|
||||
{
|
||||
private int animationSize;
|
||||
private int animationSpeed;
|
||||
private TextureRef3D tex;
|
||||
private TextureRef3D ref;
|
||||
|
||||
public ModelTile(TextureRef3D tex, int animationSize, int animationSpeed)
|
||||
public ModelTile(TextureRef3D ref, int animationSize, int animationSpeed)
|
||||
{
|
||||
this.tex = tex;
|
||||
this.ref = ref;
|
||||
this.animationSize = animationSize;
|
||||
this.animationSpeed = animationSpeed;
|
||||
}
|
||||
|
|
@ -21,27 +20,37 @@ public class ModelTile extends Model
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float[] getVerticies()
|
||||
public int getSize() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getVerticies()
|
||||
{
|
||||
int asi = animationSize;
|
||||
int asp = animationSpeed;
|
||||
|
||||
return new float[] {
|
||||
1, 0, 1, 1, 1, 0, asi, asp, 0,
|
||||
1, 0, 0, 1, 0, 0, asi, asp, 0,
|
||||
0, 0, 0, 0, 0, 0, asi, asp, 0,
|
||||
0.5f, 0, 0.5f, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0,
|
||||
0.5f, 0, -0.5f, 1, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0,
|
||||
-0.5f, 0, -0.5f, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0,
|
||||
|
||||
0, 0, 0, 0, 0, 0, asi, asp, 0,
|
||||
0, 0, 1, 0, 1, 0, asi, asp, 0,
|
||||
1, 0, 1, 1, 1, 0, asi, asp, 0,
|
||||
-0.5f, 0, -0.5f, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0,
|
||||
-0.5f, 0, 0.5f, 0, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0,
|
||||
0.5f, 0, 0.5f, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 0,
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextureRef3D[] getTextures()
|
||||
public TextureRef3D[] getTextures()
|
||||
{
|
||||
return new TextureRef3D[] {
|
||||
tex, tex
|
||||
ref, ref
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -7,12 +7,13 @@ public class ModelVertical extends Model
|
|||
{
|
||||
private int animationSize;
|
||||
private int animationSpeed;
|
||||
private TextureRef3D tex;
|
||||
private double height;
|
||||
private TextureRef3D ref;
|
||||
private Vec2d size;
|
||||
|
||||
public ModelVertical(TextureRef3D tex, Vec2d size, int animationSize, int animationSpeed)
|
||||
public ModelVertical(TextureRef3D ref, Vec2d size, int animationSize, int animationSpeed)
|
||||
{
|
||||
this.tex = tex;
|
||||
this.ref = ref;
|
||||
this.size = size;
|
||||
|
||||
this.animationSize = animationSize;
|
||||
|
|
@ -32,7 +33,12 @@ public class ModelVertical extends Model
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float[] getVerticies()
|
||||
public int getSize() {
|
||||
return 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float[] getVerticies()
|
||||
{
|
||||
float x = (float)size.x / 2;
|
||||
float y = (float)size.y;
|
||||
|
|
@ -40,22 +46,29 @@ public class ModelVertical extends Model
|
|||
int asi = animationSize;
|
||||
int asp = animationSpeed;
|
||||
|
||||
return new float[] {
|
||||
0.5f-x, 0, 0.5f, 0, 0, 0, asi, asp, 1,
|
||||
0.5f+x, 0, 0.5f, 1, 0, 0, asi, asp, 1,
|
||||
0.5f+x, y, 0.5f, 1, 1, 0, asi, asp, 1,
|
||||
height = y;
|
||||
|
||||
0.5f+x, y, 0.5f, 1, 1, 0, asi, asp, 1,
|
||||
0.5f-x, y, 0.5f, 0, 1, 0, asi, asp, 1,
|
||||
0.5f-x, 0, 0.5f, 0, 0, 0, asi, asp, 1,
|
||||
return new float[] {
|
||||
-x, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 1,
|
||||
x, 0, 0, 1, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 1,
|
||||
x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 1,
|
||||
|
||||
x, y, 0, 1, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 1,
|
||||
-x, y, 0, 0, 1, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 1,
|
||||
-x, 0, 0, 0, 0, 0, ref.sy, ref.ey, 0, 0, 0, asi, asp, 1,
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextureRef3D[] getTextures()
|
||||
public TextureRef3D[] getTextures()
|
||||
{
|
||||
return new TextureRef3D[] {
|
||||
tex, tex
|
||||
ref, ref
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,5 @@
|
|||
package projectzombie.resources;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
|
|
@ -28,7 +25,7 @@ public class Resource
|
|||
}
|
||||
|
||||
public void load() {
|
||||
data = ResourceLoader.loadResource(path);
|
||||
data = ResourceLoader.loadResource("/resources" + path);
|
||||
}
|
||||
|
||||
public byte[] getBytes() {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class Settings implements IBdfClassManager
|
|||
if(nl.get("render_distance").getType() == BdfTypes.INTEGER) {
|
||||
Chunk.RENDER_DISTANCE = nl.get("render_distance").getInteger();
|
||||
} else {
|
||||
Chunk.RENDER_DISTANCE = 1;
|
||||
Chunk.RENDER_DISTANCE = 2;
|
||||
}
|
||||
|
||||
if(nl.get("show_fps").getType() == BdfTypes.BOOLEAN) {
|
||||
|
|
@ -43,22 +43,7 @@ public class Settings implements IBdfClassManager
|
|||
DisplayRenderUI.guiScale = 2;
|
||||
}
|
||||
|
||||
switch(nl.get("particles").getByte()) {
|
||||
|
||||
case 0:
|
||||
EntityParticle.MODE = SettingQuality.FANCY;
|
||||
break;
|
||||
case 1:
|
||||
EntityParticle.MODE = SettingQuality.FAST;
|
||||
break;
|
||||
case 2:
|
||||
EntityParticle.MODE = SettingQuality.OFF;
|
||||
break;
|
||||
default:
|
||||
EntityParticle.MODE = SettingQuality.FANCY;
|
||||
break;
|
||||
|
||||
}
|
||||
EntityParticle.DISABLED = nl.get("particles").getBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,10 +53,7 @@ public class Settings implements IBdfClassManager
|
|||
nl.set("show_fps", BdfObject.withBoolean(DisplayRenderUI.showFPS));
|
||||
nl.set("show_pos", BdfObject.withBoolean(DisplayRenderUI.showPos));
|
||||
nl.set("gui_scale", BdfObject.withInteger(DisplayRenderUI.guiScale));
|
||||
nl.set("particles", BdfObject.withByte((byte)(
|
||||
EntityParticle.MODE == SettingQuality.FANCY ? 0 :
|
||||
EntityParticle.MODE == SettingQuality.FAST ? 1 :
|
||||
EntityParticle.MODE == SettingQuality.OFF ? 2 : 0)));
|
||||
nl.set("particles", BdfObject.withBoolean(EntityParticle.DISABLED));
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
package projectzombie.text;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Resources;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelGui;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class Text
|
||||
{
|
||||
|
|
@ -98,7 +96,7 @@ public class Text
|
|||
int w = Main.window.getWidth();
|
||||
int h = Main.window.getHeight();
|
||||
double aspect_ratio = ((double)w) / ((double)h);
|
||||
GlHelpers.translate2(0 - (text.length() * size.x / 2 / aspect_ratio), 0);
|
||||
//GlHelpers.translate2(0 - (text.length() * size.x / 2 / aspect_ratio), 0);
|
||||
Text.render(text, size);
|
||||
}
|
||||
|
||||
|
|
@ -110,9 +108,6 @@ public class Text
|
|||
double sx = size.x;
|
||||
double sy = size.y;
|
||||
|
||||
// Begin quads
|
||||
GlHelpers.begin();
|
||||
|
||||
// Loop over the bytes
|
||||
for(int i=0;i<text_b.length;i++)
|
||||
{
|
||||
|
|
@ -205,8 +200,5 @@ public class Text
|
|||
|
||||
l.bind();
|
||||
}
|
||||
|
||||
// Stop drawing quads
|
||||
GlHelpers.end();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,11 +1,9 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package projectzombie.tiles;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
|
|
@ -10,10 +13,7 @@ import projectzombie.entity.player.EntityPlayer;
|
|||
import projectzombie.init.LayerGenerators;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package projectzombie.tiles;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityItem;
|
||||
|
|
@ -11,8 +13,6 @@ import projectzombie.model.Model;
|
|||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
|
||||
public class TileLadder extends Tile
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
|
|
@ -8,8 +9,6 @@ import projectzombie.init.Models;
|
|||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityItem;
|
||||
import projectzombie.init.Items;
|
||||
|
|
@ -7,8 +9,6 @@ import projectzombie.init.Models;
|
|||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TileLantern extends Tile
|
||||
|
|
|
|||
|
|
@ -2,15 +2,13 @@ package projectzombie.tiles;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.particle.ParticleLava;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,15 +2,13 @@ package projectzombie.tiles;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.particle.ParticleSmoke;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
|
|
@ -8,7 +9,6 @@ import projectzombie.init.Models;
|
|||
import projectzombie.mainloop.MainloopEventHandler;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.ChunkEventHandler;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityItem;
|
||||
import projectzombie.init.Items;
|
||||
|
|
@ -7,8 +9,6 @@ import projectzombie.init.Models;
|
|||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.ItemStack;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class TileRock extends Tile implements TileBulletBreakable
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package projectzombie.tiles;
|
|||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class TileTree extends Tile implements TileBulletBreakable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,14 +1,11 @@
|
|||
package projectzombie.tiles;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.particle.ParticleWater;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ import projectzombie.display.DisplayRenderUI;
|
|||
|
||||
public class GlHelpers
|
||||
{
|
||||
private static int MATRIX_COUNT = 0;
|
||||
|
||||
public static double getAspectRatio() {
|
||||
int w = Main.window.getWidth();
|
||||
int h = Main.window.getHeight();
|
||||
|
|
@ -33,21 +31,6 @@ public class GlHelpers
|
|||
return aspect_ratio;
|
||||
}
|
||||
|
||||
public static void checkMatrixCount() {
|
||||
if(MATRIX_COUNT != 0) {
|
||||
MATRIX_COUNT = 0;
|
||||
System.err.println("Matrix count is unbalanced!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void begin() {
|
||||
glBegin(GL_QUADS);
|
||||
}
|
||||
|
||||
public static void end() {
|
||||
glEnd();
|
||||
}
|
||||
|
||||
public static int getScale() {
|
||||
if(DisplayRenderUI.guiScale == 1) return 6;
|
||||
if(DisplayRenderUI.guiScale == 2) return 10;
|
||||
|
|
@ -55,87 +38,4 @@ public class GlHelpers
|
|||
if(DisplayRenderUI.guiScale == 4) return 18;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void vertex3(double x, double y, double z) {
|
||||
int s = getScale();
|
||||
glVertex3d(x/s, y/s, z/s);
|
||||
}
|
||||
|
||||
public static void vertex2(double x, double y) {
|
||||
double aspect_ratio = getAspectRatio();
|
||||
int s = getScale();
|
||||
glVertex2d(x/s/aspect_ratio, y/s);
|
||||
}
|
||||
|
||||
public static void color3(double r, double g, double b) {
|
||||
glColor3d(r, g, b);
|
||||
}
|
||||
|
||||
public static void color4(double r, double g, double b, double a) {
|
||||
glColor4d(r, g, b, a);
|
||||
}
|
||||
|
||||
public static void rotate(double a, double x, double y, double z) {
|
||||
glRotated(a, x, y, z);
|
||||
}
|
||||
|
||||
public static void translate3(double x, double y, double z) {
|
||||
int s = getScale();
|
||||
glTranslated(x/s, y/s, z/s);
|
||||
}
|
||||
|
||||
public static void translate2(double x, double y) {
|
||||
int s = getScale();
|
||||
glTranslated(x/s, y/s, 0);
|
||||
}
|
||||
|
||||
public static void disableCullFace() {
|
||||
glDisable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
public static void enableCullFace() {
|
||||
glEnable(GL_CULL_FACE);
|
||||
}
|
||||
|
||||
public static void disableDepthTest() {
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
public static void enableDepthTest() {
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
public static void disableTexture2d() {
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void enableTexture2d() {
|
||||
glEnable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void disableAlpha() {
|
||||
glDisable(GL_ALPHA);
|
||||
}
|
||||
|
||||
public static void enableAlpha() {
|
||||
glEnable(GL_ALPHA);
|
||||
}
|
||||
|
||||
public static void disableBlend() {
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
public static void enableBlend() {
|
||||
glEnable(GL_BLEND);
|
||||
}
|
||||
|
||||
public static void popMatrix() {
|
||||
glPopMatrix();
|
||||
MATRIX_COUNT += 1;
|
||||
}
|
||||
|
||||
public static void pushMatrix() {
|
||||
glPushMatrix();
|
||||
MATRIX_COUNT -= 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
package projectzombie.util.gl;
|
||||
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.util.gl.texture.TextureReference;
|
||||
import gl_engine.vec.Vec2d;
|
||||
|
||||
public class VerticalRender
|
||||
{
|
||||
public static void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size)
|
||||
{
|
||||
if(tex == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
double w = size.x/2.0;
|
||||
double h = size.y;
|
||||
|
||||
// Push the matrix
|
||||
GlHelpers.pushMatrix();
|
||||
|
||||
// Get the angle between the camera and the tile
|
||||
double angle_r = camera.angle;
|
||||
|
||||
// Make the tile upright
|
||||
GlHelpers.translate3(0.5, 0.5, 0);
|
||||
GlHelpers.translate3(pos.x, pos.y, 0);
|
||||
GlHelpers.rotate(-angle_r, 0, 0, 1);
|
||||
GlHelpers.translate3(-0.5, -0.5, 0);
|
||||
|
||||
// Render the tile
|
||||
GlHelpers.begin();
|
||||
tex.texCoord(0, 1); GlHelpers.vertex3(0.5-w, 0.5, 0);
|
||||
tex.texCoord(1, 1); GlHelpers.vertex3(0.5+w, 0.5, 0);
|
||||
tex.texCoord(1, 0); GlHelpers.vertex3(0.5+w, 0.5, h);
|
||||
tex.texCoord(0, 0); GlHelpers.vertex3(0.5-w, 0.5, h);
|
||||
GlHelpers.end();
|
||||
|
||||
// Pop the matrix
|
||||
GlHelpers.popMatrix();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package projectzombie.util.math;
|
||||
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.tiles.Tile;
|
||||
import gl_engine.vec.Vec3d;
|
||||
|
||||
public class TileState
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package projectzombie.util.math.astar;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class AStarSearcher implements AStarSearch
|
||||
|
|
|
|||
|
|
@ -3,32 +3,32 @@ package projectzombie.world.chunk;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL33;
|
||||
|
||||
import bdf.classes.IBdfClassManager;
|
||||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import gl_engine.range.Range2i;
|
||||
import gl_engine.texture.TextureRef3D;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityAlive;
|
||||
import projectzombie.entity.EntityHeight;
|
||||
import projectzombie.entity.EntityKillWithParticles;
|
||||
import projectzombie.entity.particle.ParticleBreak;
|
||||
import projectzombie.init.Models;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.model.Model;
|
||||
import projectzombie.model.ModelChunk;
|
||||
import projectzombie.tiles.Tile;
|
||||
import projectzombie.util.gl.GlHelpers;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.matrix.Matrix4;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.range.Range2i;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class Chunk implements IBdfClassManager
|
||||
|
|
@ -38,8 +38,8 @@ public class Chunk implements IBdfClassManager
|
|||
public static final int CHUNK_INDEX = CHUNK_SIZE.mx * CHUNK_SIZE.my;
|
||||
public static final Random rand = new Random();
|
||||
|
||||
public static int SIMULATION_DISTANCE = 5;
|
||||
public static int RENDER_DISTANCE = 1;
|
||||
public static int SIMULATION_DISTANCE = 10;
|
||||
public static int RENDER_DISTANCE = 2;
|
||||
|
||||
public static boolean SHOW_CHUNKS = false;
|
||||
|
||||
|
|
@ -55,6 +55,9 @@ public class Chunk implements IBdfClassManager
|
|||
public Vec2i c_pos;
|
||||
private boolean dirty;
|
||||
private boolean light_dirty;
|
||||
private boolean render_dirty;
|
||||
|
||||
private Model model;
|
||||
|
||||
public boolean isDirty()
|
||||
{
|
||||
|
|
@ -69,6 +72,12 @@ public class Chunk implements IBdfClassManager
|
|||
dirty = false;
|
||||
}
|
||||
|
||||
private void setDirty() {
|
||||
this.light_dirty = true;
|
||||
this.render_dirty = true;
|
||||
this.dirty = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void BdfClassLoad(BdfObject bdf)
|
||||
{
|
||||
|
|
@ -138,9 +147,8 @@ public class Chunk implements IBdfClassManager
|
|||
{
|
||||
this.layer = layer;
|
||||
this.c_pos = c_pos;
|
||||
this.dirty = true;
|
||||
this.light_dirty = true;
|
||||
|
||||
setDirty();
|
||||
BdfClassLoad(bdf);
|
||||
}
|
||||
|
||||
|
|
@ -170,25 +178,116 @@ public class Chunk implements IBdfClassManager
|
|||
|
||||
public void render(Camera camera)
|
||||
{
|
||||
for(int i=0;i<256;i++)
|
||||
if(this.render_dirty)
|
||||
{
|
||||
int x = i / 16;
|
||||
int y = i % 16;
|
||||
this.render_dirty = false;
|
||||
int verticies_size = 0;
|
||||
|
||||
TileState tile_f = getFrontTile(i);
|
||||
TileState tile_b = getBackTile(i);
|
||||
for(int i=0;i<CHUNK_INDEX;i++) {
|
||||
TileState bt = getBackTile(i);
|
||||
TileState ft = getFrontTile(i);
|
||||
verticies_size += bt.tile.getModel(bt.meta).getSize();
|
||||
verticies_size += ft.tile.getModel(ft.meta).getSize();
|
||||
}
|
||||
|
||||
Model model_f = tile_f.tile.getModel(tile_f.meta);
|
||||
Model model_b = tile_b.tile.getModel(tile_b.meta);
|
||||
float[] verticies = new float[verticies_size * Model.SIZE];
|
||||
TextureRef3D[] textures = new TextureRef3D[verticies_size / 3];
|
||||
int upto = 0;
|
||||
|
||||
Matrix4 matrix = Matrix4.translate(x + c_pos.x * 16, 0, y + c_pos.y * 16);
|
||||
for(int i=0;i<CHUNK_INDEX;i++)
|
||||
{
|
||||
TileState bt = getBackTile(i);
|
||||
TileState ft = getFrontTile(i);
|
||||
|
||||
Model bm = bt.tile.getModel(bt.meta);
|
||||
Model fm = ft.tile.getModel(ft.meta);
|
||||
|
||||
float[] bv = bm.getVerticies();
|
||||
float[] fv = fm.getVerticies();
|
||||
|
||||
TextureRef3D[] btex = bm.getTextures();
|
||||
TextureRef3D[] ftex = fm.getTextures();
|
||||
|
||||
Vec2i pos = Vec2i.fromId(CHUNK_SIZE, i);
|
||||
|
||||
for(int v=0;v<fm.getSize()/3;v++) {
|
||||
textures[upto / 3 + v] = ftex[v];
|
||||
}
|
||||
|
||||
for(int v=0;v<fm.getSize();v++)
|
||||
{
|
||||
for(int i2=0;i2<Model.SIZE;i2++)
|
||||
{
|
||||
if(i2 == 8) {
|
||||
verticies[upto * Model.SIZE + i2 ] = fv[v * Model.SIZE + i2 ] + pos.x;
|
||||
}
|
||||
|
||||
else if(i2 == 10) {
|
||||
verticies[upto * Model.SIZE + i2 ] = fv[v * Model.SIZE + i2 ] + pos.y;
|
||||
}
|
||||
|
||||
else {
|
||||
verticies[upto * Model.SIZE + i2 ] = fv[v * Model.SIZE + i2 ];
|
||||
}
|
||||
}
|
||||
|
||||
upto += 1;
|
||||
}
|
||||
|
||||
for(int v=0;v<bm.getSize()/3;v++) {
|
||||
textures[upto / 3 + v] = btex[v];
|
||||
}
|
||||
|
||||
for(int v=0;v<bm.getSize();v++)
|
||||
{
|
||||
for(int i2=0;i2<Model.SIZE;i2++)
|
||||
{
|
||||
if(i2 == 8) {
|
||||
verticies[upto * Model.SIZE + i2 ] = bv[v * Model.SIZE + i2 ] + pos.x;
|
||||
}
|
||||
|
||||
else if(i2 == 10) {
|
||||
verticies[upto * Model.SIZE + i2 ] = bv[v * Model.SIZE + i2 ] + pos.y;
|
||||
}
|
||||
|
||||
else {
|
||||
verticies[upto * Model.SIZE + i2 ] = bv[v * Model.SIZE + i2 ];
|
||||
}
|
||||
}
|
||||
|
||||
upto += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(model != null) {
|
||||
model.free();
|
||||
}
|
||||
|
||||
model = new ModelChunk(verticies, textures, verticies_size);
|
||||
}
|
||||
|
||||
{
|
||||
Matrix4 matrix = Matrix4.translate(c_pos.x * 16, 0, c_pos.y * 16);
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_model, true, matrix.getArray());
|
||||
|
||||
model_f.bind();
|
||||
model_f.render();
|
||||
model.bind();
|
||||
model.render();
|
||||
}
|
||||
|
||||
model_b.bind();
|
||||
model_b.render();
|
||||
for(Entity e : entities)
|
||||
{
|
||||
Model model = e.getModel();
|
||||
double h = 0;
|
||||
|
||||
if(e instanceof EntityHeight) {
|
||||
h = ((EntityHeight)e).getHeight();
|
||||
}
|
||||
|
||||
Matrix4 matrix = Matrix4.translate(e.pos.x - 0.5, h, e.pos.y - 0.5);
|
||||
GL33.glUniformMatrix4fv(Main.window.glsl_model, true, matrix.getArray());
|
||||
|
||||
model.bind();
|
||||
model.render();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -261,8 +360,8 @@ public class Chunk implements IBdfClassManager
|
|||
// Set the back tile
|
||||
this.tiles_back[id] = tile.tile;
|
||||
this.tiles_back_meta[id] = tile.meta;
|
||||
this.light_dirty = true;
|
||||
this.dirty = true;
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
||||
public void setFrontTile(TileState tile, Vec2i pos)
|
||||
|
|
@ -281,8 +380,8 @@ public class Chunk implements IBdfClassManager
|
|||
// Set the front tile
|
||||
this.tiles_front[id] = tile.tile;
|
||||
this.tiles_front_meta[id] = tile.meta;
|
||||
this.light_dirty = true;
|
||||
this.dirty = true;
|
||||
|
||||
setDirty();
|
||||
}
|
||||
|
||||
public TileState getBackTile(Vec2i pos)
|
||||
|
|
@ -343,8 +442,7 @@ public class Chunk implements IBdfClassManager
|
|||
public void breakBackTile(Vec2i pos)
|
||||
{
|
||||
TileState ts = getBackTile(pos);
|
||||
this.light_dirty = true;
|
||||
this.dirty = true;
|
||||
setDirty();
|
||||
|
||||
if(!ts.tile.unbreakable) {
|
||||
setBackTile(layer.layergen.getTileDestroyed(), pos);
|
||||
|
|
@ -355,8 +453,7 @@ public class Chunk implements IBdfClassManager
|
|||
public void breakFrontTile(Vec2i pos)
|
||||
{
|
||||
TileState ts = getFrontTile(pos);
|
||||
this.light_dirty = true;
|
||||
this.dirty = true;
|
||||
setDirty();
|
||||
|
||||
if(!ts.tile.unbreakable) {
|
||||
setFrontTile(Tiles.VOID.getDefaultState(), pos);
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import java.util.ArrayList;
|
|||
import java.util.Random;
|
||||
|
||||
import bdf.types.BdfObject;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.util.math.TileState;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.util.math.TileState;
|
||||
|
||||
public class ChunkEmpty extends Chunk
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
package projectzombie.world.chunk;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import mainloop.task.IMainloopTask;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.lighting.TileLighting;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.map.Map2DElement;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
public class ChunkEventHandler implements IMainloopTask
|
||||
|
|
|
|||
|
|
@ -7,16 +7,16 @@ import bdf.classes.IBdfClassManager;
|
|||
import bdf.types.BdfArray;
|
||||
import bdf.types.BdfNamedList;
|
||||
import bdf.types.BdfObject;
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.display.Camera;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.init.LayerGenerators;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.map.Map2D;
|
||||
import projectzombie.util.math.map.Map2DElement;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.layergen.LayerGen;
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ public class Layer implements IBdfClassManager
|
|||
public void render(Camera camera)
|
||||
{
|
||||
// Render every chunk in the players render distance
|
||||
int r = camera.renderDistance;
|
||||
int r = Chunk.RENDER_DISTANCE;
|
||||
for(int x=-r;x<=r;x++) {
|
||||
for(int y=-r;y<=r;y++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ package projectzombie.world.layer.layergen;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.util.math.ColorRange;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.map.IMap2D;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ package projectzombie.world.layer.layergen;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.entity.EntityBoss;
|
||||
import projectzombie.entity.player.EntityPlayer;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.util.math.ColorRange;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ public class LayerGenBossArena extends LayerGen implements LayerGenRememberPlaye
|
|||
|
||||
@Override
|
||||
public void spawnPlayer(EntityPlayer player) {
|
||||
this.player_pos = player.pos.copy();
|
||||
this.player_pos = player.pos;
|
||||
player.pos = new Vec2d(
|
||||
RandomHelpers.randrange(rand, -size + 2, size - 2),
|
||||
RandomHelpers.randrange(rand, -size + 2, size - 2));
|
||||
|
|
|
|||
|
|
@ -2,18 +2,18 @@ package projectzombie.world.layer.layergen;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.MathHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityZombie;
|
||||
import projectzombie.init.Tiles;
|
||||
import projectzombie.util.math.ColorRange;
|
||||
import gl_engine.MathHelpers;
|
||||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ package projectzombie.world.layer.layergen;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.Main;
|
||||
import projectzombie.entity.Entity;
|
||||
import projectzombie.entity.EntityZombie;
|
||||
|
|
@ -11,9 +14,6 @@ import projectzombie.util.math.ColorRange;
|
|||
import projectzombie.util.math.TileState;
|
||||
import projectzombie.util.math.random.OpenSimplexNoise;
|
||||
import projectzombie.util.math.random.RandomHelpers;
|
||||
import gl_engine.vec.Vec2d;
|
||||
import gl_engine.vec.Vec2i;
|
||||
import gl_engine.vec.Vec3d;
|
||||
import projectzombie.world.chunk.Chunk;
|
||||
import projectzombie.world.layer.Layer;
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue