Added coordinate tracking in ObjectGl
This commit is contained in:
parent
b5319de940
commit
7b349c573b
@ -197,7 +197,7 @@ public class Engine {
|
|||||||
/*
|
/*
|
||||||
Engine Init
|
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<EFBFBD>placement Object
|
int speed = 10; //vitesse d<EFBFBD>placement Object
|
||||||
engine.init();
|
engine.init();
|
||||||
|
|
||||||
|
@ -27,6 +27,12 @@ public class ObjectGl {
|
|||||||
public static Matrix4f projection;
|
public static Matrix4f projection;
|
||||||
public static Matrix4f view;
|
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 zPos;
|
||||||
private float width; // To be used in setTextureWrap
|
private float width; // To be used in setTextureWrap
|
||||||
private float height;
|
private float height;
|
||||||
@ -61,6 +67,8 @@ public class ObjectGl {
|
|||||||
this.texture = new Texture(tex, 0);
|
this.texture = new Texture(tex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.xPos = 0.0f;
|
||||||
|
this.yPos = 0.0f;
|
||||||
this.zPos = z;
|
this.zPos = z;
|
||||||
this.height = h;
|
this.height = h;
|
||||||
this.width = w;
|
this.width = w;
|
||||||
@ -92,6 +100,9 @@ public class ObjectGl {
|
|||||||
public void resetTransform(){
|
public void resetTransform(){
|
||||||
this.transform = Matrix4f.identity();
|
this.transform = Matrix4f.identity();
|
||||||
this.scalingFactor = 1;
|
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){
|
public void translate(Vector3f vec){
|
||||||
vec.divXY(this.scalingFactor);
|
vec.divXY(this.scalingFactor);
|
||||||
this.transform = this.transform.multiply(Matrix4f.translate(vec));
|
this.transform = this.transform.multiply(Matrix4f.translate(vec));
|
||||||
|
this.xPos += vec.x;
|
||||||
|
this.yPos += vec.y;
|
||||||
this.zPos += vec.z;
|
this.zPos += vec.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,6 +223,14 @@ public class ObjectGl {
|
|||||||
this.vertexArray.swapTextureBufferObject(texture);
|
this.vertexArray.swapTextureBufferObject(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getXPos(){
|
||||||
|
return xPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getYPos(){
|
||||||
|
return yPos;
|
||||||
|
}
|
||||||
|
|
||||||
public float getZPos(){
|
public float getZPos(){
|
||||||
return zPos;
|
return zPos;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user