public int getLocationY() { try { return locY + Client.getRSData().getBaseInfo().getY(); } catch (Exception e) { } return -1; }
public int[][] projectVertices() { RenderLD renderData = Client.getRenderLD(); Viewport render = renderData.getViewport(); float[] data = render.getFloats(); ModelLD model = getLDModel(); double locX = (getLocalX() + 0.5) * 512; double locY = (getLocalY() + 0.5) * 512; int numVertices = Math.min( model.getVerticiesX().length, Math.min(model.getVerticiesY().length, model.getVerticiesZ().length)); int[][] screen = new int[numVertices][3]; float xOff = data[12]; float yOff = data[13]; float zOff = data[15]; float xX = data[0]; float xY = data[4]; float xZ = data[8]; float yX = data[1]; float yY = data[5]; float yZ = data[9]; float zX = data[3]; float zY = data[7]; float zZ = data[11]; int height = Calculations.tileHeight((int) locX, (int) locY); for (int index = 0; index < numVertices; index++) { int vertexX = (int) (model.getVerticiesX()[index] + locX); int vertexY = model.getVerticiesY()[index] + height; int vertexZ = (int) (model.getVerticiesZ()[index] + locY); float _z = (zOff + (zX * vertexX + zY * vertexY + zZ * vertexZ)); float _x = (xOff + (xX * vertexX + xY * vertexY + xZ * vertexZ)); float _y = (yOff + (yX * vertexX + yY * vertexY + yZ * vertexZ)); float fx = ((float) 256.0 + ((float) 256.0 * _x) / _z); float fy = ((float) 166.0 + ((float) 167.0 * _y) / _z); if (fx < 520 && fx > 0 && fy < 390 && fy > 50) { screen[index][0] = (int) fx; screen[index][1] = (int) fy; screen[index][2] = 1; } else { screen[index][0] = -1; screen[index][1] = -1; screen[index][2] = 0; } } return screen; }