Search in sources :

Example 1 with ArrayValuePerVertex

use of com.gempukku.libgdx.graph.util.ArrayValuePerVertex 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));
}
Also used : DefaultRenderableSprite(com.gempukku.libgdx.graph.util.sprite.DefaultRenderableSprite) GraphModels(com.gempukku.libgdx.graph.plugin.models.GraphModels) Vector2(com.badlogic.gdx.math.Vector2) OrthographicCamera(com.badlogic.gdx.graphics.OrthographicCamera) Vector3(com.badlogic.gdx.math.Vector3) MapWritablePropertyContainer(com.gempukku.libgdx.graph.shader.property.MapWritablePropertyContainer) ArrayValuePerVertex(com.gempukku.libgdx.graph.util.ArrayValuePerVertex) MultiPageSpriteBatchModel(com.gempukku.libgdx.graph.util.sprite.MultiPageSpriteBatchModel)

Aggregations

OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)1 Vector2 (com.badlogic.gdx.math.Vector2)1 Vector3 (com.badlogic.gdx.math.Vector3)1 GraphModels (com.gempukku.libgdx.graph.plugin.models.GraphModels)1 MapWritablePropertyContainer (com.gempukku.libgdx.graph.shader.property.MapWritablePropertyContainer)1 ArrayValuePerVertex (com.gempukku.libgdx.graph.util.ArrayValuePerVertex)1 DefaultRenderableSprite (com.gempukku.libgdx.graph.util.sprite.DefaultRenderableSprite)1 MultiPageSpriteBatchModel (com.gempukku.libgdx.graph.util.sprite.MultiPageSpriteBatchModel)1