You are on page 1of 1

package com.mime.minefront.graphics; import com.mime.minefront.

Game; public class Render3D extends Render { public Render3D(int width, int height) { super(width, height); } public void floor(Game game) { double double double double floorPosition = 8; ceilingPosition = 8; forward = game.time / 5.0; right = game.time / 5.0;

double rotation = game.time / 100.0; double cosine = Math.cos(rotation); double sine = Math.sin(rotation); for (int y = 0; y < height; y++) { double ceiling = (y - height / 2.0 ) / height; double z = floorPosition / ceiling; if (ceiling < 0) { z = ceilingPosition / -ceiling; } for (int x = 0; x < width; x++) { double depth = (x - width / 2.0) depth *= z; double xx = depth * cosine + z * double yy = z * cosine - depth * int xPix = (int) (xx); int yPix = (int) (yy); pixels[x + y * width] = ((xPix & yPix & 15) * 16) << 8; } } } }

/ height; sine + right; sine + forward; 15) * 16) ((