Planet frustum culling
This commit is contained in:
@@ -136,8 +136,12 @@ public class PlanetRenderer implements Disposable{
|
|||||||
public void renderPlanet(Planet planet){
|
public void renderPlanet(Planet planet){
|
||||||
if(!planet.visible()) return;
|
if(!planet.visible()) return;
|
||||||
|
|
||||||
|
cam.update();
|
||||||
|
|
||||||
|
if(cam.frustum.containsSphere(planet.position, planet.clipRadius)){
|
||||||
//render planet at offsetted position in the world
|
//render planet at offsetted position in the world
|
||||||
planet.draw(cam.combined, planet.getTransform(mat));
|
planet.draw(cam.combined, planet.getTransform(mat));
|
||||||
|
}
|
||||||
|
|
||||||
renderOrbit(planet);
|
renderOrbit(planet);
|
||||||
|
|
||||||
@@ -153,7 +157,7 @@ public class PlanetRenderer implements Disposable{
|
|||||||
renderSectors(planet);
|
renderSectors(planet);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){
|
if(cam.frustum.containsSphere(planet.position, planet.clipRadius) && planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){
|
||||||
Gl.depthMask(false);
|
Gl.depthMask(false);
|
||||||
|
|
||||||
Blending.additive.apply();
|
Blending.additive.apply();
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class Planet extends UnlockableContent{
|
|||||||
public float radius;
|
public float radius;
|
||||||
/** Atmosphere radius adjustment parameters. */
|
/** Atmosphere radius adjustment parameters. */
|
||||||
public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f;
|
public float atmosphereRadIn = 0, atmosphereRadOut = 0.3f;
|
||||||
|
/** Frustrum sphere clip radius. */
|
||||||
|
public float clipRadius = -1f;
|
||||||
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/
|
/** Orbital radius around the sun. Do not change unless you know exactly what you are doing.*/
|
||||||
public float orbitRadius;
|
public float orbitRadius;
|
||||||
/** Total radius of this planet and all its children. */
|
/** Total radius of this planet and all its children. */
|
||||||
@@ -47,7 +49,7 @@ public class Planet extends UnlockableContent{
|
|||||||
public float sectorApproxRadius;
|
public float sectorApproxRadius;
|
||||||
/** Whether this planet is tidally locked relative to its parent - see https://en.wikipedia.org/wiki/Tidal_locking */
|
/** Whether this planet is tidally locked relative to its parent - see https://en.wikipedia.org/wiki/Tidal_locking */
|
||||||
public boolean tidalLock = false;
|
public boolean tidalLock = false;
|
||||||
/** Whether or not this planet is listed in the planet access UI. **/
|
/** Whether this planet is listed in the planet access UI. **/
|
||||||
public boolean accessible = true;
|
public boolean accessible = true;
|
||||||
/** The default starting sector displayed to the map dialog. */
|
/** The default starting sector displayed to the map dialog. */
|
||||||
public int startSector = 0;
|
public int startSector = 0;
|
||||||
@@ -237,6 +239,7 @@ public class Planet extends UnlockableContent{
|
|||||||
updateBaseCoverage();
|
updateBaseCoverage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clipRadius = Math.max(clipRadius, radius + atmosphereRadOut + 0.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+1
-1
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
#used for slow jitpack builds; TODO see if this actually works
|
#used for slow jitpack builds; TODO see if this actually works
|
||||||
http.socketTimeout=80000
|
http.socketTimeout=80000
|
||||||
http.connectionTimeout=80000
|
http.connectionTimeout=80000
|
||||||
archash=4c1533ad063b0e91b9536e9aa6ff0c998e2489e2
|
archash=d85d38b6ad854623af961178e6fc951caeff0598
|
||||||
|
|||||||
Reference in New Issue
Block a user