use of com.gempukku.libgdx.graph.plugin.models.GraphModels in project gdx-graph by MarcinSc.
the class Episode7Scene method createStage.
private Stage createStage() {
skin = new Skin(Gdx.files.classpath("skin/default/uiskin.json"));
final TextButton switchButton = new TextButton("Normal/Toon", skin, "toggle");
switchButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
boolean checked = switchButton.isChecked();
String removeTag = checked ? "Default" : "Toon";
String tag = checked ? "Toon" : "Default";
GraphModels graphModels = pipelineRenderer.getPluginData(GraphModels.class);
modelAdapter.removeTag(removeTag);
modelAdapter.addTag(tag);
}
});
Stage stage = new Stage(new ScreenViewport());
Table tbl = new Table();
tbl.add(switchButton).row();
tbl.setFillParent(true);
tbl.align(Align.topLeft);
stage.addActor(tbl);
return stage;
}
use of com.gempukku.libgdx.graph.plugin.models.GraphModels in project gdx-graph by MarcinSc.
the class SpriteShaderTestScene method initializeScene.
@Override
public void initializeScene() {
camera = new OrthographicCamera();
pipelineRenderer = loadPipelineRenderer();
ArrayValuePerVertex<Vector2> uvPerVertex = new ArrayValuePerVertex<>(new Vector2(0, 0), new Vector2(1, 0), new Vector2(0, 1), new Vector2(1, 1));
GraphModels graphModels = pipelineRenderer.getPluginData(GraphModels.class);
spriteBatch = new MultiPageSpriteBatchModel(true, 2, graphModels, "Test");
MapWritablePropertyContainer sprite1 = new MapWritablePropertyContainer();
sprite1.setValue("Position", new Vector3(0, 0, -10));
sprite1.setValue("UV", uvPerVertex);
ArrayValuePerVertex<Vector2> colorPerVertex = new ArrayValuePerVertex<>(new Vector2(0, 1), new Vector2(1, 0), new Vector2(0, 0), new Vector2(1, 1));
sprite1.setValue("Vertex Color", colorPerVertex);
MapWritablePropertyContainer sprite2 = new MapWritablePropertyContainer();
sprite2.setValue("Position", new Vector3(150, 0, -10));
sprite2.setValue("UV", uvPerVertex);
spriteBatch.addSprite(new DefaultRenderableSprite(sprite1));
spriteBatch.addSprite(new DefaultRenderableSprite(sprite2));
graphModels.setGlobalProperty("Test", "Color", new Vector2(1f, 1f));
}
use of com.gempukku.libgdx.graph.plugin.models.GraphModels 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