Search in sources :

Example 1 with ColorPoint

use of com.talosvfx.talos.runtime.values.ColorPoint in project gdx-graph by MarcinSc.

the class GradientImage method setPoints.

public void setPoints(Array<ColorPoint> points) {
    this.points.clear();
    if (points.get(0).pos > 0) {
        this.points.add(new ColorPoint(points.get(0).color, 0f));
    }
    for (int i = 0; i < points.size; i++) {
        ColorPoint point = points.get(i);
        ColorPoint newPoint = new ColorPoint();
        newPoint.set(point);
        this.points.add(newPoint);
    }
    if (points.get(points.size - 1).pos < 1) {
        this.points.add(new ColorPoint(points.get(points.size - 1).color, 1f));
    }
}
Also used : ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint) ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint)

Example 2 with ColorPoint

use of com.talosvfx.talos.runtime.values.ColorPoint in project gdx-graph by MarcinSc.

the class GradientImage method draw.

@Override
public void draw(Batch batch, float parentAlpha) {
    ShaderProgram prevShader = batch.getShader();
    batch.setShader(shaderProgram);
    shaderProgram.setUniformi(U_POINT_COUNT, points.size);
    for (int i = 0; i < points.size; i++) {
        ColorPoint point = points.get(i);
        stringBuilder.setLength(0);
        stringBuilder.append(U_ARR_NAME).append(i).append(U_PARAM_COLOR);
        shaderProgram.setUniformf(stringBuilder.toString(), point.color.r, point.color.g, point.color.b, 1f);
        stringBuilder.setLength(0);
        stringBuilder.append(U_ARR_NAME).append(i).append(U_PARAM_ALPHA);
        shaderProgram.setUniformf(stringBuilder.toString(), point.pos);
    }
    // do the rendering
    batch.draw(WhitePixel.sharedInstance.texture, getX(), getY(), getWidth(), getHeight());
    batch.setShader(prevShader);
}
Also used : ShaderProgram(com.badlogic.gdx.graphics.glutils.ShaderProgram) ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint) ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint)

Example 3 with ColorPoint

use of com.talosvfx.talos.runtime.values.ColorPoint in project talos by rockbite.

the class GradientColorModule method setPoints.

public void setPoints(Array<ColorPoint> from) {
    points.clear();
    for (ColorPoint fromPoint : from) {
        ColorPoint point = new ColorPoint(fromPoint.color, fromPoint.pos);
        points.add(point);
    }
}
Also used : ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint)

Example 4 with ColorPoint

use of com.talosvfx.talos.runtime.values.ColorPoint in project talos by rockbite.

the class GradientColorModule method resetPoints.

private void resetPoints() {
    // need to guarantee at least one point
    points = new Array<>();
    ColorPoint colorPoint = new ColorPoint();
    colorPoint.pos = 0;
    colorPoint.color.set(255 / 255f, 68 / 255f, 26 / 255f, 1f);
    points.add(colorPoint);
}
Also used : ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint)

Example 5 with ColorPoint

use of com.talosvfx.talos.runtime.values.ColorPoint in project talos by rockbite.

the class GradientColorModule method write.

@Override
public void write(Json json) {
    super.write(json);
    Array<ColorPoint> points = getPoints();
    json.writeArrayStart("points");
    for (ColorPoint point : points) {
        json.writeObjectStart();
        json.writeValue("r", point.color.r);
        json.writeValue("g", point.color.g);
        json.writeValue("b", point.color.b);
        json.writeValue("pos", point.pos);
        json.writeObjectEnd();
    }
    json.writeArrayEnd();
}
Also used : ColorPoint(com.talosvfx.talos.runtime.values.ColorPoint)

Aggregations

ColorPoint (com.talosvfx.talos.runtime.values.ColorPoint)13 Color (com.badlogic.gdx.graphics.Color)2 ShaderProgram (com.badlogic.gdx.graphics.glutils.ShaderProgram)2 ColorPicker (com.kotcrab.vis.ui.widget.color.ColorPicker)2 ColorPickerAdapter (com.kotcrab.vis.ui.widget.color.ColorPickerAdapter)2 GradientWidget (com.talosvfx.talos.editor.widgets.GradientWidget)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)1 Drawable (com.badlogic.gdx.scenes.scene2d.utils.Drawable)1 Array (com.badlogic.gdx.utils.Array)1 JsonValue (com.badlogic.gdx.utils.JsonValue)1 ClampMethod (com.gempukku.libgdx.graph.shader.ClampMethod)1 GraphBoxImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxImpl)1 GraphBoxPartImpl (com.gempukku.libgdx.graph.ui.graph.GraphBoxPartImpl)1 GraphChangedEvent (com.gempukku.libgdx.graph.ui.graph.GraphChangedEvent)1 VisSelectBox (com.kotcrab.vis.ui.widget.VisSelectBox)1 VisTable (com.kotcrab.vis.ui.widget.VisTable)1 IOException (java.io.IOException)1