private void renderSprite(double xDiff, double yDiff, double zDiff, int tex, int color) {
		double xc = (xDiff - x) * 2 - rotXZSin * 0.2;
		double zc = (zDiff - z) * 2 - rotXZCos * 0.2;
		double yc = (yDiff - y) * 2 - rotYSin * 5;
		
		double zz = zc * rotXZCos + xc * rotXZSin;
		
		if(zz < 0.1){
			return;
		}
		
		double xx = zc * rotXZSin - xc * rotXZCos;
		double yy = yc;
		
		double xPixel = width/2 + (xx / zz * fov);
		double yPixel = height/2 + (yy / zz * fov);

		double xPixel0 = xPixel - fov / zz;
		double xPixel1 = xPixel + fov / zz;

		double yPixel0 = yPixel - fov / zz;
		double yPixel1 = yPixel + fov / zz;

		int xp0 = (int) xPixel0;
		int xp1 = (int) xPixel1;
		int yp0 = (int) yPixel0;
		int yp1 = (int) yPixel1;

		if (xp0 < 0)      xp0 = 0;
		if (xp1 > width)  xp1 = width;
		if (yp0 < 0)      yp0 = 0;
		if (yp1 > height) yp1 = height;
		zz *= 4;
		
		for (int yp = yp0; yp < yp1; yp++) {
			double yPercent = (yp - yPixel0) / (yPixel1 - yPixel0);
			int yTexture = (int) (yPercent * 16);
			for (int xp = xp0; xp < xp1; xp++) {
				
				double xPercent = (xp - xPixel0) / (xPixel1 - xPixel0);
				int xTexture = (int) (xPercent * 16);
				if (zz < zBuffer[xp + yp * width]) {
					int col = Art.testSprite.pixels[(xTexture + tex % 8 * 16) + (yTexture + (tex / 8) * 16) * 16];
					if (col != 0) {
						pixels[xp + yp * width] = ~(col ^ color);
						zBuffer[xp + yp * width] = zz;
					}
				}
			}
		}
	}