package shootergame.entity; import shootergame.display.Camera; import shootergame.util.gl.GlHelpers; import shootergame.util.math.vec.Vec2d; public class EntityParticle extends Entity { private double height; private double size; public EntityParticle(double size, double height) { // Set some settings this.opaqueTile = false; this.height = height; this.size = size; } public void setSize(double size) { this.size = size; } @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.x; // Make the bullet upright GlHelpers.translate(size/2, 0, 0); GlHelpers.translate(pos.x, pos.y, height); GlHelpers.rotate(-angle_r, 0, 0, 1); GlHelpers.translate(-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.color3(1, 1, 1); GlHelpers.popMatrix(); } }