use of javax.vecmath.Vector2f in project bdx by GoranM.
the class Mesh method serialized.
public String serialized() {
HashMap<String, Float[]> out = new HashMap<String, Float[]>();
Float[] d;
for (int i = 0; i < materials.size(); i++) {
d = new Float[getVertexCount(i) * Bdx.VERT_STRIDE];
for (int v = 0; v < getVertexCount(i); v++) {
int vi = v * 8;
Vector3f p = vertPos(i, v);
d[vi] = p.x;
d[vi + 1] = p.y;
d[vi + 2] = p.z;
p = vertNor(i, v);
d[vi + 3] = p.x;
d[vi + 4] = p.y;
d[vi + 5] = p.z;
Vector2f u = vertUV(i, v);
d[vi + 6] = u.x;
d[vi + 7] = u.y;
}
out.put(materials.get(i).name(), d);
}
return new Json().toJson(out);
}
use of javax.vecmath.Vector2f in project bdx by GoranM.
the class Mouse method positionNormalized.
public void positionNormalized(float x, float y) {
Vector2f c = Bdx.display.center();
position((int) (x * c.x * 2), (int) ((1 - y) * c.y * 2));
}
use of javax.vecmath.Vector2f in project bdx by GoranM.
the class Camera method initData.
public void initData(Type type) {
this.type = type;
if (type == Type.PERSPECTIVE) {
data = new PerspectiveCamera();
} else {
data = new OrthographicCamera();
}
resolution = new Vector2f();
ignoreObjects = new ArrayListNamed<GameObject>();
}
use of javax.vecmath.Vector2f 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));
}
use of javax.vecmath.Vector2f in project bdx by GoranM.
the class ScreenShader method check.
private void check() {
if (!isCompiled()) {
String msg = "Shader compilation error in ScreenShader at:\n" + getLog() + "\n\n\n< Vertex Shader >\n\n" + vertexShaderPath + "\n\n< Fragment Shader >\n\n" + fragmentShaderPath + "\n\n";
throw new RuntimeException(msg);
}
renderScale = new Vector2f(1, 1);
overlay = false;
}
Aggregations