WavyTextVert.glsl + support des shaders dans UIElementText.java

This commit is contained in:
Antoine
2021-06-14 17:03:10 +02:00
parent acf62519f4
commit 95d2d7e21c
5 changed files with 50 additions and 12 deletions

View File

@ -12,7 +12,7 @@ import java.util.List;
*/
public class Text {
private List<ObjectGl> charList;
private List<Letter> charList;
private final float size;
private final Engine engine;
private final float zPos;
@ -40,13 +40,13 @@ public class Text {
private void addCharListInEngine(){
int i = 0;
for (ObjectGl obj : this.charList){
for (Letter obj : this.charList){
addCharInEngine(i, obj);
i++;
}
}
private void addCharInEngine(int i, ObjectGl obj){
private void addCharInEngine(int i, Letter obj){
obj.translate(new Vector3f(i * 10.0f * this.size, 0.0f, 0.0f));
obj.translate(transformation);
this.engine.add_objectGl(obj);
@ -57,13 +57,13 @@ public class Text {
public void setNewText(String text){
int i = 0;
for (ObjectGl obj : this.charList) {
for (Letter obj : this.charList) {
ObjectGlSetCharWrap(text.charAt(i), obj);
i++;
if (i >= text.length()) break;
}
while (i < text.length()){
ObjectGl obj = this.charToObjectGl(text.charAt(i), i);
Letter obj = this.charToObjectGl(text.charAt(i), i);
this.charList.add(obj);
addCharInEngine(i, obj);
i++;
@ -91,7 +91,7 @@ public class Text {
private void removeFromIndexToEnd(int i){
int j = 0;
for (ObjectGl objectGl : this.charList){
for (Letter objectGl : this.charList){
if (j >= i) {
this.engine.remove_objectGl(objectGl);
}
@ -100,8 +100,8 @@ public class Text {
this.charList = this.charList.subList(0, i);
}
private ObjectGl charToObjectGl(char a, int index){
ObjectGl objectGl = new Letter(this.zPos, 1.0f, 1.0f, this.size, "textures/dejavu10x10_gs_tc.png", null, index);
private Letter charToObjectGl(char a, int index){
Letter objectGl = new Letter(this.zPos, 1.0f, 1.0f, this.size, "textures/dejavu10x10_gs_tc.png", null, index);
objectGl.setShader("shaders/StylishShaders/BasicVert.glsl","shaders/StylishShaders/TextFrag.glsl");
ObjectGlSetCharWrap(a, objectGl);
return objectGl;
@ -119,7 +119,7 @@ public class Text {
}
}
public List<ObjectGl> getCharList(){
public List<Letter> getCharList(){
return this.charList;
}