Added flipTextureWrapH
This commit is contained in:
parent
ba7e093a00
commit
80e3a879ee
@ -270,8 +270,6 @@ public class Engine {
|
||||
|
||||
Vector3f vecTransView = new Vector3f((-zangief.getXPos() - engine.viewXPos) - 250.0f,0.0f,0.0f);
|
||||
engine.translateView(vecTransView);
|
||||
System.out.println(zangief.getXPos());
|
||||
System.out.println(engine.viewXPos);
|
||||
|
||||
/*
|
||||
********************
|
||||
|
@ -107,5 +107,7 @@ public class KeyboardInput extends GLFWKeyCallback {
|
||||
keyPressed = true;
|
||||
}
|
||||
if (!keyPressed) token.setTextureWrap(58,0,62,82, ObjectGl.STICK_TOP);
|
||||
|
||||
token.flipTextureWrapH();
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user