@@ -12,7 +12,7 @@ public class Perspective{
1212 public static float viewportOffset = 8f ;
1313 /** Field of View in degrees */
1414 public static float fov = settings .getInt ("pm-fov" , 60 );
15- public static float fadeDst = 128f ;
15+ public static float fadeDst = 1024f ;
1616 public static float maxScale = 8f ;
1717
1818 /** @return If the z coordinate is below the viewport height. */
@@ -65,18 +65,15 @@ public static float alpha(float x, float y, float z){
6565 float cx = camera .position .x , cy = camera .position .y ;
6666 float cz = cameraZ ();
6767
68- float d1 = Math3D .dst (x , y , z , cx , cy , cz ); //Distance between camera and far point
69-
7068 x -= cx ;
7169 y -= cy ;
72- float pz = cz - z ;
73-
74- float vx = x / pz * viewportOffset ,
75- vy = y / pz * viewportOffset ;
70+ float zz = cz - z ;
7671
77- float d2 = Math3D .dst (vx , vy , z ); //Distance between camera and viewport pos
72+ float vx = x / zz * viewportOffset , //Position scaled to near plane.
73+ vy = y / zz * viewportOffset ;
74+ float vz = viewportZ ();
7875
79- float dst = d1 - d2 ;
76+ float dst = Math3D . dst ( x , y , z , vx , vy , vz ); //Distance between viewport and pos
8077 float fade = Math .min (fadeDst , cz - viewportOffset );
8178
8279 if (dst > fade ){
0 commit comments