import { Vector3 } from "../math/Vector3" ; import { Vector2 } from "../math/Vector2" ; import { Vector4 } from "../math/Vector4" ; import { Color } from "../graphics/Color" ; import { Matrix44 } from "../math/Matrix44" ; import { Plane } from "../math/Plane" ; import { VertexBuffer } from "../graphics/VertexBuffer" ; import { Triangle } from "../math/Triangle" ; import { Ray } from "../math/Ray" ; import { Basis } from "../math/Basis" ; import { Interfaces } from "../core/Interfaces" ; import { Quaternion } from "../math/Quaternion" ; import { ObjectProps } from "../core/Types" ; export class BehaviorAPIFactory { static variableObjectFactory = { Vector2 : ( ... args ) => new Vector2 ( ... args ) , Vector3 : ( ... args ) => new Vector3 ( ... args ) , Vector4 : ( ... args ) => new Vector4 ( ... args ) , Color : ( ... args ) => new Color ( ... args ) , Matrix44 : ( data ? ) => new Matrix44 ( data ) , Quaternion : ( x ? , y ? , z ? , w ? ) => new Quaternion ( x , y , z , w ) , Map : ( ) => new Map ( ) , Plane : ( normal ? , distFromOrigin ? ) => new Plane ( normal , distFromOrigin ) , Triangle : ( a ? , b ? , c ? ) => new Triangle ( a , b , c ) , Ray : ( origin ? , direction ? , length ? ) => new Ray ( origin , direction , length ) , Basis : ( ) => new Basis ( ) , VertexBuffer : ( props ? ) => new VertexBuffer ( props ) , Array : ( length ? ) => new Array ( length ) , Promise : ( executor ) => new Promise ( executor ) } ; static createObject ( typeName , ... args ) { let doIt = BehaviorAPIFactory . variableObjectFactory [ typeName ] ; if ( doIt ) { return doIt ( ... args ) ; } else { return Interfaces . factory . createObject ( typeName , ... args ) ; } } }