// Path: src/main/java/yk/senjin/AbstractState.java
// abstract public class AbstractState implements State {
// 
//     public void release() {
//     }
// }
// 
// Path: src/main/java/yk/senjin/shaders/ShaderHandler2.java
// public class ShaderHandler2 extends AbstractState {
//     public static ShaderHandler2 currentShader;
// 
//     private boolean isLinked;
//     public int program = -1;
//     public final List<UniformVariable> uniforms = new ArrayList<>();
//     public final Map<String, VertexAttrib> vertexAttribs = new HashMap<>();
// 
//     public ShaderHandler2() {
//     }
// 
//     public void initVariables() {
//         for (final UniformVariable u4f : uniforms) u4f.initForProgram(program);
//         for (final VertexAttrib a : vertexAttribs.values()) a.initForProgram(program);
//     }
// 
//     public void addVariables(final UniformVariable... variables) {
//         Collections.addAll(uniforms, variables);
//     }
// 
//     public void addVertexAttrib(final VertexAttrib attrib) {
//         vertexAttribs.put(attrib.getName(), attrib);
//     }
// 
//     public void createProgram() {
//         if (isLinked) throw shouldNeverReachHere();
//         if (program != -1) throw shouldNeverReachHere();
//         program = GL20.glCreateProgram();
//         Util.checkGLError();
//     }
// 
//     public void attachShader(int index) {
//         if (isLinked) throw shouldNeverReachHere();
//         if (program == -1) throw shouldNeverReachHere();
//         GL20.glAttachShader(program, index);
//         Util.checkGLError();
//     }
// 
//     public void linkProgram() {
//         if (isLinked) throw shouldNeverReachHere();
//         if (program == -1) throw shouldNeverReachHere();
//         GL20.glLinkProgram(program);
//         printLogInfo(program);
//         initVariables();
//         isLinked = true;
//     }
// 
//     @Override
//     public void disable() {
//         GL20.glUseProgram(0);
//         currentShader = null;
//     }
// 
//     @Override
//     public void enable() {
//         GL20.glUseProgram(program);
//         for (int i = 0; i < uniforms.size(); i++) {
//             uniforms.get(i).plug();
//         }
//         currentShader = this;
//     }
// 
//     public VertexAttrib getVertexAttrib(final String name) {
//         return vertexAttribs.get(name);
//     }
// 
//     public void deleteProgram() {
//         if (program != -1) GL20.glDeleteProgram(program);
//         else System.out.println("WARNING: already removed at " + yk.jcommon.utils.Util.stacktraceToString(new Exception()));
//         program = -1;
//     }
// }
// 
// Path: src/main/java/yk/senjin/shaders/arraystructure/AbstractArrayStructure.java
// abstract public class AbstractArrayStructure {
//     abstract public void turnOn();
// 
//     abstract public void turnOff();
// }


import org.lwjgl.opengl.GL20;
import yk.jcommon.collections.YList;
import yk.jcommon.utils.BadException;
import yk.senjin.AbstractState;
import yk.senjin.shaders.ShaderHandler2;
import yk.senjin.shaders.arraystructure.AbstractArrayStructure;
import yk.senjin.shaders.uniforms.*;
import static yk.jcommon.collections.YArrayList.al;
package yk.senjin.shaders.gshader;



abstract public class ShaderUser<V extends VertexShaderParent, F extends FragmentShaderParent> extends AbstractState {
    private ShaderHandler2 oldShaderHandler;
    private GProgram<V, F> program;

    YList<Sampler2D> samplers;
    protected YList<UniformVariable> uniforms;
// Path: src/main/java/yk/senjin/AbstractState.java
// abstract public class AbstractState implements State {
// 
//     public void release() {
//     }
// }
// 
// Path: src/main/java/yk/senjin/shaders/ShaderHandler2.java
// public class ShaderHandler2 extends AbstractState {
//     public static ShaderHandler2 currentShader;
// 
//     private boolean isLinked;
//     public int program = -1;
//     public final List<UniformVariable> uniforms = new ArrayList<>();
//     public final Map<String, VertexAttrib> vertexAttribs = new HashMap<>();
// 
//     public ShaderHandler2() {
//     }
// 
//     public void initVariables() {
//         for (final UniformVariable u4f : uniforms) u4f.initForProgram(program);
//         for (final VertexAttrib a : vertexAttribs.values()) a.initForProgram(program);
//     }
// 
//     public void addVariables(final UniformVariable... variables) {
//         Collections.addAll(uniforms, variables);
//     }
// 
//     public void addVertexAttrib(final VertexAttrib attrib) {
//         vertexAttribs.put(attrib.getName(), attrib);
//     }
// 
//     public void createProgram() {
//         if (isLinked) throw shouldNeverReachHere();
//         if (program != -1) throw shouldNeverReachHere();
//         program = GL20.glCreateProgram();
//         Util.checkGLError();
//     }
// 
//     public void attachShader(int index) {
//         if (isLinked) throw shouldNeverReachHere();
//         if (program == -1) throw shouldNeverReachHere();
//         GL20.glAttachShader(program, index);
//         Util.checkGLError();
//     }
// 
//     public void linkProgram() {
//         if (isLinked) throw shouldNeverReachHere();
//         if (program == -1) throw shouldNeverReachHere();
//         GL20.glLinkProgram(program);
//         printLogInfo(program);
//         initVariables();
//         isLinked = true;
//     }
// 
//     @Override
//     public void disable() {
//         GL20.glUseProgram(0);
//         currentShader = null;
//     }
// 
//     @Override
//     public void enable() {
//         GL20.glUseProgram(program);
//         for (int i = 0; i < uniforms.size(); i++) {
//             uniforms.get(i).plug();
//         }
//         currentShader = this;
//     }
// 
//     public VertexAttrib getVertexAttrib(final String name) {
//         return vertexAttribs.get(name);
//     }
// 
//     public void deleteProgram() {
//         if (program != -1) GL20.glDeleteProgram(program);
//         else System.out.println("WARNING: already removed at " + yk.jcommon.utils.Util.stacktraceToString(new Exception()));
//         program = -1;
//     }
// }
// 
// Path: src/main/java/yk/senjin/shaders/arraystructure/AbstractArrayStructure.java
// abstract public class AbstractArrayStructure {
//     abstract public void turnOn();
// 
//     abstract public void turnOff();
// }


// Path: src/main/java/yk/senjin/shaders/gshader/ShaderUser.java
import org.lwjgl.opengl.GL20;
import yk.jcommon.collections.YList;
import yk.jcommon.utils.BadException;
import yk.senjin.AbstractState;
import yk.senjin.shaders.ShaderHandler2;
import yk.senjin.shaders.arraystructure.AbstractArrayStructure;
import yk.senjin.shaders.uniforms.*;
import static yk.jcommon.collections.YArrayList.al;

package yk.senjin.shaders.gshader;



abstract public class ShaderUser<V extends VertexShaderParent, F extends FragmentShaderParent> extends AbstractState {
    private ShaderHandler2 oldShaderHandler;
    private GProgram<V, F> program;

    YList<Sampler2D> samplers;
    protected YList<UniformVariable> uniforms;
    private YList<AbstractArrayStructure> currentStructure;