Search in sources :

Example 1 with SceneRenderer

use of de.gg.render.SceneRenderer in project ProjektGG by eskalon.

the class GameMapScreen method onInit.

@Override
protected void onInit() {
    titleImage = assetManager.get(TITLE_IMAGE_PATH);
    sceneRenderer = new SceneRenderer(game.getGameCamera().getCamera(), game.getCurrentSession().getCity());
    Model scene = assetManager.get(TEST_SCENE_PATH);
    for (int i = 0; i < scene.nodes.size; i++) {
        String id = scene.nodes.get(i).id;
        RenderData instance = new RenderData(scene, id, true);
        if (id.equals("space")) {
            game.getCurrentSession().getCity().setSkybox(instance);
            continue;
        }
        game.getCurrentSession().getCity().getBuildings().add(new Building(i, instance));
    /*
			 * if (id.equals("ship")) ship = instance; else if
			 * (id.startsWith("block")) blocks.add(instance); else if
			 * (id.startsWith("invader")) invaders.add(instance);
			 */
    }
    ModelBuilder modelBuilder = new ModelBuilder();
    Model model = modelBuilder.createSphere(2f, 2f, 2f, 20, 20, new Material(), Usage.Position | Usage.Normal | Usage.TextureCoordinates);
    NodePart blockPart = model.nodes.get(0).parts.get(0);
    renderable = new Renderable();
    blockPart.setRenderable(renderable);
    renderable.environment = sceneRenderer.environment;
    renderable.worldTransform.idt();
    renderContext = new RenderContext(new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
    shader = new TestShader(game.getAssetManager());
    shader.init();
    // this.renderContext = new RenderContext(
    // new DefaultTextureBinder(DefaultTextureBinder.WEIGHTED, 1));
    // this.shader.init();
    this.cameraController = new CameraInputController(game.getGameCamera().getCamera());
}
Also used : Building(de.gg.entity.Building) RenderContext(com.badlogic.gdx.graphics.g3d.utils.RenderContext) Material(com.badlogic.gdx.graphics.g3d.Material) TestShader(de.gg.render.TestShader) ModelBuilder(com.badlogic.gdx.graphics.g3d.utils.ModelBuilder) CameraInputController(com.badlogic.gdx.graphics.g3d.utils.CameraInputController) Renderable(com.badlogic.gdx.graphics.g3d.Renderable) RenderData(de.gg.render.RenderData) Model(com.badlogic.gdx.graphics.g3d.Model) NodePart(com.badlogic.gdx.graphics.g3d.model.NodePart) SceneRenderer(de.gg.render.SceneRenderer) DefaultTextureBinder(com.badlogic.gdx.graphics.g3d.utils.DefaultTextureBinder)

Aggregations

Material (com.badlogic.gdx.graphics.g3d.Material)1 Model (com.badlogic.gdx.graphics.g3d.Model)1 Renderable (com.badlogic.gdx.graphics.g3d.Renderable)1 NodePart (com.badlogic.gdx.graphics.g3d.model.NodePart)1 CameraInputController (com.badlogic.gdx.graphics.g3d.utils.CameraInputController)1 DefaultTextureBinder (com.badlogic.gdx.graphics.g3d.utils.DefaultTextureBinder)1 ModelBuilder (com.badlogic.gdx.graphics.g3d.utils.ModelBuilder)1 RenderContext (com.badlogic.gdx.graphics.g3d.utils.RenderContext)1 Building (de.gg.entity.Building)1 RenderData (de.gg.render.RenderData)1 SceneRenderer (de.gg.render.SceneRenderer)1 TestShader (de.gg.render.TestShader)1