mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 19:39:04 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a47432c20b
@ -35,7 +35,13 @@ public class EventType{
|
|||||||
preDraw,
|
preDraw,
|
||||||
postDraw,
|
postDraw,
|
||||||
uiDrawBegin,
|
uiDrawBegin,
|
||||||
uiDrawEnd
|
uiDrawEnd,
|
||||||
|
//before/after bloom used, skybox or planets drawn
|
||||||
|
universeDrawBegin,
|
||||||
|
//skybox drawn and bloom is enabled - use Vars.renderer.planets
|
||||||
|
universeDraw,
|
||||||
|
//planets drawn and bloom disabled
|
||||||
|
universeDrawEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class WinEvent{}
|
public static class WinEvent{}
|
||||||
|
@ -10,6 +10,7 @@ import arc.math.geom.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
import mindustry.graphics.g3d.PlanetGrid.*;
|
import mindustry.graphics.g3d.PlanetGrid.*;
|
||||||
import mindustry.type.*;
|
import mindustry.type.*;
|
||||||
@ -38,19 +39,19 @@ public class PlanetRenderer implements Disposable{
|
|||||||
public float zoom = 1f;
|
public float zoom = 1f;
|
||||||
|
|
||||||
private final Mesh[] outlines = new Mesh[10];
|
private final Mesh[] outlines = new Mesh[10];
|
||||||
private final PlaneBatch3D projector = new PlaneBatch3D();
|
public final PlaneBatch3D projector = new PlaneBatch3D();
|
||||||
private final Mat3D mat = new Mat3D();
|
public final Mat3D mat = new Mat3D();
|
||||||
private final FrameBuffer buffer = new FrameBuffer(2, 2, true);
|
public final FrameBuffer buffer = new FrameBuffer(2, 2, true);
|
||||||
private PlanetInterfaceRenderer irenderer;
|
public PlanetInterfaceRenderer irenderer;
|
||||||
|
|
||||||
private final Bloom bloom = new Bloom(Core.graphics.getWidth()/4, Core.graphics.getHeight()/4, true, false){{
|
public final Bloom bloom = new Bloom(Core.graphics.getWidth()/4, Core.graphics.getHeight()/4, true, false){{
|
||||||
setThreshold(0.8f);
|
setThreshold(0.8f);
|
||||||
blurPasses = 6;
|
blurPasses = 6;
|
||||||
}};
|
}};
|
||||||
private final Mesh atmosphere = MeshBuilder.buildHex(Color.white, 2, false, 1.5f);
|
public final Mesh atmosphere = MeshBuilder.buildHex(Color.white, 2, false, 1.5f);
|
||||||
|
|
||||||
//seed: 8kmfuix03fw
|
//seed: 8kmfuix03fw
|
||||||
private final CubemapMesh skybox = new CubemapMesh(new Cubemap("cubemaps/stars/"));
|
public final CubemapMesh skybox = new CubemapMesh(new Cubemap("cubemaps/stars/"));
|
||||||
|
|
||||||
public PlanetRenderer(){
|
public PlanetRenderer(){
|
||||||
camPos.set(0, 0f, camLength);
|
camPos.set(0, 0f, camLength);
|
||||||
@ -82,14 +83,20 @@ public class PlanetRenderer implements Disposable{
|
|||||||
projector.proj(cam.combined);
|
projector.proj(cam.combined);
|
||||||
batch.proj(cam.combined);
|
batch.proj(cam.combined);
|
||||||
|
|
||||||
|
Events.fire(Trigger.universeDrawBegin);
|
||||||
|
|
||||||
beginBloom();
|
beginBloom();
|
||||||
|
|
||||||
skybox.render(cam.combined);
|
skybox.render(cam.combined);
|
||||||
|
|
||||||
|
Events.fire(Trigger.universeDraw);
|
||||||
|
|
||||||
renderPlanet(solarSystem);
|
renderPlanet(solarSystem);
|
||||||
|
|
||||||
endBloom();
|
endBloom();
|
||||||
|
|
||||||
|
Events.fire(Trigger.universeDrawEnd);
|
||||||
|
|
||||||
Gl.enable(Gl.blend);
|
Gl.enable(Gl.blend);
|
||||||
|
|
||||||
irenderer.renderProjections();
|
irenderer.renderProjections();
|
||||||
@ -100,16 +107,16 @@ public class PlanetRenderer implements Disposable{
|
|||||||
cam.update();
|
cam.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beginBloom(){
|
public void beginBloom(){
|
||||||
bloom.resize(Core.graphics.getWidth() / 4, Core.graphics.getHeight() / 4);
|
bloom.resize(Core.graphics.getWidth() / 4, Core.graphics.getHeight() / 4);
|
||||||
bloom.capture();
|
bloom.capture();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void endBloom(){
|
public void endBloom(){
|
||||||
bloom.render();
|
bloom.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderPlanet(Planet planet){
|
public void renderPlanet(Planet planet){
|
||||||
//render planet at offsetted position in the world
|
//render planet at offsetted position in the world
|
||||||
planet.mesh.render(cam.combined, planet.getTransform(mat));
|
planet.mesh.render(cam.combined, planet.getTransform(mat));
|
||||||
|
|
||||||
@ -137,7 +144,7 @@ public class PlanetRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderOrbit(Planet planet){
|
public void renderOrbit(Planet planet){
|
||||||
if(planet.parent == null) return;
|
if(planet.parent == null) return;
|
||||||
|
|
||||||
Vec3 center = planet.parent.position;
|
Vec3 center = planet.parent.position;
|
||||||
@ -147,7 +154,7 @@ public class PlanetRenderer implements Disposable{
|
|||||||
batch.flush(Gl.lineLoop);
|
batch.flush(Gl.lineLoop);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderSectors(Planet planet){
|
public void renderSectors(Planet planet){
|
||||||
//apply transformed position
|
//apply transformed position
|
||||||
batch.proj().mul(planet.getTransform(mat));
|
batch.proj().mul(planet.getTransform(mat));
|
||||||
|
|
||||||
@ -268,7 +275,7 @@ public class PlanetRenderer implements Disposable{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mesh outline(int size){
|
public Mesh outline(int size){
|
||||||
if(outlines[size] == null){
|
if(outlines[size] == null){
|
||||||
outlines[size] = MeshBuilder.buildHex(new HexMesher(){
|
outlines[size] = MeshBuilder.buildHex(new HexMesher(){
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user