Search in sources :

Example 1 with JRender

use of monkstone.vecmath.JRender in project propane by ruby-processing.

the class Vec2 method toCurveVertex.

/**
 * To curve vertex
 *
 * @param context ThreadContext
 * @param object IRubyObject vertex renderer
 */
@JRubyMethod(name = "to_curve_vertex")
public void toCurveVertex(ThreadContext context, IRubyObject object) {
    JRender renderer = (JRender) object.toJava(JRender.class);
    renderer.curveVertex(jx, jy);
}
Also used : JRender(monkstone.vecmath.JRender) JRubyMethod(org.jruby.anno.JRubyMethod)

Example 2 with JRender

use of monkstone.vecmath.JRender in project propane by ruby-processing.

the class Vec3 method toNormal.

/**
 * Sends this Vec3D as a processing normal
 *
 * @param context ThreadContext
 * @param object IRubyObject vertex renderer
 */
@JRubyMethod(name = "to_normal")
public void toNormal(ThreadContext context, IRubyObject object) {
    JRender renderer = (JRender) object.toJava(JRender.class);
    renderer.normal(jx, jy, jz);
}
Also used : JRender(monkstone.vecmath.JRender) JRubyMethod(org.jruby.anno.JRubyMethod)

Example 3 with JRender

use of monkstone.vecmath.JRender 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);
}
Also used : Vec2(monkstone.vecmath.vec2.Vec2) RubyFloat(org.jruby.RubyFloat) JRender(monkstone.vecmath.JRender) RubyFixnum(org.jruby.RubyFixnum) JRubyMethod(org.jruby.anno.JRubyMethod)

Example 4 with JRender

use of monkstone.vecmath.JRender in project propane by ruby-processing.

the class Vec3 method toVertex.

/**
 * To vertex
 *
 * @param context ThreadContext
 * @param object IRubyObject vertex renderer
 */
@JRubyMethod(name = "to_vertex")
public void toVertex(ThreadContext context, IRubyObject object) {
    JRender renderer = (JRender) object.toJava(JRender.class);
    renderer.vertex(jx, jy, jz);
}
Also used : JRender(monkstone.vecmath.JRender) JRubyMethod(org.jruby.anno.JRubyMethod)

Example 5 with JRender

use of monkstone.vecmath.JRender in project propane by ruby-processing.

the class Vec3 method toCurveVertex.

/**
 * To curve vertex
 *
 * @param context ThreadContext
 * @param object IRubyObject vertex renderer
 */
@JRubyMethod(name = "to_curve_vertex")
public void toCurveVertex(ThreadContext context, IRubyObject object) {
    JRender renderer = (JRender) object.toJava(JRender.class);
    renderer.curveVertex(jx, jy, jz);
}
Also used : JRender(monkstone.vecmath.JRender) JRubyMethod(org.jruby.anno.JRubyMethod)

Aggregations

JRender (monkstone.vecmath.JRender)6 JRubyMethod (org.jruby.anno.JRubyMethod)6 Vec2 (monkstone.vecmath.vec2.Vec2)1 RubyFixnum (org.jruby.RubyFixnum)1 RubyFloat (org.jruby.RubyFloat)1