Using JS and GEN for 3D Math for Jitter visuals
And it works great, except that once I begin doing many transformations using many instances generated by jit.gl.multiple, things slow down and the 3d transforms are the reason for the slowdown (as far as I can tell).
Here’s just a sample of how I am using the Sylvester library.
this is a truncated js snippet:
var rightVector = codeObj.rightVector.multiply(-20.*Math.sin((p + 1) * time / 1000));
var downVector = codeObj.downVector.multiply(-30.*Math.sin((p + 1) * time / 1000));
var forwardVector = codeObj.forwardVector.multiply(-90.+codeObj.forwardAccumulation);
myglobal.primitivePositionMatrix.setcell(myglobal.primitiveCount, "val", resultVector.elements,resultVector.elements,resultVector.elements);
If I’m not being clear, please let me know.
Here’s how to use gen with JS. You have to create a .genjit file and load it via the @gen attribute in JS.
@Wesley can you post an example for get/set param from gen inside JS.
A [jit.gen] file composed with [param a 0. 1. 2.] in a .genjit file ….& want to pass value to [param a]
I tried somethings like :
var gen = new JitterObject("jit.gen")
gen.gen = "coords";
gen.param = "2 2 2"; and another things but without success [of course i modify the coords.genjit file].
Thanks for your advise.
You can do:
gen.param("a", [0.5, 0, 0]);