Example usage for com.badlogic.gdx.graphics.g3d.materials Material getShader

List of usage examples for com.badlogic.gdx.graphics.g3d.materials Material getShader

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics.g3d.materials Material getShader.

Prototype

public ShaderProgram getShader() 

Source Link

Usage

From source file:com.badlogic.gdx.graphics.g3d.test.PrototypeRendererGL20.java

License:Apache License

/** @param material
 * @return true if new shader was binded */
boolean bindShader(Material material) {
    ShaderProgram shader = material.getShader();
    if (shader == currentShader)
        return false;

    currentShader = shader;//  ww w  .  j  ava2  s . co m
    currentShader.begin();

    lightManager.applyGlobalLights(currentShader);
    lightManager.applyLights(currentShader);
    currentShader.setUniformMatrix("u_projectionViewMatrix", cam.combined);
    currentShader.setUniformf("camPos", cam.position.x, cam.position.y, cam.position.z, 1.2f / cam.far);
    currentShader.setUniformf("camDir", cam.direction.x, cam.direction.y, cam.direction.z);
    return true;
}