diff --git a/src/engine/Engine.java b/src/engine/Engine.java index 9f78bb7..05fc9c8 100644 --- a/src/engine/Engine.java +++ b/src/engine/Engine.java @@ -197,7 +197,7 @@ public class Engine { /* Engine Init */ - Engine engine = new Engine(800, 600, 3.0f / 4.0f); + Engine engine = new Engine(1280, 720, 3.0f / 4.0f); int speed = 10; //vitesse d�placement Object engine.init(); diff --git a/src/engine/object/ObjectGl.java b/src/engine/object/ObjectGl.java index 723cc2d..5c36237 100644 --- a/src/engine/object/ObjectGl.java +++ b/src/engine/object/ObjectGl.java @@ -27,6 +27,12 @@ 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; + private float yPos; private float zPos; private float width; // To be used in setTextureWrap private float height; @@ -61,6 +67,8 @@ public class ObjectGl { this.texture = new Texture(tex, 0); } + this.xPos = 0.0f; + this.yPos = 0.0f; this.zPos = z; this.height = h; this.width = w; @@ -92,6 +100,9 @@ public class ObjectGl { public void resetTransform(){ this.transform = Matrix4f.identity(); this.scalingFactor = 1; + this.xPos = 0.0f; + this.yPos = 0.0f; + this.zPos = 0.0f; } /** @@ -101,6 +112,8 @@ public class ObjectGl { public void translate(Vector3f vec){ vec.divXY(this.scalingFactor); this.transform = this.transform.multiply(Matrix4f.translate(vec)); + this.xPos += vec.x; + this.yPos += vec.y; this.zPos += vec.z; } @@ -210,6 +223,14 @@ public class ObjectGl { this.vertexArray.swapTextureBufferObject(texture); } + public float getXPos(){ + return xPos; + } + + public float getYPos(){ + return yPos; + } + public float getZPos(){ return zPos; }