Skip to content

ilimei/gl-matrix-eval

Repository files navigation

glMartixEval

Actions Status NPM Version

glMatrix calculate library, use eval replace with func call

import MatrixEval from 'gl-matrix-eval';
import {vec2, vec3} from 'gl-matrix';

const add = new MatrixEval('v1 + v2');

console.info(add.exec({
    v1: vec2.fromValues(1, 2),
    v2: vec2.fromValues(2, 3),
})); // return vec2(3, 4);

console.info(add.exec({
    v1: vec3.fromValues(1, 2, 3),
    v2: vec3.fromValues(2, 3, 4),
})); // return vec3(3, 4, 7);