@@ -15,7 +15,7 @@ public class Perspective{
15
15
16
16
/** @return If the z coordinate is below the viewport height. */
17
17
public static boolean canDraw (float z ){
18
- return z < cameraHeight () - viewportOffset ;
18
+ return z < cameraZ () - viewportOffset ;
19
19
}
20
20
21
21
/** @return Perspective projected coordinates to draw at. */
@@ -24,7 +24,7 @@ public static Vec2 drawPos(float x, float y, float z){
24
24
Vec2 v = viewportSize ();
25
25
float vw = v .x , vh = v .y ;
26
26
float cx = camera .position .x , cy = camera .position .y ;
27
- float cz = cameraHeight ();
27
+ float cz = cameraZ ();
28
28
29
29
x -= cx ;
30
30
y -= cy ;
@@ -40,7 +40,7 @@ public static Vec2 drawPos(float x, float y, float z){
40
40
/** Multiplicative size scale at a point. */
41
41
public static float scale (float x , float y , float z ){
42
42
float cx = camera .position .x , cy = camera .position .y ;
43
- float cz = cameraHeight ();
43
+ float cz = cameraZ ();
44
44
45
45
x -= cx ;
46
46
y -= cy ;
@@ -58,7 +58,7 @@ public static float scale(float x, float y, float z){
58
58
/** Fade out based on distance to viewport. */
59
59
public static float alpha (float x , float y , float z ){
60
60
float cx = camera .position .x , cy = camera .position .y ;
61
- float cz = cameraHeight ();
61
+ float cz = cameraZ ();
62
62
63
63
float d1 = Math3D .dst (x , y , z , cx , cy , cz ); //Distance between camera point
64
64
@@ -84,7 +84,7 @@ public static float alpha(float x, float y, float z){
84
84
}
85
85
86
86
/** Calculates the camera height based on FOV and the size of the vanilla camera. */
87
- public static float cameraHeight (){
87
+ public static float cameraZ (){
88
88
float width = Math .max (camera .width , camera .height ) / 2f ;
89
89
//TOA
90
90
return (float )(width / Math .tan (fov / 2f * Mathf .degRad ));
0 commit comments