Added flipTextureWrapH
This commit is contained in:
@ -27,8 +27,7 @@ public class ObjectGl {
|
||||
public static Matrix4f projection;
|
||||
public static Matrix4f view;
|
||||
|
||||
|
||||
/*
|
||||
/**
|
||||
* xPos and yPos will stop to be relevant if you use rotate function
|
||||
*/
|
||||
private float xPos;
|
||||
@ -44,6 +43,7 @@ public class ObjectGl {
|
||||
public boolean useTime;
|
||||
|
||||
private Texture texture;
|
||||
private float[] textureWrap;
|
||||
|
||||
/**
|
||||
* Create a rectangle shape, use setTextureWrap to correctly align the texture with the model
|
||||
@ -76,6 +76,7 @@ public class ObjectGl {
|
||||
this.height = h;
|
||||
this.width = w;
|
||||
|
||||
this.textureWrap = Primitive.stdTexWrap;
|
||||
this.vertexArray = new VertexArray(Primitive.createRectangle(this.zPos, this.width, this.height), Primitive.rectangle_indices, colorBuffer, Primitive.stdTexWrap);
|
||||
|
||||
this.scalingFactor = 1;
|
||||
@ -199,6 +200,19 @@ public class ObjectGl {
|
||||
this.setTextureWrap(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the textureWrap left to right
|
||||
*/
|
||||
public void flipTextureWrapH(){
|
||||
float[] textureWrapTemp = new float[] {
|
||||
this.textureWrap[2], this.textureWrap[3],
|
||||
this.textureWrap[0], this.textureWrap[1],
|
||||
this.textureWrap[6], this.textureWrap[7],
|
||||
this.textureWrap[4], this.textureWrap[5]
|
||||
};
|
||||
setTextureWrap(textureWrapTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a new shader to be used by this object
|
||||
* @param vert path to glsl Vertex Shader
|
||||
@ -223,6 +237,7 @@ public class ObjectGl {
|
||||
}
|
||||
|
||||
private void setTextureWrap(float[] texture){
|
||||
this.textureWrap = texture;
|
||||
this.vertexArray.swapTextureBufferObject(texture);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user