Search in sources :

Example 1 with SimulationTexts

use of com.chrisali.javaflightsim.lwjgl.interfaces.text.SimulationTexts 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);
}
Also used : Ownship(com.chrisali.javaflightsim.lwjgl.entities.Ownship) TerrainCollection(com.chrisali.javaflightsim.lwjgl.terrain.TerrainCollection) SimulationTexts(com.chrisali.javaflightsim.lwjgl.interfaces.text.SimulationTexts) TexturedModel(com.chrisali.javaflightsim.lwjgl.models.TexturedModel) ParticleTexture(com.chrisali.javaflightsim.lwjgl.particles.ParticleTexture) EntityCollections(com.chrisali.javaflightsim.lwjgl.entities.EntityCollections) FontType(com.chrisali.javaflightsim.lwjgl.interfaces.text.FontType) ModelTexture(com.chrisali.javaflightsim.lwjgl.textures.ModelTexture) SoundCollection(com.chrisali.javaflightsim.lwjgl.audio.SoundCollection) Random(java.util.Random) Light(com.chrisali.javaflightsim.lwjgl.entities.Light) Vector3f(org.lwjgl.util.vector.Vector3f) Cloud(com.chrisali.javaflightsim.lwjgl.particles.Cloud) Camera(com.chrisali.javaflightsim.lwjgl.entities.Camera)

Aggregations

SoundCollection (com.chrisali.javaflightsim.lwjgl.audio.SoundCollection)1 Camera (com.chrisali.javaflightsim.lwjgl.entities.Camera)1 EntityCollections (com.chrisali.javaflightsim.lwjgl.entities.EntityCollections)1 Light (com.chrisali.javaflightsim.lwjgl.entities.Light)1 Ownship (com.chrisali.javaflightsim.lwjgl.entities.Ownship)1 FontType (com.chrisali.javaflightsim.lwjgl.interfaces.text.FontType)1 SimulationTexts (com.chrisali.javaflightsim.lwjgl.interfaces.text.SimulationTexts)1 TexturedModel (com.chrisali.javaflightsim.lwjgl.models.TexturedModel)1 Cloud (com.chrisali.javaflightsim.lwjgl.particles.Cloud)1 ParticleTexture (com.chrisali.javaflightsim.lwjgl.particles.ParticleTexture)1 TerrainCollection (com.chrisali.javaflightsim.lwjgl.terrain.TerrainCollection)1 ModelTexture (com.chrisali.javaflightsim.lwjgl.textures.ModelTexture)1 Random (java.util.Random)1 Vector3f (org.lwjgl.util.vector.Vector3f)1