Search in sources :

Example 1 with Viewport

use of com.nilunder.bdx.gl.Viewport in project bdx by GoranM.

the class Camera method rayData.

public Vector3f[] rayData(Vector2f p) {
    Viewport vp = scene.viewport;
    Ray pr = data.getPickRay(p.x, Bdx.display.height() - p.y, vp.x, vp.y, vp.w, vp.h);
    return new Vector3f[] { new Vector3f(pr.origin.x, pr.origin.y, pr.origin.z), new Vector3f(pr.direction.x, pr.direction.y, pr.direction.z) };
}
Also used : Vector3f(javax.vecmath.Vector3f) Viewport(com.nilunder.bdx.gl.Viewport) Ray(com.badlogic.gdx.math.collision.Ray)

Example 2 with Viewport

use of com.nilunder.bdx.gl.Viewport in project bdx by GoranM.

the class Camera method screenPosition.

public Vector2f screenPosition(Vector3f p) {
    Viewport vp = scene.viewport;
    Vector3 out = data.project(new Vector3(p.x, p.y, p.z), vp.x, vp.y, vp.w, vp.h);
    return new Vector2f(Math.round(out.x), Math.round(out.y));
}
Also used : Vector2f(javax.vecmath.Vector2f) Viewport(com.nilunder.bdx.gl.Viewport) Vector3(com.badlogic.gdx.math.Vector3)

Aggregations

Viewport (com.nilunder.bdx.gl.Viewport)2 Vector3 (com.badlogic.gdx.math.Vector3)1 Ray (com.badlogic.gdx.math.collision.Ray)1 Vector2f (javax.vecmath.Vector2f)1 Vector3f (javax.vecmath.Vector3f)1