Exemplo n.º 1
0
 public void setShadowmapShader1i(GL2GL3 gl, int i, String name) {
   shadowmapshader.use(gl);
   gl.glUniform1i(gl.glGetUniformLocation(shadowmapshader.getID(), name), i);
   shadowmapshadertess.use(gl);
   gl.glUniform1i(gl.glGetUniformLocation(shadowmapshadertess.getID(), name), i);
   shadowmapshadertess.unuse(gl);
 }
Exemplo n.º 2
0
 public void shader1f(GL2GL3 gl, float i, String name) {
   shader.use(gl);
   gl.glUniform1f(gl.glGetUniformLocation(shader.getID(), name), i);
   shadertess.use(gl);
   gl.glUniform1f(gl.glGetUniformLocation(shadertess.getID(), name), i);
   shadertess.unuse(gl);
 }
Exemplo n.º 3
0
 public void setShadowmapShaderTexture(GL2GL3 gl, TexBindSet tbs, String texname) {
   shadowmapshader.use(gl);
   gl.glUniform1i(gl.glGetUniformLocation(shadowmapshader.getID(), texname), tbs.texunit);
   shadowmapshadertess.use(gl);
   gl.glUniform1i(gl.glGetUniformLocation(shadowmapshadertess.getID(), texname), tbs.texunit);
   shadowmapshadertess.unuse(gl);
 }
Exemplo n.º 4
0
  public void setTessLevel(GL2GL3 gl, int level) {
    shadowmapshadertess.use(gl);
    gl.glUniform1i(gl.glGetUniformLocation(shadowmapshadertess.getID(), "tesslevel"), level);
    shadowmapshadertess.unuse(gl);

    shadertess.use(gl);
    gl.glUniform1i(gl.glGetUniformLocation(shadertess.getID(), "tesslevel"), level);
    shadertess.unuse(gl);
  }
Exemplo n.º 5
0
 public void updateligths(GL2GL3 gl, Shader shader) {
   updatelights(
       gl,
       gl.glGetUniformLocation(shader.getID(), "lightsview"),
       gl.glGetUniformLocation(shader.getID(), "lightsproj"),
       gl.glGetUniformLocation(shader.getID(), "lightscolor"),
       gl.glGetUniformLocation(shader.getID(), "lightsattr"),
       gl.glGetUniformLocation(shader.getID(), "lightcount_real_virtual"));
 }
Exemplo n.º 6
0
 public void shader1i(GL2GL3 gl, int i, String name) {
   shader.use(gl);
   gl.glUniform1i(gl.glGetUniformLocation(shader.getID(), name), i);
   // gl.glUniform(new GLUniformData(name, i));
   shadertess.use(gl);
   gl.glUniform1i(gl.glGetUniformLocation(shadertess.getID(), name), i);
   // GLUniformData tmp = new GLUniformData(name, i);
   // tmp.setLocation(gl.glGetUniformLocation(shadertess.getID(), name));
   // gl.glUniform(tmp);
   shadertess.unuse(gl);
 }
Exemplo n.º 7
0
  public void init(GL2GL3 gl, Shader shader, Shader shadertess) {
    this.shader = shader;
    shader.use(gl);
    uniformview = gl.glGetUniformLocation(shader.getID(), "view");
    uniformproj = gl.glGetUniformLocation(shader.getID(), "proj");

    this.shadertess = shadertess;
    shadertess.use(gl);
    uniformviewtess = gl.glGetUniformLocation(shadertess.getID(), "view");
    uniformprojtess = gl.glGetUniformLocation(shadertess.getID(), "proj");
    shadertess.unuse(gl);
  }
Exemplo n.º 8
0
 public void updateModelMatrix(GL2GL3 gl, Shader shader, PMVMatrix model) {
   model.update();
   //    if(gl.glGetUniformLocation(shader.getID(), "model") == -1)
   //      System.out.println("uniform model error");
   gl.glUniformMatrix4fv(
       gl.glGetUniformLocation(shader.getID(), "model"),
       1,
       false,
       model.glGetMatrixf(GL2.GL_MODELVIEW));
 }
Exemplo n.º 9
0
  public void ShadowMap(GL2GL3 gl, boolean show) {
    smapfbo.bind(gl);
    gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
    gl.glViewport(0, 0, smapwidth, smapheight);

    shadowmapshadertess.use(gl);
    gl.glUniform1i(gl.glGetUniformLocation(shadowmapshadertess.getID(), "stage"), 0);
    smapupdatelightstess(gl);
    scenetess((GL4) gl, shadowmapshadertess);

    shadowmapshader.use(gl);
    gl.glUniform1i(gl.glGetUniformLocation(shadowmapshader.getID(), "stage"), 0);
    smapupdatelights(gl);
    scene(gl, shadowmapshader, show);

    gl.glFlush();
    smapfbo.unbind(gl);
    Shader.unuse(gl);
  }
Exemplo n.º 10
0
  public void initShadowmap(GL2GL3 gl, int lightcount, int width, int height) {
    initLight(lightcount);

    Ctrlpanel.getInstance().addLightCtrl(realLightcount, this);
    smapwidth = width;
    smapheight = height;

    Tex2DArray shadowmap =
        new Tex2DArray(
            GL2.GL_RGB16,
            GL2.GL_RGB,
            GL.GL_FLOAT,
            smapwidth,
            smapheight,
            realLightcount,
            GL.GL_LINEAR,
            "shadowmap");
    Tex2DArray shadowmapdepth =
        new Tex2DArray(
            GL2.GL_DEPTH_COMPONENT,
            GL2.GL_DEPTH_COMPONENT,
            GL.GL_FLOAT,
            smapwidth,
            smapheight,
            realLightcount,
            GL.GL_LINEAR,
            "shadowmapdepth");
    shadowmap.init(gl);
    shadowmapdepth.init(gl);
    shadowmapB = tum.bind(gl, shadowmap);
    smapfbo = new FBO(gl);
    smapfbo.attachTexture(gl, shadowmapB);
    smapfbo.attachDepth(gl, shadowmapdepth);

    /*シャドウマップ*/
    shadowmapshader =
        new Shader(
            "resources/ShaderSource/BaseShaders/Shadowmap/vertsimple.c",
            null,
            null,
            smapgsrc,
            smapfsrc);
    shadowmapshader.init(gl);
    shadowmapshader.use(gl);

    uniformlightsview = gl.glGetUniformLocation(shadowmapshader.getID(), "lightsview");
    uniformlightsproj = gl.glGetUniformLocation(shadowmapshader.getID(), "lightsproj");
    uniformlightscolor = gl.glGetUniformLocation(shadowmapshader.getID(), "lightscolor");
    uniformlightsattr = gl.glGetUniformLocation(shadowmapshader.getID(), "lightsattr");
    uniformlightcount = gl.glGetUniformLocation(shadowmapshader.getID(), "lightcount_real_virtual");

    /*シャドウマップテッセレーション*/
    shadowmapshadertess = new Shader(smapvsrc, smapcsrc, smapesrc, smapgsrc, smapfsrc);
    shadowmapshadertess.init(gl);
    shadowmapshadertess.use(gl);
    uniformlightsviewtess = gl.glGetUniformLocation(shadowmapshadertess.getID(), "lightsview");
    uniformlightsprojtess = gl.glGetUniformLocation(shadowmapshadertess.getID(), "lightsproj");
    uniformlightscolortess = gl.glGetUniformLocation(shadowmapshadertess.getID(), "lightscolor");
    uniformlightsattrtess = gl.glGetUniformLocation(shadowmapshader.getID(), "lightsattr");
    uniformlightcounttess =
        gl.glGetUniformLocation(shadowmapshadertess.getID(), "lightcount_real_virtual");
  }