diff --git a/src/engine/Engine.java b/src/engine/Engine.java index f8c3c3c..657804e 100644 --- a/src/engine/Engine.java +++ b/src/engine/Engine.java @@ -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); /* ******************** diff --git a/src/engine/input/KeyboardInput.java b/src/engine/input/KeyboardInput.java index 995b650..0bc484c 100644 --- a/src/engine/input/KeyboardInput.java +++ b/src/engine/input/KeyboardInput.java @@ -107,5 +107,7 @@ public class KeyboardInput extends GLFWKeyCallback { keyPressed = true; } if (!keyPressed) token.setTextureWrap(58,0,62,82, ObjectGl.STICK_TOP); + + token.flipTextureWrapH(); } } diff --git a/src/engine/object/ObjectGl.java b/src/engine/object/ObjectGl.java index 4144a58..1abcef6 100644 --- a/src/engine/object/ObjectGl.java +++ b/src/engine/object/ObjectGl.java @@ -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); }