Fixed texture scaling issues, changed the UI due to the change in
scaling. Made rocks block light.
This commit is contained in:
parent
ef6fe56c89
commit
bc43eade55
Binary file not shown.
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 89 KiB |
Binary file not shown.
|
|
@ -21,6 +21,7 @@ import shootergame.menu.Menu;
|
||||||
import shootergame.menu.MenuGame;
|
import shootergame.menu.MenuGame;
|
||||||
import shootergame.tiles.LightLevelNoise;
|
import shootergame.tiles.LightLevelNoise;
|
||||||
import shootergame.time.GameTimer;
|
import shootergame.time.GameTimer;
|
||||||
|
import shootergame.time.NoSleep;
|
||||||
import shootergame.world.World;
|
import shootergame.world.World;
|
||||||
import shootergame.world.chunk.ChunkEventHandler;
|
import shootergame.world.chunk.ChunkEventHandler;
|
||||||
|
|
||||||
|
|
@ -60,6 +61,7 @@ public class Main
|
||||||
mainloop.register(new LightLevelNoise());
|
mainloop.register(new LightLevelNoise());
|
||||||
mainloop.register(new GameTimer());
|
mainloop.register(new GameTimer());
|
||||||
mainloop.register(new KeyCallback());
|
mainloop.register(new KeyCallback());
|
||||||
|
mainloop.register(new NoSleep());
|
||||||
|
|
||||||
// Create the display
|
// Create the display
|
||||||
window = new DisplayWindow("ShooterGame");
|
window = new DisplayWindow("ShooterGame");
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,10 @@ public class DisplayRender
|
||||||
{
|
{
|
||||||
public static void render(int w, int h)
|
public static void render(int w, int h)
|
||||||
{
|
{
|
||||||
|
// Set the width and the height
|
||||||
|
Main.window.setWidth(w);
|
||||||
|
Main.window.setHeight(h);
|
||||||
|
|
||||||
// Setup GL and clear the colour
|
// Setup GL and clear the colour
|
||||||
GL.createCapabilities();
|
GL.createCapabilities();
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
|
@ -84,7 +88,7 @@ public class DisplayRender
|
||||||
//GlHelpers.translate(0, 0, -5);
|
//GlHelpers.translate(0, 0, -5);
|
||||||
GlHelpers.rotate(camera.angle.y, 1, 0, 0);
|
GlHelpers.rotate(camera.angle.y, 1, 0, 0);
|
||||||
GlHelpers.rotate(camera.angle.x, 0, 0, 1);
|
GlHelpers.rotate(camera.angle.x, 0, 0, 1);
|
||||||
GlHelpers.translate(-camera.pos.x, -camera.pos.y, -camera.pos.z);
|
GlHelpers.translate3(-camera.pos.x, -camera.pos.y, -camera.pos.z);
|
||||||
|
|
||||||
// Process all the light sources
|
// Process all the light sources
|
||||||
LightingManager.update();
|
LightingManager.update();
|
||||||
|
|
|
||||||
|
|
@ -24,12 +24,17 @@ public class DisplayRenderUI
|
||||||
GlHelpers.disableDepthTest();
|
GlHelpers.disableDepthTest();
|
||||||
GlHelpers.color4(1, 1, 1, 1);
|
GlHelpers.color4(1, 1, 1, 1);
|
||||||
|
|
||||||
|
// Get the aspect ratio
|
||||||
|
double aspect_ratio = (
|
||||||
|
((double) Main.window.getWidth()) /
|
||||||
|
((double) Main.window.getHeight()));
|
||||||
|
|
||||||
// Get some text settings
|
// Get some text settings
|
||||||
Vec2d text_size = new Vec2d(0.5, 0.2);
|
Vec2d text_size = new Vec2d(0.45, 0.45);
|
||||||
|
|
||||||
// Render the fps
|
// Render the fps
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(-9.5, 9.5, 0);
|
GlHelpers.translate2(-9.5, 9.5);
|
||||||
GlHelpers.color3(1, 1, 0);
|
GlHelpers.color3(1, 1, 0);
|
||||||
Text.render("FPS: " + DisplayStatsEventHandler.fps, text_size);
|
Text.render("FPS: " + DisplayStatsEventHandler.fps, text_size);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
|
|
@ -38,7 +43,7 @@ public class DisplayRenderUI
|
||||||
{
|
{
|
||||||
// Render the fps and the position
|
// Render the fps and the position
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(-9.5, 9, 0);
|
GlHelpers.translate2(-9.5, 9);
|
||||||
GlHelpers.color3(1, 1, 0);
|
GlHelpers.color3(1, 1, 0);
|
||||||
Text.render("x: " + (int) player.pos.x + ", y: " + (int) player.pos.y, text_size);
|
Text.render("x: " + (int) player.pos.x + ", y: " + (int) player.pos.y, text_size);
|
||||||
GlHelpers.color3(1, 1, 1);
|
GlHelpers.color3(1, 1, 1);
|
||||||
|
|
@ -49,78 +54,96 @@ public class DisplayRenderUI
|
||||||
double a = 1 - (player.getHealth() / max_health);
|
double a = 1 - (player.getHealth() / max_health);
|
||||||
TextureReference health_fg = Textures.UI_HEALTH_FG;
|
TextureReference health_fg = Textures.UI_HEALTH_FG;
|
||||||
TextureReference health_bg = Textures.UI_HEALTH_BG;
|
TextureReference health_bg = Textures.UI_HEALTH_BG;
|
||||||
|
|
||||||
|
GlHelpers.pushMatrix();
|
||||||
|
GlHelpers.translate2(-2, -9);
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
||||||
health_bg.texCoord(0, 1); GlHelpers.vertex2(-3.2, -8.0);
|
health_bg.texCoord(0, 1); GlHelpers.vertex2(-8, 1);
|
||||||
health_bg.texCoord(0, 0); GlHelpers.vertex2(-3.2, -9.0);
|
health_bg.texCoord(0, 0); GlHelpers.vertex2(-8, 0);
|
||||||
health_bg.texCoord(1, 0); GlHelpers.vertex2(3.2, -9.0);
|
health_bg.texCoord(1, 0); GlHelpers.vertex2(8, 0);
|
||||||
health_bg.texCoord(1, 1); GlHelpers.vertex2(3.2, -8.0);
|
health_bg.texCoord(1, 1); GlHelpers.vertex2(8, 1);
|
||||||
|
|
||||||
health_fg.texCoord(0, 1); GlHelpers.vertex2(-3.2, -8.0);
|
health_fg.texCoord(0, 1); GlHelpers.vertex2(-8, 1);
|
||||||
health_fg.texCoord(0, 0); GlHelpers.vertex2(-3.2, -9.0);
|
health_fg.texCoord(0, 0); GlHelpers.vertex2(-8, 0);
|
||||||
health_fg.texCoord(1-a, 0); GlHelpers.vertex2(3.2-a*6.4, -9.0);
|
health_fg.texCoord(1-a, 0); GlHelpers.vertex2(8-a*16, 0);
|
||||||
health_fg.texCoord(1-a, 1); GlHelpers.vertex2(3.2-a*6.4, -8.0);
|
health_fg.texCoord(1-a, 1); GlHelpers.vertex2(8-a*16, 1);
|
||||||
|
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
|
GlHelpers.popMatrix();
|
||||||
|
|
||||||
// Display the amount of ammo left, and the defence and gun level
|
// Display the amount of ammo left, and the defence and gun level
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
TextureReference ammo_tex = Textures.ITEM_AMMO_BOX;
|
TextureReference ammo_tex = Textures.ITEM_AMMO_BOX;
|
||||||
TextureReference gunlevel_tex = Textures.UI_GUN_LEVEL;
|
TextureReference gunlevel_tex = Textures.UI_GUN_LEVEL;
|
||||||
TextureReference deflevel_tex = Textures.UI_DEFENCE_LEVEL;
|
TextureReference deflevel_tex = Textures.UI_DEFENCE_LEVEL;
|
||||||
|
|
||||||
|
GlHelpers.translate2(-9.5, -9);
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
ammo_tex.texCoord(0, 1); GlHelpers.vertex2(0, 0);
|
||||||
ammo_tex.texCoord(0, 1); GlHelpers.vertex2(-9.5, -8.5);
|
ammo_tex.texCoord(0, 0); GlHelpers.vertex2(0, 2);
|
||||||
ammo_tex.texCoord(0, 0); GlHelpers.vertex2(-9.5, -7.0);
|
ammo_tex.texCoord(1, 0); GlHelpers.vertex2(2, 2);
|
||||||
ammo_tex.texCoord(1, 0); GlHelpers.vertex2(-8.5, -7.0);
|
ammo_tex.texCoord(1, 1); GlHelpers.vertex2(2, 0);
|
||||||
ammo_tex.texCoord(1, 1); GlHelpers.vertex2(-8.5, -8.5);
|
|
||||||
|
|
||||||
|
|
||||||
gunlevel_tex.texCoord(0, 1); GlHelpers.vertex2(-9.5, -6.5);
|
|
||||||
gunlevel_tex.texCoord(0, 0); GlHelpers.vertex2(-9.5, -5.0);
|
|
||||||
gunlevel_tex.texCoord(1, 0); GlHelpers.vertex2(-8.5, -5.0);
|
|
||||||
gunlevel_tex.texCoord(1, 1); GlHelpers.vertex2(-8.5, -6.5);
|
|
||||||
|
|
||||||
deflevel_tex.texCoord(0, 1); GlHelpers.vertex2(-9.5, -4.5);
|
|
||||||
deflevel_tex.texCoord(0, 0); GlHelpers.vertex2(-9.5, -3.0);
|
|
||||||
deflevel_tex.texCoord(1, 0); GlHelpers.vertex2(-8.5, -3.0);
|
|
||||||
deflevel_tex.texCoord(1, 1); GlHelpers.vertex2(-8.5, -4.5);
|
|
||||||
|
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
|
|
||||||
GlHelpers.translate(-8.5, -9, 0);
|
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, -9.25);
|
||||||
Text.render(Integer.toString(player.ammo), text_size);
|
Text.render(Integer.toString(player.ammo), text_size);
|
||||||
GlHelpers.translate(0, 2.5, 0);
|
GlHelpers.translate2(0, 3);
|
||||||
Text.render(Integer.toString(player.gun_level), text_size);
|
Text.render(Integer.toString(player.gun_level), text_size);
|
||||||
GlHelpers.translate(0, 2, 0);
|
GlHelpers.translate2(0, 2);
|
||||||
Text.render(Integer.toString(player.defence_level), text_size);
|
Text.render(Integer.toString(player.defence_level), text_size);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
|
|
||||||
// Display all the items in the players inventory
|
// Display all the items in the players inventory
|
||||||
TextureReference slots_tex = Textures.UI_ITEM_SLOTS;
|
TextureReference slots_tex = Textures.UI_ITEM_SLOTS;
|
||||||
|
|
||||||
|
GlHelpers.pushMatrix();
|
||||||
|
GlHelpers.translate2(3, -9.5);
|
||||||
|
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
slots_tex.texCoord(0, 1); GlHelpers.vertex2(12, 2);
|
||||||
slots_tex.texCoord(0, 1); GlHelpers.vertex2(9.5, -9.4);
|
slots_tex.texCoord(0, 0); GlHelpers.vertex2(12, 0);
|
||||||
slots_tex.texCoord(0, 0); GlHelpers.vertex2(9.5, -7.6);
|
slots_tex.texCoord(1, 0); GlHelpers.vertex2(0, 0);
|
||||||
slots_tex.texCoord(1, 0); GlHelpers.vertex2(3.5, -7.6);
|
slots_tex.texCoord(1, 1); GlHelpers.vertex2(0, 2);
|
||||||
slots_tex.texCoord(1, 1); GlHelpers.vertex2(3.5, -9.4);
|
|
||||||
|
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
|
|
||||||
// Render the players active slot
|
// Render the players active slot
|
||||||
TextureReference hotbar_slot_tex = Textures.UI_ACTIVE_SLOT;
|
TextureReference hotbar_slot_tex = Textures.UI_ACTIVE_SLOT;
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
||||||
hotbar_slot_tex.texCoord(0, 1); GlHelpers.vertex2(4.55 + player.inventory_hand, -9.45);
|
hotbar_slot_tex.texCoord(0, 1); GlHelpers.vertex2(2.1 + player.inventory_hand*2, 2.1);
|
||||||
hotbar_slot_tex.texCoord(0, 0); GlHelpers.vertex2(4.55 + player.inventory_hand, -7.55);
|
hotbar_slot_tex.texCoord(0, 0); GlHelpers.vertex2(2.1 + player.inventory_hand*2, -0.1);
|
||||||
hotbar_slot_tex.texCoord(1, 0); GlHelpers.vertex2(3.45 + player.inventory_hand, -7.55);
|
hotbar_slot_tex.texCoord(1, 0); GlHelpers.vertex2(-0.1 + player.inventory_hand*2, -0.1);
|
||||||
hotbar_slot_tex.texCoord(1, 1); GlHelpers.vertex2(3.45 + player.inventory_hand, -9.45);
|
hotbar_slot_tex.texCoord(1, 1); GlHelpers.vertex2(-0.1 + player.inventory_hand*2, 2.1);
|
||||||
|
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
|
|
||||||
|
GlHelpers.popMatrix();
|
||||||
|
|
||||||
// Get the players inventory
|
// Get the players inventory
|
||||||
Inventory player_inv = player.getInventory();
|
Inventory player_inv = player.getInventory();
|
||||||
|
|
||||||
|
GlHelpers.pushMatrix();
|
||||||
|
GlHelpers.translate2(3.12, -9.5);
|
||||||
|
|
||||||
// Render the players inventory
|
// Render the players inventory
|
||||||
for(int i=0;i<6;i++)
|
for(int i=0;i<6;i++)
|
||||||
{
|
{
|
||||||
|
|
@ -128,21 +151,23 @@ public class DisplayRenderUI
|
||||||
|
|
||||||
if(!player_item.isEmpty())
|
if(!player_item.isEmpty())
|
||||||
{
|
{
|
||||||
player_item.item.render(new Vec2d(3.5 + i, -9.2), new Vec2d(1, 1.5));
|
|
||||||
|
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(3.8 + i, -9.2, 0);
|
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.5 / aspect_ratio, -0.1);
|
||||||
Text.render(Integer.toString(player_item.count), text_size);
|
Text.render(Integer.toString(player_item.count), text_size);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GlHelpers.popMatrix();
|
||||||
|
|
||||||
// Render the active slots text
|
// Render the active slots text
|
||||||
ItemStack item_active = player_inv.getItem(player.inventory_hand);
|
ItemStack item_active = player_inv.getItem(player.inventory_hand);
|
||||||
if(!item_active.isEmpty())
|
if(!item_active.isEmpty())
|
||||||
{
|
{
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(3.8, -7.4, 0);
|
GlHelpers.translate2(3.5, -7.25);
|
||||||
Text.render(item_active.item.getName(item_active.meta), text_size);
|
Text.render(item_active.item.getName(item_active.meta), text_size);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,16 +32,24 @@ public class DisplayWindow implements IMainloopTask
|
||||||
return this.height;
|
return this.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayWindow(String name)
|
void setWidth(int w) {
|
||||||
{
|
width = w;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setHeight(int h) {
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DisplayWindow(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
// Initialize GLFW
|
// Initialize GLFW
|
||||||
if(!GLFW.glfwInit())
|
if(!GLFW.glfwInit()) {
|
||||||
throw new RuntimeException("Failed to initialize GLFW");
|
throw new RuntimeException("Failed to initialize GLFW");
|
||||||
|
}
|
||||||
|
|
||||||
// Get the monitor size
|
// Get the monitor size
|
||||||
IntBuffer w = BufferUtils.createIntBuffer(1);
|
IntBuffer w = BufferUtils.createIntBuffer(1);
|
||||||
|
|
@ -55,7 +63,7 @@ public class DisplayWindow implements IMainloopTask
|
||||||
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
|
GLFW.glfwWindowHint(GLFW.GLFW_VISIBLE, GLFW.GLFW_FALSE);
|
||||||
|
|
||||||
// Create the window
|
// Create the window
|
||||||
this.window = GLFW.glfwCreateWindow(this.width, this.height, this.name, 0, 0);
|
this.window = GLFW.glfwCreateWindow(this.width, this.height, this.name, monitor, 0);
|
||||||
|
|
||||||
// Has the window been created
|
// Has the window been created
|
||||||
if(this.window == 0) {
|
if(this.window == 0) {
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,15 @@ public class BossBars
|
||||||
double a = 1 - (bossbar.getHealth() / max_health);
|
double a = 1 - (bossbar.getHealth() / max_health);
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
||||||
health_bg.texCoord(0, 1); GlHelpers.vertex2(-3.2, 8.5 - i);
|
health_bg.texCoord(0, 1); GlHelpers.vertex2(-4, 8.5 - i);
|
||||||
health_bg.texCoord(0, 0); GlHelpers.vertex2(-3.2, 9.0 - i);
|
health_bg.texCoord(0, 0); GlHelpers.vertex2(-4, 9.0 - i);
|
||||||
health_bg.texCoord(1, 0); GlHelpers.vertex2(3.2, 9.0 - i);
|
health_bg.texCoord(1, 0); GlHelpers.vertex2(4, 9.0 - i);
|
||||||
health_bg.texCoord(1, 1); GlHelpers.vertex2(3.2, 8.5 - i);
|
health_bg.texCoord(1, 1); GlHelpers.vertex2(4, 8.5 - i);
|
||||||
|
|
||||||
health_fg.texCoord(0, 1); GlHelpers.vertex2(-3.2, 8.5 - i);
|
health_fg.texCoord(0, 1); GlHelpers.vertex2(-4, 8.5 - i);
|
||||||
health_fg.texCoord(0, 0); GlHelpers.vertex2(-3.2, 9.0 - i);
|
health_fg.texCoord(0, 0); GlHelpers.vertex2(-4, 9.0 - i);
|
||||||
health_fg.texCoord(1-a, 0); GlHelpers.vertex2(3.2-a*6.4, 9.0 - i);
|
health_fg.texCoord(1-a, 0); GlHelpers.vertex2(4-a*8, 9.0 - i);
|
||||||
health_fg.texCoord(1-a, 1); GlHelpers.vertex2(3.2-a*6.4, 8.5 - i);
|
health_fg.texCoord(1-a, 1); GlHelpers.vertex2(4-a*8, 8.5 - i);
|
||||||
|
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
i += 1;
|
i += 1;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ import shootergame.display.bossbar.BossBars;
|
||||||
import shootergame.display.bossbar.IBossBar;
|
import shootergame.display.bossbar.IBossBar;
|
||||||
import shootergame.init.Items;
|
import shootergame.init.Items;
|
||||||
import shootergame.init.Textures;
|
import shootergame.init.Textures;
|
||||||
|
import shootergame.init.Tiles;
|
||||||
|
import shootergame.tiles.Tile;
|
||||||
import shootergame.time.GameTimer;
|
import shootergame.time.GameTimer;
|
||||||
import shootergame.util.gl.texture.TextureReference;
|
import shootergame.util.gl.texture.TextureReference;
|
||||||
import shootergame.util.math.ItemStack;
|
import shootergame.util.math.ItemStack;
|
||||||
|
|
@ -13,6 +15,7 @@ import shootergame.util.math.MathHelpers;
|
||||||
import shootergame.util.math.random.OpenSimplexNoise;
|
import shootergame.util.math.random.OpenSimplexNoise;
|
||||||
import shootergame.util.math.random.RandomHelpers;
|
import shootergame.util.math.random.RandomHelpers;
|
||||||
import shootergame.util.math.vec.Vec2d;
|
import shootergame.util.math.vec.Vec2d;
|
||||||
|
import shootergame.util.math.vec.Vec2i;
|
||||||
import shootergame.util.math.vec.Vec3d;
|
import shootergame.util.math.vec.Vec3d;
|
||||||
import shootergame.world.chunk.Chunk;
|
import shootergame.world.chunk.Chunk;
|
||||||
import shootergame.world.layer.Layer;
|
import shootergame.world.layer.Layer;
|
||||||
|
|
@ -54,10 +57,18 @@ public class EntityBoss extends EntityVertical implements IBossBar
|
||||||
|
|
||||||
if(this.noise_spawn.eval(GameTimer.getTime() / 5000.0, 0) > 0.2) {
|
if(this.noise_spawn.eval(GameTimer.getTime() / 5000.0, 0) > 0.2) {
|
||||||
if(spawn_frequency == 0) {
|
if(spawn_frequency == 0) {
|
||||||
int r = 2;
|
int r = 2, m = 1000;
|
||||||
layer.spawnEntity(new EntityZombie(this.pos.add(new Vec2d(
|
Vec2d zombie_pos = new Vec2d(
|
||||||
RandomHelpers.randrange(rand, -r, r),
|
RandomHelpers.randrange(rand, -r*m, r*m)/(double)m,
|
||||||
RandomHelpers.randrange(rand, -r, r)))));
|
RandomHelpers.randrange(rand, -r*m, r*m)/(double)m);
|
||||||
|
Vec2i zombie_tpos = new Vec2i(
|
||||||
|
MathHelpers.floor(zombie_pos.x),
|
||||||
|
MathHelpers.floor(zombie_pos.y));
|
||||||
|
if(
|
||||||
|
layer.getBackTile(zombie_tpos).tile == layer.layergen.getTileDestroyed().tile &&
|
||||||
|
layer.getFrontTile(zombie_tpos).tile == Tiles.VOID) {
|
||||||
|
layer.spawnEntity(new EntityZombie(this.pos.add(zombie_pos)));
|
||||||
|
}
|
||||||
spawn_frequency = 50;
|
spawn_frequency = 50;
|
||||||
}
|
}
|
||||||
spawn_frequency -= 1;
|
spawn_frequency -= 1;
|
||||||
|
|
|
||||||
|
|
@ -70,9 +70,6 @@ public class EntityExplosion extends Entity
|
||||||
// Get the layer
|
// Get the layer
|
||||||
Layer l = Main.world.getLayer();
|
Layer l = Main.world.getLayer();
|
||||||
|
|
||||||
// Calculate the blackened gradient
|
|
||||||
byte blackened_gradient = (byte)( Byte.MAX_VALUE - distance / radius * Byte.MAX_VALUE );
|
|
||||||
|
|
||||||
// Get the front and back tile
|
// Get the front and back tile
|
||||||
Vec2i tpos = new Vec2i(MathHelpers.floor(px), MathHelpers.floor(py));
|
Vec2i tpos = new Vec2i(MathHelpers.floor(px), MathHelpers.floor(py));
|
||||||
TileState bts = l.getBackTile(tpos);
|
TileState bts = l.getBackTile(tpos);
|
||||||
|
|
@ -80,13 +77,10 @@ public class EntityExplosion extends Entity
|
||||||
|
|
||||||
// Is this tile the same as the "empty" tile
|
// Is this tile the same as the "empty" tile
|
||||||
TileState ets = l.layergen.getTileDestroyed();
|
TileState ets = l.layergen.getTileDestroyed();
|
||||||
if(bts.tile == ets.tile) {
|
|
||||||
if(bts.meta > blackened_gradient) blackened_gradient = bts.meta;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the tiles
|
// Set the tiles
|
||||||
if(!bts.tile.unbreakable) {
|
if(!bts.tile.unbreakable) {
|
||||||
l.setBackTile(new TileState(ets.tile, blackened_gradient), tpos);
|
l.setBackTile(ets, tpos);
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ public class EntityGrapplingHook extends EntityVertical
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public void render(Vec2d pos, Camera camera) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
super.render(pos, camera);
|
super.render(pos, camera);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class EntityItem extends EntityVertical
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
super.render(pos, camera, tex, size);
|
super.render(pos, camera, tex, size);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,10 +51,10 @@ public class EntityParticle extends Entity
|
||||||
double angle_r = camera.angle.x;
|
double angle_r = camera.angle.x;
|
||||||
|
|
||||||
// Make the bullet upright
|
// Make the bullet upright
|
||||||
GlHelpers.translate(size/2, 0, 0);
|
GlHelpers.translate3(size/2, 0, 0);
|
||||||
GlHelpers.translate(pos.x, pos.y, height);
|
GlHelpers.translate3(pos.x, pos.y, height);
|
||||||
GlHelpers.rotate(-angle_r, 0, 0, 1);
|
GlHelpers.rotate(-angle_r, 0, 0, 1);
|
||||||
GlHelpers.translate(-size/2, 0, 0);
|
GlHelpers.translate3(-size/2, 0, 0);
|
||||||
|
|
||||||
// Draw the bullet
|
// Draw the bullet
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ public class EntityTnt extends EntityVertical
|
||||||
{
|
{
|
||||||
// Render the tnt with the height
|
// Render the tnt with the height
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
super.render(pos, camera);
|
super.render(pos, camera);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public class ParticleBlood extends EntityParticle
|
||||||
// Set some settings
|
// Set some settings
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.color3(r_color * light, 0, 0);
|
GlHelpers.color3(r_color * light, 0, 0);
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
|
|
||||||
// Call super
|
// Call super
|
||||||
super.render(pos, camera);
|
super.render(pos, camera);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ public class ParticleBreak extends EntityVertical
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
||||||
GlHelpers.color3(light, light, light);
|
GlHelpers.color3(light, light, light);
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
super.render(pos, camera, tex, size);
|
super.render(pos, camera, tex, size);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public class ParticleLava extends EntityParticle
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public void render(Vec2d pos, Camera camera) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
GlHelpers.color3(1, 0, 0);
|
GlHelpers.color3(1, 0, 0);
|
||||||
super.render(pos, camera);
|
super.render(pos, camera);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public class ParticleSmoke extends EntityVertical
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public void render(Vec2d pos, Camera camera) {
|
||||||
if(opacity <= 0) return;
|
if(opacity <= 0) return;
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
double light = chunk.getLightLevel(new Vec2i(
|
double light = chunk.getLightLevel(new Vec2i(
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
||||||
GlHelpers.color4(light, light, light, opacity);
|
GlHelpers.color4(light, light, light, opacity);
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class ParticleWater extends EntityParticle
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public void render(Vec2d pos, Camera camera) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
double light = chunk.getLightLevel(new Vec2i(
|
double light = chunk.getLightLevel(new Vec2i(
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
||||||
GlHelpers.color4(0, 0, light, 0.4);
|
GlHelpers.color4(0, 0, light, 0.4);
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import shootergame.entity.EntityHeight;
|
||||||
import shootergame.entity.EntityInventory;
|
import shootergame.entity.EntityInventory;
|
||||||
import shootergame.entity.EntityItem;
|
import shootergame.entity.EntityItem;
|
||||||
import shootergame.entity.EntityVertical;
|
import shootergame.entity.EntityVertical;
|
||||||
|
import shootergame.init.Items;
|
||||||
import shootergame.init.Textures;
|
import shootergame.init.Textures;
|
||||||
import shootergame.inventory.Inventory;
|
import shootergame.inventory.Inventory;
|
||||||
import shootergame.util.gl.GlHelpers;
|
import shootergame.util.gl.GlHelpers;
|
||||||
|
|
@ -151,7 +152,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
|
|
||||||
// Translation
|
// Translation
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, height);
|
GlHelpers.translate3(0, 0, height);
|
||||||
|
|
||||||
// Set the colour due to the lighting
|
// Set the colour due to the lighting
|
||||||
double light = chunk.getLightLevel(new Vec2i(
|
double light = chunk.getLightLevel(new Vec2i(
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,11 @@ public class JoystickCallback implements GLFWJoystickCallbackI, IMainloopTask
|
||||||
// Get all the axes
|
// Get all the axes
|
||||||
FloatBuffer axes = GLFW.glfwGetJoystickAxes(jid);
|
FloatBuffer axes = GLFW.glfwGetJoystickAxes(jid);
|
||||||
|
|
||||||
|
// Check if the axes are undefined
|
||||||
|
if(axes == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Store all the axes data
|
// Store all the axes data
|
||||||
left_x = combineJoystickAxis(left_x, axes.get(0));
|
left_x = combineJoystickAxis(left_x, axes.get(0));
|
||||||
left_y = combineJoystickAxis(left_y, axes.get(1));
|
left_y = combineJoystickAxis(left_y, axes.get(1));
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,10 @@ public class Item
|
||||||
{
|
{
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
||||||
texture.texCoord(0, 1); GlHelpers.vertex3(pos.x+size.x , pos.y , 0);
|
texture.texCoord(0, 1); GlHelpers.vertex2(pos.x+size.x , pos.y );
|
||||||
texture.texCoord(0, 0); GlHelpers.vertex3(pos.x+size.x , pos.y+size.y , 0);
|
texture.texCoord(0, 0); GlHelpers.vertex2(pos.x+size.x , pos.y+size.y );
|
||||||
texture.texCoord(1, 0); GlHelpers.vertex3(pos.x , pos.y+size.y , 0);
|
texture.texCoord(1, 0); GlHelpers.vertex2(pos.x , pos.y+size.y );
|
||||||
texture.texCoord(1, 1); GlHelpers.vertex3(pos.x , pos.y , 0);
|
texture.texCoord(1, 1); GlHelpers.vertex2(pos.x , pos.y );
|
||||||
|
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,18 +20,18 @@ public class MenuGamePause extends Menu
|
||||||
GlHelpers.disableTexture2d();
|
GlHelpers.disableTexture2d();
|
||||||
GlHelpers.color4(0, 0, 0, 0.5);
|
GlHelpers.color4(0, 0, 0, 0.5);
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
GlHelpers.vertex2(-10, -10);
|
GlHelpers.vertex3(-10, -10, 0);
|
||||||
GlHelpers.vertex2(-10, 10);
|
GlHelpers.vertex3(-10, 10, 0);
|
||||||
GlHelpers.vertex2(10, 10);
|
GlHelpers.vertex3(10, 10, 0);
|
||||||
GlHelpers.vertex2(10, -10);
|
GlHelpers.vertex3(10, -10, 0);
|
||||||
GlHelpers.end();
|
GlHelpers.end();
|
||||||
GlHelpers.color4(1, 1, 1, 1);
|
GlHelpers.color4(1, 1, 1, 1);
|
||||||
GlHelpers.enableTexture2d();
|
GlHelpers.enableTexture2d();
|
||||||
|
|
||||||
// Render some text to say the game is paused
|
// Render some text to say the game is paused
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(-2, 1, 0);
|
GlHelpers.translate3(-2.5, 1, 0);
|
||||||
Text.render("Game Paused", new Vec2d(1, 0.4));
|
Text.render("Game Paused", new Vec2d(1, 1));
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -195,10 +195,10 @@ public class Text
|
||||||
if(l != null)
|
if(l != null)
|
||||||
{
|
{
|
||||||
// Render the character
|
// Render the character
|
||||||
l.texCoord(0, 1); GlHelpers.vertex3(sy*(i-1), 0, 0);
|
l.texCoord(0, 1); GlHelpers.vertex2(sy*(i-1), 0);
|
||||||
l.texCoord(0, 0); GlHelpers.vertex3(sy*(i-1), sx, 0);
|
l.texCoord(0, 0); GlHelpers.vertex2(sy*(i-1), sx);
|
||||||
l.texCoord(1, 0); GlHelpers.vertex3(sy*i, sx, 0);
|
l.texCoord(1, 0); GlHelpers.vertex2(sy*i, sx);
|
||||||
l.texCoord(1, 1); GlHelpers.vertex3(sy*i, 0, 0);
|
l.texCoord(1, 1); GlHelpers.vertex2(sy*i, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ public class TileLava extends TileFlat
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public void render(Vec2d pos, Camera camera, TileState state) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, 0.001);
|
GlHelpers.translate3(0, 0, 0.001);
|
||||||
super.render(pos, camera, state);
|
super.render(pos, camera, state);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ public class TileLavaFlow extends TileFlat
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public void render(Vec2d pos, Camera camera, TileState state) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, 0.001);
|
GlHelpers.translate3(0, 0, 0.001);
|
||||||
super.render(pos, camera, state);
|
super.render(pos, camera, state);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package shootergame.tiles;
|
package shootergame.tiles;
|
||||||
|
|
||||||
import shootergame.init.Textures;
|
import shootergame.init.Textures;
|
||||||
|
import shootergame.util.math.TileState;
|
||||||
import shootergame.util.math.vec.Vec2d;
|
import shootergame.util.math.vec.Vec2d;
|
||||||
|
|
||||||
public class TileRock extends TileVertical
|
public class TileRock extends TileVertical
|
||||||
|
|
@ -15,4 +16,9 @@ public class TileRock extends TileVertical
|
||||||
this.tileHitbox = 0.4;
|
this.tileHitbox = 0.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getLightDissipation(TileState state) {
|
||||||
|
return 1/2.0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ public class TileWater extends TileFlat
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public void render(Vec2d pos, Camera camera, TileState state) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, 0.001);
|
GlHelpers.translate3(0, 0, 0.001);
|
||||||
super.render(pos, camera, state);
|
super.render(pos, camera, state);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ public class TileWaterFlow extends TileFlat
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public void render(Vec2d pos, Camera camera, TileState state) {
|
||||||
GlHelpers.pushMatrix();
|
GlHelpers.pushMatrix();
|
||||||
GlHelpers.translate(0, 0, 0.001);
|
GlHelpers.translate3(0, 0, 0.001);
|
||||||
super.render(pos, camera, state);
|
super.render(pos, camera, state);
|
||||||
GlHelpers.popMatrix();
|
GlHelpers.popMatrix();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,37 @@
|
||||||
|
package shootergame.time;
|
||||||
|
|
||||||
|
import java.awt.AWTException;
|
||||||
|
import java.awt.Robot;
|
||||||
|
import java.awt.event.InputEvent;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
|
||||||
|
import mainloop.task.IMainloopTask;
|
||||||
|
|
||||||
|
public class NoSleep implements IMainloopTask
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean MainLoopDelay(long millis) {
|
||||||
|
return millis > 10000;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean MainLoopRepeat() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void MainLoopUpdate()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
Robot robot = new Robot();
|
||||||
|
robot.keyPress(KeyEvent.VK_F15);
|
||||||
|
robot.keyRelease(KeyEvent.VK_F15);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(AWTException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,23 +1,8 @@
|
||||||
package shootergame.util.gl;
|
package shootergame.util.gl;
|
||||||
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_ALPHA;
|
import static org.lwjgl.opengl.GL11.*;
|
||||||
import static org.lwjgl.opengl.GL11.GL_BLEND;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_CULL_FACE;
|
import shootergame.Main;
|
||||||
import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_QUADS;
|
|
||||||
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
|
|
||||||
import static org.lwjgl.opengl.GL11.glBegin;
|
|
||||||
import static org.lwjgl.opengl.GL11.glColor3d;
|
|
||||||
import static org.lwjgl.opengl.GL11.glColor4d;
|
|
||||||
import static org.lwjgl.opengl.GL11.glDisable;
|
|
||||||
import static org.lwjgl.opengl.GL11.glEnable;
|
|
||||||
import static org.lwjgl.opengl.GL11.glEnd;
|
|
||||||
import static org.lwjgl.opengl.GL11.glPopMatrix;
|
|
||||||
import static org.lwjgl.opengl.GL11.glPushMatrix;
|
|
||||||
import static org.lwjgl.opengl.GL11.glRotated;
|
|
||||||
import static org.lwjgl.opengl.GL11.glTranslated;
|
|
||||||
import static org.lwjgl.opengl.GL11.glVertex2d;
|
|
||||||
import static org.lwjgl.opengl.GL11.glVertex3d;
|
|
||||||
|
|
||||||
public class GlHelpers
|
public class GlHelpers
|
||||||
{
|
{
|
||||||
|
|
@ -43,7 +28,10 @@ public class GlHelpers
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void vertex2(double x, double y) {
|
public static void vertex2(double x, double y) {
|
||||||
glVertex2d(x/10, y/10);
|
int w = Main.window.getWidth();
|
||||||
|
int h = Main.window.getHeight();
|
||||||
|
double aspect_ratio = ((double)w) / ((double)h);
|
||||||
|
glVertex2d(x/10/aspect_ratio, y/10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void color3(double r, double g, double b) {
|
public static void color3(double r, double g, double b) {
|
||||||
|
|
@ -58,10 +46,14 @@ public class GlHelpers
|
||||||
glRotated(a, x, y, z);
|
glRotated(a, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void translate(double x, double y, double z) {
|
public static void translate3(double x, double y, double z) {
|
||||||
glTranslated(x/10, y/10, z/10);
|
glTranslated(x/10, y/10, z/10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void translate2(double x, double y) {
|
||||||
|
glTranslated(x/10, y/10, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public static void disableCullFace() {
|
public static void disableCullFace() {
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,10 @@ public class VerticalRender
|
||||||
double angle_r = camera.angle.x;
|
double angle_r = camera.angle.x;
|
||||||
|
|
||||||
// Make the tile upright
|
// Make the tile upright
|
||||||
GlHelpers.translate(0.5, 0.5, 0);
|
GlHelpers.translate3(0.5, 0.5, 0);
|
||||||
GlHelpers.translate(pos.x, pos.y, 0);
|
GlHelpers.translate3(pos.x, pos.y, 0);
|
||||||
GlHelpers.rotate(-angle_r, 0, 0, 1);
|
GlHelpers.rotate(-angle_r, 0, 0, 1);
|
||||||
GlHelpers.translate(-0.5, -0.5, 0);
|
GlHelpers.translate3(-0.5, -0.5, 0);
|
||||||
|
|
||||||
// Render the tile
|
// Render the tile
|
||||||
GlHelpers.begin();
|
GlHelpers.begin();
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ public class LayerGenEarth extends LayerGen
|
||||||
if(portal) {
|
if(portal) {
|
||||||
chunk.setBackTile(new TileState(Tiles.PORTAL_DOWN, (short)1), portal_pos);
|
chunk.setBackTile(new TileState(Tiles.PORTAL_DOWN, (short)1), portal_pos);
|
||||||
chunk.setFrontTile(Tiles.LADDER.getDefaultState(), portal_pos);
|
chunk.setFrontTile(Tiles.LADDER.getDefaultState(), portal_pos);
|
||||||
|
//chunk.setFrontTile(Tiles.BOSS_PORTAL.getDefaultState(), portal_pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue