This commit is contained in:
Anuken
2020-11-16 19:43:56 -05:00
parent 3b609f698a
commit f296d23cfa
17 changed files with 52 additions and 19 deletions

View File

@@ -71,8 +71,8 @@ public class Shaders{
setUniformf("u_rcampos", Tmp.v31.set(camera.position).sub(planet.position));
setUniformf("u_light", planet.getLightNormal());
setUniformf("u_color", planet.atmosphereColor.r, planet.atmosphereColor.g, planet.atmosphereColor.b);
setUniformf("u_innerRadius", planet.radius + 0.02f);
setUniformf("u_outerRadius", planet.radius * 1.3f);
setUniformf("u_innerRadius", planet.radius + planet.atmosphereRadIn);
setUniformf("u_outerRadius", planet.radius + planet.atmosphereRadOut);
setUniformMatrix4("u_model", planet.getTransform(mat).val);
setUniformMatrix4("u_projection", camera.combined.val);

View File

@@ -77,8 +77,6 @@ public class MeshBuilder{
if(c.length > 5){
verts(c[0].v, c[4].v, c[5].v, nor, color);
}else{
verts(c[0].v, c[3].v, c[4].v, nor, color);
}
}

View File

@@ -57,6 +57,7 @@ public class PlanetRenderer implements Disposable{
camPos.set(0, 0f, camLength);
projector.setScaling(1f / 150f);
cam.fov = 60f;
cam.far = 150f;
}
/** Render the entire planet scene to the screen. */
@@ -93,6 +94,8 @@ public class PlanetRenderer implements Disposable{
renderPlanet(solarSystem);
renderTransparent(solarSystem);
endBloom();
Events.fire(Trigger.universeDrawEnd);
@@ -125,11 +128,21 @@ public class PlanetRenderer implements Disposable{
renderOrbit(planet);
for(Planet child : planet.children){
renderPlanet(child);
}
}
public void renderTransparent(Planet planet){
if(!planet.visible()) return;
if(planet.isLandable() && planet == this.planet){
renderSectors(planet);
}
if(planet.parent != null && planet.hasAtmosphere && Core.settings.getBool("atmosphere")){
Gl.depthMask(false);
Blending.additive.apply();
Shaders.atmosphere.camera = cam;
@@ -140,10 +153,12 @@ public class PlanetRenderer implements Disposable{
atmosphere.render(Shaders.atmosphere, Gl.triangles);
Blending.normal.apply();
Gl.depthMask(true);
}
for(Planet child : planet.children){
renderPlanet(child);
renderTransparent(child);
}
}