use of org.terasology.rendering.opengl.GLSLMaterial in project Terasology by MovingBlocks.
the class ShaderManagerLwjgl method addShaderProgram.
// TODO: discuss having a `public removeShaderProgram`, to dispose shader programs no longer in use by any node
public GLSLMaterial addShaderProgram(String title) {
String uri = "engine:" + 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("engine:prog." + title), new MaterialData(shader.get()), Material.class);
progamaticShaders.add(material);
return material;
}
Aggregations