Cleanup
This commit is contained in:
@@ -7,15 +7,19 @@ import arc.graphics.g3d.*;
|
||||
import arc.input.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.graphics.PlanetGrid.*;
|
||||
import mindustry.maps.planet.*;
|
||||
import mindustry.type.*;
|
||||
|
||||
public class PlanetRenderer{
|
||||
private Camera3D cam = new Camera3D();
|
||||
private float lastX, lastY, camLength = 4f;
|
||||
public class PlanetRenderer implements PlanetGenerator{
|
||||
private final Color outlineColor = Pal.accent.cpy().a(0.7f);
|
||||
private final float camLength = 4f, outlineRad = 1.2f;
|
||||
|
||||
//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);
|
||||
private final PlanetMesh[] outlines = new PlanetMesh[10];
|
||||
private final Camera3D cam = new Camera3D();
|
||||
private final VertexBatch3D batch = new VertexBatch3D(false, true, 0);
|
||||
|
||||
private float lastX, lastY;
|
||||
|
||||
public PlanetRenderer(){
|
||||
Tmp.v1.trns(0, camLength);
|
||||
@@ -34,24 +38,31 @@ public class PlanetRenderer{
|
||||
cam.lookAt(0, 0, 0);
|
||||
cam.update();
|
||||
|
||||
PlanetMesh outline = outline(planet.size);
|
||||
|
||||
planet.mesh.render(cam.combined());
|
||||
//outline.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++){
|
||||
batch.color(1f, 1f, 1f, 0.5f);
|
||||
batch.color(outlineColor);
|
||||
batch.vertex(tile.corners[i].v);
|
||||
}
|
||||
batch.flush(cam.combined(), Gl.triangleFan);
|
||||
}*/
|
||||
}
|
||||
|
||||
Gl.disable(Gl.depthTest);
|
||||
}
|
||||
|
||||
void input(){
|
||||
private PlanetMesh outline(int size){
|
||||
if(outlines[size] == null){
|
||||
outlines[size] = new PlanetMesh(size, this, outlineRad, true);
|
||||
}
|
||||
return outlines[size];
|
||||
}
|
||||
|
||||
private void input(){
|
||||
Vec3 v = Tmp.v33.set(Core.input.mouseX(), Core.input.mouseY(), 0);
|
||||
|
||||
if(Core.input.keyDown(KeyCode.MOUSE_LEFT)){
|
||||
@@ -60,4 +71,14 @@ public class PlanetRenderer{
|
||||
lastX = v.x;
|
||||
lastY = v.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHeight(Vec3 position){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor(Vec3 position){
|
||||
return outlineColor;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user