@Override protected void initialize(Application app) { ed = getState(EntityDataState.class).getEntityData(); entities = ed.getEntities(Position.class, ModelType.class); // Calculate how big min/max needs to be to incorporate // the full view + margin at z = 0 Camera cam = app.getCamera(); float z = cam.getViewToProjectionZ(cam.getLocation().z); Vector3f worldMin = cam.getWorldCoordinates(new Vector2f(0, 0), z); Vector3f worldMax = cam.getWorldCoordinates(new Vector2f(cam.getWidth(), cam.getHeight()), z); min = worldMin.addLocal(-margin, -margin, 0); max = worldMax.addLocal(margin, margin, 0); }
@Override public void cleanup() { entityData.close(); entityData = null; // cannot be reused }