Structural changes

This commit is contained in:
Anuken
2020-01-13 16:10:17 -05:00
parent 899a12eddb
commit b20e0967fd
5 changed files with 25 additions and 11 deletions

View File

@ -4,7 +4,7 @@ import arc.math.*;
import arc.math.geom.*;
import arc.util.*;
class PlanetGrid{
public class PlanetGrid{
private static final float x = -0.525731112119133606f;
private static final float z = -0.850650808352039932f;

View File

@ -7,14 +7,14 @@ import arc.graphics.g3d.*;
import arc.input.*;
import arc.math.geom.*;
import arc.util.*;
import mindustry.graphics.PlanetGrid.*;
import mindustry.type.*;
public class PlanetRenderer{
private Camera3D cam = new Camera3D();
private float lastX, lastY, camLength = 4f;
private PlanetMesh planet = new PlanetMesh(6, 1f, false, Color.royal);
private PlanetMesh outline = new PlanetMesh(3, 1.3f, true, Pal.accent);
//private PlanetMesh planet = new PlanetMesh(6, 1f, false, Color.royal);
//private PlanetMesh outline = new PlanetMesh(3, 1.3f, true, Pal.accent);
private VertexBatch3D batch = new VertexBatch3D(false, true, 0);
public PlanetRenderer(){
@ -22,7 +22,7 @@ public class PlanetRenderer{
cam.position.set(Tmp.v1.x, 0f, Tmp.v1.y);
}
public void draw(){
public void render(Planet planet){
Draw.flush();
Gl.clear(Gl.depthBufferBit);
Gl.enable(Gl.depthTest);
@ -34,9 +34,11 @@ public class PlanetRenderer{
cam.lookAt(0, 0, 0);
cam.update();
planet.render(cam.combined());
planet.mesh.render(cam.combined());
//outline.render(cam.combined());
//TODO
/*
Ptile tile = outline.getTile(cam.getPickRay(Core.input.mouseX(), Core.input.mouseY()));
if(tile != null){
for(int i = 0; i < tile.corners.length; i++){
@ -44,7 +46,7 @@ public class PlanetRenderer{
batch.vertex(tile.corners[i].v);
}
batch.flush(cam.combined(), Gl.triangleFan);
}
}*/
Gl.disable(Gl.depthTest);
}

View File

@ -1,12 +1,23 @@
package mindustry.type;
import arc.scene.ui.layout.*;
import arc.util.ArcAnnotate.*;
import mindustry.ctype.*;
import mindustry.graphics.*;
//TODO add full icon for this planet
public class Planet extends UnlockableContent{
/** Mesh used for rendering. */
public @NonNull PlanetMesh mesh;
/** Grid used for the sectors on the planet. */
public @NonNull PlanetGrid grid;
public Planet(String name){
public Planet(String name, PlanetMesh mesh){
super(name);
this.mesh = mesh;
}
//mods
Planet(String name){
super(name);
}

View File

@ -1,5 +1,6 @@
package mindustry.ui.dialogs;
import mindustry.content.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.*;
@ -23,7 +24,7 @@ public class PlanetDialog extends FloatingDialog{
titleTable.remove();
cont.addRect((x, y, w, h) -> {
renderer.draw();
renderer.render(Planets.starter);
}).grow();
}
}

View File

@ -1,3 +1,3 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=097f07c939d99020b24a9b33fc3e24bf800e210d
archash=2868291fbe70f3719efaa18414162d127a9aa774