Changed how animated textures work,
continuing on working on fixing the renderer.
|
Before Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 105 KiB |
BIN
settings.bdf
|
|
@ -22,7 +22,6 @@ import projectzombie.input.MouseButtonCallback;
|
||||||
import projectzombie.input.ScrollWheelCallback;
|
import projectzombie.input.ScrollWheelCallback;
|
||||||
import projectzombie.mainloop.MainloopEventHandler;
|
import projectzombie.mainloop.MainloopEventHandler;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.AnimationEventHandler;
|
|
||||||
|
|
||||||
public class DisplayWindow implements IMainloopTask
|
public class DisplayWindow implements IMainloopTask
|
||||||
{
|
{
|
||||||
|
|
@ -92,7 +91,6 @@ public class DisplayWindow implements IMainloopTask
|
||||||
|
|
||||||
// Register the display event loop
|
// Register the display event loop
|
||||||
Main.mainloop.register(this);
|
Main.mainloop.register(this);
|
||||||
Main.mainloop.register(AnimationEventHandler.ANIMATION_EVENT_HANDLER);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render()
|
public void render()
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Entities;
|
import projectzombie.init.Entities;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.tiles.Tile;
|
import projectzombie.tiles.Tile;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
|
|
@ -22,10 +23,9 @@ import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class Entity implements IBdfClassManager
|
public abstract class Entity implements IBdfClassManager
|
||||||
{
|
{
|
||||||
public Vec2d pos;
|
public Vec2d pos;
|
||||||
public boolean opaqueTile = true;
|
|
||||||
public double hitbox = 1;
|
public double hitbox = 1;
|
||||||
public boolean isSolid = false;
|
public boolean isSolid = false;
|
||||||
public Chunk chunk;
|
public Chunk chunk;
|
||||||
|
|
@ -35,9 +35,10 @@ public class Entity implements IBdfClassManager
|
||||||
public boolean goThroughSolid = true;
|
public boolean goThroughSolid = true;
|
||||||
protected static final Random rand = new Random();
|
protected static final Random rand = new Random();
|
||||||
public boolean emitsLight = false;
|
public boolean emitsLight = false;
|
||||||
|
|
||||||
public int stepOnTileCooldown = 0;
|
public int stepOnTileCooldown = 0;
|
||||||
|
|
||||||
|
public abstract Model getModel();
|
||||||
|
|
||||||
protected double getTilesLightDissipation() {
|
protected double getTilesLightDissipation() {
|
||||||
if(chunk == null) return 0;
|
if(chunk == null) return 0;
|
||||||
TileState tsf = chunk.getFrontTile(pos.toInt());
|
TileState tsf = chunk.getFrontTile(pos.toInt());
|
||||||
|
|
@ -117,7 +118,6 @@ public class Entity implements IBdfClassManager
|
||||||
BdfNamedList nl = bdf.getNamedList();
|
BdfNamedList nl = bdf.getNamedList();
|
||||||
BdfArray e = nl.get("e").getArray();
|
BdfArray e = nl.get("e").getArray();
|
||||||
pos = new Vec2d(e.get(0));
|
pos = new Vec2d(e.get(0));
|
||||||
opaqueTile = e.get(1).getBoolean();
|
|
||||||
hitbox = e.get(2).getDouble();
|
hitbox = e.get(2).getDouble();
|
||||||
isSolid = e.get(3).getBoolean();
|
isSolid = e.get(3).getBoolean();
|
||||||
crossUnWalkable = e.get(4).getBoolean();
|
crossUnWalkable = e.get(4).getBoolean();
|
||||||
|
|
@ -143,7 +143,6 @@ public class Entity implements IBdfClassManager
|
||||||
nl.set("e", BdfObject.withArray(e));
|
nl.set("e", BdfObject.withArray(e));
|
||||||
|
|
||||||
e.add(pos_bdf);
|
e.add(pos_bdf);
|
||||||
e.add(BdfObject.withBoolean(opaqueTile));
|
|
||||||
e.add(BdfObject.withDouble(hitbox));
|
e.add(BdfObject.withDouble(hitbox));
|
||||||
e.add(BdfObject.withBoolean(isSolid));
|
e.add(BdfObject.withBoolean(isSolid));
|
||||||
e.add(BdfObject.withBoolean(crossUnWalkable));
|
e.add(BdfObject.withBoolean(crossUnWalkable));
|
||||||
|
|
@ -184,21 +183,6 @@ public class Entity implements IBdfClassManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(Vec2d pos, Camera camera) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
this.render(pos, camera);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doRender(Vec2d pos, Camera camera) {
|
|
||||||
this.render(pos, camera);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOpaqueTile() {
|
|
||||||
return this.opaqueTile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void moveTowards(double angle, double speed)
|
public void moveTowards(double angle, double speed)
|
||||||
{
|
{
|
||||||
if(chunk == null) {
|
if(chunk == null) {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import projectzombie.display.bossbar.IBossBar;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.time.GameTimer;
|
import projectzombie.time.GameTimer;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
@ -23,7 +24,7 @@ import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityBoss extends EntityVertical implements IBossBar, EntityKillWithParticles
|
public class EntityBoss extends Entity implements IBossBar, EntityKillWithParticles
|
||||||
{
|
{
|
||||||
private boolean moving = false;
|
private boolean moving = false;
|
||||||
private boolean firing = false;
|
private boolean firing = false;
|
||||||
|
|
@ -42,7 +43,7 @@ public class EntityBoss extends EntityVertical implements IBossBar, EntityKillWi
|
||||||
private long seed;
|
private long seed;
|
||||||
|
|
||||||
public EntityBoss(BdfObject bdf) {
|
public EntityBoss(BdfObject bdf) {
|
||||||
super(bdf, TextureReference.EMPTY, new Vec2d(4, 4));
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -82,7 +83,7 @@ public class EntityBoss extends EntityVertical implements IBossBar, EntityKillWi
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityBoss(Vec2d pos) {
|
public EntityBoss(Vec2d pos) {
|
||||||
super(pos, TextureReference.EMPTY, new Vec2d(4, 4));
|
super(pos);
|
||||||
|
|
||||||
this.isSolid = true;
|
this.isSolid = true;
|
||||||
this.goThroughSolid = false;
|
this.goThroughSolid = false;
|
||||||
|
|
@ -178,24 +179,6 @@ public class EntityBoss extends EntityVertical implements IBossBar, EntityKillWi
|
||||||
time += 0.001;
|
time += 0.001;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size)
|
|
||||||
{
|
|
||||||
// Get the boss texture
|
|
||||||
if(moving && firing) {
|
|
||||||
tex = Models.ENTITY_BOSS_WALKING_AND_FIRING;
|
|
||||||
} else if(moving) {
|
|
||||||
tex = Models.ENTITY_BOSS_WALKING;
|
|
||||||
} else if(firing) {
|
|
||||||
tex = Models.ENTITY_BOSS_FIRING;
|
|
||||||
} else {
|
|
||||||
tex = Models.ENTITY_BOSS_IDLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call render
|
|
||||||
super.render(pos, camera, tex, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addHealth(double amount) {
|
public void addHealth(double amount) {
|
||||||
this.health += amount;
|
this.health += amount;
|
||||||
|
|
@ -282,4 +265,24 @@ public class EntityBoss extends EntityVertical implements IBossBar, EntityKillWi
|
||||||
@Override
|
@Override
|
||||||
protected void moveAwayFromSolidEntities(Layer layer) {
|
protected void moveAwayFromSolidEntities(Layer layer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void killWithParticles() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel()
|
||||||
|
{
|
||||||
|
if(moving && firing) {
|
||||||
|
return Models.ENTITY_BOSS_WALKING_AND_FIRING;
|
||||||
|
} else if(moving) {
|
||||||
|
return Models.ENTITY_BOSS_WALKING;
|
||||||
|
} else if(firing) {
|
||||||
|
return Models.ENTITY_BOSS_FIRING;
|
||||||
|
} else {
|
||||||
|
return Models.ENTITY_BOSS_IDLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,9 @@ import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.particle.ParticleBlood;
|
import projectzombie.entity.particle.ParticleBlood;
|
||||||
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Sounds;
|
import projectzombie.init.Sounds;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.tiles.Tile;
|
import projectzombie.tiles.Tile;
|
||||||
import projectzombie.tiles.TileBulletBreakable;
|
import projectzombie.tiles.TileBulletBreakable;
|
||||||
|
|
@ -60,7 +62,7 @@ public class EntityBullet extends EntityParticle
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityBullet(Vec2d pos, Entity parent, double angle, double damage, int despawn_time) {
|
public EntityBullet(Vec2d pos, Entity parent, double angle, double damage, int despawn_time) {
|
||||||
super(pos, 0.2, despawn_time);
|
super(pos);
|
||||||
|
|
||||||
// Store some specified values
|
// Store some specified values
|
||||||
this.angle = angle;
|
this.angle = angle;
|
||||||
|
|
@ -182,18 +184,7 @@ public class EntityBullet extends EntityParticle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera)
|
public Model getModel() {
|
||||||
{
|
return Models.PARTICLE_BULLET;
|
||||||
// Set the colour
|
|
||||||
Vec3d light = chunk.getRGBLightLevel(new Vec2i(
|
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
|
||||||
GlHelpers.color3(1 * light.x, 0.8 * light.y, 0.3 * light.z);
|
|
||||||
|
|
||||||
// Set the height
|
|
||||||
this.setHeight(height);
|
|
||||||
|
|
||||||
// Call super
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.color3(1, 1, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,17 @@ package projectzombie.entity;
|
||||||
|
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class EntityDummy extends EntityVertical implements EntityAlive
|
public class EntityDummy extends Entity implements EntityAlive
|
||||||
{
|
{
|
||||||
public EntityDummy(BdfObject bdf) {
|
public EntityDummy(BdfObject bdf) {
|
||||||
super(bdf, Models.ENTITY_DUMMY, new Vec2d(1, 1));
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityDummy(Vec2d pos) {
|
public EntityDummy(Vec2d pos) {
|
||||||
super(pos, Models.ENTITY_DUMMY, new Vec2d(1, 1));
|
super(pos);
|
||||||
|
|
||||||
this.hitbox = 0.5;
|
this.hitbox = 0.5;
|
||||||
this.isSolid = true;
|
this.isSolid = true;
|
||||||
|
|
@ -55,4 +56,9 @@ public class EntityDummy extends EntityVertical implements EntityAlive
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel() {
|
||||||
|
return Models.ENTITY_DUMMY;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import projectzombie.entity.particle.ParticleBreak;
|
||||||
import projectzombie.entity.particle.ParticleSmoke;
|
import projectzombie.entity.particle.ParticleSmoke;
|
||||||
import projectzombie.init.Sounds;
|
import projectzombie.init.Sounds;
|
||||||
import projectzombie.init.Tiles;
|
import projectzombie.init.Tiles;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
|
|
@ -132,4 +133,9 @@ public class EntityExplosion extends Entity
|
||||||
// Kill the explosion entity
|
// Kill the explosion entity
|
||||||
kill();
|
kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,6 @@ public class EntityFlare extends EntityTnt
|
||||||
this.explode_time = 1000;
|
this.explode_time = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
|
||||||
super.render(pos, camera, Models.ENTITY_FLARE, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getLightLevel() {
|
public double getLightLevel() {
|
||||||
return getLightWithHeight(1 - (this.height * (1/12.0))) * ( rand.nextDouble() / 10.0 + 0.9 );
|
return getLightWithHeight(1 - (this.height * (1/12.0))) * ( rand.nextDouble() / 10.0 + 0.9 );
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,21 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
import projectzombie.world.layer.layergen.LayerGenRememberPlayerPos;
|
import projectzombie.world.layer.layergen.LayerGenRememberPlayerPos;
|
||||||
|
|
||||||
public class EntityGrapplingHook extends EntityVertical
|
public class EntityGrapplingHook extends Entity
|
||||||
{
|
{
|
||||||
private int layerId;
|
private int layerId;
|
||||||
private double height;
|
private double height;
|
||||||
private Entity entity;
|
private Entity entity;
|
||||||
|
|
||||||
public EntityGrapplingHook(BdfObject bdf) {
|
public EntityGrapplingHook(BdfObject bdf) {
|
||||||
super(bdf, Models.ENTITY_GRAPPLING_HOOK, new Vec2d(1, 16));
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -41,7 +42,7 @@ public class EntityGrapplingHook extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityGrapplingHook(Vec2d pos, int layerId, Entity entity) {
|
public EntityGrapplingHook(Vec2d pos, int layerId, Entity entity) {
|
||||||
super(pos, Models.ENTITY_GRAPPLING_HOOK, new Vec2d(1, 16));
|
super(pos);
|
||||||
|
|
||||||
this.layerId = layerId;
|
this.layerId = layerId;
|
||||||
this.height = -16;
|
this.height = -16;
|
||||||
|
|
@ -104,11 +105,8 @@ public class EntityGrapplingHook extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public Model getModel() {
|
||||||
GlHelpers.pushMatrix();
|
return Models.ENTITY_GRAPPLING_HOOK;
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
|
|
@ -12,7 +13,7 @@ import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityItem extends EntityVertical
|
public class EntityItem extends Entity
|
||||||
{
|
{
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
private double height = 0;
|
private double height = 0;
|
||||||
|
|
@ -23,7 +24,7 @@ public class EntityItem extends EntityVertical
|
||||||
public double angle;
|
public double angle;
|
||||||
|
|
||||||
public EntityItem(BdfObject bdf) {
|
public EntityItem(BdfObject bdf) {
|
||||||
super(bdf, TextureReference.EMPTY, new Vec2d(0.5, 0.5));
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -37,8 +38,6 @@ public class EntityItem extends EntityVertical
|
||||||
pickup_time = nl.get("pickup").getInteger();
|
pickup_time = nl.get("pickup").getInteger();
|
||||||
age = nl.get("age").getLong();
|
age = nl.get("age").getLong();
|
||||||
angle = nl.get("angle").getDouble();
|
angle = nl.get("angle").getDouble();
|
||||||
|
|
||||||
tex = stack.item.texture;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -55,10 +54,9 @@ public class EntityItem extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityItem(Vec2d pos, ItemStack stack) {
|
public EntityItem(Vec2d pos, ItemStack stack) {
|
||||||
super(pos, stack.item.texture, new Vec2d(0.5, 0.5));
|
super(pos);
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.opaqueTile = true;
|
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
this.angle = RandomHelpers.randrange(rand, 360);
|
this.angle = RandomHelpers.randrange(rand, 360);
|
||||||
height_speed = RandomHelpers.randrange(rand, 10000) / 200000.0;
|
height_speed = RandomHelpers.randrange(rand, 10000) / 200000.0;
|
||||||
|
|
@ -135,10 +133,9 @@ public class EntityItem extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
public Model getModel() {
|
||||||
GlHelpers.pushMatrix();
|
return Models.ITEM_NONE;
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
super.render(pos, camera, stack.item.texture, size);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,36 +5,22 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
|
import gl_engine.texture.TextureRef3D;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityParticle extends Entity
|
public abstract class EntityParticle extends Entity
|
||||||
{
|
{
|
||||||
public static SettingQuality MODE = SettingQuality.FANCY;
|
public static SettingQuality MODE = SettingQuality.FANCY;
|
||||||
|
protected TextureRef3D tex;
|
||||||
private double height;
|
|
||||||
private double size;
|
|
||||||
|
|
||||||
public EntityParticle(BdfObject bdf) {
|
public EntityParticle(BdfObject bdf) {
|
||||||
super(bdf);
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityParticle(Vec2d pos, double size, double height) {
|
public EntityParticle(Vec2d pos) {
|
||||||
super(pos);
|
super(pos);
|
||||||
|
|
||||||
// Set some settings
|
|
||||||
this.opaqueTile = false;
|
|
||||||
this.height = height;
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSize(double size) {
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeight(double height) {
|
|
||||||
this.height = height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -44,38 +30,4 @@ public class EntityParticle extends Entity
|
||||||
// Kill the particle if the player can't see it to reduce lag
|
// 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) > Camera.camera.renderDistance * 16) this.kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera)
|
|
||||||
{
|
|
||||||
// Call super
|
|
||||||
super.render(pos, camera);
|
|
||||||
|
|
||||||
// Push the matrix, disable textures, colour, and translate the bullet
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.disableTexture2d();
|
|
||||||
|
|
||||||
// Get the angle between the camera and the bullet
|
|
||||||
double angle_r = camera.angle;
|
|
||||||
|
|
||||||
// Make the bullet upright
|
|
||||||
GlHelpers.translate3(size/2, 0, 0);
|
|
||||||
GlHelpers.translate3(pos.x, pos.y, height);
|
|
||||||
GlHelpers.rotate(-angle_r, 0, 0, 1);
|
|
||||||
GlHelpers.translate3(-size/2, 0, 0);
|
|
||||||
|
|
||||||
// Draw the bullet
|
|
||||||
GlHelpers.begin();
|
|
||||||
{
|
|
||||||
GlHelpers.vertex3(0.0f, 0, 0.0f);
|
|
||||||
GlHelpers.vertex3(size, 0, 0.0f);
|
|
||||||
GlHelpers.vertex3(size, 0, size);
|
|
||||||
GlHelpers.vertex3(0.0f, 0, size);
|
|
||||||
}
|
|
||||||
GlHelpers.end();
|
|
||||||
|
|
||||||
// Pop the matrix, remove the colour, and enable textures
|
|
||||||
GlHelpers.enableTexture2d();
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.particle.ParticleSpark;
|
import projectzombie.entity.particle.ParticleSpark;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
@ -12,7 +13,7 @@ import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityTnt extends EntityVertical
|
public class EntityTnt extends Entity
|
||||||
{
|
{
|
||||||
protected double height = 0.4;
|
protected double height = 0.4;
|
||||||
protected Vec3d velocity;
|
protected Vec3d velocity;
|
||||||
|
|
@ -21,7 +22,7 @@ public class EntityTnt extends EntityVertical
|
||||||
private double explode_damage;
|
private double explode_damage;
|
||||||
|
|
||||||
public EntityTnt(BdfObject bdf) {
|
public EntityTnt(BdfObject bdf) {
|
||||||
super(bdf, Models.ENTITY_TNT, new Vec2d(0.5, 0.5));
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -53,7 +54,7 @@ public class EntityTnt extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityTnt(Vec2d pos, double angle, int explode_radius, double explode_damage) {
|
public EntityTnt(Vec2d pos, double angle, int explode_radius, double explode_damage) {
|
||||||
super(pos, Models.ENTITY_TNT, new Vec2d(0.5, 0.5));
|
super(pos);
|
||||||
|
|
||||||
Vec2d v = MathHelpers.moveTowards2(0.05, Math.toRadians(angle));
|
Vec2d v = MathHelpers.moveTowards2(0.05, Math.toRadians(angle));
|
||||||
velocity = new Vec3d(v.x, v.y, 0.01);
|
velocity = new Vec3d(v.x, v.y, 0.01);
|
||||||
|
|
@ -112,17 +113,7 @@ public class EntityTnt extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create sparks
|
// Create sparks
|
||||||
chunk.spawnEntity(new ParticleSpark(pos.copy(), height));
|
chunk.spawnEntity(new ParticleSpark(pos.copy()));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera)
|
|
||||||
{
|
|
||||||
// Render the tnt with the height
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -134,4 +125,10 @@ public class EntityTnt extends EntityVertical
|
||||||
protected void moveAwayFromSolidEntities(Layer layer) {
|
protected void moveAwayFromSolidEntities(Layer layer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
package projectzombie.entity;
|
|
||||||
|
|
||||||
import bdf.types.BdfObject;
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.entity.particle.ParticleBreak;
|
|
||||||
import projectzombie.util.gl.GlHelpers;
|
|
||||||
import projectzombie.util.gl.VerticalRender;
|
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
|
||||||
import gl_engine.MathHelpers;
|
|
||||||
import gl_engine.vec.Vec2d;
|
|
||||||
import gl_engine.vec.Vec2i;
|
|
||||||
import gl_engine.vec.Vec3d;
|
|
||||||
|
|
||||||
public class EntityVertical extends Entity implements IHasTexture
|
|
||||||
{
|
|
||||||
public TextureReference tex;
|
|
||||||
public Vec2d size;
|
|
||||||
|
|
||||||
public EntityVertical(BdfObject bdf, TextureReference tex, Vec2d size) {
|
|
||||||
super(bdf);
|
|
||||||
this.size = size;
|
|
||||||
this.tex = tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityVertical(Vec2d pos, TextureReference tex, Vec2d size) {
|
|
||||||
super(pos);
|
|
||||||
this.size = size;
|
|
||||||
this.tex = tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
|
||||||
super.render(pos, camera);
|
|
||||||
VerticalRender.render(new Vec2d(pos.x - 0.5, pos.y - 0.5), camera, tex, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera) {
|
|
||||||
this.render(pos, camera, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void render(Vec2d pos, Camera camera, double opacity) {
|
|
||||||
Vec3d light = chunk.getRGBLightLevel(new Vec2i(
|
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
|
||||||
GlHelpers.color4(light.x, light.y, light.z, opacity);
|
|
||||||
this.render(pos, camera, tex, size);
|
|
||||||
GlHelpers.color4(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureReference getTexture() {
|
|
||||||
return tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void killWithParticles() {
|
|
||||||
ParticleBreak.spawnParticles(chunk, pos, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -6,6 +6,7 @@ import bdf.types.BdfNamedList;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.math.astar.AStar;
|
import projectzombie.util.math.astar.AStar;
|
||||||
import projectzombie.util.math.astar.AStarSearcher;
|
import projectzombie.util.math.astar.AStarSearcher;
|
||||||
|
|
@ -15,7 +16,7 @@ import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityZombie extends EntityVertical implements EntityAlive, EntityKillWithParticles
|
public class EntityZombie extends Entity implements EntityAlive, EntityKillWithParticles
|
||||||
{
|
{
|
||||||
protected OpenSimplexNoise noise_movement;
|
protected OpenSimplexNoise noise_movement;
|
||||||
protected OpenSimplexNoise noise_gun_fire;
|
protected OpenSimplexNoise noise_gun_fire;
|
||||||
|
|
@ -36,10 +37,8 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
private boolean can_see_player = false;
|
private boolean can_see_player = false;
|
||||||
private int walking_for = 0;
|
private int walking_for = 0;
|
||||||
|
|
||||||
private static final Vec2d size = new Vec2d(1, 1);
|
|
||||||
|
|
||||||
public EntityZombie(BdfObject bdf) {
|
public EntityZombie(BdfObject bdf) {
|
||||||
super(bdf, Models.ENTITY_ZOMBIE_F, size);
|
super(bdf);
|
||||||
|
|
||||||
// Set some settings
|
// Set some settings
|
||||||
hitbox = 0.5;
|
hitbox = 0.5;
|
||||||
|
|
@ -84,7 +83,7 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityZombie(Vec2d pos) {
|
public EntityZombie(Vec2d pos) {
|
||||||
super(pos, Models.ENTITY_ZOMBIE_F, size);
|
super(pos);
|
||||||
|
|
||||||
seed = rand.nextLong();
|
seed = rand.nextLong();
|
||||||
Random rand = new Random(seed);
|
Random rand = new Random(seed);
|
||||||
|
|
@ -169,7 +168,7 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureReference getTexture() {
|
public Model getModel() {
|
||||||
return Models.ENTITY_ZOMBIE_F;
|
return Models.ENTITY_ZOMBIE_F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,4 +220,10 @@ public class EntityZombie extends EntityVertical implements EntityAlive, EntityK
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void killWithParticles() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package projectzombie.entity;
|
||||||
import bdf.types.BdfObject;
|
import bdf.types.BdfObject;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
|
|
@ -21,14 +22,14 @@ public class EntityZombieArmored extends EntityZombie
|
||||||
this.crossUnWalkable = true;
|
this.crossUnWalkable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
|
||||||
super.render(pos, camera, Models.ENTITY_ZOMBIE_F_ARMORED, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int bloodParticles() {
|
public int bloodParticles() {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel() {
|
||||||
|
return Models.ENTITY_ZOMBIE_F_ARMORED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import java.util.Random;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
|
|
@ -22,7 +24,7 @@ public class ParticleBlood extends EntityParticle
|
||||||
private Vec3d velocity;
|
private Vec3d velocity;
|
||||||
|
|
||||||
public ParticleBlood(Random rand, Vec2d pos, double angle) {
|
public ParticleBlood(Random rand, Vec2d pos, double angle) {
|
||||||
super(pos, rand.nextDouble() / 5, 0);
|
super(pos);
|
||||||
|
|
||||||
angle += RandomHelpers.randrange(rand, -100, 100);
|
angle += RandomHelpers.randrange(rand, -100, 100);
|
||||||
double angle_height = RandomHelpers.randrange(rand, 9000, 18000) / 100;
|
double angle_height = RandomHelpers.randrange(rand, 9000, 18000) / 100;
|
||||||
|
|
@ -64,20 +66,7 @@ public class ParticleBlood extends EntityParticle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera)
|
public Model getModel() {
|
||||||
{
|
return Models.PARTICLE_BLOOD;
|
||||||
// Get the light level
|
|
||||||
Vec3d light = chunk.getRGBLightLevel(new Vec2i(
|
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
|
||||||
|
|
||||||
// Set some settings
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.color3(r_color * light.x, 0, 0);
|
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
|
|
||||||
// Call super
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.color3(1, 1, 1);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,11 @@ import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.entity.EntityVertical;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.tiles.TileVertical;
|
import projectzombie.tiles.TileVertical;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.AnimationReference;
|
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
import projectzombie.util.gl.texture.IHasTexture;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
|
|
@ -20,7 +20,7 @@ import gl_engine.vec.Vec3d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class ParticleBreak extends EntityVertical
|
public class ParticleBreak extends EntityParticle
|
||||||
{
|
{
|
||||||
private double height = 0;
|
private double height = 0;
|
||||||
private Vec3d velocity;
|
private Vec3d velocity;
|
||||||
|
|
@ -35,13 +35,13 @@ public class ParticleBreak extends EntityVertical
|
||||||
|
|
||||||
int height = 1;
|
int height = 1;
|
||||||
|
|
||||||
if(e instanceof EntityVertical) {
|
/*if(e instanceof EntityVertical) {
|
||||||
height = MathHelpers.floor(((EntityVertical)e).size.y);
|
height = MathHelpers.floor(((EntityVertical)e).size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0;i<50 * height;i++) {
|
for(int i=0;i<50 * height;i++) {
|
||||||
chunk.spawnEntity(new ParticleBreak(pos.copy(), e));
|
chunk.spawnEntity(new ParticleBreak(pos.copy(), e));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void spawnParticles(Chunk chunk, Vec2d pos, TileState s)
|
public static void spawnParticles(Chunk chunk, Vec2d pos, TileState s)
|
||||||
|
|
@ -61,16 +61,12 @@ public class ParticleBreak extends EntityVertical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextureReference getTexture(TileState ts)
|
/*private static TextureReference getTexture(TileState ts)
|
||||||
{
|
{
|
||||||
if(ts.tile instanceof IHasTexture)
|
if(ts.tile instanceof IHasTexture)
|
||||||
{
|
{
|
||||||
TextureReference tex = ((IHasTexture)ts.tile).getTexture();
|
TextureReference tex = ((IHasTexture)ts.tile).getTexture();
|
||||||
|
|
||||||
if(tex instanceof AnimationReference) {
|
|
||||||
tex = ((AnimationReference)tex).c;
|
|
||||||
}
|
|
||||||
|
|
||||||
int px = RandomHelpers.randrange(rand, tex.start_x, tex.end_x - 2);
|
int px = RandomHelpers.randrange(rand, tex.start_x, tex.end_x - 2);
|
||||||
int py = RandomHelpers.randrange(rand, tex.start_y, tex.end_y - 2);
|
int py = RandomHelpers.randrange(rand, tex.start_y, tex.end_y - 2);
|
||||||
return tex.getTextureReference(px, px + 2, py, py + 2);
|
return tex.getTextureReference(px, px + 2, py, py + 2);
|
||||||
|
|
@ -87,10 +83,6 @@ public class ParticleBreak extends EntityVertical
|
||||||
{
|
{
|
||||||
TextureReference tex = ((IHasTexture)entity).getTexture();
|
TextureReference tex = ((IHasTexture)entity).getTexture();
|
||||||
|
|
||||||
if(tex instanceof AnimationReference) {
|
|
||||||
tex = ((AnimationReference)tex).c;
|
|
||||||
}
|
|
||||||
|
|
||||||
int px = RandomHelpers.randrange(rand, tex.start_x, tex.end_x - 2);
|
int px = RandomHelpers.randrange(rand, tex.start_x, tex.end_x - 2);
|
||||||
int py = RandomHelpers.randrange(rand, tex.start_y, tex.end_y - 2);
|
int py = RandomHelpers.randrange(rand, tex.start_y, tex.end_y - 2);
|
||||||
return tex.getTextureReference(px, px + 2, py, py + 2);
|
return tex.getTextureReference(px, px + 2, py, py + 2);
|
||||||
|
|
@ -99,17 +91,12 @@ public class ParticleBreak extends EntityVertical
|
||||||
else {
|
else {
|
||||||
return TextureReference.EMPTY;
|
return TextureReference.EMPTY;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public ParticleBreak(Vec2d pos, TileState ts) {
|
public ParticleBreak(Vec2d pos, TileState ts) {
|
||||||
super(pos, getTexture(ts), new Vec2d(1/8.0, 1/8.0));
|
super(pos);
|
||||||
double angle = RandomHelpers.randrange(rand, 360);
|
|
||||||
|
|
||||||
if(EntityParticle.MODE == SettingQuality.FANCY) {
|
double angle = RandomHelpers.randrange(rand, 360);
|
||||||
this.opaqueTile = ts.tile.opaqueTile;
|
|
||||||
} else {
|
|
||||||
this.opaqueTile = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ts.tile instanceof TileVertical) {
|
if(ts.tile instanceof TileVertical) {
|
||||||
TileVertical ts_v = (TileVertical) ts.tile;
|
TileVertical ts_v = (TileVertical) ts.tile;
|
||||||
|
|
@ -126,27 +113,23 @@ public class ParticleBreak extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
public ParticleBreak(Vec2d pos, Entity entity) {
|
public ParticleBreak(Vec2d pos, Entity entity) {
|
||||||
super(pos, getTexture(entity), new Vec2d(1/8.0, 1/8.0));
|
super(pos);
|
||||||
double angle = RandomHelpers.randrange(rand, 360);
|
double angle = RandomHelpers.randrange(rand, 360);
|
||||||
|
|
||||||
if(EntityParticle.MODE == SettingQuality.FANCY) {
|
|
||||||
this.opaqueTile = entity.opaqueTile;
|
|
||||||
} else {
|
|
||||||
this.opaqueTile = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(entity instanceof EntityVertical) {
|
|
||||||
EntityVertical entity_v = (EntityVertical) entity;
|
|
||||||
|
|
||||||
height = RandomHelpers.randrange(rand, 0, MathHelpers.floor(entity_v.size.y));
|
|
||||||
}
|
|
||||||
|
|
||||||
Vec2d side_v = MathHelpers.moveTowards2(0.01, Math.toRadians(angle));
|
Vec2d side_v = MathHelpers.moveTowards2(0.01, Math.toRadians(angle));
|
||||||
velocity = new Vec3d(
|
velocity = new Vec3d(
|
||||||
side_v.x, side_v.y,
|
side_v.x, side_v.y,
|
||||||
RandomHelpers.randrange(rand, 10000) / 200000.0);
|
RandomHelpers.randrange(rand, 10000) / 200000.0);
|
||||||
|
|
||||||
time = RandomHelpers.randrange(rand, 500, 1500);
|
time = RandomHelpers.randrange(rand, 500, 1500);
|
||||||
|
|
||||||
|
/*if(entity instanceof EntityVertical) {
|
||||||
|
EntityVertical entity_v = (EntityVertical) entity;
|
||||||
|
|
||||||
|
height = RandomHelpers.randrange(rand, 0, MathHelpers.floor(entity_v.size.y));
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -186,13 +169,9 @@ public class ParticleBreak extends EntityVertical
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TextureReference tex, Vec2d size) {
|
public Model getModel() {
|
||||||
Vec3d light = chunk.getRGBLightLevel(new Vec2i(
|
return Models.ENTITY_NONE;
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
|
||||||
GlHelpers.color3(light.x, light.y, light.z);
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
super.render(pos, camera, tex, size);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import java.util.Random;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
|
|
@ -20,7 +22,7 @@ public class ParticleLava extends EntityParticle
|
||||||
private double height = 0;
|
private double height = 0;
|
||||||
|
|
||||||
public ParticleLava(Vec2d pos) {
|
public ParticleLava(Vec2d pos) {
|
||||||
super(pos, rand.nextDouble()/5, 0);
|
super(pos);
|
||||||
|
|
||||||
// Set the velocity
|
// Set the velocity
|
||||||
velocity = MathHelpers.moveTowards3(0.05, new Vec2d(Math.toRadians(
|
velocity = MathHelpers.moveTowards3(0.05, new Vec2d(Math.toRadians(
|
||||||
|
|
@ -48,11 +50,7 @@ public class ParticleLava extends EntityParticle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public Model getModel() {
|
||||||
GlHelpers.pushMatrix();
|
return Models.PARTICLE_LAVA;
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
GlHelpers.color3(1, 0, 0);
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@ package projectzombie.entity.particle;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
import projectzombie.entity.EntityVertical;
|
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
|
|
@ -12,15 +12,17 @@ import gl_engine.vec.Vec2d;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class ParticleSmoke extends EntityVertical
|
public class ParticleSmoke extends EntityParticle
|
||||||
{
|
{
|
||||||
double height = 0;
|
double height = 0;
|
||||||
double opacity = 1;
|
double opacity = 1;
|
||||||
double height_speed;
|
double height_speed;
|
||||||
double disappear_speed;
|
double disappear_speed;
|
||||||
|
|
||||||
|
private Model model;
|
||||||
|
|
||||||
public ParticleSmoke(Vec2d pos) {
|
public ParticleSmoke(Vec2d pos) {
|
||||||
super(new Vec2d(0, 0), Models.PARTICLE_SMOKE_RANDOM.getTexture(), new Vec2d(1, 1));
|
super(pos);
|
||||||
|
|
||||||
this.pos = new Vec2d(
|
this.pos = new Vec2d(
|
||||||
RandomHelpers.randrange(rand, 1000)/1000.0 - 0.5 + pos.x,
|
RandomHelpers.randrange(rand, 1000)/1000.0 - 0.5 + pos.x,
|
||||||
|
|
@ -28,16 +30,7 @@ public class ParticleSmoke extends EntityVertical
|
||||||
|
|
||||||
height_speed = (rand.nextDouble() + 0.5) / 250;
|
height_speed = (rand.nextDouble() + 0.5) / 250;
|
||||||
disappear_speed = (rand.nextDouble() + 0.5) / 1000;
|
disappear_speed = (rand.nextDouble() + 0.5) / 1000;
|
||||||
this.opaqueTile = true;
|
model = Models.PARTICLE_SMOKE_RANDOM.getModel();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera) {
|
|
||||||
if(opacity <= 0) return;
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
super.render(pos, camera, opacity);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -56,4 +49,9 @@ public class ParticleSmoke extends EntityVertical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel() {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package projectzombie.entity.particle;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
@ -12,9 +14,8 @@ public class ParticleSpark extends EntityParticle
|
||||||
{
|
{
|
||||||
private double size = 0.1;
|
private double size = 0.1;
|
||||||
|
|
||||||
public ParticleSpark(Vec2d pos, double height) {
|
public ParticleSpark(Vec2d pos) {
|
||||||
super(pos, 1, height+0.4);
|
super(pos);
|
||||||
this.opaqueTile = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -23,7 +24,6 @@ public class ParticleSpark extends EntityParticle
|
||||||
|
|
||||||
// Reduce the size
|
// Reduce the size
|
||||||
size -= 0.004;
|
size -= 0.004;
|
||||||
setSize(size);
|
|
||||||
|
|
||||||
// Is the size zero
|
// Is the size zero
|
||||||
if(size <= 0)
|
if(size <= 0)
|
||||||
|
|
@ -38,16 +38,8 @@ public class ParticleSpark extends EntityParticle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera)
|
public Model getModel() {
|
||||||
{
|
return Models.PARTICLE_SMOKE_TRAIL;
|
||||||
// Set some settings
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.color3(1, 1, 0);
|
|
||||||
|
|
||||||
// Call super
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.color3(1, 1, 1);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package projectzombie.entity.particle;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.EntityParticle;
|
import projectzombie.entity.EntityParticle;
|
||||||
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.SettingQuality;
|
import projectzombie.settings.SettingQuality;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
|
|
@ -18,7 +20,7 @@ public class ParticleWater extends EntityParticle
|
||||||
private double height = 0;
|
private double height = 0;
|
||||||
|
|
||||||
public ParticleWater(Vec2d pos) {
|
public ParticleWater(Vec2d pos) {
|
||||||
super(pos, rand.nextDouble()/5, 0);
|
super(pos);
|
||||||
|
|
||||||
// Set the velocity
|
// Set the velocity
|
||||||
velocity = MathHelpers.moveTowards3(0.05, new Vec2d(Math.toRadians(
|
velocity = MathHelpers.moveTowards3(0.05, new Vec2d(Math.toRadians(
|
||||||
|
|
@ -46,15 +48,8 @@ public class ParticleWater extends EntityParticle
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera) {
|
public Model getModel() {
|
||||||
GlHelpers.pushMatrix();
|
return Models.PARTICLE_WATER;
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
Vec3d light = chunk.getRGBLightLevel(new Vec2i(
|
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
|
||||||
GlHelpers.color3(light.x * 0.2, light.y * 0.2, light.z * 0.6);
|
|
||||||
super.render(pos, camera);
|
|
||||||
GlHelpers.color3(1, 1, 1);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,17 +9,18 @@ import bdf.types.BdfObject;
|
||||||
import mainloop.task.IMainloopTask;
|
import mainloop.task.IMainloopTask;
|
||||||
import projectzombie.Main;
|
import projectzombie.Main;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityAlive;
|
import projectzombie.entity.EntityAlive;
|
||||||
import projectzombie.entity.EntityBullet;
|
import projectzombie.entity.EntityBullet;
|
||||||
import projectzombie.entity.EntityHeight;
|
import projectzombie.entity.EntityHeight;
|
||||||
import projectzombie.entity.EntityInventory;
|
import projectzombie.entity.EntityInventory;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.entity.EntityVertical;
|
|
||||||
import projectzombie.entity.particle.ParticleBreak;
|
import projectzombie.entity.particle.ParticleBreak;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.inventory.Inventory;
|
import projectzombie.inventory.Inventory;
|
||||||
import projectzombie.menu.MenuDeath;
|
import projectzombie.menu.MenuDeath;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.settings.Cheats;
|
import projectzombie.settings.Cheats;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
|
|
@ -33,7 +34,7 @@ import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class EntityPlayer extends EntityVertical implements EntityAlive, EntityInventory, EntityHeight
|
public class EntityPlayer extends Entity implements EntityAlive, EntityInventory, EntityHeight
|
||||||
{
|
{
|
||||||
public boolean MOVE_FORWARD = false;
|
public boolean MOVE_FORWARD = false;
|
||||||
public boolean MOVE_BACKWARD = false;
|
public boolean MOVE_BACKWARD = false;
|
||||||
|
|
@ -42,8 +43,8 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
public boolean GUN = false;
|
public boolean GUN = false;
|
||||||
public boolean moving = false;
|
public boolean moving = false;
|
||||||
|
|
||||||
public TextureReference PLAYER_MOVING = Models.ENTITY_PLAYER_B_W_MOVING;
|
public Model PLAYER_MOVING = Models.ENTITY_PLAYER_B_W_MOVING;
|
||||||
public TextureReference PLAYER_STILL = Models.ENTITY_PLAYER_B_W_STILL;
|
public Model PLAYER_STILL = Models.ENTITY_PLAYER_B_W_STILL;
|
||||||
|
|
||||||
public double height = 0;
|
public double height = 0;
|
||||||
|
|
||||||
|
|
@ -67,7 +68,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
private static final Vec2d size = new Vec2d(1, 1);
|
private static final Vec2d size = new Vec2d(1, 1);
|
||||||
|
|
||||||
public EntityPlayer(BdfObject bdf) {
|
public EntityPlayer(BdfObject bdf) {
|
||||||
super(bdf, TextureReference.EMPTY, size);
|
super(bdf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -101,7 +102,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
}
|
}
|
||||||
|
|
||||||
public EntityPlayer() {
|
public EntityPlayer() {
|
||||||
super(new Vec2d(0, 0), TextureReference.EMPTY, size);
|
super(new Vec2d(0, 0));
|
||||||
|
|
||||||
this.angle = 45;
|
this.angle = 45;
|
||||||
|
|
||||||
|
|
@ -136,10 +137,7 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureReference getTexture() {
|
|
||||||
return PLAYER_STILL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick(Chunk chunk, Layer layer)
|
public void tick(Chunk chunk, Layer layer)
|
||||||
|
|
@ -240,37 +238,6 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
this.moveTowards(angle, 0.08);
|
this.moveTowards(angle, 0.08);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera)
|
|
||||||
{
|
|
||||||
// Don't render if the player is dead
|
|
||||||
if(dead) return;
|
|
||||||
|
|
||||||
// Don't render if the chunk isnt loaded
|
|
||||||
if(!ChunkEventHandler.loaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Translation
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.translate3(0, 0, height);
|
|
||||||
|
|
||||||
// Set the colour due to the lighting
|
|
||||||
Vec3d light = chunk.getRGBLightLevel(new Vec2i(
|
|
||||||
MathHelpers.floor(pos.x), MathHelpers.floor(pos.y)));
|
|
||||||
GlHelpers.color3(light.x, light.y, light.z);
|
|
||||||
|
|
||||||
// Moving
|
|
||||||
if(MOVE_BACKWARD || MOVE_FORWARD || moving)
|
|
||||||
super.render(pos, camera, PLAYER_MOVING, size);
|
|
||||||
|
|
||||||
// Standing still
|
|
||||||
else super.render(pos, camera, PLAYER_STILL, size);
|
|
||||||
|
|
||||||
// Pop the matrix
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void fireBullet(double angle)
|
public void fireBullet(double angle)
|
||||||
{
|
{
|
||||||
if(dead || in_animation) return;
|
if(dead || in_animation) return;
|
||||||
|
|
@ -374,4 +341,9 @@ public class EntityPlayer extends EntityVertical implements EntityAlive, EntityI
|
||||||
public void setHeight(double height) {
|
public void setHeight(double height) {
|
||||||
this.height = height;
|
this.height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel() {
|
||||||
|
return moving ? PLAYER_MOVING : PLAYER_STILL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,229 +5,92 @@ import java.util.ArrayList;
|
||||||
import org.lwjgl.opengl.GL;
|
import org.lwjgl.opengl.GL;
|
||||||
|
|
||||||
import projectzombie.display.DisplayWindow;
|
import projectzombie.display.DisplayWindow;
|
||||||
import projectzombie.util.gl.texture.AnimationReference;
|
import projectzombie.model.Model;
|
||||||
|
import projectzombie.model.ModelGui;
|
||||||
|
import projectzombie.model.ModelRandom;
|
||||||
|
import projectzombie.model.ModelTile;
|
||||||
|
import projectzombie.model.ModelVertical;
|
||||||
import projectzombie.util.gl.texture.TextureMap;
|
import projectzombie.util.gl.texture.TextureMap;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import projectzombie.util.gl.texture.TextureReferenceRandom;
|
import projectzombie.util.gl.texture.TextureReferenceRandom;
|
||||||
|
|
||||||
public class Models
|
public class Models
|
||||||
{
|
{
|
||||||
public static final TextureReference TILE_GRASS = texmap.getTextureReference(0, 1, 0, 1);
|
public static final Model TILE_NONE = new ModelTile(Resources.ATLAS.get("NONE"));
|
||||||
public static final TextureReference TILE_SAND = texmap.getTextureReference(1, 2, 0, 1);
|
public static final Model ENTITY_NONE = new ModelTile(Resources.ATLAS.get("NONE"));
|
||||||
public static final TextureReference TILE_STONE = texmap.getTextureReference(2, 3, 0, 1);
|
public static final Model ITEM_NONE = new ModelTile(Resources.ATLAS.get("NONE"));
|
||||||
public static final TextureReference TILE_DIRT = texmap.getTextureReference(3, 4, 0, 1);
|
|
||||||
public static final TextureReference TILE_TREE = texmap.getTextureReference(4, 5, 0, 4);
|
|
||||||
public static final TextureReference TILE_ROCK = texmap.getTextureReference(4, 5, 4, 5);
|
|
||||||
public static final TextureReference ENTITY_TNT = texmap.getTextureReference(4, 5, 5, 6);
|
|
||||||
public static final TextureReference TILE_LADDER = texmap.getTextureReference(3, 4, 4, 5);
|
|
||||||
public static final TextureReference TILE_PORTAL = texmap.getTextureReference(3, 4, 5, 6);
|
|
||||||
public static final TextureReference TILE_WALL = texmap.getTextureReference(2, 3, 5, 6);
|
|
||||||
public static final TextureReference TILE_LADDER_UP = texmap.getTextureReference(16, 17, 0, 16);
|
|
||||||
public static final TextureReference TILE_CHEST = texmap.getTextureReference(2, 3, 4, 5);
|
|
||||||
public static final TextureReference ENTITY_FLARE = texmap.getTextureReference(6, 7, 15, 16);
|
|
||||||
public static final TextureReference ENTITY_DUMMY = texmap.getTextureReference(7, 8, 15, 16);
|
|
||||||
public static final TextureReference TILE_BOSS_PORTAL = texmap.getTextureReference(18, 20, 0, 2);
|
|
||||||
public static final TextureReference ITEM_GRAPPLING_HOOK = texmap.getTextureReference(18, 19, 2, 3);
|
|
||||||
public static final TextureReference ENTITY_GRAPPLING_HOOK = texmap.getTextureReference(17, 18, 0, 16);
|
|
||||||
|
|
||||||
public static final TextureReference BUTTON = texmap.getTextureReference(18, 26, 8, 9);
|
public static final Model TILE_GRASS = new ModelTile(Resources.ATLAS.get("/tile/grass.png"));
|
||||||
public static final TextureReference BUTTON_HOVER = texmap.getTextureReference(18, 26, 9, 10);
|
public static final Model TILE_SAND = new ModelTile(Resources.ATLAS.get("/tile/sand.png"));
|
||||||
|
public static final Model TILE_STONE = new ModelTile(Resources.ATLAS.get("/tile/stone.png"));
|
||||||
|
public static final Model TILE_DIRT = new ModelTile(Resources.ATLAS.get("/tile/dirt.png"));
|
||||||
|
public static final Model TILE_TREE = new ModelVertical(Resources.ATLAS.get("/tile/tree.png"));
|
||||||
|
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_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_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 AnimationReference ENTITY_BOSS_IDLE = new AnimationReference(50,
|
public static final Model ENTITY_BOSS_IDLE = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_idle.png"));
|
||||||
texmap.getTextureReference(20, 22, 0, 2),
|
public static final Model ENTITY_BOSS_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_firing.png"), 4, 10);
|
||||||
texmap.getTextureReference(22, 24, 0, 2),
|
public static final Model ENTITY_BOSS_WALKING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_walking.png"), 4, 10);
|
||||||
texmap.getTextureReference(24, 26, 0, 2),
|
public static final Model ENTITY_BOSS_WALKING_AND_FIRING = new ModelVertical(Resources.ATLAS.get("/entity/boss1/boss_walking_firing.png"), 4, 10);
|
||||||
texmap.getTextureReference(26, 28, 0, 2));
|
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 AnimationReference ENTITY_BOSS_FIRING = new AnimationReference(50,
|
public static final Model TILE_LANTERN = new ModelVertical(Resources.ATLAS.get("/tile/lantern.png"), 4, 5);
|
||||||
texmap.getTextureReference(20, 22, 2, 4),
|
|
||||||
texmap.getTextureReference(22, 24, 2, 4),
|
|
||||||
texmap.getTextureReference(24, 26, 2, 4),
|
|
||||||
texmap.getTextureReference(26, 28, 2, 4));
|
|
||||||
|
|
||||||
public static final AnimationReference ENTITY_BOSS_WALKING = new AnimationReference(50,
|
public static final Model PARTICLE_BLOOD = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||||
texmap.getTextureReference(20, 22, 4, 6),
|
public static final Model PARTICLE_LAVA = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||||
texmap.getTextureReference(22, 24, 4, 6),
|
public static final Model PARTICLE_WATER = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||||
texmap.getTextureReference(24, 26, 4, 6),
|
public static final Model PARTICLE_SMOKE_TRAIL = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||||
texmap.getTextureReference(26, 28, 4, 6));
|
public static final Model PARTICLE_BULLET = new ModelVertical(Resources.ATLAS.get("/particle/blood.png"));
|
||||||
|
|
||||||
public static final AnimationReference ENTITY_BOSS_WALKING_AND_FIRING = new AnimationReference(50,
|
public static final ModelRandom PARTICLE_SMOKE_RANDOM = new ModelRandom(
|
||||||
texmap.getTextureReference(20, 22, 6, 8),
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_0.png")),
|
||||||
texmap.getTextureReference(22, 24, 6, 8),
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_1.png")),
|
||||||
texmap.getTextureReference(24, 26, 6, 8),
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_2.png")),
|
||||||
texmap.getTextureReference(26, 28, 6, 8));
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_3.png")),
|
||||||
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_4.png")),
|
||||||
|
new ModelVertical(Resources.ATLAS.get("/particle/smoke_5.png")));
|
||||||
|
|
||||||
public static final AnimationReference TILE_LANTERN = new AnimationReference(10,
|
public static final Model BUTTON = new ModelGui(Resources.ATLAS.get("/gui/button.png"));
|
||||||
texmap.getTextureReference(8, 9, 15, 16),
|
public static final Model BUTTON_HOVER = new ModelGui(Resources.ATLAS.get("/tile/tree.png"));
|
||||||
texmap.getTextureReference(9, 10, 15, 16),
|
|
||||||
texmap.getTextureReference(10, 11, 15, 16),
|
|
||||||
texmap.getTextureReference(11, 12, 15, 16),
|
|
||||||
texmap.getTextureReference(12, 13, 15, 16),
|
|
||||||
texmap.getTextureReference(13, 14, 15, 16));
|
|
||||||
|
|
||||||
public static final TextureReferenceRandom PARTICLE_SMOKE_RANDOM = new TextureReferenceRandom(
|
public static final Model UI_HEALTH_FG = new ModelGui(Resources.ATLAS.get("/gui/health_full.png"));
|
||||||
texmap.getTextureReference(14, 15, 13, 14), texmap.getTextureReference(15, 16, 13, 14),
|
public static final Model UI_HEALTH_BG = new ModelGui(Resources.ATLAS.get("/gui/health_empty.png"));
|
||||||
texmap.getTextureReference(14, 15, 14, 15), texmap.getTextureReference(15, 16, 14, 15),
|
public static final Model UI_ITEM_SLOTS = new ModelGui(Resources.ATLAS.get("/gui/hotbar.png"));
|
||||||
texmap.getTextureReference(14, 15, 15, 16), texmap.getTextureReference(15, 16, 15, 16));
|
public static final Model UI_ACTIVE_SLOT = new ModelGui(Resources.ATLAS.get("/gui/hotbar_selected.png"));
|
||||||
|
|
||||||
public static final TextureReference UI_HEALTH_FG = texmap.getTextureReference(0, 16, 11, 12);
|
public static final Model UI_DEFENCE_LEVEL = new ModelGui(Resources.ATLAS.get("/gui/shield.png"));
|
||||||
public static final TextureReference UI_HEALTH_BG = texmap.getTextureReference(0, 16, 12, 13);
|
public static final Model UI_GUN_LEVEL = new ModelGui(Resources.ATLAS.get("/gui/gun.png"));
|
||||||
public static final TextureReference UI_ITEM_SLOTS = texmap.getTextureReference(0, 12, 13, 15);
|
|
||||||
public static final TextureReference UI_ACTIVE_SLOT = texmap.getTextureReference(12, 14, 13, 15);
|
|
||||||
|
|
||||||
public static final TextureReference UI_DEFENCE_LEVEL = texmap.getTextureReference(0, 1, 15, 16);
|
public static final Model ITEM_GRAPPLING_HOOK = new ModelGui(Resources.ATLAS.get("/item/grappling_hook.png"));
|
||||||
public static final TextureReference UI_GUN_LEVEL = texmap.getTextureReference(1, 2, 15, 16);
|
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 TextureReference ITEM_HEALTH_POTION = texmap.getTextureReference(0, 1, 5, 6);
|
public static final Model ITEM_GUN_UPGRADE = new ModelGui(Resources.ATLAS.get("/item/gun_upgrade.png"));
|
||||||
public static final TextureReference ITEM_AMMO_BOX = texmap.getTextureReference(1, 2, 5, 6);
|
public static final Model ITEM_DEFENCE_UPGRADE = new ModelGui(Resources.ATLAS.get("/item/shield_upgrade.png"));
|
||||||
public static final TextureReference ITEM_GUN_UPGRADE = texmap.getTextureReference(0, 1, 4, 5);
|
public static final Model ITEM_ROCK = new ModelGui(Resources.ATLAS.get("/item/rock.png"));
|
||||||
public static final TextureReference ITEM_DEFENCE_UPGRADE = texmap.getTextureReference(1, 2, 4, 5);
|
|
||||||
|
|
||||||
public static final TextureReference ITEM_ROCK = texmap.getTextureReference(0, 1, 3, 4);
|
|
||||||
|
|
||||||
// Player Back White Varient
|
// Player Back White Varient
|
||||||
public static final TextureReference ENTITY_PLAYER_B_W_STILL = texmap.getTextureReference(28, 29, 0, 1);
|
public static final Model ENTITY_PLAYER_B_W_STILL = new ModelVertical(Resources.ATLAS.get("/player/player_white_back_still.png"));
|
||||||
public static final TextureReference ENTITY_PLAYER_B_W_MOVING = new AnimationReference(10,
|
public static final Model ENTITY_PLAYER_B_W_MOVING = new ModelVertical(Resources.ATLAS.get("/player/player_white_back_moving.png"), 4, 10);
|
||||||
texmap.getTextureReference(28, 29, 0, 1),
|
public static final Model ENTITY_PLAYER_F_W_STILL = new ModelVertical(Resources.ATLAS.get("/player/player_white_front_still.png"));
|
||||||
texmap.getTextureReference(29, 30, 0, 1),
|
public static final Model ENTITY_PLAYER_F_W_MOVING = new ModelVertical(Resources.ATLAS.get("/player/player_white_front_moving.png"), 4, 10);
|
||||||
texmap.getTextureReference(30, 31, 0, 1),
|
public static final Model ENTITY_PLAYER_B_B_STILL = new ModelVertical(Resources.ATLAS.get("/player/player_black_back_still.png"));
|
||||||
texmap.getTextureReference(31, 32, 0, 1)
|
public static final Model ENTITY_PLAYER_B_B_MOVING = new ModelVertical(Resources.ATLAS.get("/player/player_black_back_moving.png"), 4, 10);
|
||||||
);
|
public static final Model ENTITY_PLAYER_F_B_STILL = new ModelVertical(Resources.ATLAS.get("/player/player_black_front_still.png"));
|
||||||
|
public static final Model ENTITY_PLAYER_F_B_MOVING = new ModelVertical(Resources.ATLAS.get("/player/player_blacl_front_moving.png"), 4, 10);
|
||||||
// Player Front White Varient
|
|
||||||
public static final TextureReference ENTITY_PLAYER_F_W_STILL = texmap.getTextureReference(28, 29, 1, 2);
|
|
||||||
public static final TextureReference ENTITY_PLAYER_F_W_MOVING = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 1, 2),
|
|
||||||
texmap.getTextureReference(29, 30, 1, 2),
|
|
||||||
texmap.getTextureReference(30, 31, 1, 2),
|
|
||||||
texmap.getTextureReference(31, 32, 1, 2)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Player Back Black Varient
|
|
||||||
public static final TextureReference ENTITY_PLAYER_B_B_STILL = texmap.getTextureReference(28, 29, 2, 3);
|
|
||||||
public static final TextureReference ENTITY_PLAYER_B_B_MOVING = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 2, 3),
|
|
||||||
texmap.getTextureReference(29, 30, 2, 3),
|
|
||||||
texmap.getTextureReference(30, 31, 2, 3),
|
|
||||||
texmap.getTextureReference(31, 32, 2, 3)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Player Front Black Varient
|
|
||||||
public static final TextureReference ENTITY_PLAYER_F_B_STILL = texmap.getTextureReference(28, 29, 3, 4);
|
|
||||||
public static final TextureReference ENTITY_PLAYER_F_B_MOVING = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 3, 4),
|
|
||||||
texmap.getTextureReference(29, 30, 3, 4),
|
|
||||||
texmap.getTextureReference(30, 31, 3, 4),
|
|
||||||
texmap.getTextureReference(31, 32, 3, 4)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Zombie
|
|
||||||
public static final TextureReference ENTITY_ZOMBIE_B = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 4, 5),
|
|
||||||
texmap.getTextureReference(29, 30, 4, 5),
|
|
||||||
texmap.getTextureReference(30, 31, 4, 5),
|
|
||||||
texmap.getTextureReference(31, 32, 4, 5)
|
|
||||||
);
|
|
||||||
public static final TextureReference ENTITY_ZOMBIE_F = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 5, 6),
|
|
||||||
texmap.getTextureReference(29, 30, 5, 6),
|
|
||||||
texmap.getTextureReference(30, 31, 5, 6),
|
|
||||||
texmap.getTextureReference(31, 32, 5, 6)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Zombie Bomber
|
|
||||||
public static final TextureReference ENTITY_ZOMBIE_B_ARMORED = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 6, 7),
|
|
||||||
texmap.getTextureReference(29, 30, 6, 7),
|
|
||||||
texmap.getTextureReference(30, 31, 6, 7),
|
|
||||||
texmap.getTextureReference(31, 32, 6, 7)
|
|
||||||
);
|
|
||||||
public static final TextureReference ENTITY_ZOMBIE_F_ARMORED = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(28, 29, 7, 8),
|
|
||||||
texmap.getTextureReference(29, 30, 7, 8),
|
|
||||||
texmap.getTextureReference(30, 31, 7, 8),
|
|
||||||
texmap.getTextureReference(31, 32, 7, 8)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Water
|
|
||||||
public static final TextureReference TILE_WATER = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(0, 1, 8, 9),
|
|
||||||
texmap.getTextureReference(1, 2, 8, 9),
|
|
||||||
texmap.getTextureReference(2, 3, 8, 9),
|
|
||||||
texmap.getTextureReference(3, 4, 8, 9),
|
|
||||||
texmap.getTextureReference(4, 5, 8, 9),
|
|
||||||
texmap.getTextureReference(5, 6, 8, 9),
|
|
||||||
texmap.getTextureReference(6, 7, 8, 9),
|
|
||||||
texmap.getTextureReference(7, 8, 8, 9),
|
|
||||||
texmap.getTextureReference(8, 9, 8, 9),
|
|
||||||
texmap.getTextureReference(9, 10, 8, 9),
|
|
||||||
texmap.getTextureReference(10, 11, 8, 9),
|
|
||||||
texmap.getTextureReference(11, 12, 8, 9),
|
|
||||||
texmap.getTextureReference(12, 13, 8, 9),
|
|
||||||
texmap.getTextureReference(13, 14, 8, 9),
|
|
||||||
texmap.getTextureReference(14, 15, 8, 9),
|
|
||||||
texmap.getTextureReference(15, 16, 8, 9)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Lava
|
|
||||||
public static final TextureReference TILE_LAVA = new AnimationReference(50,
|
|
||||||
texmap.getTextureReference(0, 1, 6, 7),
|
|
||||||
texmap.getTextureReference(1, 2, 6, 7),
|
|
||||||
texmap.getTextureReference(2, 3, 6, 7),
|
|
||||||
texmap.getTextureReference(3, 4, 6, 7),
|
|
||||||
texmap.getTextureReference(4, 5, 6, 7),
|
|
||||||
texmap.getTextureReference(5, 6, 6, 7),
|
|
||||||
texmap.getTextureReference(6, 7, 6, 7),
|
|
||||||
texmap.getTextureReference(7, 8, 6, 7),
|
|
||||||
texmap.getTextureReference(8, 9, 6, 7),
|
|
||||||
texmap.getTextureReference(9, 10, 6, 7),
|
|
||||||
texmap.getTextureReference(10, 11, 6, 7),
|
|
||||||
texmap.getTextureReference(11, 12, 6, 7),
|
|
||||||
texmap.getTextureReference(12, 13, 6, 7),
|
|
||||||
texmap.getTextureReference(13, 14, 6, 7),
|
|
||||||
texmap.getTextureReference(14, 15, 6, 7),
|
|
||||||
texmap.getTextureReference(15, 16, 6, 7)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Water flow
|
|
||||||
public static final TextureReference TILE_WATER_FLOW = new AnimationReference(10,
|
|
||||||
texmap.getTextureReference(0, 1, 9, 10),
|
|
||||||
texmap.getTextureReference(1, 2, 9, 10),
|
|
||||||
texmap.getTextureReference(2, 3, 9, 10),
|
|
||||||
texmap.getTextureReference(3, 4, 9, 10),
|
|
||||||
texmap.getTextureReference(4, 5, 9, 10),
|
|
||||||
texmap.getTextureReference(5, 6, 9, 10),
|
|
||||||
texmap.getTextureReference(6, 7, 9, 10),
|
|
||||||
texmap.getTextureReference(7, 8, 9, 10),
|
|
||||||
texmap.getTextureReference(8, 9, 9, 10),
|
|
||||||
texmap.getTextureReference(9, 10, 9, 10),
|
|
||||||
texmap.getTextureReference(10, 11, 9, 10),
|
|
||||||
texmap.getTextureReference(11, 12, 9, 10),
|
|
||||||
texmap.getTextureReference(12, 13, 9, 10),
|
|
||||||
texmap.getTextureReference(13, 14, 9, 10),
|
|
||||||
texmap.getTextureReference(14, 15, 9, 10),
|
|
||||||
texmap.getTextureReference(15, 16, 9, 10)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Lava flow
|
|
||||||
public static final TextureReference TILE_LAVA_FLOW = new AnimationReference(50,
|
|
||||||
texmap.getTextureReference(0, 1, 7, 8),
|
|
||||||
texmap.getTextureReference(1, 2, 7, 8),
|
|
||||||
texmap.getTextureReference(2, 3, 7, 8),
|
|
||||||
texmap.getTextureReference(3, 4, 7, 8),
|
|
||||||
texmap.getTextureReference(4, 5, 7, 8),
|
|
||||||
texmap.getTextureReference(5, 6, 7, 8),
|
|
||||||
texmap.getTextureReference(6, 7, 7, 8),
|
|
||||||
texmap.getTextureReference(7, 8, 7, 8),
|
|
||||||
texmap.getTextureReference(8, 9, 7, 8),
|
|
||||||
texmap.getTextureReference(9, 10, 7, 8),
|
|
||||||
texmap.getTextureReference(10, 11, 7, 8),
|
|
||||||
texmap.getTextureReference(11, 12, 7, 8),
|
|
||||||
texmap.getTextureReference(12, 13, 7, 8),
|
|
||||||
texmap.getTextureReference(13, 14, 7, 8),
|
|
||||||
texmap.getTextureReference(14, 15, 7, 8),
|
|
||||||
texmap.getTextureReference(15, 16, 7, 8)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
public static final Model ENTITY_ZOMBIE_B = new ModelVertical(Resources.ATLAS.get("/entity/zombie_back_moving.png"), 4, 10);
|
||||||
|
public static final Model ENTITY_ZOMBIE_F = new ModelVertical(Resources.ATLAS.get("/entity/zombie_front_moving.png"), 4, 10);
|
||||||
|
public static final Model ENTITY_ZOMBIE_B_ARMORED = new ModelVertical(Resources.ATLAS.get("/entity/armored_zombie_back_moving.png"), 4, 10);
|
||||||
|
public static final Model ENTITY_ZOMBIE_F_ARMORED = new ModelVertical(Resources.ATLAS.get("/entity/armored_zombie_front_moving.png"), 4, 10);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ public abstract class Model
|
||||||
{
|
{
|
||||||
int vao, size;
|
int vao, size;
|
||||||
boolean loaded = false;
|
boolean loaded = false;
|
||||||
private static final int SIZE = 7;
|
private static final int SIZE = 9;
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
|
|
@ -53,12 +53,9 @@ public abstract class Model
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, verticies, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, verticies, GL_STATIC_DRAW);
|
||||||
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, false, Float.BYTES * SIZE, 0);
|
glVertexAttribPointer(0, SIZE, GL_FLOAT, false, Float.BYTES * SIZE, 0);
|
||||||
glEnableVertexAttribArray(0);
|
glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
glVertexAttribPointer(1, 4, GL_FLOAT, false, Float.BYTES * SIZE, Float.BYTES * 3);
|
|
||||||
glEnableVertexAttribArray(1);
|
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
package projectzombie.model;
|
|
||||||
|
|
||||||
import gl_engine.texture.TextureRef3D;
|
|
||||||
|
|
||||||
public class ModelChar extends Model
|
|
||||||
{
|
|
||||||
private TextureRef3D ref;
|
|
||||||
|
|
||||||
public ModelChar(TextureRef3D ref) {
|
|
||||||
this.ref = ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float[] getVerticies() {
|
|
||||||
return new float[] {
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
1, 0, 0, 1, 0, 0, 0,
|
|
||||||
1, 1, 0, 1, 1, 0, 0,
|
|
||||||
|
|
||||||
1, 1, 0, 1, 1, 0, 0,
|
|
||||||
0, 1, 0, 0, 1, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected TextureRef3D[] getTextures() {
|
|
||||||
return new TextureRef3D[] {ref, ref};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package projectzombie.model;
|
||||||
|
|
||||||
|
import gl_engine.texture.TextureRef3D;
|
||||||
|
|
||||||
|
public class ModelGui extends Model
|
||||||
|
{
|
||||||
|
private int animationSize;
|
||||||
|
private int animationSpeed;
|
||||||
|
private TextureRef3D ref;
|
||||||
|
|
||||||
|
public ModelGui(TextureRef3D ref, int animationSize, int animationSpeed)
|
||||||
|
{
|
||||||
|
this.ref = ref;
|
||||||
|
this.animationSize = animationSize;
|
||||||
|
this.animationSpeed = animationSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelGui(TextureRef3D ref) {
|
||||||
|
this.ref = ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float[] getVerticies()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected TextureRef3D[] getTextures() {
|
||||||
|
return new TextureRef3D[] {ref, ref};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package projectzombie.model;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class ModelRandom
|
||||||
|
{
|
||||||
|
private static final Random rand = new Random();
|
||||||
|
|
||||||
|
private Model[] models;
|
||||||
|
|
||||||
|
public ModelRandom(Model ...models) {
|
||||||
|
this.models = models;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Model getModel() {
|
||||||
|
return models[(int)(rand.nextDouble() * models.length)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,26 +1,39 @@
|
||||||
package projectzombie.model;
|
package projectzombie.model;
|
||||||
|
|
||||||
import gl_engine.texture.TextureRef3D;
|
import gl_engine.texture.TextureRef3D;
|
||||||
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public abstract class ModelTile extends Model
|
public class ModelTile extends Model
|
||||||
{
|
{
|
||||||
|
private int animationSize;
|
||||||
|
private int animationSpeed;
|
||||||
private TextureRef3D tex;
|
private TextureRef3D tex;
|
||||||
|
|
||||||
public ModelTile(TextureRef3D tex) {
|
public ModelTile(TextureRef3D tex, int animationSize, int animationSpeed)
|
||||||
|
{
|
||||||
this.tex = tex;
|
this.tex = tex;
|
||||||
|
this.animationSize = animationSize;
|
||||||
|
this.animationSpeed = animationSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelTile(TextureRef3D tex) {
|
||||||
|
this(tex, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected float[] getVerticies()
|
protected float[] getVerticies()
|
||||||
{
|
{
|
||||||
return new float[] {
|
int asi = animationSize;
|
||||||
1, 0, 1, 1, 1, 0, 0,
|
int asp = animationSpeed;
|
||||||
1, 0, 0, 1, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
|
||||||
|
|
||||||
0, 0, 0, 0, 0, 0, 0,
|
return new float[] {
|
||||||
0, 0, 1, 0, 1, 0, 0,
|
1, 0, 1, 1, 1, 0, asi, asp, 0,
|
||||||
1, 0, 1, 1, 1, 0, 0,
|
1, 0, 0, 1, 0, 0, asi, asp, 0,
|
||||||
|
0, 0, 0, 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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,18 +3,32 @@ package projectzombie.model;
|
||||||
import gl_engine.texture.TextureRef3D;
|
import gl_engine.texture.TextureRef3D;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public abstract class ModelVertical extends Model
|
public class ModelVertical extends Model
|
||||||
{
|
{
|
||||||
|
private int animationSize;
|
||||||
|
private int animationSpeed;
|
||||||
private TextureRef3D tex;
|
private TextureRef3D tex;
|
||||||
private Vec2d size;
|
private Vec2d size;
|
||||||
|
|
||||||
public ModelVertical(TextureRef3D tex, Vec2d size) {
|
public ModelVertical(TextureRef3D tex, Vec2d size, int animationSize, int animationSpeed)
|
||||||
|
{
|
||||||
this.tex = tex;
|
this.tex = tex;
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
||||||
|
this.animationSize = animationSize;
|
||||||
|
this.animationSpeed = animationSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelVertical(TextureRef3D tex, int animationSize, int animationSpeed) {
|
||||||
|
this(tex, new Vec2d(1, 1), animationSize, animationSpeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelVertical(TextureRef3D tex, Vec2d size) {
|
||||||
|
this(tex, size, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelVertical(TextureRef3D tex) {
|
public ModelVertical(TextureRef3D tex) {
|
||||||
this(tex, new Vec2d(1, 1));
|
this(tex, new Vec2d(1, 1), 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -23,14 +37,17 @@ public abstract class ModelVertical extends Model
|
||||||
float x = (float)size.x / 2;
|
float x = (float)size.x / 2;
|
||||||
float y = (float)size.y;
|
float y = (float)size.y;
|
||||||
|
|
||||||
return new float[] {
|
int asi = animationSize;
|
||||||
0.5f-x, 0, 0.5f, 0, 0, 0, 1,
|
int asp = animationSpeed;
|
||||||
0.5f+x, 0, 0.5f, 1, 0, 0, 1,
|
|
||||||
0.5f+x, y, 0.5f, 1, 1, 0, 1,
|
|
||||||
|
|
||||||
0.5f+x, y, 0.5f, 1, 1, 0, 1,
|
return new float[] {
|
||||||
0.5f-x, y, 0.5f, 0, 1, 0, 1,
|
0.5f-x, 0, 0.5f, 0, 0, 0, asi, asp, 1,
|
||||||
0.5f-x, 0, 0.5f, 0, 0, 0, 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,
|
||||||
|
|
||||||
|
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,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,15 @@ import java.io.InputStream;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
|
import gl_engine.ResourceLoader;
|
||||||
|
|
||||||
public class Resource
|
public class Resource
|
||||||
{
|
{
|
||||||
String path;
|
String path;
|
||||||
byte[] data;
|
byte[] data;
|
||||||
|
|
||||||
private String filePath(String path) {
|
private String filePath(String path) {
|
||||||
return "resources/"+path;
|
return "/resources/"+path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Resource(String path)
|
public Resource(String path)
|
||||||
|
|
@ -21,25 +23,8 @@ public class Resource
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load()
|
public void load() {
|
||||||
{
|
data = ResourceLoader.loadResource(path);
|
||||||
try
|
|
||||||
{
|
|
||||||
// Open the file stored on the hard drive
|
|
||||||
InputStream file_stream = new FileInputStream(filePath(path));
|
|
||||||
|
|
||||||
data = new byte[file_stream.available()];
|
|
||||||
file_stream.read(data);
|
|
||||||
file_stream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
// Print the stacktrace and exit
|
|
||||||
System.err.println("Error opening file at "+path+"!");
|
|
||||||
e.printStackTrace();
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getBytes() {
|
public byte[] getBytes() {
|
||||||
|
|
|
||||||
|
|
@ -4,95 +4,95 @@ import projectzombie.Main;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.init.Resources;
|
import projectzombie.init.Resources;
|
||||||
import projectzombie.model.Model;
|
import projectzombie.model.Model;
|
||||||
import projectzombie.model.ModelChar;
|
import projectzombie.model.ModelGui;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
import projectzombie.util.gl.texture.TextureReference;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
||||||
public class Text
|
public class Text
|
||||||
{
|
{
|
||||||
public static final Model CHAR_A = new ModelChar(Resources.ATLAS.get("/char/char_u_a.png"));
|
public static final Model CHAR_A = new ModelGui(Resources.ATLAS.get("/text/char_u_a.png"));
|
||||||
public static final Model CHAR_B = new ModelChar(Resources.ATLAS.get("/char/char_u_b.png"));
|
public static final Model CHAR_B = new ModelGui(Resources.ATLAS.get("/text/char_u_b.png"));
|
||||||
public static final Model CHAR_C = new ModelChar(Resources.ATLAS.get("/char/char_u_c.png"));
|
public static final Model CHAR_C = new ModelGui(Resources.ATLAS.get("/text/char_u_c.png"));
|
||||||
public static final Model CHAR_D = new ModelChar(Resources.ATLAS.get("/char/char_u_d.png"));
|
public static final Model CHAR_D = new ModelGui(Resources.ATLAS.get("/text/char_u_d.png"));
|
||||||
public static final Model CHAR_E = new ModelChar(Resources.ATLAS.get("/char/char_u_e.png"));
|
public static final Model CHAR_E = new ModelGui(Resources.ATLAS.get("/text/char_u_e.png"));
|
||||||
public static final Model CHAR_F = new ModelChar(Resources.ATLAS.get("/char/char_u_f.png"));
|
public static final Model CHAR_F = new ModelGui(Resources.ATLAS.get("/text/char_u_f.png"));
|
||||||
public static final Model CHAR_G = new ModelChar(Resources.ATLAS.get("/char/char_u_g.png"));
|
public static final Model CHAR_G = new ModelGui(Resources.ATLAS.get("/text/char_u_g.png"));
|
||||||
public static final Model CHAR_H = new ModelChar(Resources.ATLAS.get("/char/char_u_h.png"));
|
public static final Model CHAR_H = new ModelGui(Resources.ATLAS.get("/text/char_u_h.png"));
|
||||||
public static final Model CHAR_I = new ModelChar(Resources.ATLAS.get("/char/char_u_i.png"));
|
public static final Model CHAR_I = new ModelGui(Resources.ATLAS.get("/text/char_u_i.png"));
|
||||||
public static final Model CHAR_J = new ModelChar(Resources.ATLAS.get("/char/char_u_j.png"));
|
public static final Model CHAR_J = new ModelGui(Resources.ATLAS.get("/text/char_u_j.png"));
|
||||||
public static final Model CHAR_K = new ModelChar(Resources.ATLAS.get("/char/char_u_k.png"));
|
public static final Model CHAR_K = new ModelGui(Resources.ATLAS.get("/text/char_u_k.png"));
|
||||||
public static final Model CHAR_L = new ModelChar(Resources.ATLAS.get("/char/char_u_l.png"));
|
public static final Model CHAR_L = new ModelGui(Resources.ATLAS.get("/text/char_u_l.png"));
|
||||||
public static final Model CHAR_M = new ModelChar(Resources.ATLAS.get("/char/char_u_m.png"));
|
public static final Model CHAR_M = new ModelGui(Resources.ATLAS.get("/text/char_u_m.png"));
|
||||||
public static final Model CHAR_N = new ModelChar(Resources.ATLAS.get("/char/char_u_n.png"));
|
public static final Model CHAR_N = new ModelGui(Resources.ATLAS.get("/text/char_u_n.png"));
|
||||||
public static final Model CHAR_O = new ModelChar(Resources.ATLAS.get("/char/char_u_o.png"));
|
public static final Model CHAR_O = new ModelGui(Resources.ATLAS.get("/text/char_u_o.png"));
|
||||||
public static final Model CHAR_P = new ModelChar(Resources.ATLAS.get("/char/char_u_p.png"));
|
public static final Model CHAR_P = new ModelGui(Resources.ATLAS.get("/text/char_u_p.png"));
|
||||||
public static final Model CHAR_Q = new ModelChar(Resources.ATLAS.get("/char/char_u_q.png"));
|
public static final Model CHAR_Q = new ModelGui(Resources.ATLAS.get("/text/char_u_q.png"));
|
||||||
public static final Model CHAR_R = new ModelChar(Resources.ATLAS.get("/char/char_u_r.png"));
|
public static final Model CHAR_R = new ModelGui(Resources.ATLAS.get("/text/char_u_r.png"));
|
||||||
public static final Model CHAR_S = new ModelChar(Resources.ATLAS.get("/char/char_u_s.png"));
|
public static final Model CHAR_S = new ModelGui(Resources.ATLAS.get("/text/char_u_s.png"));
|
||||||
public static final Model CHAR_T = new ModelChar(Resources.ATLAS.get("/char/char_u_t.png"));
|
public static final Model CHAR_T = new ModelGui(Resources.ATLAS.get("/text/char_u_t.png"));
|
||||||
public static final Model CHAR_U = new ModelChar(Resources.ATLAS.get("/char/char_u_u.png"));
|
public static final Model CHAR_U = new ModelGui(Resources.ATLAS.get("/text/char_u_u.png"));
|
||||||
public static final Model CHAR_V = new ModelChar(Resources.ATLAS.get("/char/char_u_v.png"));
|
public static final Model CHAR_V = new ModelGui(Resources.ATLAS.get("/text/char_u_v.png"));
|
||||||
public static final Model CHAR_W = new ModelChar(Resources.ATLAS.get("/char/char_u_w.png"));
|
public static final Model CHAR_W = new ModelGui(Resources.ATLAS.get("/text/char_u_w.png"));
|
||||||
public static final Model CHAR_X = new ModelChar(Resources.ATLAS.get("/char/char_u_x.png"));
|
public static final Model CHAR_X = new ModelGui(Resources.ATLAS.get("/text/char_u_x.png"));
|
||||||
public static final Model CHAR_Y = new ModelChar(Resources.ATLAS.get("/char/char_u_y.png"));
|
public static final Model CHAR_Y = new ModelGui(Resources.ATLAS.get("/text/char_u_y.png"));
|
||||||
public static final Model CHAR_Z = new ModelChar(Resources.ATLAS.get("/char/char_u_z.png"));
|
public static final Model CHAR_Z = new ModelGui(Resources.ATLAS.get("/text/char_u_z.png"));
|
||||||
public static final Model CHAR_a = new ModelChar(Resources.ATLAS.get("/char/char_l_a.png"));
|
public static final Model CHAR_a = new ModelGui(Resources.ATLAS.get("/text/char_l_a.png"));
|
||||||
public static final Model CHAR_b = new ModelChar(Resources.ATLAS.get("/char/char_l_b.png"));
|
public static final Model CHAR_b = new ModelGui(Resources.ATLAS.get("/text/char_l_b.png"));
|
||||||
public static final Model CHAR_c = new ModelChar(Resources.ATLAS.get("/char/char_l_c.png"));
|
public static final Model CHAR_c = new ModelGui(Resources.ATLAS.get("/text/char_l_c.png"));
|
||||||
public static final Model CHAR_d = new ModelChar(Resources.ATLAS.get("/char/char_l_d.png"));
|
public static final Model CHAR_d = new ModelGui(Resources.ATLAS.get("/text/char_l_d.png"));
|
||||||
public static final Model CHAR_e = new ModelChar(Resources.ATLAS.get("/char/char_l_e.png"));
|
public static final Model CHAR_e = new ModelGui(Resources.ATLAS.get("/text/char_l_e.png"));
|
||||||
public static final Model CHAR_f = new ModelChar(Resources.ATLAS.get("/char/char_l_f.png"));
|
public static final Model CHAR_f = new ModelGui(Resources.ATLAS.get("/text/char_l_f.png"));
|
||||||
public static final Model CHAR_g = new ModelChar(Resources.ATLAS.get("/char/char_l_g.png"));
|
public static final Model CHAR_g = new ModelGui(Resources.ATLAS.get("/text/char_l_g.png"));
|
||||||
public static final Model CHAR_i = new ModelChar(Resources.ATLAS.get("/char/char_l_h.png"));
|
public static final Model CHAR_i = new ModelGui(Resources.ATLAS.get("/text/char_l_h.png"));
|
||||||
public static final Model CHAR_h = new ModelChar(Resources.ATLAS.get("/char/char_l_i.png"));
|
public static final Model CHAR_h = new ModelGui(Resources.ATLAS.get("/text/char_l_i.png"));
|
||||||
public static final Model CHAR_j = new ModelChar(Resources.ATLAS.get("/char/char_l_j.png"));
|
public static final Model CHAR_j = new ModelGui(Resources.ATLAS.get("/text/char_l_j.png"));
|
||||||
public static final Model CHAR_k = new ModelChar(Resources.ATLAS.get("/char/char_l_k.png"));
|
public static final Model CHAR_k = new ModelGui(Resources.ATLAS.get("/text/char_l_k.png"));
|
||||||
public static final Model CHAR_l = new ModelChar(Resources.ATLAS.get("/char/char_l_l.png"));
|
public static final Model CHAR_l = new ModelGui(Resources.ATLAS.get("/text/char_l_l.png"));
|
||||||
public static final Model CHAR_m = new ModelChar(Resources.ATLAS.get("/char/char_l_m.png"));
|
public static final Model CHAR_m = new ModelGui(Resources.ATLAS.get("/text/char_l_m.png"));
|
||||||
public static final Model CHAR_n = new ModelChar(Resources.ATLAS.get("/char/char_l_n.png"));
|
public static final Model CHAR_n = new ModelGui(Resources.ATLAS.get("/text/char_l_n.png"));
|
||||||
public static final Model CHAR_o = new ModelChar(Resources.ATLAS.get("/char/char_l_o.png"));
|
public static final Model CHAR_o = new ModelGui(Resources.ATLAS.get("/text/char_l_o.png"));
|
||||||
public static final Model CHAR_p = new ModelChar(Resources.ATLAS.get("/char/char_l_p.png"));
|
public static final Model CHAR_p = new ModelGui(Resources.ATLAS.get("/text/char_l_p.png"));
|
||||||
public static final Model CHAR_q = new ModelChar(Resources.ATLAS.get("/char/char_l_q.png"));
|
public static final Model CHAR_q = new ModelGui(Resources.ATLAS.get("/text/char_l_q.png"));
|
||||||
public static final Model CHAR_r = new ModelChar(Resources.ATLAS.get("/char/char_l_r.png"));
|
public static final Model CHAR_r = new ModelGui(Resources.ATLAS.get("/text/char_l_r.png"));
|
||||||
public static final Model CHAR_s = new ModelChar(Resources.ATLAS.get("/char/char_l_s.png"));
|
public static final Model CHAR_s = new ModelGui(Resources.ATLAS.get("/text/char_l_s.png"));
|
||||||
public static final Model CHAR_t = new ModelChar(Resources.ATLAS.get("/char/char_l_t.png"));
|
public static final Model CHAR_t = new ModelGui(Resources.ATLAS.get("/text/char_l_t.png"));
|
||||||
public static final Model CHAR_u = new ModelChar(Resources.ATLAS.get("/char/char_l_u.png"));
|
public static final Model CHAR_u = new ModelGui(Resources.ATLAS.get("/text/char_l_u.png"));
|
||||||
public static final Model CHAR_v = new ModelChar(Resources.ATLAS.get("/char/char_l_v.png"));
|
public static final Model CHAR_v = new ModelGui(Resources.ATLAS.get("/text/char_l_v.png"));
|
||||||
public static final Model CHAR_w = new ModelChar(Resources.ATLAS.get("/char/char_l_w.png"));
|
public static final Model CHAR_w = new ModelGui(Resources.ATLAS.get("/text/char_l_w.png"));
|
||||||
public static final Model CHAR_x = new ModelChar(Resources.ATLAS.get("/char/char_l_x.png"));
|
public static final Model CHAR_x = new ModelGui(Resources.ATLAS.get("/text/char_l_x.png"));
|
||||||
public static final Model CHAR_y = new ModelChar(Resources.ATLAS.get("/char/char_l_y.png"));
|
public static final Model CHAR_y = new ModelGui(Resources.ATLAS.get("/text/char_l_y.png"));
|
||||||
public static final Model CHAR_z = new ModelChar(Resources.ATLAS.get("/char/char_l_z.png"));
|
public static final Model CHAR_z = new ModelGui(Resources.ATLAS.get("/text/char_l_z.png"));
|
||||||
public static final Model CHAR_0 = new ModelChar(Resources.ATLAS.get("/char/char_0.png"));
|
public static final Model CHAR_0 = new ModelGui(Resources.ATLAS.get("/text/char_0.png"));
|
||||||
public static final Model CHAR_1 = new ModelChar(Resources.ATLAS.get("/char/char_1.png"));
|
public static final Model CHAR_1 = new ModelGui(Resources.ATLAS.get("/text/char_1.png"));
|
||||||
public static final Model CHAR_2 = new ModelChar(Resources.ATLAS.get("/char/char_2.png"));
|
public static final Model CHAR_2 = new ModelGui(Resources.ATLAS.get("/text/char_2.png"));
|
||||||
public static final Model CHAR_3 = new ModelChar(Resources.ATLAS.get("/char/char_3.png"));
|
public static final Model CHAR_3 = new ModelGui(Resources.ATLAS.get("/text/char_3.png"));
|
||||||
public static final Model CHAR_4 = new ModelChar(Resources.ATLAS.get("/char/char_4.png"));
|
public static final Model CHAR_4 = new ModelGui(Resources.ATLAS.get("/text/char_4.png"));
|
||||||
public static final Model CHAR_5 = new ModelChar(Resources.ATLAS.get("/char/char_5.png"));
|
public static final Model CHAR_5 = new ModelGui(Resources.ATLAS.get("/text/char_5.png"));
|
||||||
public static final Model CHAR_6 = new ModelChar(Resources.ATLAS.get("/char/char_6.png"));
|
public static final Model CHAR_6 = new ModelGui(Resources.ATLAS.get("/text/char_6.png"));
|
||||||
public static final Model CHAR_7 = new ModelChar(Resources.ATLAS.get("/char/char_7.png"));
|
public static final Model CHAR_7 = new ModelGui(Resources.ATLAS.get("/text/char_7.png"));
|
||||||
public static final Model CHAR_8 = new ModelChar(Resources.ATLAS.get("/char/char_8.png"));
|
public static final Model CHAR_8 = new ModelGui(Resources.ATLAS.get("/text/char_8.png"));
|
||||||
public static final Model CHAR_9 = new ModelChar(Resources.ATLAS.get("/char/char_9.png"));
|
public static final Model CHAR_9 = new ModelGui(Resources.ATLAS.get("/text/char_9.png"));
|
||||||
public static final Model CHAR_FULLSTOP = new ModelChar(Resources.ATLAS.get("/char/char_fullstop.png"));
|
public static final Model CHAR_FULLSTOP = new ModelGui(Resources.ATLAS.get("/text/char_fullstop.png"));
|
||||||
public static final Model CHAR_COLON = new ModelChar(Resources.ATLAS.get("/char/char_colon.png"));
|
public static final Model CHAR_COLON = new ModelGui(Resources.ATLAS.get("/text/char_colon.png"));
|
||||||
public static final Model CHAR_COMMA = new ModelChar(Resources.ATLAS.get("/char/char_comma.png"));
|
public static final Model CHAR_COMMA = new ModelGui(Resources.ATLAS.get("/text/char_comma.png"));
|
||||||
public static final Model CHAR_EXMARK = new ModelChar(Resources.ATLAS.get("/char/char_exclamation.png"));
|
public static final Model CHAR_EXMARK = new ModelGui(Resources.ATLAS.get("/text/char_exclamation.png"));
|
||||||
public static final Model CHAR_MINUS = new ModelChar(Resources.ATLAS.get("/char/char_minus.png"));
|
public static final Model CHAR_MINUS = new ModelGui(Resources.ATLAS.get("/text/char_minus.png"));
|
||||||
public static final Model CHAR_PLUS = new ModelChar(Resources.ATLAS.get("/char/char_plus.png"));
|
public static final Model CHAR_PLUS = new ModelGui(Resources.ATLAS.get("/text/char_plus.png"));
|
||||||
public static final Model CHAR_F_SLASH = new ModelChar(Resources.ATLAS.get("/char/char_fslash.png"));
|
public static final Model CHAR_F_SLASH = new ModelGui(Resources.ATLAS.get("/text/char_fslash.png"));
|
||||||
public static final Model CHAR_B_SLASH = new ModelChar(Resources.ATLAS.get("/char/char_bslash.png"));
|
public static final Model CHAR_B_SLASH = new ModelGui(Resources.ATLAS.get("/text/char_bslash.png"));
|
||||||
public static final Model CHAR_EQUALS = new ModelChar(Resources.ATLAS.get("/char/char_equals.png"));
|
public static final Model CHAR_EQUALS = new ModelGui(Resources.ATLAS.get("/text/char_equals.png"));
|
||||||
public static final Model CHAR_USCORE = new ModelChar(Resources.ATLAS.get("/char/char_underscore.png"));
|
public static final Model CHAR_USCORE = new ModelGui(Resources.ATLAS.get("/text/char_underscore.png"));
|
||||||
public static final Model CHAR_NULL = new ModelChar(Resources.ATLAS.get("/char/char_unknown.png"));
|
public static final Model CHAR_NULL = new ModelGui(Resources.ATLAS.get("/text/char_unknown.png"));
|
||||||
public static final Model CHAR_BRACKET_O = new ModelChar(Resources.ATLAS.get("/char/char_obracket.png"));
|
public static final Model CHAR_BRACKET_O = new ModelGui(Resources.ATLAS.get("/text/char_obracket.png"));
|
||||||
public static final Model CHAR_BRACKET_C = new ModelChar(Resources.ATLAS.get("/char/char_cbracket.png"));
|
public static final Model CHAR_BRACKET_C = new ModelGui(Resources.ATLAS.get("/text/char_cbracket.png"));
|
||||||
public static final Model CHAR_PERCENT = new ModelChar(Resources.ATLAS.get("/char/char_percent.png"));
|
public static final Model CHAR_PERCENT = new ModelGui(Resources.ATLAS.get("/text/char_percent.png"));
|
||||||
public static final Model CHAR_VBAR = new ModelChar(Resources.ATLAS.get("/char/char_vertical.png"));
|
public static final Model CHAR_VBAR = new ModelGui(Resources.ATLAS.get("/text/char_vertical.png"));
|
||||||
public static final Model CHAR_QMARK = new ModelChar(Resources.ATLAS.get("/char/char_question.png"));
|
public static final Model CHAR_QMARK = new ModelGui(Resources.ATLAS.get("/text/char_question.png"));
|
||||||
public static final Model CHAR_DOLLAR = new ModelChar(Resources.ATLAS.get("/char/char_dollar.png"));
|
public static final Model CHAR_DOLLAR = new ModelGui(Resources.ATLAS.get("/text/char_dollar.png"));
|
||||||
public static final Model CHAR_HASHTAG = new ModelChar(Resources.ATLAS.get("/char/char_hashtag.png"));
|
public static final Model CHAR_HASHTAG = new ModelGui(Resources.ATLAS.get("/text/char_hashtag.png"));
|
||||||
public static final Model CHAR_L_THAN = new ModelChar(Resources.ATLAS.get("/char/char_lthan.png"));
|
public static final Model CHAR_L_THAN = new ModelGui(Resources.ATLAS.get("/text/char_lthan.png"));
|
||||||
public static final Model CHAR_G_THAN = new ModelChar(Resources.ATLAS.get("/char/char_gthan.png"));
|
public static final Model CHAR_G_THAN = new ModelGui(Resources.ATLAS.get("/text/char_gthan.png"));
|
||||||
|
|
||||||
public static void renderCenter(String text, Vec2d size) {
|
public static void renderCenter(String text, Vec2d size) {
|
||||||
int w = Main.window.getWidth();
|
int w = Main.window.getWidth();
|
||||||
|
|
@ -203,7 +203,7 @@ public class Text
|
||||||
case('<'): l = CHAR_L_THAN; break;
|
case('<'): l = CHAR_L_THAN; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
l.bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop drawing quads
|
// Stop drawing quads
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@ package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class Tile
|
public abstract class Tile
|
||||||
{
|
{
|
||||||
public short id;
|
public short id;
|
||||||
public boolean opaqueTile = false;
|
|
||||||
public boolean tileSolid = false;
|
public boolean tileSolid = false;
|
||||||
public boolean tileWalkable = true;
|
public boolean tileWalkable = true;
|
||||||
public double tileHitbox = 0;
|
public double tileHitbox = 0;
|
||||||
|
|
@ -21,24 +21,9 @@ public class Tile
|
||||||
public boolean emitsLight = false;
|
public boolean emitsLight = false;
|
||||||
public boolean passNaturalLight = true;
|
public boolean passNaturalLight = true;
|
||||||
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void doRender(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
this.render(pos, camera, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOpaqueTile() {
|
|
||||||
return this.opaqueTile;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onWalkedOn(Chunk chunk, Layer layer, Vec2i pos, Entity entity, TileState state) {
|
public void onWalkedOn(Chunk chunk, Layer layer, Vec2i pos, Entity entity, TileState state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec2d getRenderOffset(TileState ts) {
|
|
||||||
return new Vec2d(0.5, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TileState getDefaultState() {
|
public TileState getDefaultState() {
|
||||||
return new TileState(this, 0);
|
return new TileState(this, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -57,4 +42,6 @@ public class Tile
|
||||||
public void tickRandomly(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
public void tickRandomly(Layer layer, Chunk chunk, TileState state, Vec2i pos) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract Model getModel(byte meta);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import projectzombie.entity.particle.ParticleBreak;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.LayerGenerators;
|
import projectzombie.init.LayerGenerators;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import gl_engine.MathHelpers;
|
import gl_engine.MathHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
@ -17,15 +18,13 @@ import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
import projectzombie.world.layer.layergen.LayerGenBossArena;
|
||||||
|
|
||||||
public class TileBossPortal extends TileVertical
|
public class TileBossPortal extends Tile
|
||||||
{
|
{
|
||||||
private static Random rand = new Random();
|
private static Random rand = new Random();
|
||||||
|
|
||||||
public TileBossPortal() {
|
public TileBossPortal() {
|
||||||
super(Models.TILE_BOSS_PORTAL, new Vec2d(2, 2));
|
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.opaqueTile = true;
|
|
||||||
this.tileHitbox = 0.4;
|
this.tileHitbox = 0.4;
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
|
|
@ -50,7 +49,7 @@ public class TileBossPortal extends TileVertical
|
||||||
LayerGenBossArena layergen = (LayerGenBossArena) LayerGenerators.BOSS_ARENA;
|
LayerGenBossArena layergen = (LayerGenBossArena) LayerGenerators.BOSS_ARENA;
|
||||||
layergen.spawnPlayer(ep);
|
layergen.spawnPlayer(ep);
|
||||||
layer.setFrontTile(TileState.EMPTY, tpos);
|
layer.setFrontTile(TileState.EMPTY, tpos);
|
||||||
ParticleBreak.spawnParticles(layer.getChunk(tpos), size, state);
|
ParticleBreak.spawnParticles(layer.getChunk(tpos), new Vec2d(1, 1), state);
|
||||||
|
|
||||||
int id = Main.world.addLayer(new Layer(rand, layergen));
|
int id = Main.world.addLayer(new Layer(rand, layergen));
|
||||||
Main.world.setLayer(id);
|
Main.world.setLayer(id);
|
||||||
|
|
@ -94,4 +93,9 @@ public class TileBossPortal extends TileVertical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_BOSS_PORTAL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
|
|
@ -15,16 +16,14 @@ import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileChest extends TileVertical implements TileBulletBreakable
|
public class TileChest extends Tile implements TileBulletBreakable
|
||||||
{
|
{
|
||||||
public static final short CHEST_CAVES = 1;
|
public static final short CHEST_CAVES = 1;
|
||||||
public static final short CHEST_LAVA_CAVES = 2;
|
public static final short CHEST_LAVA_CAVES = 2;
|
||||||
|
|
||||||
public TileChest() {
|
public TileChest() {
|
||||||
super(Models.TILE_CHEST, new Vec2d(1, 1));
|
|
||||||
|
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.opaqueTile = true;
|
|
||||||
this.tileHitbox = 0.4;
|
this.tileHitbox = 0.4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -116,4 +115,9 @@ public class TileChest extends TileVertical implements TileBulletBreakable
|
||||||
return 25;
|
return 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_CHEST;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
|
||||||
public class TileDirt extends TileFlatFaded
|
public class TileDirt extends Tile
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileDirt() {
|
@Override
|
||||||
super(Models.TILE_DIRT);
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_DIRT;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package projectzombie.tiles;
|
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.util.gl.GlHelpers;
|
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
|
||||||
import projectzombie.util.math.TileState;
|
|
||||||
import gl_engine.vec.Vec2d;
|
|
||||||
import gl_engine.vec.Vec3d;
|
|
||||||
|
|
||||||
public class TileFlat extends Tile implements IHasTexture
|
|
||||||
{
|
|
||||||
private TextureReference tex;
|
|
||||||
protected boolean rotates = false;
|
|
||||||
private static final Vec3d default_tile_color = new Vec3d(1, 1, 1);
|
|
||||||
|
|
||||||
public TileFlat(TextureReference tex) {
|
|
||||||
this.tex = tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state, Vec3d color)
|
|
||||||
{
|
|
||||||
// Call super
|
|
||||||
super.render(pos, camera, state);
|
|
||||||
|
|
||||||
// Render the tile
|
|
||||||
GlHelpers.color3(state.light.x * color.x, state.light.y * color.y, state.light.z * color.z);
|
|
||||||
GlHelpers.begin();
|
|
||||||
tex.texCoord(1, 1); GlHelpers.vertex3(pos.x+0, pos.y+0, 0);
|
|
||||||
tex.texCoord(0, 1); GlHelpers.vertex3(pos.x+1, pos.y+0, 0);
|
|
||||||
tex.texCoord(0, 0); GlHelpers.vertex3(pos.x+1, pos.y+1, 0);
|
|
||||||
tex.texCoord(1, 0); GlHelpers.vertex3(pos.x+0, pos.y+1, 0);
|
|
||||||
GlHelpers.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
this.render(pos, camera, state, default_tile_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureReference getTexture() {
|
|
||||||
return tex;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package projectzombie.tiles;
|
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
|
||||||
import projectzombie.util.math.TileState;
|
|
||||||
import gl_engine.vec.Vec2d;
|
|
||||||
import gl_engine.vec.Vec3d;
|
|
||||||
|
|
||||||
public class TileFlatFaded extends TileFlat
|
|
||||||
{
|
|
||||||
|
|
||||||
public TileFlatFaded(TextureReference tex) {
|
|
||||||
super(tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
double fade_amount = (Byte.MAX_VALUE - (double)state.meta) / Byte.MAX_VALUE;
|
|
||||||
super.render(pos, camera, state, new Vec3d(fade_amount, fade_amount, fade_amount));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
|
|
||||||
public class TileGrass extends TileFlat
|
public class TileGrass extends Tile
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileGrass() {
|
@Override
|
||||||
super(Models.TILE_GRASS);
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_GRASS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
package projectzombie.tiles;
|
package projectzombie.tiles;
|
||||||
|
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
|
|
||||||
public class TileLadder extends TileVertical
|
public class TileLadder extends Tile
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileLadder() {
|
public TileLadder() {
|
||||||
super(Models.TILE_LADDER, new Vec2d(1, 1));
|
|
||||||
|
|
||||||
this.opaqueTile = true;
|
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.tileHitbox = 0.3;
|
this.tileHitbox = 0.3;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
|
|
@ -24,4 +23,9 @@ public class TileLadder extends TileVertical
|
||||||
return 0.5;
|
return 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_LADDER;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,17 @@ import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.mainloop.MainloopEventHandler;
|
import projectzombie.mainloop.MainloopEventHandler;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileLadderUp extends TileVertical
|
public class TileLadderUp extends Tile
|
||||||
{
|
{
|
||||||
public TileLadderUp() {
|
public TileLadderUp() {
|
||||||
super(Models.TILE_LADDER_UP, new Vec2d(1, 16));
|
|
||||||
|
|
||||||
this.opaqueTile = true;
|
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.tileHitbox = 0.3;
|
this.tileHitbox = 0.3;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
|
|
@ -95,4 +94,9 @@ public class TileLadderUp extends TileVertical
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_LADDER_UP;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,19 @@ import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileLantern extends TileVertical
|
public class TileLantern extends Tile
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileLantern() {
|
public TileLantern() {
|
||||||
super(Models.TILE_LANTERN, new Vec2d(1, 1));
|
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.opaqueTile = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -34,6 +33,9 @@ public class TileLantern extends TileVertical
|
||||||
new ItemStack(Items.LANTERN, 1, (byte)0)));
|
new ItemStack(Items.LANTERN, 1, (byte)0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_LANTERN;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.Entity;
|
import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.particle.ParticleLava;
|
import projectzombie.entity.particle.ParticleLava;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
|
|
@ -13,12 +14,11 @@ import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileLava extends TileFlat
|
public class TileLava extends Tile
|
||||||
{
|
{
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
|
|
||||||
public TileLava() {
|
public TileLava() {
|
||||||
super(Models.TILE_LAVA);
|
|
||||||
|
|
||||||
this.slowness = 0.5;
|
this.slowness = 0.5;
|
||||||
this.tileWalkable = false;
|
this.tileWalkable = false;
|
||||||
|
|
@ -27,11 +27,8 @@ public class TileLava extends TileFlat
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
public Model getModel(byte meta) {
|
||||||
GlHelpers.pushMatrix();
|
return Models.TILE_LAVA;
|
||||||
GlHelpers.translate3(0, 0, 0.001);
|
|
||||||
super.render(pos, camera, state);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.Random;
|
||||||
import projectzombie.display.Camera;
|
import projectzombie.display.Camera;
|
||||||
import projectzombie.entity.particle.ParticleSmoke;
|
import projectzombie.entity.particle.ParticleSmoke;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.gl.GlHelpers;
|
import projectzombie.util.gl.GlHelpers;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import projectzombie.util.math.random.RandomHelpers;
|
import projectzombie.util.math.random.RandomHelpers;
|
||||||
|
|
@ -13,25 +14,16 @@ import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.Chunk;
|
import projectzombie.world.chunk.Chunk;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileLavaFlow extends TileFlat
|
public class TileLavaFlow extends Tile
|
||||||
{
|
{
|
||||||
private Random rand = new Random();
|
private Random rand = new Random();
|
||||||
|
|
||||||
public TileLavaFlow() {
|
public TileLavaFlow() {
|
||||||
super(Models.TILE_LAVA_FLOW);
|
|
||||||
|
|
||||||
this.emitsLight = true;
|
this.emitsLight = true;
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
GlHelpers.pushMatrix();
|
|
||||||
GlHelpers.translate3(0, 0, 0.001);
|
|
||||||
super.render(pos, camera, state);
|
|
||||||
GlHelpers.popMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getLightLevel(TileState state, Vec2i pos) {
|
public double getLightLevel(TileState state, Vec2i pos) {
|
||||||
return 0.6;
|
return 0.6;
|
||||||
|
|
@ -47,4 +39,9 @@ public class TileLavaFlow extends TileFlat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_LAVA_FLOW;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,16 +6,16 @@ import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.player.EntityPlayer;
|
import projectzombie.entity.player.EntityPlayer;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
import projectzombie.mainloop.MainloopEventHandler;
|
import projectzombie.mainloop.MainloopEventHandler;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.chunk.ChunkEventHandler;
|
import projectzombie.world.chunk.ChunkEventHandler;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TilePortalDown extends TileFlat
|
public class TilePortalDown extends Tile
|
||||||
{
|
{
|
||||||
|
|
||||||
public TilePortalDown() {
|
public TilePortalDown() {
|
||||||
super(Models.TILE_PORTAL);
|
|
||||||
|
|
||||||
this.unbreakable = true;
|
this.unbreakable = true;
|
||||||
}
|
}
|
||||||
|
|
@ -126,4 +126,9 @@ public class TilePortalDown extends TileFlat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_PORTAL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,19 @@ import projectzombie.entity.Entity;
|
||||||
import projectzombie.entity.EntityItem;
|
import projectzombie.entity.EntityItem;
|
||||||
import projectzombie.init.Items;
|
import projectzombie.init.Items;
|
||||||
import projectzombie.init.Models;
|
import projectzombie.init.Models;
|
||||||
|
import projectzombie.model.Model;
|
||||||
import projectzombie.util.math.ItemStack;
|
import projectzombie.util.math.ItemStack;
|
||||||
import projectzombie.util.math.TileState;
|
import projectzombie.util.math.TileState;
|
||||||
import gl_engine.vec.Vec2d;
|
import gl_engine.vec.Vec2d;
|
||||||
import gl_engine.vec.Vec2i;
|
import gl_engine.vec.Vec2i;
|
||||||
import projectzombie.world.layer.Layer;
|
import projectzombie.world.layer.Layer;
|
||||||
|
|
||||||
public class TileRock extends TileVertical implements TileBulletBreakable
|
public class TileRock extends Tile implements TileBulletBreakable
|
||||||
{
|
{
|
||||||
|
|
||||||
public TileRock() {
|
public TileRock() {
|
||||||
super(Models.TILE_ROCK, new Vec2d(1, 1));
|
|
||||||
|
|
||||||
// Set some settings
|
// Set some settings
|
||||||
this.opaqueTile = true;
|
|
||||||
this.tileSolid = true;
|
this.tileSolid = true;
|
||||||
this.tileHitbox = 0.4;
|
this.tileHitbox = 0.4;
|
||||||
}
|
}
|
||||||
|
|
@ -40,4 +39,9 @@ public class TileRock extends TileVertical implements TileBulletBreakable
|
||||||
return 15;
|
return 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Model getModel(byte meta) {
|
||||||
|
return Models.TILE_ROCK;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
package projectzombie.tiles;
|
|
||||||
|
|
||||||
import projectzombie.display.Camera;
|
|
||||||
import projectzombie.util.gl.GlHelpers;
|
|
||||||
import projectzombie.util.gl.VerticalRender;
|
|
||||||
import projectzombie.util.gl.texture.IHasTexture;
|
|
||||||
import projectzombie.util.gl.texture.TextureReference;
|
|
||||||
import projectzombie.util.math.TileState;
|
|
||||||
import gl_engine.vec.Vec2d;
|
|
||||||
|
|
||||||
public class TileVertical extends Tile implements IHasTexture
|
|
||||||
{
|
|
||||||
public final TextureReference tex;
|
|
||||||
public final Vec2d size;
|
|
||||||
|
|
||||||
public TileVertical(TextureReference tex, Vec2d size) {
|
|
||||||
|
|
||||||
// Store some variables
|
|
||||||
this.tex = tex;
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(Vec2d pos, Camera camera, TileState state) {
|
|
||||||
super.render(pos, camera, state);
|
|
||||||
GlHelpers.color3(state.light.x, state.light.y, state.light.z);
|
|
||||||
VerticalRender.render(pos, camera, tex, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureReference getTexture() {
|
|
||||||
return tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec3 pTexture;
|
||||||
|
out vec4 color;
|
||||||
|
|
||||||
|
uniform sampler3D tex;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
color = texture(tex, pTexture);
|
||||||
|
|
||||||
|
if(color.a == 0) {
|
||||||
|
discard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
layout (location = 0) in float[9] vertices;
|
||||||
|
|
||||||
|
out vec3 pTexture;
|
||||||
|
|
||||||
|
uniform mat4 projection;
|
||||||
|
uniform mat4 model;
|
||||||
|
uniform mat4 camera;
|
||||||
|
uniform float cameraAngle;
|
||||||
|
|
||||||
|
mat4 rotate(float angle, float x, float y, float z)
|
||||||
|
{
|
||||||
|
mat4 result = mat4(1);
|
||||||
|
|
||||||
|
float csin = sin(angle);
|
||||||
|
float ccos = cos(angle);
|
||||||
|
float iccos = 1 - ccos;
|
||||||
|
|
||||||
|
result[0][0] = ccos + x * x * iccos;
|
||||||
|
result[0][1] = x * y * iccos - z * csin;
|
||||||
|
result[0][2] = x * z * iccos + y * csin;
|
||||||
|
result[1][0] = y * x * iccos + z * csin;
|
||||||
|
result[1][1] = ccos + y * y * iccos;
|
||||||
|
result[1][2] = y * z * iccos - x * csin;
|
||||||
|
result[2][0] = z * x * iccos - y * csin;
|
||||||
|
result[2][1] = z * y * iccos + x * csin;
|
||||||
|
result[2][2] = ccos + z * z * iccos;
|
||||||
|
result[3][3] = 1;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
int type = int(vertices[8]);
|
||||||
|
|
||||||
|
mat4 do_rotation = rotate(cameraAngle, 0, 1, 0);
|
||||||
|
mat4 no_rotation = mat4(1);
|
||||||
|
|
||||||
|
gl_Position = vec4(vertices[0], vertices[1], vertices[2], 1) *
|
||||||
|
(type == 1 ? do_rotation : no_rotation) * model * camera * projection;
|
||||||
|
|
||||||
|
pTexture = vec3(vertices[3], vertices[4], vertices[5]);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
in vec3 pTexture;
|
||||||
|
out vec4 color;
|
||||||
|
|
||||||
|
uniform sampler3D tex;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
color = texture(tex, pTexture);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
#version 330
|
||||||
|
|
||||||
|
layout (location = 0) in float[9] vertices;
|
||||||
|
|
||||||
|
out vec3 pTexture;
|
||||||
|
|
||||||
|
uniform mat4 model;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
gl_Position = vec4(vertices[0], vertices[1], vertices[2], 0, 1);
|
||||||
|
pTexture = vec3(vertices[3], vertices[4], vertices[5]);
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |