Example usage for com.badlogic.gdx.graphics.glutils ShaderProgram setUniformf

List of usage examples for com.badlogic.gdx.graphics.glutils ShaderProgram setUniformf

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.glutils ShaderProgram setUniformf.

Prototype

public void setUniformf(int location, Color values) 

Source Link

Usage

From source file:airfoil.Main.java

License:Open Source License

protected final void renderMeshTriangles(Mesh mesh) {
    final ShaderProgram bodyShader = this.bodyShader;
    if (null != bodyShader) {

        if (null != mesh) {
            final Matrix4 camera = this.getCamera();

            bodyShader.begin();//  ww  w  . j ava  2  s . c om

            bodyShader.setUniformMatrix("u_camera", camera);
            bodyShader.setUniformf("u_color", Color.YELLOW);
            bodyShader.setUniformf("u_light", LightNormal);
            bodyShader.setUniformf("u_mat", Material);

            mesh.render(bodyShader, GL20.GL_TRIANGLES);

            bodyShader.end();
        }
    }
}

From source file:airfoil.Main.java

License:Open Source License

protected final void renderMeshLines(Mesh mesh) {
    final ShaderProgram axesShader = this.axesShader;
    if (null != axesShader) {

        if (null != mesh) {
            final Matrix4 camera = this.getCamera();

            axesShader.begin();//from  w  w  w.j a  v  a 2 s.c o  m

            axesShader.setUniformMatrix("u_camera", camera);
            axesShader.setUniformf("u_color", Color.YELLOW);
            axesShader.setUniformf("u_light", LightNormal);
            axesShader.setUniformf("u_mat", Material);

            mesh.render(axesShader, GL20.GL_LINES);

            axesShader.end();
        }
    }
}

From source file:com.kotcrab.vis.ui.widget.color.internal.Palette.java

License:Apache License

@Override
protected void setShaderUniforms(ShaderProgram shader) {
    shader.setUniformf("u_h", pickerHue);
}

From source file:com.lyeeedar.Roguelike3D.Graphics.Lights.PointLight.java

License:Open Source License

public void bind(ShaderProgram shader) {
    shader.setUniformf("u_model", position);
    shader.setUniformf("u_colour", getColour().r, getColour().g, getColour().b);
    shader.setUniformf("u_attenuation", attenuation);
    shader.setUniformf("u_power", power);
}

From source file:com.maplescot.loggerbill.game.world.BillGhost.java

License:Creative Commons License

public boolean draw(SpriteBatch batch, ShaderProgram ghostShader, float delta) {

    // We will use a wibbly-wobbly shader for bill's ghost
    batch.setShader(ghostShader);/*  w  w  w  . ja  v  a2  s . c o m*/
    ghostTime += delta;
    ghostShader.setUniformf("time", ghostTime);
    //ghostShader.setUniformf("resolution", 1.0f, 1.0f);

    sprite.setPosition(x, y);
    sprite.setAlpha(alpha);

    sprite.draw(batch);
    y += delta * 250;
    x -= (MathUtils.sin(y / 100 % 360) * 2) * side;
    alpha = (VIEW_HEIGHT - (y / VIEW_HEIGHT / 2));

    batch.setShader(null); // turn off ghost shader.
    return y <= VIEW_HEIGHT + sprite.getHeight();
}

From source file:de.redlion.badminton.render.AnimateAttribute.java

License:Apache License

@Override
public void bind(ShaderProgram program) {
    time += Gdx.graphics.getDeltaTime() * 5.f;
    program.setUniformf("time", time);
}

From source file:graphics.terrain.FogOverlay.java

License:Open Source License

protected void applyToMinimap(ShaderProgram shader) {
    updateTex();//  w  w  w  .j  a v a 2s .co m
    oldTex.bind(1);
    newTex.bind(2);
    shader.setUniformi("u_fog_old", 1);
    shader.setUniformi("u_fog_new", 2);
    shader.setUniformf("u_fogTime", oldTime % 1);
}

From source file:org.illarion.engine.backend.gdx.GdxTileLightEffect.java

License:Open Source License

private static void setUniform(@Nonnull ShaderProgram shader, @Nonnull String name,
        @Nonnull com.badlogic.gdx.graphics.Color color) {
    if (shader.hasUniform(name)) {
        shader.setUniformf(name, color);
    }//from   w  ww . jav a2  s .  c om
}

From source file:org.illarion.engine.backend.gdx.GdxTileLightEffect.java

License:Open Source License

private static void setUniform(@Nonnull ShaderProgram shader, @Nonnull String name, @Nonnull Vector2 vector2) {
    if (shader.hasUniform(name)) {
        shader.setUniformf(name, vector2);
    }/*  w w w. ja  va2s  .c  o m*/
}

From source file:rosthouse.rosty.components.shader.FireShaderDefinition.java

@Override
public void applyUniformsToShaderProgram(ShaderProgram shader, float time) {
    shader.setUniformf("Time", time);
}