use of com.chrisali.javaflightsim.lwjgl.entities.EntityCollections in project j6dof-flight-sim by chris-ali.
the class LWJGLWorld method loadAssets.
/**
* Initializes and generates all assets needed to render lights, entities, particles terrain and text
*/
private void loadAssets() {
// ==================================== Sun ===========================================================
logger.debug("Generating sun...");
lights = new ArrayList<>();
lights.add(new Light(new Vector3f(20000, 40000, 20000), new Vector3f(0.95f, 0.95f, 0.95f)));
// ================================= Entities ==========================================================
logger.debug("Generating collections of entities...");
entities = new EntityCollections(lights, loader);
// ================================= Ownship ===========================================================
logger.debug("Creating ownship...");
TexturedModel airplane = new TexturedModel(OBJLoader.loadObjModel("airplane", OTWDirectories.ENTITIES.toString(), loader), new ModelTexture(loader.loadTexture("airplane", OTWDirectories.ENTITIES.toString())));
ownship = new Ownship(airplane, configuration.getInitialConditions(), 1.25f);
logger.debug("Setting up camera...");
// Camera tied to ownship as first person view
camera = new Camera(ownship);
camera.setChaseView(true);
ownship.setScale(camera.isChaseView() ? 1.25f : 0f);
entities.addToStaticEntities(ownship);
// ================================= Terrain ==========================================================
logger.debug("Generating terrain...");
terrainCollection = new TerrainCollection(10, loader, ownship);
entities.setTerrainTree(terrainCollection.getTerrainTree());
// =============================== Particles ==========================================================
logger.debug("Generating clouds...");
ParticleTexture clouds = new ParticleTexture(loader.loadTexture("clouds", OTWDirectories.PARTICLES.toString()), 4, true);
// Generates clouds at random positions along terrain map
Random random = new Random();
for (int i = -1000; i < 1000; i++) new Cloud(clouds, new Vector3f(random.nextInt(800 * 10), 300, i * 10), new Vector3f(0, 0, 0), 0, 200);
// =============================== Interface ==========================================================
logger.debug("Generating on-screen text and panel...");
// On-screen text
simTexts = new SimulationTexts(new FontType(loader, "ubuntu"));
// Instrument Panel and Gauges
interfaceTextures = new ArrayList<>();
panel = FileUtilities.readInstrumentPanelConfiguration(configuration.getSelectedAircraft());
if (configuration.getSimulationOptions().contains(Options.INSTRUMENT_PANEL)) {
interfaceTextures = panel.loadAndGetTextures(loader, configuration.getSelectedAircraft());
camera.setPilotPosition(new Vector3f(0, 5, 0));
camera.setPitchOffset(25);
}
// ==================================== Audio =========================================================
logger.debug("Generating sound collection...");
soundCollection = new SoundCollection(configuration);
}
Aggregations