Search in sources :

Example 1 with UIPluginPublicData

use of com.gempukku.libgdx.graph.plugin.ui.UIPluginPublicData in project gdx-graph by MarcinSc.

the class ShadowShaderTestScene method initializeScene.

@Override
public void initializeScene() {
    camera = new PerspectiveCamera();
    camera.near = 0.1f;
    camera.far = 100;
    updateCamera();
    pipelineRenderer = loadPipelineRenderer();
    float halfSize = 5;
    ModelBuilder modelBuilder = new ModelBuilder();
    Model wall = modelBuilder.createBox(halfSize * 2, halfSize * 2, 0.001f, new Material(), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
    Model sphere = modelBuilder.createSphere(2, 2, 2, 50, 50, new Material(), VertexAttributes.Usage.Position | VertexAttributes.Usage.Normal);
    disposables.add(wall);
    disposables.add(sphere);
    ModelInstance wallInstance = new ModelInstance(wall);
    wallInstance.transform.translate(0, 0, -3);
    sphereInstance = new ModelInstance(sphere);
    GraphModels graphModels = pipelineRenderer.getPluginData(GraphModels.class);
    CommonPropertiesModelInstanceModelAdapter wallAdapter = new CommonPropertiesModelInstanceModelAdapter(wallInstance, graphModels);
    wallAdapter.getPropertyContainer().setValue("Color", Color.LIGHT_GRAY);
    CommonPropertiesModelInstanceModelAdapter sphereAdapter = new CommonPropertiesModelInstanceModelAdapter(sphereInstance, graphModels);
    sphereAdapter.getPropertyContainer().setValue("Color", Color.RED);
    wallAdapter.addTag("Color");
    wallAdapter.addTag("Color Shadow");
    sphereAdapter.addTag("Color");
    sphereAdapter.addTag("Color Shadow");
    Lighting3DPublicData lighting = pipelineRenderer.getPluginData(Lighting3DPublicData.class);
    environment = new Lighting3DEnvironment(new Vector3(), 20f);
    environment.setAmbientColor(new Color(0.1f, 0.1f, 0.1f, 1f));
    Directional3DLight directionalLight = new Directional3DLight();
    directionalLight.setColor(Color.WHITE);
    directionalLight.setIntensity(0.4f);
    directionalLight.setDirection(0, 0, -1);
    directionalLight.setShadowsEnabled(true);
    directionalLight.setShadowBufferSize(512);
    environment.addDirectionalLight(directionalLight);
    lighting.setEnvironment("Scene", environment);
    stage = createStage();
    disposables.add(stage);
    Gdx.input.setInputProcessor(stage);
    UIPluginPublicData ui = pipelineRenderer.getPluginData(UIPluginPublicData.class);
    ui.setStage("Stage", stage);
}
Also used : CommonPropertiesModelInstanceModelAdapter(com.gempukku.libgdx.graph.util.model.CommonPropertiesModelInstanceModelAdapter) Directional3DLight(com.gempukku.libgdx.graph.plugin.lighting3d.Directional3DLight) Color(com.badlogic.gdx.graphics.Color) Material(com.badlogic.gdx.graphics.g3d.Material) Vector3(com.badlogic.gdx.math.Vector3) PerspectiveCamera(com.badlogic.gdx.graphics.PerspectiveCamera) ModelInstance(com.badlogic.gdx.graphics.g3d.ModelInstance) ModelBuilder(com.badlogic.gdx.graphics.g3d.utils.ModelBuilder) UIPluginPublicData(com.gempukku.libgdx.graph.plugin.ui.UIPluginPublicData) GraphModels(com.gempukku.libgdx.graph.plugin.models.GraphModels) Lighting3DEnvironment(com.gempukku.libgdx.graph.plugin.lighting3d.Lighting3DEnvironment) Model(com.badlogic.gdx.graphics.g3d.Model) Lighting3DPublicData(com.gempukku.libgdx.graph.plugin.lighting3d.Lighting3DPublicData)

Aggregations

Color (com.badlogic.gdx.graphics.Color)1 PerspectiveCamera (com.badlogic.gdx.graphics.PerspectiveCamera)1 Material (com.badlogic.gdx.graphics.g3d.Material)1 Model (com.badlogic.gdx.graphics.g3d.Model)1 ModelInstance (com.badlogic.gdx.graphics.g3d.ModelInstance)1 ModelBuilder (com.badlogic.gdx.graphics.g3d.utils.ModelBuilder)1 Vector3 (com.badlogic.gdx.math.Vector3)1 Directional3DLight (com.gempukku.libgdx.graph.plugin.lighting3d.Directional3DLight)1 Lighting3DEnvironment (com.gempukku.libgdx.graph.plugin.lighting3d.Lighting3DEnvironment)1 Lighting3DPublicData (com.gempukku.libgdx.graph.plugin.lighting3d.Lighting3DPublicData)1 GraphModels (com.gempukku.libgdx.graph.plugin.models.GraphModels)1 UIPluginPublicData (com.gempukku.libgdx.graph.plugin.ui.UIPluginPublicData)1 CommonPropertiesModelInstanceModelAdapter (com.gempukku.libgdx.graph.util.model.CommonPropertiesModelInstanceModelAdapter)1