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