Browse Source

Shader.get(Collection<String> names)

master
Mathieu Sérandour 2 years ago
parent
commit
2688fda157
  1. 20
      src/client/graphics/engine/shader/Shader.java

20
src/client/graphics/engine/shader/Shader.java

@ -35,6 +35,8 @@ import java.io.FileReader;
import java.io.IOException;
import java.nio.IntBuffer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.TreeMap;
import org.lwjgl.BufferUtils;
@ -65,13 +67,27 @@ public class Shader implements Freeable {
private static TreeMap<String, Shader> shaders = new TreeMap<>();
public static Shader put(String name, Shader s) {
public static final Shader put(String name, Shader s) {
return shaders.put(name, s);
}
public static Shader get(String name) {
public static final Shader get(String name) {
return shaders.get(name);
}
/**
* vectorized get function
* @param names
* @return
*/
public static final List<Shader> get(Collection<String> names) {
List<Shader> shaders = new ArrayList<>();
for(String name: names) {
shaders.add(get(name));
}
return shaders;
}
public static boolean contains(String name) {
return shaders.containsKey(name);

Loading…
Cancel
Save