-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-add frustum culling, add hack to make moving past lots of speakers…
… feel less weird
- Loading branch information
1 parent
81b03c3
commit a7e57d1
Showing
7 changed files
with
120 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/io/github/foundationgames/phonos/client/render/CableBounds.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.github.foundationgames.phonos.client.render; | ||
|
||
import net.minecraft.client.render.Frustum; | ||
|
||
public class CableBounds { | ||
private double minX, minY, minZ, maxX, maxY, maxZ; | ||
|
||
public void clear() { | ||
minX = Float.POSITIVE_INFINITY; | ||
minY = Float.POSITIVE_INFINITY; | ||
minZ = Float.POSITIVE_INFINITY; | ||
maxX = Float.NEGATIVE_INFINITY; | ||
maxY = Float.NEGATIVE_INFINITY;; | ||
maxZ = Float.NEGATIVE_INFINITY;; | ||
} | ||
|
||
public void fit(double x, double y, double z) { | ||
minX = Math.min(minX, x); | ||
minY = Math.min(minY, y); | ||
minZ = Math.min(minZ, z); | ||
maxX = Math.max(maxX, x); | ||
maxY = Math.max(maxY, y); | ||
maxZ = Math.max(maxZ, z); | ||
} | ||
|
||
public void fitTwo(double x0, double y0, double z0, double x1, double y1, double z1) { | ||
minX = Math.min(x0, x1); | ||
minY = Math.min(y0, y1); | ||
minZ = Math.min(z0, z1); | ||
maxX = Math.max(x0, x1); | ||
maxY = Math.max(y0, y1); | ||
maxZ = Math.max(z0, z1); | ||
} | ||
|
||
public boolean visible(Frustum frustum) { | ||
return frustum.isVisible(minX, minY, minZ, maxX, maxY, maxZ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters