Exemple #1
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);
 }
Exemple #2
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);
 }
Exemple #3
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);
 }
Exemple #4
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"));
 }
Exemple #5
0
  public void renderingToWindow(GL2GL3 gl, boolean show) {
    shadertess.use(gl);
    updateligths(gl, shadertess);
    scenetess((GL3) gl, shadertess, false);

    shader.use(gl);
    updateligths(gl, shader);
    scene(gl, shader, show);
    Shader.unuse(gl);
  }
Exemple #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);
 }
Exemple #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);
  }
Exemple #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));
 }
Exemple #9
0
  public void renderingToFBO(
      GL2GL3 gl, FBO fbo, int offsetx, int offsety, int width, int height, boolean show) {
    shader.use(gl);
    fbo.bind(gl);
    gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
    gl.glViewport(offsetx, offsety, width, height);

    shader.use(gl);
    updateligths(gl, shader);
    scene(gl, shader, show);

    shadertess.use(gl);
    updateligths(gl, shadertess);
    scenetess((GL3) gl, shadertess);
    shadertess.unuse(gl);

    fbo.unbind(gl);
    gl.glFlush();
  }
Exemple #10
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);
  }
Exemple #11
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);
  }
Exemple #12
0
 public void updatePVMatrixtess(GL2GL3 gl) {
   shadertess.use(gl);
   gl.glUniformMatrix4fv(uniformviewtess, 1, false, pvmat.glGetMatrixf(GL2.GL_MODELVIEW));
   gl.glUniformMatrix4fv(uniformprojtess, 1, false, pvmat.glGetMatrixf(GL2.GL_PROJECTION));
   Shader.unuse(gl);
 }
Exemple #13
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");
  }