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));
}
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();
}
}
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));
}
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));
}
Aggregations