@@ -15,7 +15,7 @@ public class Perspective{
15
15
/** z values below this are considered on the ground, and bypass calculations. */
16
16
private static final float groundTolerance = 0.001f ;
17
17
/** Viewport offset from the camera height in world units. */
18
- public static float viewportOffset = 16f ;
18
+ public static float viewportOffset = 80f ;
19
19
/** Field of View in degrees */
20
20
public static float fov = -1f ;
21
21
public static float fadeDst = 1024f ;
@@ -95,7 +95,7 @@ public static float alpha(float x, float y, float z){
95
95
}else if (z > vz ){ //Behind viewport, should be 0
96
96
return 0f ;
97
97
}else {
98
- return Interp .pow2In .apply (Mathf .clamp (dst / fade ));
98
+ return Interp .pow5In .apply (Mathf .clamp (dst / fade ));
99
99
}
100
100
}
101
101
@@ -107,10 +107,11 @@ public static float cameraZ(){
107
107
}
108
108
109
109
/**
110
+ * Never returns a negative, max to 0. If that's happening, calculations are probably breaking, so don't zoom in so much.
110
111
* @return viewport z coordinate
111
112
*/
112
113
public static float viewportZ (){
113
- return cameraZ - viewportOffset ;
114
+ return Math . max ( cameraZ - viewportOffset , 0f ) ;
114
115
}
115
116
116
117
public static Vec3 scaleToViewport (float x , float y , float z ){
0 commit comments