Cleanup uniformInjection
This commit is contained in:
parent
ae4a332eaf
commit
acf62519f4
@ -26,13 +26,7 @@ public class HorizontalProgressBar extends ObjectGl{
|
|||||||
this.max = newMax;
|
this.max = newMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
protected void uniformInjection() {
|
||||||
* Do shader binding, texture binding and vertexArray drawing
|
|
||||||
*/
|
|
||||||
public void render(){
|
|
||||||
|
|
||||||
this.shader.enable();
|
|
||||||
|
|
||||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||||
|
|
||||||
if (this.leftToRight == 1) {
|
if (this.leftToRight == 1) {
|
||||||
@ -46,9 +40,5 @@ public class HorizontalProgressBar extends ObjectGl{
|
|||||||
this.shader.setUniformMat4f("projection", projection);
|
this.shader.setUniformMat4f("projection", projection);
|
||||||
this.shader.setUniformMat4f("view", view);
|
this.shader.setUniformMat4f("view", view);
|
||||||
this.shader.setUniformMat4f("transform", this.transform);
|
this.shader.setUniformMat4f("transform", this.transform);
|
||||||
|
|
||||||
this.vertexArray.render();
|
|
||||||
|
|
||||||
this.shader.disable();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,21 +19,13 @@ public class Letter extends ObjectGl {
|
|||||||
this.indexBasedShader = b;
|
this.indexBasedShader = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(){
|
protected void uniformInjection(){
|
||||||
|
|
||||||
this.shader.enable();
|
|
||||||
if (this.texture != null) this.texture.bind();
|
|
||||||
|
|
||||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||||
if (this.indexBasedShader) this.shader.setUniform1i("index",this.index);
|
if (this.indexBasedShader) this.shader.setUniform1i("index",this.index);
|
||||||
|
|
||||||
this.shader.setUniformMat4f("projection", projection);
|
this.shader.setUniformMat4f("projection", projection);
|
||||||
this.shader.setUniformMat4f("view", view);
|
this.shader.setUniformMat4f("view", view);
|
||||||
this.shader.setUniformMat4f("transform", this.transform);
|
this.shader.setUniformMat4f("transform", this.transform);
|
||||||
|
|
||||||
this.vertexArray.render();
|
|
||||||
|
|
||||||
if (this.texture != null) this.texture.unbind();
|
|
||||||
this.shader.disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -265,6 +265,14 @@ public class ObjectGl {
|
|||||||
return scalingFactor;
|
return scalingFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void uniformInjection(){
|
||||||
|
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||||
|
|
||||||
|
this.shader.setUniformMat4f("projection", projection);
|
||||||
|
this.shader.setUniformMat4f("view", view);
|
||||||
|
this.shader.setUniformMat4f("transform", this.transform);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Do shader binding, texture binding and vertexArray drawing
|
* Do shader binding, texture binding and vertexArray drawing
|
||||||
*/
|
*/
|
||||||
@ -273,11 +281,7 @@ public class ObjectGl {
|
|||||||
this.shader.enable();
|
this.shader.enable();
|
||||||
if (this.texture != null) this.texture.bind();
|
if (this.texture != null) this.texture.bind();
|
||||||
|
|
||||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
this.uniformInjection();
|
||||||
|
|
||||||
this.shader.setUniformMat4f("projection", projection);
|
|
||||||
this.shader.setUniformMat4f("view", view);
|
|
||||||
this.shader.setUniformMat4f("transform", this.transform);
|
|
||||||
|
|
||||||
this.vertexArray.render();
|
this.vertexArray.render();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user