@polygonjs/polygonjs
Version:
node-based WebGL 3D engine https://polygonjs.com
648 lines (647 loc) • 17.7 kB
JavaScript
;
import { _matchArrayLength } from "./_ArrayUtils";
import { NamedFunction } from "./_Base";
import { JsConnectionPointType } from "../nodes/utils/io/connections/Js";
class MathNamedFunction2 extends NamedFunction {
}
class MathNamedFunction3 extends NamedFunction {
}
class MathNamedFunction4 extends NamedFunction {
}
class MathNamedFunction5 extends NamedFunction {
}
class MathNamedFunction6 extends NamedFunction {
}
class MathNamedFunction7 extends NamedFunction {
}
class MathNamedFunction8 extends NamedFunction {
}
export const _vectorFunctionName_1 = (inputType) => {
if (inputType == JsConnectionPointType.COLOR) {
return "mathColor_1";
}
if (inputType == JsConnectionPointType.VECTOR2) {
return "mathVector2_1";
}
if (inputType == JsConnectionPointType.VECTOR3) {
return "mathVector3_1";
}
if (inputType == JsConnectionPointType.VECTOR4) {
return "mathVector4_1";
}
};
export const _vectorFunctionName_2 = (inputType) => {
if (inputType == JsConnectionPointType.COLOR) {
return "mathColor_2";
}
if (inputType == JsConnectionPointType.VECTOR2) {
return "mathVector2_2";
}
if (inputType == JsConnectionPointType.VECTOR3) {
return "mathVector3_2";
}
if (inputType == JsConnectionPointType.VECTOR4) {
return "mathVector4_2";
}
};
export const _vectorFunctionName_3 = (inputType) => {
if (inputType == JsConnectionPointType.COLOR) {
return "mathColor_3";
}
if (inputType == JsConnectionPointType.VECTOR2) {
return "mathVector2_3";
}
if (inputType == JsConnectionPointType.VECTOR3) {
return "mathVector3_3";
}
if (inputType == JsConnectionPointType.VECTOR4) {
return "mathVector4_3";
}
};
export const _vectorFunctionName_3vvf = (inputType) => {
if (inputType == JsConnectionPointType.COLOR) {
return "mathColor_3vvf";
}
if (inputType == JsConnectionPointType.VECTOR2) {
return "mathVector2_3vvf";
}
if (inputType == JsConnectionPointType.VECTOR3) {
return "mathVector3_3vvf";
}
if (inputType == JsConnectionPointType.VECTOR4) {
return "mathVector4_3vvf";
}
};
export const _vectorFunctionName_4 = (inputType) => {
if (inputType == JsConnectionPointType.COLOR) {
return "mathColor_4";
}
if (inputType == JsConnectionPointType.VECTOR2) {
return "mathVector2_4";
}
if (inputType == JsConnectionPointType.VECTOR3) {
return "mathVector3_4";
}
if (inputType == JsConnectionPointType.VECTOR4) {
return "mathVector4_4";
}
};
export const _vectorFunctionName_5 = (inputType) => {
if (inputType == JsConnectionPointType.COLOR) {
return "mathColor_5";
}
if (inputType == JsConnectionPointType.VECTOR2) {
return "mathVector2_5";
}
if (inputType == JsConnectionPointType.VECTOR3) {
return "mathVector3_5";
}
if (inputType == JsConnectionPointType.VECTOR4) {
return "mathVector4_5";
}
};
const COLOR_FUNC_1 = (_func, src, target) => {
target.r = _func(src.r);
target.g = _func(src.g);
target.b = _func(src.b);
return target;
};
const COLOR_FUNC_2 = (_func, src, arg1, target) => {
target.r = _func(src.r, arg1.r);
target.g = _func(src.g, arg1.g);
target.b = _func(src.b, arg1.b);
return target;
};
const COLOR_FUNC_3 = (_func, src, arg1, arg2, target) => {
target.r = _func(src.r, arg1.r, arg2.r);
target.g = _func(src.g, arg1.g, arg2.g);
target.b = _func(src.b, arg1.b, arg2.b);
return target;
};
const COLOR_FUNC_3VVF = (_func, src, arg1, arg2, target) => {
target.r = _func(src.r, arg1.r, arg2);
target.g = _func(src.g, arg1.g, arg2);
target.b = _func(src.b, arg1.b, arg2);
return target;
};
const COLOR_FUNC_4 = (_func, src, arg1, arg2, arg3, target) => {
target.r = _func(src.r, arg1.r, arg2.r, arg3.r);
target.g = _func(src.g, arg1.g, arg2.g, arg3.g);
target.b = _func(src.b, arg1.b, arg2.b, arg3.b);
return target;
};
const COLOR_FUNC_5 = (_func, src, arg1, arg2, arg3, arg4, target) => {
target.r = _func(src.r, arg1.r, arg2.r, arg3.r, arg4.r);
target.g = _func(src.g, arg1.g, arg2.g, arg3.g, arg4.g);
target.b = _func(src.b, arg1.b, arg2.b, arg3.b, arg4.b);
return target;
};
const VECTOR2_FUNC_1 = (_func, src, target) => {
target.x = _func(src.x);
target.y = _func(src.y);
return target;
};
const VECTOR2_FUNC_2 = (_func, src, arg1, target) => {
target.x = _func(src.x, arg1.x);
target.y = _func(src.y, arg1.y);
return target;
};
const VECTOR2_FUNC_3 = (_func, src, arg1, arg2, target) => {
target.x = _func(src.x, arg1.x, arg2.x);
target.y = _func(src.y, arg1.y, arg2.y);
return target;
};
const VECTOR2_FUNC_3VVF = (_func, src, arg1, arg2, target) => {
target.x = _func(src.x, arg1.x, arg2);
target.y = _func(src.y, arg1.y, arg2);
return target;
};
const VECTOR2_FUNC_4 = (_func, src, arg1, arg2, arg3, target) => {
target.x = _func(src.x, arg1.x, arg2.x, arg3.x);
target.y = _func(src.y, arg1.y, arg2.y, arg3.y);
return target;
};
const VECTOR2_FUNC_5 = (_func, src, arg1, arg2, arg3, arg4, target) => {
target.x = _func(src.x, arg1.x, arg2.x, arg3.x, arg4.x);
target.y = _func(src.y, arg1.y, arg2.y, arg3.y, arg4.y);
return target;
};
const VECTOR3_FUNC_1 = (_func, src, target) => {
target.x = _func(src.x);
target.y = _func(src.y);
target.z = _func(src.z);
return target;
};
const VECTOR3_FUNC_2 = (_func, src, arg1, target) => {
target.x = _func(src.x, arg1.x);
target.y = _func(src.y, arg1.y);
target.z = _func(src.z, arg1.z);
return target;
};
const VECTOR3_FUNC_3 = (_func, src, arg1, arg2, target) => {
target.x = _func(src.x, arg1.x, arg2.x);
target.y = _func(src.y, arg1.y, arg2.y);
target.z = _func(src.z, arg1.z, arg2.z);
return target;
};
const VECTOR3_FUNC_3VVF = (_func, src, arg1, arg2, target) => {
target.x = _func(src.x, arg1.x, arg2);
target.y = _func(src.y, arg1.y, arg2);
target.z = _func(src.z, arg1.z, arg2);
return target;
};
const VECTOR3_FUNC_4 = (_func, src, arg1, arg2, arg3, target) => {
target.x = _func(src.x, arg1.x, arg2.x, arg3.x);
target.y = _func(src.y, arg1.y, arg2.y, arg3.y);
target.z = _func(src.z, arg1.z, arg2.z, arg3.z);
return target;
};
const VECTOR3_FUNC_5 = (_func, src, arg1, arg2, arg3, arg4, target) => {
target.x = _func(src.x, arg1.x, arg2.x, arg3.x, arg4.x);
target.y = _func(src.y, arg1.y, arg2.y, arg3.y, arg4.y);
target.z = _func(src.z, arg1.z, arg2.z, arg3.z, arg4.z);
return target;
};
const VECTOR4_FUNC_1 = (_func, src, target) => {
target.x = _func(src.x);
target.y = _func(src.y);
target.z = _func(src.z);
target.w = _func(src.w);
return target;
};
const VECTOR4_FUNC_2 = (_func, src, arg1, target) => {
target.x = _func(src.x, arg1.x);
target.y = _func(src.y, arg1.y);
target.z = _func(src.z, arg1.z);
target.w = _func(src.w, arg1.w);
return target;
};
const VECTOR4_FUNC_3 = (_func, src, arg1, arg2, target) => {
target.x = _func(src.x, arg1.x, arg2.x);
target.y = _func(src.y, arg1.y, arg2.y);
target.z = _func(src.z, arg1.z, arg2.z);
target.w = _func(src.w, arg1.w, arg2.w);
return target;
};
const VECTOR4_FUNC_3VVF = (_func, src, arg1, arg2, target) => {
target.x = _func(src.x, arg1.x, arg2);
target.y = _func(src.y, arg1.y, arg2);
target.z = _func(src.z, arg1.z, arg2);
target.w = _func(src.w, arg1.w, arg2);
return target;
};
const VECTOR4_FUNC_4 = (_func, src, arg1, arg2, arg3, target) => {
target.x = _func(src.x, arg1.x, arg2.x, arg3.x);
target.y = _func(src.y, arg1.y, arg2.y, arg3.y);
target.z = _func(src.z, arg1.z, arg2.z, arg3.z);
target.w = _func(src.w, arg1.w, arg2.w, arg3.w);
return target;
};
const VECTOR4_FUNC_5 = (_func, src, arg1, arg2, arg3, arg4, target) => {
target.x = _func(src.x, arg1.x, arg2.x, arg3.x, arg4.x);
target.y = _func(src.y, arg1.y, arg2.y, arg3.y, arg4.y);
target.z = _func(src.z, arg1.z, arg2.z, arg3.z, arg4.z);
target.w = _func(src.w, arg1.w, arg2.w, arg3.w, arg4.w);
return target;
};
export class mathFloat_1 extends MathNamedFunction2 {
static type() {
return "mathFloat_1";
}
func(_func, value) {
return _func(value);
}
}
export class mathFloat_2 extends MathNamedFunction3 {
static type() {
return "mathFloat_2";
}
func(_func, value, arg1) {
return _func(value, arg1);
}
}
export class mathFloat_3 extends MathNamedFunction4 {
static type() {
return "mathFloat_3";
}
func(_func, value, arg1, arg2) {
return _func(value, arg1, arg2);
}
}
export class mathFloat_4 extends MathNamedFunction5 {
static type() {
return "mathFloat_4";
}
func(_func, value, arg1, arg2, arg3) {
return _func(value, arg1, arg2, arg3);
}
}
export class mathFloat_5 extends MathNamedFunction6 {
static type() {
return "mathFloat_5";
}
func(_func, value, arg1, arg2, arg3, arg4) {
return _func(value, arg1, arg2, arg3, arg4);
}
}
export class mathColor_1 extends MathNamedFunction3 {
constructor() {
super(...arguments);
this.func = COLOR_FUNC_1;
}
static type() {
return "mathColor_1";
}
}
export class mathColor_2 extends MathNamedFunction4 {
constructor() {
super(...arguments);
this.func = COLOR_FUNC_2;
}
static type() {
return "mathColor_2";
}
}
export class mathColor_3 extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = COLOR_FUNC_3;
}
static type() {
return "mathColor_3";
}
}
export class mathColor_3vvf extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = COLOR_FUNC_3VVF;
}
static type() {
return "mathColor_3vvf";
}
}
export class mathColor_4 extends MathNamedFunction6 {
constructor() {
super(...arguments);
this.func = COLOR_FUNC_4;
}
static type() {
return "mathColor_4";
}
}
export class mathColor_5 extends MathNamedFunction7 {
constructor() {
super(...arguments);
this.func = COLOR_FUNC_5;
}
static type() {
return "mathColor_5";
}
}
export class mathVector2_1 extends MathNamedFunction3 {
constructor() {
super(...arguments);
this.func = VECTOR2_FUNC_1;
}
static type() {
return "mathVector2_1";
}
}
export class mathVector2_2 extends MathNamedFunction4 {
constructor() {
super(...arguments);
this.func = VECTOR2_FUNC_2;
}
static type() {
return "mathVector2_2";
}
}
export class mathVector2_3 extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = VECTOR2_FUNC_3;
}
static type() {
return "mathVector2_3";
}
}
export class mathVector2_3vvf extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = VECTOR2_FUNC_3VVF;
}
static type() {
return "mathVector2_3vvf";
}
}
export class mathVector2_4 extends MathNamedFunction6 {
constructor() {
super(...arguments);
this.func = VECTOR2_FUNC_4;
}
static type() {
return "mathVector2_4";
}
}
export class mathVector2_5 extends MathNamedFunction7 {
constructor() {
super(...arguments);
this.func = VECTOR2_FUNC_5;
}
static type() {
return "mathVector2_5";
}
}
export class mathVector3_1 extends MathNamedFunction3 {
constructor() {
super(...arguments);
this.func = VECTOR3_FUNC_1;
}
static type() {
return "mathVector3_1";
}
}
export class mathVector3_2 extends MathNamedFunction4 {
constructor() {
super(...arguments);
this.func = VECTOR3_FUNC_2;
}
static type() {
return "mathVector3_2";
}
}
export class mathVector3_3 extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = VECTOR3_FUNC_3;
}
static type() {
return "mathVector3_3";
}
}
export class mathVector3_3vvf extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = VECTOR3_FUNC_3VVF;
}
static type() {
return "mathVector3_3vvf";
}
}
export class mathVector3_4 extends MathNamedFunction6 {
constructor() {
super(...arguments);
this.func = VECTOR3_FUNC_4;
}
static type() {
return "mathVector3_4";
}
}
export class mathVector3_5 extends MathNamedFunction7 {
constructor() {
super(...arguments);
this.func = VECTOR3_FUNC_5;
}
static type() {
return "mathVector3_5";
}
}
export class mathVector4_1 extends MathNamedFunction3 {
constructor() {
super(...arguments);
this.func = VECTOR4_FUNC_1;
}
static type() {
return "mathVector4_1";
}
}
export class mathVector4_2 extends MathNamedFunction4 {
constructor() {
super(...arguments);
this.func = VECTOR4_FUNC_2;
}
static type() {
return "mathVector4_2";
}
}
export class mathVector4_3 extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = VECTOR4_FUNC_3;
}
static type() {
return "mathVector4_3";
}
}
export class mathVector4_3vvf extends MathNamedFunction5 {
constructor() {
super(...arguments);
this.func = VECTOR4_FUNC_3VVF;
}
static type() {
return "mathVector4_3vvf";
}
}
export class mathVector4_4 extends MathNamedFunction6 {
constructor() {
super(...arguments);
this.func = VECTOR4_FUNC_4;
}
static type() {
return "mathVector4_4";
}
}
export class mathVector4_5 extends MathNamedFunction7 {
constructor() {
super(...arguments);
this.func = VECTOR4_FUNC_5;
}
static type() {
return "mathVector4_5";
}
}
export class mathPrimArray_1 extends MathNamedFunction3 {
static type() {
return "mathPrimArray_1";
}
func(_func, srcElements, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0] != null ? srcElements[0] : 0);
let i = 0;
for (let src of srcElements) {
targetElements[i] = _func(src);
i++;
}
return targetElements;
}
}
export class mathPrimArray_2 extends MathNamedFunction4 {
static type() {
return "mathPrimArray_2";
}
func(_func, srcElements, arg1, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0] != null ? srcElements[0] : 0);
let i = 0;
for (let src of srcElements) {
targetElements[i] = _func(src, arg1);
i++;
}
return targetElements;
}
}
export class mathPrimArray_3 extends MathNamedFunction5 {
static type() {
return "mathPrimArray_3";
}
func(_func, srcElements, arg1, arg2, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0] != null ? srcElements[0] : 0);
let i = 0;
for (let src of srcElements) {
targetElements[i] = _func(src, arg1, arg2);
i++;
}
return targetElements;
}
}
export class mathPrimArray_4 extends MathNamedFunction6 {
static type() {
return "mathPrimArray_4";
}
func(_func, srcElements, arg1, arg2, arg3, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0] != null ? srcElements[0] : 0);
let i = 0;
for (let src of srcElements) {
targetElements[i] = _func(src, arg1, arg2, arg3);
i++;
}
return targetElements;
}
}
export class mathPrimArray_5 extends MathNamedFunction7 {
static type() {
return "mathPrimArray_5";
}
func(_func, srcElements, arg1, arg2, arg3, arg4, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0] != null ? srcElements[0] : 0);
let i = 0;
for (let src of srcElements) {
targetElements[i] = _func(src, arg1, arg2, arg3, arg4);
i++;
}
return targetElements;
}
}
export class mathVectorArray_1 extends MathNamedFunction4 {
static type() {
return "mathVectorArray_1";
}
func(_func, vectorFunc, srcElements, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0].clone());
let i = 0;
for (let src of srcElements) {
const target = targetElements[i];
vectorFunc(_func, src, target);
i++;
}
return targetElements;
}
}
export class mathVectorArray_2 extends MathNamedFunction5 {
static type() {
return "mathVectorArray_2";
}
func(_func, vectorFunc, srcElements, arg1, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0].clone());
let i = 0;
for (let src of srcElements) {
const target = targetElements[i];
vectorFunc(_func, src, arg1, target);
i++;
}
return targetElements;
}
}
export class mathVectorArray_3 extends MathNamedFunction6 {
static type() {
return "mathVectorArray_3";
}
func(_func, vectorFunc, srcElements, arg1, arg2, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0].clone());
let i = 0;
for (let src of srcElements) {
const target = targetElements[i];
vectorFunc(_func, src, arg1, arg2, target);
i++;
}
return targetElements;
}
}
export class mathVectorArray_4 extends MathNamedFunction7 {
static type() {
return "mathVectorArray_4";
}
func(_func, vectorFunc, srcElements, arg1, arg2, arg3, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0].clone());
let i = 0;
for (let src of srcElements) {
const target = targetElements[i];
vectorFunc(_func, src, arg1, arg2, arg3, target);
i++;
}
return targetElements;
}
}
export class mathVectorArray_5 extends MathNamedFunction8 {
static type() {
return "mathVectorArray_5";
}
func(_func, vectorFunc, srcElements, arg1, arg2, arg3, arg4, targetElements) {
_matchArrayLength(srcElements, targetElements, () => srcElements[0].clone());
let i = 0;
for (let src of srcElements) {
const target = targetElements[i];
vectorFunc(_func, src, arg1, arg2, arg3, arg4, target);
i++;
}
return targetElements;
}
}