use of monkstone.vecmath.vec2.Vec2 in project propane by ruby-processing.
the class Vec3 method toVertexUV.
/**
* Sends this Vec3D as a processing vertex uv
*
* @param context ThreadContext
* @param args IRubyObject[]
*/
@JRubyMethod(name = "to_vertex_uv", rest = true)
public void toVertexUV(ThreadContext context, IRubyObject... args) {
int count = args.length;
double u = 0;
double v = 0;
if (count == 3) {
u = args[1] instanceof RubyFloat ? ((RubyFloat) args[1]).getValue() : ((RubyFixnum) args[1]).getDoubleValue();
v = args[2] instanceof RubyFloat ? ((RubyFloat) args[2]).getValue() : ((RubyFixnum) args[2]).getDoubleValue();
}
if (count == 2) {
Vec2 texture = (Vec2) args[1].toJava(Vec2.class);
u = texture.javax();
v = texture.javay();
}
JRender renderer = (JRender) args[0].toJava(JRender.class);
renderer.vertex(jx, jy, jz, u, v);
}
Aggregations