Search in sources :

Example 6 with TexturedModel

use of com.chrisali.javaflightsim.lwjgl.models.TexturedModel in project j6dof-flight-sim by chris-ali.

the class EntityCollections method createStaticEntity.

/**
 * Creates a single static entity based on the position vector specified
 *
 * @param entityName
 * @param position
 * @param xRot
 * @param yRot
 * @param zRot
 * @param scale
 */
public void createStaticEntity(String entityName, Vector3f position, float xRot, float yRot, float zRot, float scale) {
    logger.debug("Generating a(n)" + entityName + " at: (" + position.x + ", " + position.y + ", " + position.z + ")...");
    TexturedModel staticEntity = new TexturedModel(OBJLoader.loadObjModel(entityName, OTWDirectories.ENTITIES.toString(), loader), new ModelTexture(loader.loadTexture(entityName, OTWDirectories.ENTITIES.toString())));
    miscStaticEntities.add(new Entity(staticEntity, position, xRot, yRot, zRot, scale));
}
Also used : TexturedModel(com.chrisali.javaflightsim.lwjgl.models.TexturedModel) ModelTexture(com.chrisali.javaflightsim.lwjgl.textures.ModelTexture)

Example 7 with TexturedModel

use of com.chrisali.javaflightsim.lwjgl.models.TexturedModel in project j6dof-flight-sim by chris-ali.

the class EntityRenderer method render.

public void render(Map<TexturedModel, List<Entity>> entities) {
    for (TexturedModel model : entities.keySet()) {
        prepareTexturedModel(model);
        List<Entity> batch = entities.get(model);
        for (Entity entity : batch) {
            prepareInstance(entity);
            GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
        }
        unbindTexturedModel();
    }
}
Also used : Entity(com.chrisali.javaflightsim.lwjgl.entities.Entity) TexturedModel(com.chrisali.javaflightsim.lwjgl.models.TexturedModel)

Example 8 with TexturedModel

use of com.chrisali.javaflightsim.lwjgl.models.TexturedModel in project j6dof-flight-sim by chris-ali.

the class EntityCollections method createStaticEntity.

/**
 * Creates a single static entity based on the X and Z coordinates specified; the Y coordinate is the height of the terrain
 * at the given X and Z coordinates
 *
 * @param entityName
 * @param xPos
 * @param zPos
 * @param yRot
 * @param scale
 */
public void createStaticEntity(String entityName, float xPos, float zPos, float yRot, float scale) {
    TexturedModel staticEntity = new TexturedModel(OBJLoader.loadObjModel(entityName, OTWDirectories.ENTITIES.toString(), loader), new ModelTexture(loader.loadTexture(entityName, OTWDirectories.ENTITIES.toString())));
    float yPos = Terrain.getCurrentTerrain(terrainTree, xPos, zPos).getTerrainHeight(xPos, zPos);
    logger.debug("Generating a(n)" + entityName + " at: (" + xPos + ", " + yPos + ", " + zPos + ")...");
    Vector3f position = new Vector3f(xPos, yPos, zPos);
    miscStaticEntities.add(new Entity(staticEntity, position, 0, yRot, 0, scale));
}
Also used : TexturedModel(com.chrisali.javaflightsim.lwjgl.models.TexturedModel) Vector3f(org.lwjgl.util.vector.Vector3f) ModelTexture(com.chrisali.javaflightsim.lwjgl.textures.ModelTexture)

Example 9 with TexturedModel

use of com.chrisali.javaflightsim.lwjgl.models.TexturedModel in project j6dof-flight-sim by chris-ali.

the class EntityCollections method createStaticEntity.

/**
 * Creates a single static entity based on the player's position
 *
 * @param entityName
 * @param player
 * @param scale
 */
public void createStaticEntity(String entityName, Player player, float scale) {
    logger.debug("Generating a(n)" + entityName + " at the ownship's postion: (" + player.getPosition().x + ", " + player.getPosition().y + ", " + player.getPosition().z + ")...");
    TexturedModel staticEntity = new TexturedModel(OBJLoader.loadObjModel(entityName, OTWDirectories.ENTITIES.toString(), loader), new ModelTexture(loader.loadTexture(entityName, OTWDirectories.ENTITIES.toString())));
    miscStaticEntities.add(new Entity(staticEntity, player.getPosition(), player.getRotX(), player.getRotY(), player.getRotZ(), scale));
}
Also used : TexturedModel(com.chrisali.javaflightsim.lwjgl.models.TexturedModel) ModelTexture(com.chrisali.javaflightsim.lwjgl.textures.ModelTexture)

Aggregations

TexturedModel (com.chrisali.javaflightsim.lwjgl.models.TexturedModel)9 ModelTexture (com.chrisali.javaflightsim.lwjgl.textures.ModelTexture)7 Vector3f (org.lwjgl.util.vector.Vector3f)4 Entity (com.chrisali.javaflightsim.lwjgl.entities.Entity)2 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 Cloud (com.chrisali.javaflightsim.lwjgl.particles.Cloud)1 ParticleTexture (com.chrisali.javaflightsim.lwjgl.particles.ParticleTexture)1 TerrainCollection (com.chrisali.javaflightsim.lwjgl.terrain.TerrainCollection)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1