package catalystsurvival.tiles; import catalystsurvival.display.Camera; import catalystsurvival.util.gl.GlHelpers; import catalystsurvival.util.gl.texture.IHasTexture; import catalystsurvival.util.gl.texture.TextureReference; import catalystsurvival.util.math.TileState; import catalystsurvival.util.math.vec.Vec2d; import catalystsurvival.util.math.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(String id, TextureReference tex) { super(id); 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 * color.x, state.light * color.y, state.light * 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; } }