Search in sources :

Example 56 with ModelInstance

use of com.badlogic.gdx.graphics.g3d.ModelInstance in project ProjektGG by eskalon.

the class GameLoadingScreen method onFinishedLoading.

@Override
protected void onFinishedLoading() {
    GameSession session = ((ProjektGGApplication) application).getClient().getSession();
    World world = session.getWorld();
    // Create the ModelInstances
    for (BuildingSlot s : world.getBuildingSlots()) {
        if (s.isBuiltOn()) {
            s.getBuilding().setRenderData(new SelectableRenderData(application.getAssetManager().get(s.getBuilding().getType().getModelPath(), Model.class)));
            // FIXME siehe AuthoritativeSession#init(...)
            s.getBuilding().getRenderData().transform.translate(s.getPosX(), 0, s.getPosZ());
            s.getBuilding().getRenderData().transform.rotate(Y_AXIS, s.getRotationToStreet());
        // TODO Use _one_ scene for all models?
        // new SelectableRenderData(scene,
        // building1.getType().getNodeName(), true);
        }
    }
    Model skyboxModel = application.getAssetManager().get(session.getSessionSetup().getMap().getSkyboxPath(), Model.class);
    for (Material m : skyboxModel.materials) {
        // fixes a bug related to changes in gdx 1.9.9, see
        // https://github.com/libgdx/libgdx/issues/5529
        m.remove(ColorAttribute.Emissive);
    }
    world.setSkybox(new ModelInstance(skyboxModel));
    Log.info("Client", "Game assets loaded");
    if (((ProjektGGApplication) application).isHost()) {
        ((ProjektGGApplication) application).getServer().startMatch();
        Log.info("Server", "Game started!");
    }
    application.getScreenManager().pushScreen("round_end", "simple_zoom", 1);
}
Also used : GameSession(de.gg.game.session.GameSession) ModelInstance(com.badlogic.gdx.graphics.g3d.ModelInstance) Model(com.badlogic.gdx.graphics.g3d.Model) Material(com.badlogic.gdx.graphics.g3d.Material) ProjektGGApplication(de.gg.game.core.ProjektGGApplication) World(de.gg.game.model.World) SelectableRenderData(de.gg.game.ui.rendering.SelectableRenderData) BuildingSlot(de.gg.game.model.entities.BuildingSlot)

Aggregations

ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)56 Material (com.badlogic.gdx.graphics.g3d.Material)30 ModelBuilder (com.badlogic.gdx.graphics.g3d.utils.ModelBuilder)26 Model (com.badlogic.gdx.graphics.g3d.Model)23 PerspectiveCamera (com.badlogic.gdx.graphics.PerspectiveCamera)17 ModelBatch (com.badlogic.gdx.graphics.g3d.ModelBatch)16 ColorAttribute (com.badlogic.gdx.graphics.g3d.attributes.ColorAttribute)15 MeshPartBuilder (com.badlogic.gdx.graphics.g3d.utils.MeshPartBuilder)11 Texture (com.badlogic.gdx.graphics.Texture)10 Environment (com.badlogic.gdx.graphics.g3d.Environment)10 Vector3 (com.badlogic.gdx.math.Vector3)10 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)9 AnimationController (com.badlogic.gdx.graphics.g3d.utils.AnimationController)9 DungeonTileModelInstance (util.DungeonTileModelInstance)8 BlendingAttribute (com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute)7 DirectionalLight (com.badlogic.gdx.graphics.g3d.environment.DirectionalLight)7 CameraInputController (com.badlogic.gdx.graphics.g3d.utils.CameraInputController)6 InputMultiplexer (com.badlogic.gdx.InputMultiplexer)5 AssetManager (com.badlogic.gdx.assets.AssetManager)4 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)4