@@ -0,0 +1,2393 @@
+package au.com.codeka.warworlds.game.starfield;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.andengine.entity.primitive.DrawMode;%0Aimport org.andengine.entity.primitive.Mesh;%0Aimport org.andengine.entity.scene.Scene;%0Aimport org.andengine.opengl.vbo.VertexBufferObjectManager;%0A%0Aimport au.com.codeka.common.PointCloud;%0Aimport au.com.codeka.common.Triangle;%0Aimport au.com.codeka.common.Vector2;%0Aimport au.com.codeka.common.Voronoi;%0Aimport au.com.codeka.controlfield.ControlField;%0Aimport au.com.codeka.warworlds.model.Sector;%0A%0A/** Represents the ControlField used by the tactical view. */%0Aclass TacticalControlField extends ControlField %7B%0A  private ArrayList%3CMesh%3E meshes;%0A%0A  public TacticalControlField(PointCloud pointCloud, Voronoi voronoi) %7B%0A    super(pointCloud, voronoi);%0A    meshes = new ArrayList%3CMesh%3E();%0A  %7D%0A%0A  public void updateAlpha(boolean visible, float alpha) %7B%0A    for (Mesh mesh : meshes) %7B%0A      mesh.setVisible(visible);%0A      mesh.setAlpha(alpha);%0A    %7D%0A  %7D%0A%0A  public void addToScene(Scene scene, VertexBufferObjectManager vboManager, int colour,%0A      float alpha) %7B%0A    for (Vector2 pt : mOwnedPoints) %7B%0A      List%3CTriangle%3E triangles = mVoronoi.getTrianglesForPoint(pt);%0A      if (triangles == null) %7B%0A        continue;%0A      %7D%0A%0A      float%5B%5D meshVertices = new float%5B(triangles.size() + 2) * Mesh.VERTEX_SIZE%5D;%0A      meshVertices%5BMesh.VERTEX_INDEX_X%5D = (float) pt.x * Sector.SECTOR_SIZE;%0A      meshVertices%5BMesh.VERTEX_INDEX_Y%5D = (float) pt.y * Sector.SECTOR_SIZE;%0A      for (int i = 0; i %3C triangles.size(); i++) %7B%0A        meshVertices%5B(i + 1) * Mesh.VERTEX_SIZE + Mesh.VERTEX_INDEX_X%5D =%0A            (float) triangles.get(i).centre.x * Sector.SECTOR_SIZE;%0A        meshVertices%5B(i + 1) * Mesh.VERTEX_SIZE + Mesh.VERTEX_INDEX_Y%5D =%0A            (float) triangles.get(i).centre.y * Sector.SECTOR_SIZE;%0A      %7D%0A      meshVertices%5B(triangles.size() + 1) * Mesh.VERTEX_SIZE + Mesh.VERTEX_INDEX_X%5D =%0A          (float) triangles.get(0).centre.x * Sector.SECTOR_SIZE;%0A      meshVertices%5B(triangles.size() + 1) * Mesh.VERTEX_SIZE + Mesh.VERTEX_INDEX_Y%5D =%0A          (float) triangles.get(0).centre.y * Sector.SECTOR_SIZE;%0A%0A      Mesh mesh = new Mesh(0.0f, 0.0f, meshVertices, triangles.size() + 2, DrawMode.TRIANGLE_FAN,%0A          vboManager);%0A      mesh.setColor(colour);%0A      mesh.setAlpha(alpha);%0A      scene.attachChild(mesh);%0A      meshes.add(mesh);%0A    %7D%0A  %7D%0A%7D%0A

Move all the entities into the scene, since the scene will be created in a different thread.