Cleanup uniformInjection
This commit is contained in:
parent
ae4a332eaf
commit
acf62519f4
@ -4,7 +4,7 @@ import engine.math.Vector3f;
|
||||
|
||||
import static org.lwjgl.glfw.GLFW.glfwGetTime;
|
||||
|
||||
public class HorizontalProgressBar extends ObjectGl{
|
||||
public class HorizontalProgressBar extends ObjectGl {
|
||||
|
||||
private float max;
|
||||
private float current;
|
||||
@ -18,24 +18,18 @@ public class HorizontalProgressBar extends ObjectGl{
|
||||
this.setShader("shaders/StylishShaders/BasicNoTexVert.glsl", "shaders/StylishShaders/HorizontalProgressBar.glsl");
|
||||
}
|
||||
|
||||
public void setCurrent(float newCurrent){
|
||||
public void setCurrent(float newCurrent) {
|
||||
this.current = newCurrent;
|
||||
}
|
||||
|
||||
public void setMax(float newMax){
|
||||
public void setMax(float newMax) {
|
||||
this.max = newMax;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do shader binding, texture binding and vertexArray drawing
|
||||
*/
|
||||
public void render(){
|
||||
|
||||
this.shader.enable();
|
||||
|
||||
protected void uniformInjection() {
|
||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||
|
||||
if (this.leftToRight == 1){
|
||||
if (this.leftToRight == 1) {
|
||||
this.shader.setUniform1f("fill", (this.current / this.max) * this.getWidth());
|
||||
} else {
|
||||
this.shader.setUniform1f("fill", Math.abs(((this.current / this.max) * this.getWidth()) - this.getWidth()));
|
||||
@ -46,9 +40,5 @@ public class HorizontalProgressBar extends ObjectGl{
|
||||
this.shader.setUniformMat4f("projection", projection);
|
||||
this.shader.setUniformMat4f("view", view);
|
||||
this.shader.setUniformMat4f("transform", this.transform);
|
||||
|
||||
this.vertexArray.render();
|
||||
|
||||
this.shader.disable();
|
||||
}
|
||||
}
|
||||
|
@ -19,21 +19,13 @@ public class Letter extends ObjectGl {
|
||||
this.indexBasedShader = b;
|
||||
}
|
||||
|
||||
public void render(){
|
||||
|
||||
this.shader.enable();
|
||||
if (this.texture != null) this.texture.bind();
|
||||
|
||||
protected void uniformInjection(){
|
||||
if (this.useTime) this.shader.setUniform1f("time", (float) glfwGetTime());
|
||||
if (this.indexBasedShader) this.shader.setUniform1i("index",this.index);
|
||||
|
||||
this.shader.setUniformMat4f("projection", projection);
|
||||
this.shader.setUniformMat4f("view", view);
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
*/
|
||||
@ -273,11 +281,7 @@ public class ObjectGl {
|
||||
this.shader.enable();
|
||||
if (this.texture != null) this.texture.bind();
|
||||
|
||||
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);
|
||||
this.uniformInjection();
|
||||
|
||||
this.vertexArray.render();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user