Skip to content

Commit

Permalink
Correct alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
MEEPofFaith committed Nov 21, 2024
1 parent 99c5889 commit 14d5130
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SkyBeamBulletType extends BulletType{
public float radius = tilesize;
public boolean bloom = true;
public Color baseColor = PMPal.nexusLaserDark;
public Color topColor = PMPal.nexusLaser.cpy().a(0);
public Color topColor = PMPal.nexusLaser;

static{
BlackHoleUtils.immuneBulletTypes.add(SkyBeamBulletType.class);
Expand Down
15 changes: 6 additions & 9 deletions src/progressed/graphics/draw3d/Perspective.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Perspective{
public static float viewportOffset = 8f;
/** Field of View in degrees */
public static float fov = settings.getInt("pm-fov", 60);
public static float fadeDst = 128f;
public static float fadeDst = 1024f;
public static float maxScale = 8f;

/** @return If the z coordinate is below the viewport height. */
Expand Down Expand Up @@ -65,18 +65,15 @@ public static float alpha(float x, float y, float z){
float cx = camera.position.x, cy = camera.position.y;
float cz = cameraZ();

float d1 = Math3D.dst(x, y, z, cx, cy, cz); //Distance between camera and far point

x -= cx;
y -= cy;
float pz = cz - z;

float vx = x / pz * viewportOffset,
vy = y / pz * viewportOffset;
float zz = cz - z;

float d2 = Math3D.dst(vx, vy, z); //Distance between camera and viewport pos
float vx = x / zz * viewportOffset, //Position scaled to near plane.
vy = y / zz * viewportOffset;
float vz = viewportZ();

float dst = d1 - d2;
float dst = Math3D.dst(x, y, z, vx, vy, vz); //Distance between viewport and pos
float fade = Math.min(fadeDst, cz - viewportOffset);

if(dst > fade){
Expand Down

0 comments on commit 14d5130

Please sign in to comment.