Search in sources :

Example 1 with GLSLMaterial

use of org.terasology.engine.rendering.opengl.GLSLMaterial in project Terasology by MovingBlocks.

the class ShaderManagerLwjgl method addShaderProgram.

public GLSLMaterial addShaderProgram(String title, String providingModule) {
    String uri = providingModule + ":" + title;
    Optional<? extends Shader> shader = Assets.getShader(uri);
    checkState(shader.isPresent(), "Failed to resolve %s", uri);
    shader.get().recompile();
    GLSLMaterial material = (GLSLMaterial) Assets.generateAsset(new ResourceUrn(providingModule + ":prog." + title), new MaterialData(shader.get()), Material.class);
    progamaticShaders.add(material);
    return material;
}
Also used : GLSLMaterial(org.terasology.engine.rendering.opengl.GLSLMaterial) Material(org.terasology.engine.rendering.assets.material.Material) MaterialData(org.terasology.engine.rendering.assets.material.MaterialData) ResourceUrn(org.terasology.gestalt.assets.ResourceUrn) GLSLMaterial(org.terasology.engine.rendering.opengl.GLSLMaterial)

Aggregations

Material (org.terasology.engine.rendering.assets.material.Material)1 MaterialData (org.terasology.engine.rendering.assets.material.MaterialData)1 GLSLMaterial (org.terasology.engine.rendering.opengl.GLSLMaterial)1 ResourceUrn (org.terasology.gestalt.assets.ResourceUrn)1