;
/**
* Returns a wrapper of the node that matches the provided reference name.
diff --git a/express-serve-static-core/express-serve-static-core.d.ts b/express-serve-static-core/express-serve-static-core.d.ts
index e80ffa85a9..624ed5ae5d 100644
--- a/express-serve-static-core/express-serve-static-core.d.ts
+++ b/express-serve-static-core/express-serve-static-core.d.ts
@@ -97,6 +97,10 @@ declare module "express-serve-static-core" {
use: IRouterHandler & IRouterMatcher;
route(prefix: PathParams): IRoute;
+ /**
+ * Stack of configured routes
+ */
+ stack: any[];
}
interface IRoute {
@@ -1048,7 +1052,7 @@ declare module "express-serve-static-core" {
routes: any;
/**
- * Using to all registered routes in Express Application
+ * Used to get all registered routes in Express Application
*/
_router: any;
}
diff --git a/express/express-tests.ts b/express/express-tests.ts
index 439ef95012..92cef00b85 100644
--- a/express/express-tests.ts
+++ b/express/express-tests.ts
@@ -1,101 +1,114 @@
///
///
-
import * as express from 'express';
-var app = express();
-
-app.engine('jade', require('jade').__express);
-app.engine('html', require('ejs').renderFile);
-
-express.static.mime.define({
- 'application/fx': ['fx']
-});
-app.use('/static', express.static(__dirname + '/public'));
-
-// simple logger
-app.use(function(req, res, next){
- console.log('%s %s', req.method, req.url);
- next();
-});
-
-app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
- console.error(err);
- next(err);
-});
-app.get('/', function(req, res){
- res.send('hello world');
-});
+namespace express_tests {
-const router = express.Router();
+ var app = express();
+ app.engine('jade', require('jade').__express);
+ app.engine('html', require('ejs').renderFile);
-const pathStr : string = 'test';
-const pathRE : RegExp = /test/;
-const path = true? pathStr : pathRE;
+ express.static.mime.define({
+ 'application/fx': ['fx']
+ });
+ app.use('/static', express.static(__dirname + '/public'));
-router.get(path);
-router.put(path)
-router.post(path);
-router.delete(path);
-router.get(pathStr);
-router.put(pathStr)
-router.post(pathStr);
-router.delete(pathStr);
-router.get(pathRE);
-router.put(pathRE)
-router.post(pathRE);
-router.delete(pathRE);
-
-router.use((req, res, next) => { next(); })
-router.route('/users')
- .get((req, res, next) => {
- let types: string[] = req.accepts();
- let type: string | boolean = req.accepts('json');
- type = req.accepts(['json', 'text']);
- type = req.accepts('json', 'text');
-
- let charsets: string[] = req.acceptsCharsets();
- let charset: string | boolean = req.acceptsCharsets('utf-8');
- charset = req.acceptsCharsets(['utf-8', 'utf-16']);
- charset = req.acceptsCharsets('utf-8', 'utf-16');
-
- let encodings: string[] = req.acceptsEncodings();
- let encoding: string | boolean = req.acceptsEncodings('gzip');
- encoding = req.acceptsEncodings(['gzip', 'deflate']);
- encoding = req.acceptsEncodings('gzip', 'deflate');
-
- let languages: string[] = req.acceptsLanguages();
- let language: string | boolean = req.acceptsLanguages('en');
- language = req.acceptsLanguages(['en', 'ja']);
- language = req.acceptsLanguages('en', 'ja');
-
- res.send(req.query['token']);
+ // simple logger
+ app.use(function(req, res, next) {
+ console.log('%s %s', req.method, req.url);
+ next();
});
-router.get('/user/:id', function(req, res, next) {
- if (req.params.id == 0) next('route');
- else next();
-}, function(req, res, next) {
- res.render('regular');
-});
+ app.use(function(err: any, req: express.Request, res: express.Response, next: express.NextFunction) {
+ console.error(err);
+ next(err);
+ });
-app.use((req, res, next) => {
- // hacky trick, router is just a handler
- router(req, res, next);
-});
-app.use(router);
+ app.get('/', function(req, res) {
+ res.send('hello world');
+ });
-app.listen(3000);
+ const router = express.Router();
-const next: express.NextFunction = () => {};
-const nextWithArgument: express.NextFunction = (err: any) => {};
-/**
- * The express.Application is compatible with http.createServer
- */
+ const pathStr: string = 'test';
+ const pathRE: RegExp = /test/;
+ const path = true ? pathStr : pathRE;
+ router.get(path);
+ router.put(path)
+ router.post(path);
+ router.delete(path);
+ router.get(pathStr);
+ router.put(pathStr)
+ router.post(pathStr);
+ router.delete(pathStr);
+ router.get(pathRE);
+ router.put(pathRE)
+ router.post(pathRE);
+ router.delete(pathRE);
+
+ router.use((req, res, next) => { next(); })
+ router.route('/users')
+ .get((req, res, next) => {
+ let types: string[] = req.accepts();
+ let type: string | boolean = req.accepts('json');
+ type = req.accepts(['json', 'text']);
+ type = req.accepts('json', 'text');
+
+ let charsets: string[] = req.acceptsCharsets();
+ let charset: string | boolean = req.acceptsCharsets('utf-8');
+ charset = req.acceptsCharsets(['utf-8', 'utf-16']);
+ charset = req.acceptsCharsets('utf-8', 'utf-16');
+
+ let encodings: string[] = req.acceptsEncodings();
+ let encoding: string | boolean = req.acceptsEncodings('gzip');
+ encoding = req.acceptsEncodings(['gzip', 'deflate']);
+ encoding = req.acceptsEncodings('gzip', 'deflate');
+
+ let languages: string[] = req.acceptsLanguages();
+ let language: string | boolean = req.acceptsLanguages('en');
+ language = req.acceptsLanguages(['en', 'ja']);
+ language = req.acceptsLanguages('en', 'ja');
+
+ res.send(req.query['token']);
+ });
+
+ router.get('/user/:id', function(req, res, next) {
+ if (req.params.id == 0) next('route');
+ else next();
+ }, function(req, res, next) {
+ res.render('regular');
+ });
+
+ app.use((req, res, next) => {
+ // hacky trick, router is just a handler
+ router(req, res, next);
+ });
+
+ app.use(router);
+
+ app.listen(3000);
+
+ const next: express.NextFunction = () => { };
+}
+
+/***************************
+ * *
+ * Test with other modules *
+ * *
+ ***************************/
import * as http from 'http';
-http.createServer(app);
+
+
+namespace node_tests {
+
+ {
+ // http.createServer can take express application
+ const app: express.Application = express();
+ http.createServer(app).listen(5678);
+ }
+}
diff --git a/facebook-js-sdk/facebook-js-sdk-tests.ts b/facebook-js-sdk/facebook-js-sdk-tests.ts
index 49e615f529..41c0eaff40 100644
--- a/facebook-js-sdk/facebook-js-sdk-tests.ts
+++ b/facebook-js-sdk/facebook-js-sdk-tests.ts
@@ -14,6 +14,12 @@ FB.getLoginStatus(function(response: fb.AuthResponse) {
console.log(response.authResponse.accessToken);
});
+FB.getLoginStatus(function(response: fb.AuthResponse) {
+ console.log(response);
+ console.log(response.status);
+ console.log(response.authResponse.accessToken);
+}, true);
+
FB.getAuthResponse(function(response: fb.AuthResponse) {
console.log(response);
console.log(response.status);
diff --git a/facebook-js-sdk/facebook-js-sdk.d.ts b/facebook-js-sdk/facebook-js-sdk.d.ts
index 5353353911..bee34f0a2c 100644
--- a/facebook-js-sdk/facebook-js-sdk.d.ts
+++ b/facebook-js-sdk/facebook-js-sdk.d.ts
@@ -8,10 +8,11 @@ declare var FB: fb.FacebookStatic;
declare namespace facebook {
interface FacebookStatic {
- // api: any;
- // AppEvents: any;
- // Canvas: any;
- // Event: any;
+ api: any;
+ AppEvents: any;
+ Canvas: any;
+ Event: any;
+
/**
* The method FB.getAuthResponse() is a synchronous accessor for the current authResponse.
* The synchronous nature of this method is what sets it apart from the other login methods.
@@ -25,7 +26,7 @@ declare namespace facebook {
*
* @param callback function to handle the response.
*/
- getLoginStatus(callback: (response: AuthResponse) => void): void;
+ getLoginStatus(callback: (response: AuthResponse) => void, roundtrip?: boolean ): void;
/**
* The method FB.init() is used to initialize and setup the SDK.
*
@@ -49,8 +50,9 @@ declare namespace facebook {
* @param callback function to handle the response
*/
logout(callback: (response: AuthResponse) => void): void;
- // ui: any;
- // XFBML: any;
+
+ ui: any;
+ XFBML: any;
}
interface InitParams {
diff --git a/fs-extra-promise/fs-extra-promise.d.ts b/fs-extra-promise/fs-extra-promise.d.ts
index bdf8360b77..2243a4d1c5 100644
--- a/fs-extra-promise/fs-extra-promise.d.ts
+++ b/fs-extra-promise/fs-extra-promise.d.ts
@@ -6,7 +6,7 @@
// Imported from: https://github.com/soywiz/typescript-node-definitions/fs-extra.d.ts via TSD fs-extra definition
///
-///
+///
declare module "fs-extra-promise" {
import stream = require("stream");
diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts
index 3dc72d7075..64b7cf6a02 100644
--- a/github-electron/github-electron.d.ts
+++ b/github-electron/github-electron.d.ts
@@ -1,4 +1,4 @@
-// Type definitions for Electron v1.3.5
+// Type definitions for Electron v1.3.6
// Project: http://electron.atom.io/
// Definitions by: jedmao , rhysd , Milan Burda
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -62,7 +62,7 @@ declare namespace Electron {
/**
* Emitted when Electron has finished initialization.
*/
- on(event: 'ready', listener: Function): this;
+ on(event: 'ready', listener: (event: Event, launchInfo: Object) => void): this;
/**
* Emitted when all windows have been closed.
*
@@ -218,6 +218,10 @@ declare namespace Electron {
args?: string[],
execPath?: string
}): void;
+ /**
+ * @returns Whether Electron has finished initializing.
+ */
+ isReady(): boolean;
/**
* On Linux, focuses on the first visible window.
* On macOS, makes the application the active app.
@@ -1367,6 +1371,12 @@ declare namespace Electron {
}
interface WebPreferences {
+ /**
+ * Whether to enable DevTools.
+ * If it is set to false, can not use BrowserWindow.webContents.openDevTools() to open DevTools.
+ * Default: true.
+ */
+ devTools?: boolean;
/**
* Whether node integration is enabled.
* Default: true.
@@ -1957,7 +1967,7 @@ declare namespace Electron {
interface CrashReporterStartOptions {
/**
- * Default: Electron
+ * Default: app.getName()
*/
productName?: string;
companyName: string;
@@ -3392,16 +3402,18 @@ declare namespace Electron {
interface Shell {
/**
* Show the given file in a file manager. If possible, select the file.
+ * @returns Whether the item was successfully shown.
*/
- showItemInFolder(fullPath: string): void;
+ showItemInFolder(fullPath: string): boolean;
/**
* Open the given file in the desktop's default manner.
+ * @returns Whether the item was successfully shown.
*/
- openItem(fullPath: string): void;
+ openItem(fullPath: string): boolean;
/**
* Open the given external protocol URL in the desktop's default manner
* (e.g., mailto: URLs in the default mail user agent).
- * @returns true if an application was available to open the URL, false otherwise.
+ * @returns Whether an application was available to open the URL.
*/
openExternal(url: string, options?: {
/**
@@ -3412,7 +3424,7 @@ declare namespace Electron {
}): boolean;
/**
* Move the given file to trash.
- * @returns boolean status for the operation.
+ * @returns Whether the item was successfully moved to the trash.
*/
moveItemToTrash(fullPath: string): boolean;
/**
diff --git a/gl-matrix/gl-matrix-legacy-tests.ts b/gl-matrix/gl-matrix-legacy-tests.ts
new file mode 100644
index 0000000000..5cfa9a1c3a
--- /dev/null
+++ b/gl-matrix/gl-matrix-legacy-tests.ts
@@ -0,0 +1,362 @@
+///
+
+// common
+var result: number = glMatrix.toRadian(180);
+
+var out: GLM.IArray;
+var outVal: number;
+var outStr: string;
+
+// vec2
+var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray;
+var vecArray: GLM.IArray;
+
+vecA = [1, 2];
+vecB = new Float32Array([3, 4]);
+out = [0, 0];
+matA = [1, 2, 3, 4, 5, 6];
+vecArray = [1, 2, 3, 4, 0, 0];
+
+out = vec2.create();
+out = vec2.clone(vecA);
+out = vec2.fromValues(1, 2);
+out = vec2.copy(out, vecA);
+out = vec2.set(out, 1, 2);
+out = vec2.add(out, vecA, vecB);
+out = vec2.subtract(out, vecA, vecB);
+out = vec2.sub(out, vecA, vecB);
+out = vec2.multiply(out, vecA, vecB);
+out = vec2.mul(out, vecA, vecB);
+out = vec2.divide(out, vecA, vecB);
+out = vec2.div(out, vecA, vecB);
+out = vec2.min(out, vecA, vecB);
+out = vec2.max(out, vecA, vecB);
+out = vec2.scale(out, vecA, 2);
+out = vec2.scaleAndAdd(out, vecA, vecB, 0.5);
+outVal = vec2.distance(vecA, vecB);
+outVal = vec2.dist(vecA, vecB);
+outVal = vec2.squaredDistance(vecA, vecB);
+outVal = vec2.sqrDist(vecA, vecB);
+outVal = vec2.length(vecA);
+outVal = vec2.len(vecA);
+outVal = vec2.squaredLength(vecA);
+outVal = vec2.sqrLen(vecA);
+out = vec2.negate(out, vecA);
+out = vec2.inverse(out, vecA);
+out = vec2.normalize(out, vecA);
+outVal = vec2.dot(vecA, vecB);
+out = vec2.cross(out, vecA, vecB);
+out = vec2.lerp(out, vecA, vecB, 0.5);
+out = vec2.random(out);
+out = vec2.random(out, 5.0);
+out = vec2.transformMat2(out, vecA, matA);
+out = vec2.transformMat2d(out, vecA, matA);
+out = vec2.transformMat3(out, vecA, matA);
+out = vec2.transformMat4(out, vecA, matA);
+out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
+outStr = vec2.str(vecA);
+
+// vec3
+var matr: GLM.IArray;
+var q: GLM.IArray;
+
+vecA = [1, 2, 3];
+vecB = new Float32Array([4, 5, 6]);
+out = [0, 0, 0];
+vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0];
+matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ];
+
+out = vec3.create();
+out = vec3.clone(vecA);
+out = vec3.fromValues(1, 2, 3);
+out = vec3.copy(out, vecA);
+out = vec3.set(out, 1, 2, 3);
+out = vec3.add(out, vecA, vecB);
+out = vec3.subtract(out, vecA, vecB);
+out = vec3.sub(out, vecA, vecB);
+out = vec3.multiply(out, vecA, vecB);
+out = vec3.mul(out, vecA, vecB);
+out = vec3.divide(out, vecA, vecB);
+out = vec3.div(out, vecA, vecB);
+out = vec3.min(out, vecA, vecB);
+out = vec3.max(out, vecA, vecB);
+out = vec3.scale(out, vecA, 2);
+out = vec3.scaleAndAdd(out, vecA, vecB, 0.5);
+outVal = vec3.distance(vecA, vecB);
+outVal = vec3.dist(vecA, vecB);
+outVal = vec3.squaredDistance(vecA, vecB);
+outVal = vec3.sqrDist(vecA, vecB);
+outVal = vec3.length(vecA);
+outVal = vec3.len(vecA);
+outVal = vec3.squaredLength(vecA);
+outVal = vec3.sqrLen(vecA);
+out = vec3.negate(out, vecA);
+out = vec3.inverse(out, vecA);
+out = vec3.normalize(out, vecA);
+outVal = vec3.dot(vecA, vecB);
+out = vec3.cross(out, vecA, vecB);
+out = vec3.lerp(out, vecA, vecB, 0.5);
+out = vec3.random(out);
+out = vec3.random(out, 5.0);
+out = vec3.rotateX(out, vecA, vecB, Math.PI);
+out = vec3.rotateY(out, vecA, vecB, Math.PI);
+out = vec3.rotateZ(out, vecA, vecB, Math.PI);
+out = vec3.transformMat3(out, vecA, matr);
+
+matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ];
+out = vec3.transformMat4(out, vecA, matr);
+
+q = [1, 2, 3, 4];
+out = vec3.transformQuat(out, vecA, matr);
+
+out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
+outVal = vec3.angle(vecA, vecB);
+outStr = vec3.str(vecA);
+
+// vec4
+var q: GLM.IArray;
+
+vecA = [1, 2, 3, 4];
+vecB = new Float32Array([5, 6, 7, 8]);
+out = [0, 0, 0, 0];
+q = [1, 2, 3, 4];
+
+out = vec4.create();
+out = vec4.clone(vecA);
+out = vec4.fromValues(1, 2, 3, 4);
+out = vec4.copy(out, vecA);
+out = vec4.set(out, 1, 2, 3, 4);
+out = vec4.add(out, vecA, vecB);
+out = vec4.subtract(out, vecA, vecB);
+out = vec4.sub(out, vecA, vecB);
+out = vec4.multiply(out, vecA, vecB);
+out = vec4.mul(out, vecA, vecB);
+out = vec4.divide(out, vecA, vecB);
+out = vec4.div(out, vecA, vecB);
+out = vec4.min(out, vecA, vecB);
+out = vec4.max(out, vecA, vecB);
+out = vec4.scale(out, vecA, 2);
+out = vec4.scaleAndAdd(out, vecA, vecB, 0.5);
+outVal = vec4.distance(vecA, vecB);
+outVal = vec4.dist(vecA, vecB);
+outVal = vec4.squaredDistance(vecA, vecB);
+outVal = vec4.sqrDist(vecA, vecB);
+outVal = vec4.length(vecA);
+outVal = vec4.len(vecA);
+outVal = vec4.squaredLength(vecA);
+outVal = vec4.sqrLen(vecA);
+out = vec4.negate(out, vecA);
+out = vec4.inverse(out, vecA);
+out = vec4.normalize(out, vecA);
+outVal = vec4.dot(vecA, vecB);
+out = vec4.lerp(out, vecA, vecB, 0.5);
+out = vec4.random(out);
+out = vec4.random(out, 5.0);
+
+matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]
+out = vec4.transformMat4(out, vecA, matr);
+out = vec4.transformQuat(out, vecA, q);
+
+vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0];
+out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
+outStr = vec4.str(vecA);
+
+// mat2
+var matB: GLM.IArray, identity: GLM.IArray;
+
+matA = [1, 2, 3, 4];
+matB = new Float32Array([5, 6, 7, 8]);
+out = [0, 0, 0, 0];
+identity = [1, 0, 0, 1];
+
+out = mat2.create();
+out = mat2.clone(matA);
+out = mat2.copy(out, matA);
+out = mat2.identity(out);
+out = mat2.transpose(out, matA);
+out = mat2.invert(out, matA);
+out = mat2.adjoint(out, matA);
+outVal = mat2.determinant(matA);
+out = mat2.multiply(out, matA, matB);
+out = mat2.mul(out, matA, matB);
+out = mat2.rotate(out, matA, Math.PI * 0.5);
+
+vecA = [2, 3];
+out = mat2.scale(out, matA, vecA);
+outStr = mat2.str(matA);
+outVal = mat2.frob(matA);
+
+var L = mat2.create();
+var D = mat2.create();
+var U = mat2.create();
+out = mat2.LDU(L, D, U, [4,3,6,3]);
+
+// mat2d
+matA = [1, 2, 3, 4, 5, 6];
+matB = [7, 8, 9, 10, 11, 12];
+out = [0, 0, 0, 0, 0, 0];
+identity = [1, 0, 0, 1, 0, 0];
+
+out = mat2d.create();
+out = mat2d.clone(matA);
+out = mat2d.copy(out, matA);
+out = mat2d.identity(out);
+out = mat2d.invert(out, matA);
+outVal = mat2d.determinant(matA);
+out = mat2d.multiply(out, matA, matB);
+out = mat2d.mul(out, matA, matB);
+out = mat2d.rotate(out, matA, Math.PI * 0.5);
+
+vecA = [2, 3];
+out = mat2d.scale(out, matA, vecA);
+out = mat2d.translate(out, matA, vecA);
+outStr = mat2d.str(matA);
+outVal = mat2d.frob(matA);
+
+// mat3
+matA = [1, 0, 0, 0, 1, 0, 1, 2, 1];
+matB = [1, 0, 0, 0, 1, 0, 3, 4, 1];
+out = [0, 0, 0, 0, 0, 0, 0, 0, 0];
+identity = [1, 0, 0, 0, 1, 0, 0, 0, 1];
+
+out = mat3.create();
+out = mat3.clone(matA);
+out = mat3.copy(out, matA);
+out = mat3.identity(out);
+out = mat3.transpose(out, matA);
+out = mat3.invert(out, matA);
+out = mat3.adjoint(out, matA);
+outVal = mat3.determinant(matA);
+out = mat3.multiply(out, matA, matB);
+out = mat3.mul(out, matA, matB);
+outStr = mat3.str(matA);
+outVal = mat3.frob(matA);
+
+matA = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1];
+out = mat3.normalFromMat4(out, matA);
+
+q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ];
+out = mat3.fromQuat(out, q);
+
+out = mat3.normalFromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
+out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
+out = mat3.scale(out, matA, [2,2]);
+out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]);
+
+out = mat3.translate(out, matA, [1, 2, 3]);
+out = mat3.rotate(out, matA, Math.PI/2);
+
+// mat4
+matA = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 1, 2, 3, 1];
+
+matB = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 4, 5, 6, 1];
+
+out = [0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ 0, 0, 0, 0];
+
+identity = [1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1];
+
+out = mat4.create();
+out = mat4.clone(matA);
+out = mat4.copy(out, matA);
+out = mat4.identity(out);
+out = mat4.transpose(out, matA);
+out = mat4.invert(out, matA);
+out = mat4.adjoint(out, matA);
+outVal = mat4.determinant(matA);
+out = mat4.multiply(out, matA, matB);
+out = mat4.mul(out, matA, matB);
+out = mat4.translate(out, matA, [4, 5, 6]);
+out = mat4.scale(out, matA, [4, 5, 6]);
+
+var rad = Math.PI * 0.5;
+var axis = [1, 0, 0];
+out = mat4.rotate(out, matA, rad, axis);
+out = mat4.rotateX(out, matA, rad);
+out = mat4.rotateY(out, matA, rad);
+out = mat4.rotateZ(out, matA, rad);
+
+out = mat4.frustum(out, -1, 1, -1, 1, -1, 1);
+
+var fovy = Math.PI * 0.5;
+out = mat4.perspective(out, fovy, 1, 0, 1);
+out = mat4.ortho(out, -1, 1, -1, 1, -1, 1);
+
+var eye = [0, 0, 1];
+var center = [0, 0, -1];
+var up = [0, 1, 0];
+out = mat4.lookAt(out, eye, center, up);
+
+outStr = mat4.str(matA);
+outVal = mat4.frob(matA);
+
+q = [0, 0, 0, 1];
+out = mat4.fromRotationTranslation(out, q, [1, 2, 3]);
+out = mat4.fromQuat(out, q);
+
+q = [0, 0, 0, 1];
+out = mat4.fromRotationTranslationScale(out, q, [1, 2, 3], [1, 2, 3]);
+out = mat4.fromQuat(out, q);
+
+
+// quat
+var quatA = [1, 2, 3, 4];
+var quatB = [5, 6, 7, 8];
+out = [0, 0, 0, 0];
+var vec = [1, 1, -1];
+var id = [0, 0, 0, 1];
+var deg90 = Math.PI / 2;
+
+out = quat.create();
+out = quat.clone(quatA);
+out = quat.fromValues(1, 2, 3, 4);
+out = quat.copy(out, quatA);
+out = quat.set(out, 1, 2, 3, 4);
+out = quat.identity(out);
+out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5);
+out = quat.add(out, quatA, quatB);
+out = quat.multiply(out, quatA, quatB);
+out = quat.mul(out, quatA, quatB);
+out = quat.scale(out, quatA, 2);
+outVal = quat.length(quatA);
+outVal = quat.len(quatA);
+outVal = quat.squaredLength(quatA);
+outVal = quat.sqrLen(quatA);
+out = quat.normalize(out, quatA);
+outVal = quat.dot(out, quatA, quatB);
+out = quat.lerp(out, quatA, quatB, 0.5);
+out = quat.slerp(out, quatA, quatB, 0.5);
+out = quat.invert(out, quatA);
+out = quat.conjugate(out, quatA);
+outStr = quat.str(quatA);
+out = quat.rotateX(out, id, deg90);
+out = quat.rotateY(out, id, deg90);
+out = quat.rotateZ(out, id, deg90);
+
+matr = [ 1, 0, 0,
+ 0, 0, -1,
+ 0, 1, 0 ];
+out = quat.fromMat3(out, matr);
+
+var view = [-1, 0, 0];
+up = [ 0, 1, 0];
+var right= [ 0, 0,-1];
+out = quat.setAxes([], view, right, up);
+
+out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]);
+out = quat.calculateW(out, quatA);
+
diff --git a/gl-matrix/gl-matrix-legacy.d.ts b/gl-matrix/gl-matrix-legacy.d.ts
new file mode 100644
index 0000000000..16366f263a
--- /dev/null
+++ b/gl-matrix/gl-matrix-legacy.d.ts
@@ -0,0 +1,2163 @@
+// Type definitions for gl-matrix 2.2.2
+// Project: https://github.com/toji/gl-matrix
+// Definitions by: Tat
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare namespace GLM {
+ interface IArray
+ {
+ /**
+ * Must be indexable like an array
+ */
+ [index: number]: number;
+ }
+}
+
+// Common
+declare namespace glMatrix {
+ /**
+ * Convert Degree To Radian
+ *
+ * @param a Angle in Degrees
+ */
+ export function toRadian(a: number): number;
+}
+
+// vec2
+declare namespace vec2 {
+ /**
+ * Creates a new, empty vec2
+ *
+ * @returns a new 2D vector
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new vec2 initialized with values from an existing vector
+ *
+ * @param a a vector to clone
+ * @returns a new 2D vector
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new vec2 initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @returns a new 2D vector
+ */
+ export function fromValues(x: number, y: number): GLM.IArray;
+
+ /**
+ * Copy the values from one vec2 to another
+ *
+ * @param out the receiving vector
+ * @param a the source vector
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a vec2 to the given values
+ *
+ * @param out the receiving vector
+ * @param x X component
+ * @param y Y component
+ * @returns out
+ */
+ export function set(out: GLM.IArray, x: number, y: number): GLM.IArray;
+
+ /**
+ * Adds two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the minimum of two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the maximum of two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a vec2 by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Adds two vec2's after scaling the second operand by a scalar value
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param scale the amount to scale b by before adding
+ * @returns out
+ */
+ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Calculates the euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function distance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function dist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec2
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec2
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec2
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec2
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Negates the components of a vec2
+ *
+ * @param out the receiving vector
+ * @param a vector to negate
+ * @returns out
+ */
+ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the inverse of the components of a vec2
+ *
+ * @param out the receiving vector
+ * @param a vector to invert
+ * @returns out
+ */
+ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Normalize a vec2
+ *
+ * @param out the receiving vector
+ * @param a vector to normalize
+ * @returns out
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two vec2's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ */
+ export function dot(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Computes the cross product of two vec2's
+ * Note that the cross product must by definition produce a 3D vector
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Performs a linear interpolation between two vec2's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Generates a random unit vector
+ *
+ * @param out the receiving vector
+ * @returns out
+ */
+ export function random(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param out the receiving vector
+ * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns out
+ */
+ export function random(out: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat2
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat2(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat2d
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat3
+ * 3rd vector component is implicitly '1'
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec2 with a mat4
+ * 3rd vector component is implicitly '0'
+ * 4th vector component is implicitly '1'
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec2s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec2s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @param arg additional argument to pass to fn
+ * @returns a
+ */
+ export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec2s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec2s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @returns a
+ */
+ export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+}
+
+// vec3
+declare namespace vec3 {
+
+ /**
+ * Creates a new, empty vec3
+ *
+ * @returns a new 3D vector
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new vec3 initialized with values from an existing vector
+ *
+ * @param a vector to clone
+ * @returns a new 3D vector
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new vec3 initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @returns a new 3D vector
+ */
+ export function fromValues(x: number, y: number, z: number): GLM.IArray;
+
+ /**
+ * Copy the values from one vec3 to another
+ *
+ * @param out the receiving vector
+ * @param a the source vector
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a vec3 to the given values
+ *
+ * @param out the receiving vector
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @returns out
+ */
+ export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray;
+
+ /**
+ * Adds two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray
+
+ /**
+ * Multiplies two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the minimum of two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the maximum of two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a vec3 by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Adds two vec3's after scaling the second operand by a scalar value
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param scale the amount to scale b by before adding
+ * @returns out
+ */
+ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Calculates the euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function distance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function dist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec3
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec3
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec3
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec3
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Negates the components of a vec3
+ *
+ * @param out the receiving vector
+ * @param a vector to negate
+ * @returns out
+ */
+ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the inverse of the components of a vec3
+ *
+ * @param out the receiving vector
+ * @param a vector to invert
+ * @returns out
+ */
+ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Normalize a vec3
+ *
+ * @param out the receiving vector
+ * @param a vector to normalize
+ * @returns out
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two vec3's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ */
+ export function dot(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Computes the cross product of two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Performs a linear interpolation between two vec3's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Generates a random unit vector
+ *
+ * @param out the receiving vector
+ * @returns out
+ */
+ export function random(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param out the receiving vector
+ * @param [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns out
+ */
+ export function random(out: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Rotate a 3D vector around the x-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ export function rotateX(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+
+ /**
+ * Rotate a 3D vector around the y-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ export function rotateY(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+
+ /**
+ * Rotate a 3D vector around the z-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ export function rotateZ(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+
+ /**
+ * Transforms the vec3 with a mat3.
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m the 3x3 matrix to transform with
+ * @returns out
+ */
+ export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec3 with a mat4.
+ * 4th vector component is implicitly '1'
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec3 with a quat
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param q quaternion to transform with
+ * @returns out
+ */
+ export function transformQuat(out: GLM.IArray, a: GLM.IArray, q: GLM.IArray): GLM.IArray;
+
+
+ /**
+ * Perform some operation over an array of vec3s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec3s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @param arg additional argument to pass to fn
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec3s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec3s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+
+ /**
+ * Get the angle between two 3D vectors
+ * @param a The first operand
+ * @param b The second operand
+ * @returns The angle in radians
+ */
+ export function angle(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+}
+
+// vec4
+declare namespace vec4 {
+
+ /**
+ * Creates a new, empty vec4
+ *
+ * @returns a new 4D vector
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new vec4 initialized with values from an existing vector
+ *
+ * @param a vector to clone
+ * @returns a new 4D vector
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new vec4 initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns a new 4D vector
+ */
+ export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Copy the values from one vec4 to another
+ *
+ * @param out the receiving vector
+ * @param a the source vector
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a vec4 to the given values
+ *
+ * @param out the receiving vector
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns out
+ */
+ export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Adds two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Subtracts vector b from vector a
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Divides two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the minimum of two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the maximum of two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a vec4 by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Adds two vec4's after scaling the second operand by a scalar value
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param scale the amount to scale b by before adding
+ * @returns out
+ */
+ export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Calculates the euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function distance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns distance between a and b
+ */
+ export function dist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the squared euclidian distance between two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns squared distance between a and b
+ */
+ export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec4
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a vec4
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec4
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a vec4
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Negates the components of a vec4
+ *
+ * @param out the receiving vector
+ * @param a vector to negate
+ * @returns out
+ */
+ export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns the inverse of the components of a vec4
+ *
+ * @param out the receiving vector
+ * @param a vector to invert
+ * @returns out
+ */
+ export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Normalize a vec4
+ *
+ * @param out the receiving vector
+ * @param a vector to normalize
+ * @returns out
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two vec4's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ */
+ export function dot(a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Performs a linear interpolation between two vec4's
+ *
+ * @param out the receiving vector
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Generates a random unit vector
+ *
+ * @param out the receiving vector
+ * @returns out
+ */
+ export function random(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Generates a random vector with the given scale
+ *
+ * @param out the receiving vector
+ * @param Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @returns out
+ */
+ export function random(out: GLM.IArray, scale: number): GLM.IArray;
+
+ /**
+ * Transforms the vec4 with a mat4.
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param m matrix to transform with
+ * @returns out
+ */
+ export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transforms the vec4 with a quat
+ *
+ * @param out the receiving vector
+ * @param a the vector to transform
+ * @param q quaternion to transform with
+ * @returns out
+ */
+ export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec4s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec4s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @param additional argument to pass to fn
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+
+ /**
+ * Perform some operation over an array of vec4s.
+ *
+ * @param a the array of vectors to iterate over
+ * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
+ * @param offset Number of elements to skip at the beginning of the array
+ * @param count Number of vec4s to iterate over. If 0 iterates over entire array
+ * @param fn Function to call for each vector in the array
+ * @returns a
+ * @function
+ */
+ export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
+ callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+
+ /**
+ * Returns a string representation of a vector
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+}
+
+// mat2
+declare namespace mat2 {
+
+ /**
+ * Creates a new identity mat2
+ *
+ * @returns a new 2x2 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat2 initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 2x2 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat2 to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat2 to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transpose the values of a mat2
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat2
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the adjugate of a mat2
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat2
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat2's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat2's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat2 by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Scales the mat2 by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat2
+ *
+ * @param a matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(a: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat2
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+
+ /**
+ * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
+ * @param L the lower triangular matrix
+ * @param D the diagonal matrix
+ * @param U the upper triangular matrix
+ * @param a the input matrix to factorize
+ */
+ export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray;
+}
+
+// mat2d
+declare namespace mat2d {
+
+ /**
+ * Creates a new identity mat2d
+ *
+ * @returns a new 2x3 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat2d initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 2x3 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat2d to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat2d to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat2d
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat2d
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat2d's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat2d's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat2d by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Scales the mat2d by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Translates the mat2d by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v the vec2 to translate the matrix by
+ * @returns out
+ **/
+ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat2d
+ *
+ * @param a matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(a: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat2d
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+}
+
+// mat3
+declare namespace mat3 {
+
+ /**
+ * Creates a new identity mat3
+ *
+ * @returns a new 3x3 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat3 initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 3x3 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat3 to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat3 to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transpose the values of a mat3
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat3
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the adjugate of a mat3
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat3
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat3's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat3's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat3
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(mat: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat3
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+
+ /**
+ * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
+ *
+ * @param out mat3 receiving operation result
+ * @param a Mat4 to derive the normal matrix from
+ *
+ * @returns out
+ */
+ export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates a 3x3 matrix from the given quaternion
+ *
+ * @param out mat3 receiving operation result
+ * @param q Quaternion to create matrix from
+ *
+ * @returns out
+ */
+ export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copies the upper-left 3x3 values into the given mat3.
+ *
+ * @param out the receiving 3x3 matrix
+ * @param a the source 4x4 matrix
+ * @returns out
+ */
+ export function fromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales the mat3 by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copies the values from a mat2d into a mat3
+ *
+ * @param out the receiving matrix
+ * @param {mat2d} a the matrix to copy
+ * @returns out
+ **/
+ export function fromMat2d(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Translate a mat3 by the given vector
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v vector to translate by
+ * @returns out
+ */
+ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat3 by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+}
+
+// mat4
+declare namespace mat4 {
+
+ /**
+ * Creates a new identity mat4
+ *
+ * @returns a new 4x4 matrix
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new mat4 initialized with values from an existing matrix
+ *
+ * @param a matrix to clone
+ * @returns a new 4x4 matrix
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Copy the values from one mat4 to another
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set a mat4 to the identity matrix
+ *
+ * @param out the receiving matrix
+ * @returns out
+ */
+ export function identity(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Transpose the values of a mat4
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Inverts a mat4
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the adjugate of a mat4
+ *
+ * @param out the receiving matrix
+ * @param a the source matrix
+ * @returns out
+ */
+ export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the determinant of a mat4
+ *
+ * @param a the source matrix
+ * @returns determinant of a
+ */
+ export function determinant(a: GLM.IArray): number;
+
+ /**
+ * Multiplies two mat4's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two mat4's
+ *
+ * @param out the receiving matrix
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Translate a mat4 by the given vector
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to translate
+ * @param v vector to translate by
+ * @returns out
+ */
+ export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales the mat4 by the dimensions in the given vec3
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to scale
+ * @param v the vec3 to scale the matrix by
+ * @returns out
+ **/
+ export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a mat4 by the given angle
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @param axis the axis to rotate around
+ * @returns out
+ */
+ export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray;
+
+ /**
+ * Rotates a matrix by the given angle around the X axis
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a matrix by the given angle around the Y axis
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a matrix by the given angle around the Z axis
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param rad the angle to rotate the matrix by
+ * @returns out
+ */
+ export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Generates a frustum matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ export function frustum(out: GLM.IArray, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): GLM.IArray;
+
+ /**
+ * Generates a perspective projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param fovy Vertical field of view in radians
+ * @param aspect Aspect ratio. typically viewport width/height
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ export function perspective(out: GLM.IArray, fovy: number, aspect: number,
+ near: number, far: number): GLM.IArray;
+
+ /**
+ * Generates a orthogonal projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ export function ortho(out: GLM.IArray, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): GLM.IArray;
+
+ /**
+ * Generates a look-at matrix with the given eye position, focal point, and up axis
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param eye Position of the viewer
+ * @param center Point the viewer is looking at
+ * @param up vec3 pointing up
+ * @returns out
+ */
+ export function lookAt(out: GLM.IArray, eye: GLM.IArray,
+ center: GLM.IArray, up: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a mat4
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ export function str(mat: GLM.IArray): string;
+
+ /**
+ * Returns Frobenius norm of a mat4
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ export function frob(a: GLM.IArray): number;
+
+ /**
+ * Creates a matrix from a quaternion rotation and vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ *
+ * @param out mat4 receiving operation result
+ * @param q Rotation quaternion
+ * @param v Translation vector
+ * @returns out
+ */
+ export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale.
+ *
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
+ *
+ * @param out mat4 receiving operation result
+ * @param q Rotation quaternion
+ * @param v Translation vector
+ * @param s Scale vector
+ * @returns out
+ */
+ export function fromRotationTranslationScale(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray, s: GLM.IArray): GLM.IArray
+
+ /**
+ * Creates a matrix from a quaternion
+ *
+ * @param out mat4 receiving operation result
+ * @param q Rotation quaternion
+ * @returns out
+ */
+ export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
+}
+
+// quat
+declare namespace quat {
+
+ /**
+ * Creates a new identity quat
+ *
+ * @returns a new quaternion
+ */
+ export function create(): GLM.IArray;
+
+ /**
+ * Creates a new quat initialized with values from an existing quaternion
+ *
+ * @param a quaternion to clone
+ * @returns a new quaternion
+ * @function
+ */
+ export function clone(a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Creates a new quat initialized with the given values
+ *
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns a new quaternion
+ * @function
+ */
+ export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Copy the values from one quat to another
+ *
+ * @param out the receiving quaternion
+ * @param a the source quaternion
+ * @returns out
+ * @function
+ */
+ export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Set the components of a quat to the given values
+ *
+ * @param out the receiving quaternion
+ * @param x X component
+ * @param y Y component
+ * @param z Z component
+ * @param w W component
+ * @returns out
+ * @function
+ */
+ export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+
+ /**
+ * Set a quat to the identity quaternion
+ *
+ * @param out the receiving quaternion
+ * @returns out
+ */
+ export function identity(out: GLM.IArray): GLM.IArray;
+
+ /**
+ * Sets a quat from the given angle and rotation axis,
+ * then returns it.
+ *
+ * @param out the receiving quaternion
+ * @param axis the axis around which to rotate
+ * @param rad the angle in radians
+ * @returns out
+ **/
+ export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Adds two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ * @function
+ */
+ export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Multiplies two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @returns out
+ */
+ export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Scales a quat by a scalar number
+ *
+ * @param out the receiving vector
+ * @param a the vector to scale
+ * @param b amount to scale the vector by
+ * @returns out
+ * @function
+ */
+ export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+
+ /**
+ * Calculates the length of a quat
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ * @function
+ */
+ export function length(a: GLM.IArray): number;
+
+ /**
+ * Calculates the length of a quat
+ *
+ * @param a vector to calculate length of
+ * @returns length of a
+ * @function
+ */
+ export function len(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a quat
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ * @function
+ */
+ export function squaredLength(a: GLM.IArray): number;
+
+ /**
+ * Calculates the squared length of a quat
+ *
+ * @param a vector to calculate squared length of
+ * @returns squared length of a
+ * @function
+ */
+ export function sqrLen(a: GLM.IArray): number;
+
+ /**
+ * Normalize a quat
+ *
+ * @param out the receiving quaternion
+ * @param a quaternion to normalize
+ * @returns out
+ * @function
+ */
+ export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the dot product of two quat's
+ *
+ * @param a the first operand
+ * @param b the second operand
+ * @returns dot product of a and b
+ * @function
+ */
+ export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number;
+
+ /**
+ * Performs a linear interpolation between two quat's
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ * @function
+ */
+ export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Performs a spherical linear interpolation between two quat
+ *
+ * @param out the receiving quaternion
+ * @param a the first operand
+ * @param b the second operand
+ * @param t interpolation amount between the two inputs
+ * @returns out
+ */
+ export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+
+ /**
+ * Calculates the inverse of a quat
+ *
+ * @param out the receiving quaternion
+ * @param a quat to calculate inverse of
+ * @returns out
+ */
+ export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the conjugate of a quat
+ * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
+ *
+ * @param out the receiving quaternion
+ * @param a quat to calculate conjugate of
+ * @returns out
+ */
+ export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+
+ /**
+ * Returns a string representation of a quatenion
+ *
+ * @param vec vector to represent as a string
+ * @returns string representation of the vector
+ */
+ export function str(a: GLM.IArray): string;
+
+ /**
+ * Rotates a quaternion by the given angle about the X axis
+ *
+ * @param out quat receiving operation result
+ * @param a quat to rotate
+ * @param rad angle (in radians) to rotate
+ * @returns out
+ */
+ export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a quaternion by the given angle about the Y axis
+ *
+ * @param out quat receiving operation result
+ * @param a quat to rotate
+ * @param rad angle (in radians) to rotate
+ * @returns out
+ */
+ export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Rotates a quaternion by the given angle about the Z axis
+ *
+ * @param out quat receiving operation result
+ * @param a quat to rotate
+ * @param rad angle (in radians) to rotate
+ * @returns out
+ */
+ export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+
+ /**
+ * Creates a quaternion from the given 3x3 rotation matrix.
+ *
+ * NOTE: The resultant quaternion is not normalized, so you should be sure
+ * to renormalize the quaternion yourself where necessary.
+ *
+ * @param out the receiving quaternion
+ * @param m rotation matrix
+ * @returns out
+ * @function
+ */
+ export function fromMat3(out: GLM.IArray, m: GLM.IArray): GLM.IArray;
+
+ /**
+ * Sets the specified quaternion with values corresponding to the given
+ * axes. Each axis is a vec3 and is expected to be unit length and
+ * perpendicular to all other specified axes.
+ *
+ * @param view the vector representing the viewing direction
+ * @param right the vector representing the local "right" direction
+ * @param up the vector representing the local "up" direction
+ * @returns out
+ */
+ export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray,
+ up: GLM.IArray): GLM.IArray;
+
+ /**
+ * Sets a quaternion to represent the shortest rotation from one
+ * vector to another.
+ *
+ * Both vectors are assumed to be unit length.
+ *
+ * @param out the receiving quaternion.
+ * @param a the initial vector
+ * @param b the destination vector
+ * @returns out
+ */
+ export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+
+ /**
+ * Calculates the W component of a quat from the X, Y, and Z components.
+ * Assumes that quaternion is 1 unit in length.
+ * Any existing W component will be ignored.
+ *
+ * @param out the receiving quaternion
+ * @param a quat to calculate W component of
+ * @returns out
+ */
+ export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+}
diff --git a/gl-matrix/gl-matrix-tests.ts b/gl-matrix/gl-matrix-tests.ts
index 682bca7b8b..984ca3d1c3 100644
--- a/gl-matrix/gl-matrix-tests.ts
+++ b/gl-matrix/gl-matrix-tests.ts
@@ -1,362 +1,347 @@
///
// common
-var result: number = glMatrix.toRadian(180);
+import {vec2, mat2, mat3, mat4, vec3, vec4, mat2d, quat} from "./gl-matrix";
-var out: GLM.IArray;
var outVal: number;
+var outBool: boolean;
var outStr: string;
+let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
+
+let vec2A = vec2.fromValues(1, 2);
+let vec2B = vec2.fromValues(3, 4);
+let vec3A = vec3.fromValues(1, 2, 3);
+let vec3B = vec3.fromValues(3, 4, 5);
+let vec4A = vec4.fromValues(1, 2, 3, 4);
+let vec4B = vec4.fromValues(3, 4, 5, 6);
+let mat2A = mat2.fromValues(1, 2, 3, 4);
+let mat2B = mat2.fromValues(1, 2, 3, 4);
+let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
+let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
+let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
+let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
+let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+let quatA = quat.fromValues(1, 2, 3, 4);
+let quatB = quat.fromValues(5, 6, 7, 8);
+
+let outVec2 = vec2.create();
+let outVec3 = vec3.create();
+let outVec4 = vec4.create();
+let outMat2 = mat2.create();
+let outMat2d = mat2d.create();
+let outMat3 = mat3.create();
+let outMat4 = mat4.create();
+let outQuat = quat.create();
+
// vec2
-var vecA: GLM.IArray, vecB: GLM.IArray, matA: GLM.IArray;
-var vecArray: GLM.IArray;
-
-vecA = [1, 2];
-vecB = new Float32Array([3, 4]);
-out = [0, 0];
-matA = [1, 2, 3, 4, 5, 6];
-vecArray = [1, 2, 3, 4, 0, 0];
-
-out = vec2.create();
-out = vec2.clone(vecA);
-out = vec2.fromValues(1, 2);
-out = vec2.copy(out, vecA);
-out = vec2.set(out, 1, 2);
-out = vec2.add(out, vecA, vecB);
-out = vec2.subtract(out, vecA, vecB);
-out = vec2.sub(out, vecA, vecB);
-out = vec2.multiply(out, vecA, vecB);
-out = vec2.mul(out, vecA, vecB);
-out = vec2.divide(out, vecA, vecB);
-out = vec2.div(out, vecA, vecB);
-out = vec2.min(out, vecA, vecB);
-out = vec2.max(out, vecA, vecB);
-out = vec2.scale(out, vecA, 2);
-out = vec2.scaleAndAdd(out, vecA, vecB, 0.5);
-outVal = vec2.distance(vecA, vecB);
-outVal = vec2.dist(vecA, vecB);
-outVal = vec2.squaredDistance(vecA, vecB);
-outVal = vec2.sqrDist(vecA, vecB);
-outVal = vec2.length(vecA);
-outVal = vec2.len(vecA);
-outVal = vec2.squaredLength(vecA);
-outVal = vec2.sqrLen(vecA);
-out = vec2.negate(out, vecA);
-out = vec2.inverse(out, vecA);
-out = vec2.normalize(out, vecA);
-outVal = vec2.dot(vecA, vecB);
-out = vec2.cross(out, vecA, vecB);
-out = vec2.lerp(out, vecA, vecB, 0.5);
-out = vec2.random(out);
-out = vec2.random(out, 5.0);
-out = vec2.transformMat2(out, vecA, matA);
-out = vec2.transformMat2d(out, vecA, matA);
-out = vec2.transformMat3(out, vecA, matA);
-out = vec2.transformMat4(out, vecA, matA);
-out = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
-outStr = vec2.str(vecA);
+outVec2 = vec2.create();
+outVec2 = vec2.clone(vec2A);
+outVec2 = vec2.fromValues(1, 2);
+outVec2 = vec2.copy(outVec2, vec2A);
+outVec2 = vec2.set(outVec2, 1, 2);
+outVec2 = vec2.add(outVec2, vec2A, vec2B);
+outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
+outVec2 = vec2.sub(outVec2, vec2A, vec2B);
+outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
+outVec2 = vec2.mul(outVec2, vec2A, vec2B);
+outVec2 = vec2.divide(outVec2, vec2A, vec2B);
+outVec2 = vec2.div(outVec2, vec2A, vec2B);
+outVec2 = vec2.ceil(outVec2, vec2A);
+outVec2 = vec2.floor(outVec2, vec2A);
+outVec2 = vec2.min(outVec2, vec2A, vec2B);
+outVec2 = vec2.max(outVec2, vec2A, vec2B);
+outVec2 = vec2.round(outVec2, vec2A);
+outVec2 = vec2.scale(outVec2, vec2A, 2);
+outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
+outVal = vec2.distance(vec2A, vec2B);
+outVal = vec2.dist(vec2A, vec2B);
+outVal = vec2.squaredDistance(vec2A, vec2B);
+outVal = vec2.sqrDist(vec2A, vec2B);
+outVal = vec2.length(vec2A);
+outVal = vec2.len(vec2A);
+outVal = vec2.squaredLength(vec2A);
+outVal = vec2.sqrLen(vec2A);
+outVec2 = vec2.negate(outVec2, vec2A);
+outVec2 = vec2.inverse(outVec2, vec2A);
+outVec2 = vec2.normalize(outVec2, vec2A);
+outVal = vec2.dot(vec2A, vec2B);
+outVec2 = vec2.cross(outVec2, vec2A, vec2B);
+outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
+outVec2 = vec2.random(outVec2);
+outVec2 = vec2.random(outVec2, 5.0);
+outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
+outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
+outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
+outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
+vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
+outStr = vec2.str(vec2A);
+outBool = vec2.exactEquals(vec2A, vec2B);
+outBool = vec2.equals(vec2A, vec2B);
+outVec2 = vec2.add(outVec2, [0, 1], [2, 3]); // test one method with number array input
// vec3
-var matr: GLM.IArray;
-var q: GLM.IArray;
-
-vecA = [1, 2, 3];
-vecB = new Float32Array([4, 5, 6]);
-out = [0, 0, 0];
-vecArray = [1, 2, 3, 4, 5, 6, 0, 0, 0];
-matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ];
-
-out = vec3.create();
-out = vec3.clone(vecA);
-out = vec3.fromValues(1, 2, 3);
-out = vec3.copy(out, vecA);
-out = vec3.set(out, 1, 2, 3);
-out = vec3.add(out, vecA, vecB);
-out = vec3.subtract(out, vecA, vecB);
-out = vec3.sub(out, vecA, vecB);
-out = vec3.multiply(out, vecA, vecB);
-out = vec3.mul(out, vecA, vecB);
-out = vec3.divide(out, vecA, vecB);
-out = vec3.div(out, vecA, vecB);
-out = vec3.min(out, vecA, vecB);
-out = vec3.max(out, vecA, vecB);
-out = vec3.scale(out, vecA, 2);
-out = vec3.scaleAndAdd(out, vecA, vecB, 0.5);
-outVal = vec3.distance(vecA, vecB);
-outVal = vec3.dist(vecA, vecB);
-outVal = vec3.squaredDistance(vecA, vecB);
-outVal = vec3.sqrDist(vecA, vecB);
-outVal = vec3.length(vecA);
-outVal = vec3.len(vecA);
-outVal = vec3.squaredLength(vecA);
-outVal = vec3.sqrLen(vecA);
-out = vec3.negate(out, vecA);
-out = vec3.inverse(out, vecA);
-out = vec3.normalize(out, vecA);
-outVal = vec3.dot(vecA, vecB);
-out = vec3.cross(out, vecA, vecB);
-out = vec3.lerp(out, vecA, vecB, 0.5);
-out = vec3.random(out);
-out = vec3.random(out, 5.0);
-out = vec3.rotateX(out, vecA, vecB, Math.PI);
-out = vec3.rotateY(out, vecA, vecB, Math.PI);
-out = vec3.rotateZ(out, vecA, vecB, Math.PI);
-out = vec3.transformMat3(out, vecA, matr);
-
-matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ];
-out = vec3.transformMat4(out, vecA, matr);
-
-q = [1, 2, 3, 4];
-out = vec3.transformQuat(out, vecA, matr);
-
-out = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
-outVal = vec3.angle(vecA, vecB);
-outStr = vec3.str(vecA);
+outVec3 = vec3.create();
+outVec3 = vec3.clone(vec3A);
+outVec3 = vec3.fromValues(1, 2, 3);
+outVec3 = vec3.copy(outVec3, vec3A);
+outVec3 = vec3.set(outVec3, 1, 2, 3);
+outVec3 = vec3.add(outVec3, vec3A, vec3B);
+outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
+outVec3 = vec3.sub(outVec3, vec3A, vec3B);
+outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
+outVec3 = vec3.mul(outVec3, vec3A, vec3B);
+outVec3 = vec3.divide(outVec3, vec3A, vec3B);
+outVec3 = vec3.div(outVec3, vec3A, vec3B);
+outVec3 = vec3.ceil(outVec3, vec3A);
+outVec3 = vec3.floor(outVec3, vec3A);
+outVec3 = vec3.min(outVec3, vec3A, vec3B);
+outVec3 = vec3.max(outVec3, vec3A, vec3B);
+outVec3 = vec3.round(outVec3, vec3A);
+outVec3 = vec3.scale(outVec3, vec3A, 2);
+outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
+outVal = vec3.distance(vec3A, vec3B);
+outVal = vec3.dist(vec3A, vec3B);
+outVal = vec3.squaredDistance(vec3A, vec3B);
+outVal = vec3.sqrDist(vec3A, vec3B);
+outVal = vec3.length(vec3A);
+outVal = vec3.len(vec3A);
+outVal = vec3.squaredLength(vec3A);
+outVal = vec3.sqrLen(vec3A);
+outVec3 = vec3.negate(outVec3, vec3A);
+outVec3 = vec3.inverse(outVec3, vec3A);
+outVec3 = vec3.normalize(outVec3, vec3A);
+outVal = vec3.dot(vec3A, vec3B);
+outVec3 = vec3.cross(outVec3, vec3A, vec3B);
+outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
+outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
+outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
+outVec3 = vec3.random(outVec3);
+outVec3 = vec3.random(outVec3, 5.0);
+outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
+outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
+outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
+outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
+outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
+outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
+vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
+outVal = vec3.angle(vec3A, vec3B);
+outStr = vec3.str(vec3A);
+outBool = vec3.exactEquals(vec3A, vec3B);
+outBool = vec3.equals(vec3A, vec3B);
+outVec3 = vec3.add(outVec3, [0, 1, 2], [3, 4, 5]); // test one method with number array input
// vec4
-var q: GLM.IArray;
-
-vecA = [1, 2, 3, 4];
-vecB = new Float32Array([5, 6, 7, 8]);
-out = [0, 0, 0, 0];
-q = [1, 2, 3, 4];
-
-out = vec4.create();
-out = vec4.clone(vecA);
-out = vec4.fromValues(1, 2, 3, 4);
-out = vec4.copy(out, vecA);
-out = vec4.set(out, 1, 2, 3, 4);
-out = vec4.add(out, vecA, vecB);
-out = vec4.subtract(out, vecA, vecB);
-out = vec4.sub(out, vecA, vecB);
-out = vec4.multiply(out, vecA, vecB);
-out = vec4.mul(out, vecA, vecB);
-out = vec4.divide(out, vecA, vecB);
-out = vec4.div(out, vecA, vecB);
-out = vec4.min(out, vecA, vecB);
-out = vec4.max(out, vecA, vecB);
-out = vec4.scale(out, vecA, 2);
-out = vec4.scaleAndAdd(out, vecA, vecB, 0.5);
-outVal = vec4.distance(vecA, vecB);
-outVal = vec4.dist(vecA, vecB);
-outVal = vec4.squaredDistance(vecA, vecB);
-outVal = vec4.sqrDist(vecA, vecB);
-outVal = vec4.length(vecA);
-outVal = vec4.len(vecA);
-outVal = vec4.squaredLength(vecA);
-outVal = vec4.sqrLen(vecA);
-out = vec4.negate(out, vecA);
-out = vec4.inverse(out, vecA);
-out = vec4.normalize(out, vecA);
-outVal = vec4.dot(vecA, vecB);
-out = vec4.lerp(out, vecA, vecB, 0.5);
-out = vec4.random(out);
-out = vec4.random(out, 5.0);
-
-matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ]
-out = vec4.transformMat4(out, vecA, matr);
-out = vec4.transformQuat(out, vecA, q);
-
-vecArray = [1, 2, 3, 4, 5, 6, 7, 8, 0, 0, 0, 0];
-out = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
-outStr = vec4.str(vecA);
+outVec4 = vec4.create();
+outVec4 = vec4.clone(vec4A);
+outVec4 = vec4.fromValues(1, 2, 3, 4);
+outVec4 = vec4.copy(outVec4, vec4A);
+outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
+outVec4 = vec4.add(outVec4, vec4A, vec4B);
+outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
+outVec4 = vec4.sub(outVec4, vec4A, vec4B);
+outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
+outVec4 = vec4.mul(outVec4, vec4A, vec4B);
+outVec4 = vec4.divide(outVec4, vec4A, vec4B);
+outVec4 = vec4.div(outVec4, vec4A, vec4B);
+outVec4 = vec4.ceil(outVec4, vec4A);
+outVec4 = vec4.floor(outVec4, vec4A);
+outVec4 = vec4.min(outVec4, vec4A, vec4B);
+outVec4 = vec4.max(outVec4, vec4A, vec4B);
+outVec4 = vec4.scale(outVec4, vec4A, 2);
+outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
+outVal = vec4.distance(vec4A, vec4B);
+outVal = vec4.dist(vec4A, vec4B);
+outVal = vec4.squaredDistance(vec4A, vec4B);
+outVal = vec4.sqrDist(vec4A, vec4B);
+outVal = vec4.length(vec4A);
+outVal = vec4.len(vec4A);
+outVal = vec4.squaredLength(vec4A);
+outVal = vec4.sqrLen(vec4A);
+outVec4 = vec4.negate(outVec4, vec4A);
+outVec4 = vec4.inverse(outVec4, vec4A);
+outVec4 = vec4.normalize(outVec4, vec4A);
+outVal = vec4.dot(vec4A, vec4B);
+outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
+outVec4 = vec4.random(outVec4);
+outVec4 = vec4.random(outVec4, 5.0);
+outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
+outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
+vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
+outStr = vec4.str(vec4A);
+outBool = vec4.exactEquals(vec4A, vec4B);
+outBool = vec4.equals(vec4A, vec4B);
+outVec4 = vec4.add(outVec4, [0, 1, 2, 3], [4, 5, 6, 7]); // test one method with number array input
// mat2
-var matB: GLM.IArray, identity: GLM.IArray;
-
-matA = [1, 2, 3, 4];
-matB = new Float32Array([5, 6, 7, 8]);
-out = [0, 0, 0, 0];
-identity = [1, 0, 0, 1];
-
-out = mat2.create();
-out = mat2.clone(matA);
-out = mat2.copy(out, matA);
-out = mat2.identity(out);
-out = mat2.transpose(out, matA);
-out = mat2.invert(out, matA);
-out = mat2.adjoint(out, matA);
-outVal = mat2.determinant(matA);
-out = mat2.multiply(out, matA, matB);
-out = mat2.mul(out, matA, matB);
-out = mat2.rotate(out, matA, Math.PI * 0.5);
-
-vecA = [2, 3];
-out = mat2.scale(out, matA, vecA);
-outStr = mat2.str(matA);
-outVal = mat2.frob(matA);
-
-var L = mat2.create();
-var D = mat2.create();
+outMat2 = mat2.create();
+outMat2 = mat2.clone(mat2A);
+outMat2 = mat2.copy(outMat2, mat2A);
+outMat2 = mat2.identity(outMat2);
+outMat2 = mat2.fromValues(1, 2, 3, 4);
+outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
+outMat2 = mat2.transpose(outMat2, mat2A);
+outMat2 = mat2.invert(outMat2, mat2A);
+outMat2 = mat2.adjoint(outMat2, mat2A);
+outVal = mat2.determinant(mat2A);
+outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
+outMat2 = mat2.mul(outMat2, mat2A, mat2B);
+outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
+outMat2 = mat2.scale(outMat2, mat2A, vec2A);
+outMat2 = mat2.fromRotation(outMat2, 0.5);
+outMat2 = mat2.fromScaling(outMat2, vec2A);
+outStr = mat2.str(mat2A);
+outVal = mat2.frob(mat2A);
+var L = mat2.create();
+var D = mat2.create();
var U = mat2.create();
-out = mat2.LDU(L, D, U, [4,3,6,3]);
+outMat2 = mat2.LDU(L, D, U, mat2A);
+outMat2 = mat2.add(outMat2, mat2A, mat2B);
+outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
+outMat2 = mat2.sub(outMat2, mat2A, mat2B);
+outBool = mat2.exactEquals(mat2A, mat2B);
+outBool = mat2.equals(mat2A, mat2B);
+outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2);
+outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2);
// mat2d
-matA = [1, 2, 3, 4, 5, 6];
-matB = [7, 8, 9, 10, 11, 12];
-out = [0, 0, 0, 0, 0, 0];
-identity = [1, 0, 0, 1, 0, 0];
-
-out = mat2d.create();
-out = mat2d.clone(matA);
-out = mat2d.copy(out, matA);
-out = mat2d.identity(out);
-out = mat2d.invert(out, matA);
-outVal = mat2d.determinant(matA);
-out = mat2d.multiply(out, matA, matB);
-out = mat2d.mul(out, matA, matB);
-out = mat2d.rotate(out, matA, Math.PI * 0.5);
-
-vecA = [2, 3];
-out = mat2d.scale(out, matA, vecA);
-out = mat2d.translate(out, matA, vecA);
-outStr = mat2d.str(matA);
-outVal = mat2d.frob(matA);
+outMat2d = mat2d.create();
+outMat2d = mat2d.clone(mat2dA);
+outMat2d = mat2d.copy(outMat2d, mat2dA);
+outMat2d = mat2d.identity(outMat2d);
+outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
+outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
+outMat2d = mat2d.invert(outMat2d, mat2dA);
+outVal = mat2d.determinant(mat2dA);
+outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
+outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
+outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
+outMat2d = mat2d.fromRotation(outMat2d, 0.5);
+outMat2d = mat2d.fromScaling(outMat2d, vec2A);
+outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
+outStr = mat2d.str(mat2dA);
+outVal = mat2d.frob(mat2dA);
+outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
+outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2);
+outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2);
+outBool = mat2d.exactEquals(mat2dA, mat2dB);
+outBool = mat2d.equals(mat2dA, mat2dB);
// mat3
-matA = [1, 0, 0, 0, 1, 0, 1, 2, 1];
-matB = [1, 0, 0, 0, 1, 0, 3, 4, 1];
-out = [0, 0, 0, 0, 0, 0, 0, 0, 0];
-identity = [1, 0, 0, 0, 1, 0, 0, 0, 1];
-
-out = mat3.create();
-out = mat3.clone(matA);
-out = mat3.copy(out, matA);
-out = mat3.identity(out);
-out = mat3.transpose(out, matA);
-out = mat3.invert(out, matA);
-out = mat3.adjoint(out, matA);
-outVal = mat3.determinant(matA);
-out = mat3.multiply(out, matA, matB);
-out = mat3.mul(out, matA, matB);
-outStr = mat3.str(matA);
-outVal = mat3.frob(matA);
-
-matA = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
-out = mat3.normalFromMat4(out, matA);
-
-q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ];
-out = mat3.fromQuat(out, q);
-
-out = mat3.normalFromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
-out = mat3.fromMat4(out, [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12, 13,14,15,16]);
-out = mat3.scale(out, matA, [2,2]);
-out = mat3.fromMat2d(out, [1, 2, 3, 4, 5, 6]);
-
-out = mat3.translate(out, matA, [1, 2, 3]);
-out = mat3.rotate(out, matA, Math.PI/2);
-
-// mat4
-matA = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1];
-
-matB = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 4, 5, 6, 1];
-
-out = [0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0];
-
-identity = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
-
-out = mat4.create();
-out = mat4.clone(matA);
-out = mat4.copy(out, matA);
-out = mat4.identity(out);
-out = mat4.transpose(out, matA);
-out = mat4.invert(out, matA);
-out = mat4.adjoint(out, matA);
-outVal = mat4.determinant(matA);
-out = mat4.multiply(out, matA, matB);
-out = mat4.mul(out, matA, matB);
-out = mat4.translate(out, matA, [4, 5, 6]);
-out = mat4.scale(out, matA, [4, 5, 6]);
-
-var rad = Math.PI * 0.5;
-var axis = [1, 0, 0];
-out = mat4.rotate(out, matA, rad, axis);
-out = mat4.rotateX(out, matA, rad);
-out = mat4.rotateY(out, matA, rad);
-out = mat4.rotateZ(out, matA, rad);
-
-out = mat4.frustum(out, -1, 1, -1, 1, -1, 1);
-
-var fovy = Math.PI * 0.5;
-out = mat4.perspective(out, fovy, 1, 0, 1);
-out = mat4.ortho(out, -1, 1, -1, 1, -1, 1);
-
-var eye = [0, 0, 1];
-var center = [0, 0, -1];
-var up = [0, 1, 0];
-out = mat4.lookAt(out, eye, center, up);
-
-outStr = mat4.str(matA);
-outVal = mat4.frob(matA);
-
-q = [0, 0, 0, 1];
-out = mat4.fromRotationTranslation(out, q, [1, 2, 3]);
-out = mat4.fromQuat(out, q);
-
-q = [0, 0, 0, 1];
-out = mat4.fromRotationTranslationScale(out, q, [1, 2, 3], [1, 2, 3]);
-out = mat4.fromQuat(out, q);
+outMat3 = mat3.create();
+outMat3 = mat3.fromMat4(outMat3, mat4A);
+outMat3 = mat3.clone(mat3A);
+outMat3 = mat3.copy(outMat3, mat3A);
+outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
+outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
+outMat3 = mat3.identity(outMat3);
+outMat3 = mat3.transpose(outMat3, mat3A);
+outMat3 = mat3.invert(outMat3, mat3A);
+outMat3 = mat3.adjoint(outMat3, mat3A);
+outVal = mat3.determinant(mat3A);
+outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
+outMat3 = mat3.mul(outMat3, mat3A, mat3B);
+outMat3 = mat3.translate(outMat3, mat3A, vec3A);
+outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2);
+outMat3 = mat3.scale(outMat3, mat3A, vec2A);
+outMat3 = mat3.fromTranslation(outMat3, vec2A);
+outMat3 = mat3.fromRotation(outMat3, Math.PI);
+outMat3 = mat3.fromScaling(outMat3, vec2A);
+outMat3 = mat3.fromMat2d(outMat3, mat2dA);
+outMat3 = mat3.fromQuat(outMat3, quatA);
+outMat3 = mat3.normalFromMat4(outMat3, mat4A);
+outStr = mat3.str(mat3A);
+outVal = mat3.frob(mat3A);
+outMat3 = mat3.add(outMat3, mat3A, mat3B);
+outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
+outMat3 = mat3.sub(outMat3, mat3A, mat3B);
+outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2);
+outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2);
+outBool = mat3.exactEquals(mat3A, mat3B);
+outBool = mat3.equals(mat3A, mat3B);
+//mat4
+outMat4 = mat4.create();
+outMat4 = mat4.clone(mat4A);
+outMat4 = mat4.copy(outMat4, mat4A);
+outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
+outMat4 = mat4.identity(outMat4);
+outMat4 = mat4.transpose(outMat4, mat4A);
+outMat4 = mat4.invert(outMat4, mat4A);
+outMat4 = mat4.adjoint(outMat4, mat4A);
+outVal = mat4.determinant(mat4A);
+outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
+outMat4 = mat4.mul(outMat4, mat4A, mat4B);
+outMat4 = mat4.translate(outMat4, mat4A, vec3A);
+outMat4 = mat4.scale(outMat4, mat4A, vec3A);
+outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
+outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
+outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
+outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
+outMat4 = mat4.fromTranslation(outMat4, vec3A);
+outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A);
+outMat4 = mat4.fromScaling(outMat4, vec3A);
+outMat4 = mat4.fromXRotation(outMat4, Math.PI);
+outMat4 = mat4.fromYRotation(outMat4, Math.PI);
+outMat4 = mat4.fromZRotation(outMat4, Math.PI);
+outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
+outVec3 = mat4.getTranslation(outVec3, mat4A)
+outQuat = mat4.getRotation(outQuat, mat4A)
+outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
+outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
+outMat4 = mat4.fromQuat(outMat4, quatB);
+outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
+outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
+outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0);
+outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
+outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
+outStr = mat4.str(mat4A);
+outVal = mat4.frob(mat4A);
+outMat4 = mat4.add(outMat4, mat4A, mat4B);
+outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
+outMat4 = mat4.sub(outMat4, mat4A, mat4B);
+outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2);
+outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2);
+outBool = mat4.exactEquals(mat4A, mat4B);
+outBool = mat4.equals(mat4A, mat4B);
// quat
-var quatA = [1, 2, 3, 4];
-var quatB = [5, 6, 7, 8];
-out = [0, 0, 0, 0];
-var vec = [1, 1, -1];
-var id = [0, 0, 0, 1];
var deg90 = Math.PI / 2;
-
-out = quat.create();
-out = quat.clone(quatA);
-out = quat.fromValues(1, 2, 3, 4);
-out = quat.copy(out, quatA);
-out = quat.set(out, 1, 2, 3, 4);
-out = quat.identity(out);
-out = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5);
-out = quat.add(out, quatA, quatB);
-out = quat.multiply(out, quatA, quatB);
-out = quat.mul(out, quatA, quatB);
-out = quat.scale(out, quatA, 2);
+outQuat = quat.create();
+outQuat = quat.clone(quatA);
+outQuat = quat.fromValues(1, 2, 3, 4);
+outQuat = quat.copy(outQuat, quatA);
+outQuat = quat.set(outQuat, 1, 2, 3, 4);
+outQuat = quat.identity(outQuat);
+outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
+outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
+outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
+outVal = quat.getAxisAngle (outVec3, quatA);
+outQuat = quat.add(outQuat, quatA, quatB);
+outQuat = quat.multiply(outQuat, quatA, quatB);
+outQuat = quat.mul(outQuat, quatA, quatB);
+outQuat = quat.scale(outQuat, quatA, 2);
outVal = quat.length(quatA);
outVal = quat.len(quatA);
outVal = quat.squaredLength(quatA);
outVal = quat.sqrLen(quatA);
-out = quat.normalize(out, quatA);
-outVal = quat.dot(out, quatA, quatB);
-out = quat.lerp(out, quatA, quatB, 0.5);
-out = quat.slerp(out, quatA, quatB, 0.5);
-out = quat.invert(out, quatA);
-out = quat.conjugate(out, quatA);
+outQuat = quat.normalize(outQuat, quatA);
+outVal = quat.dot(quatA, quatB);
+outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
+outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
+outQuat = quat.invert(outQuat, quatA);
+outQuat = quat.conjugate(outQuat, quatA);
outStr = quat.str(quatA);
-out = quat.rotateX(out, id, deg90);
-out = quat.rotateY(out, id, deg90);
-out = quat.rotateZ(out, id, deg90);
-
-matr = [ 1, 0, 0,
- 0, 0, -1,
- 0, 1, 0 ];
-out = quat.fromMat3(out, matr);
-
-var view = [-1, 0, 0];
-up = [ 0, 1, 0];
-var right= [ 0, 0,-1];
-out = quat.setAxes([], view, right, up);
-
-out = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]);
-out = quat.calculateW(out, quatA);
-
+outQuat = quat.rotateX(outQuat, quatA, deg90);
+outQuat = quat.rotateY(outQuat, quatA, deg90);
+outQuat = quat.rotateZ(outQuat, quatA, deg90);
+outQuat = quat.fromMat3(outQuat, mat3A);
+outQuat = quat.calculateW(outQuat, quatA);
+outBool = quat.exactEquals(quatA, quatB);
+outBool = quat.equals(quatA, quatB);
diff --git a/gl-matrix/gl-matrix-typed-tests.ts b/gl-matrix/gl-matrix-typed-tests.ts
deleted file mode 100644
index 7364ec0a83..0000000000
--- a/gl-matrix/gl-matrix-typed-tests.ts
+++ /dev/null
@@ -1,346 +0,0 @@
-///
-
-// common
-import {vec2, mat2, mat3, mat4, vec3, vec4, glMatrix, mat2d, quat} from "./gl-matrix-typed";
-var result: number = glMatrix.toRadian(180);
-
-var outVal: number;
-var outBool: boolean;
-var outStr: string;
-
-let vecArray = new Float32Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]);
-
-let vec2A = vec2.fromValues(1, 2);
-let vec2B = vec2.fromValues(3, 4);
-let vec3A = vec3.fromValues(1, 2, 3);
-let vec3B = vec3.fromValues(3, 4, 5);
-let vec4A = vec4.fromValues(1, 2, 3, 4);
-let vec4B = vec4.fromValues(3, 4, 5, 6);
-let mat2A = mat2.fromValues(1, 2, 3, 4);
-let mat2B = mat2.fromValues(1, 2, 3, 4);
-let mat2dA = mat2d.fromValues(1, 2, 3, 4, 5, 6);
-let mat2dB = mat2d.fromValues(1, 2, 3, 4, 5, 6);
-let mat3A = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
-let mat3B = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
-let mat4A = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-let mat4B = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-let quatA = quat.fromValues(1, 2, 3, 4);
-let quatB = quat.fromValues(5, 6, 7, 8);
-
-let outVec2 = vec2.create();
-let outVec3 = vec3.create();
-let outVec4 = vec4.create();
-let outMat2 = mat2.create();
-let outMat2d = mat2d.create();
-let outMat3 = mat3.create();
-let outMat4 = mat4.create();
-let outQuat = quat.create();
-
-// vec2
-outVec2 = vec2.create();
-outVec2 = vec2.clone(vec2A);
-outVec2 = vec2.fromValues(1, 2);
-outVec2 = vec2.copy(outVec2, vec2A);
-outVec2 = vec2.set(outVec2, 1, 2);
-outVec2 = vec2.add(outVec2, vec2A, vec2B);
-outVec2 = vec2.subtract(outVec2, vec2A, vec2B);
-outVec2 = vec2.sub(outVec2, vec2A, vec2B);
-outVec2 = vec2.multiply(outVec2, vec2A, vec2B);
-outVec2 = vec2.mul(outVec2, vec2A, vec2B);
-outVec2 = vec2.divide(outVec2, vec2A, vec2B);
-outVec2 = vec2.div(outVec2, vec2A, vec2B);
-outVec2 = vec2.ceil(outVec2, vec2A);
-outVec2 = vec2.floor(outVec2, vec2A);
-outVec2 = vec2.min(outVec2, vec2A, vec2B);
-outVec2 = vec2.max(outVec2, vec2A, vec2B);
-outVec2 = vec2.round(outVec2, vec2A);
-outVec2 = vec2.scale(outVec2, vec2A, 2);
-outVec2 = vec2.scaleAndAdd(outVec2, vec2A, vec2B, 0.5);
-outVal = vec2.distance(vec2A, vec2B);
-outVal = vec2.dist(vec2A, vec2B);
-outVal = vec2.squaredDistance(vec2A, vec2B);
-outVal = vec2.sqrDist(vec2A, vec2B);
-outVal = vec2.length(vec2A);
-outVal = vec2.len(vec2A);
-outVal = vec2.squaredLength(vec2A);
-outVal = vec2.sqrLen(vec2A);
-outVec2 = vec2.negate(outVec2, vec2A);
-outVec2 = vec2.inverse(outVec2, vec2A);
-outVec2 = vec2.normalize(outVec2, vec2A);
-outVal = vec2.dot(vec2A, vec2B);
-outVec2 = vec2.cross(outVec2, vec2A, vec2B);
-outVec2 = vec2.lerp(outVec2, vec2A, vec2B, 0.5);
-outVec2 = vec2.random(outVec2);
-outVec2 = vec2.random(outVec2, 5.0);
-outVec2 = vec2.transformMat2(outVec2, vec2A, mat2A);
-outVec2 = vec2.transformMat2d(outVec2, vec2A, mat2dA);
-outVec2 = vec2.transformMat3(outVec2, vec2A, mat3A);
-outVec2 = vec2.transformMat4(outVec2, vec2A, mat4A);
-vecArray = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize);
-outStr = vec2.str(vec2A);
-outBool = vec2.exactEquals(vec2A, vec2B);
-outBool = vec2.equals(vec2A, vec2B);
-
-// vec3
-outVec3 = vec3.create();
-outVec3 = vec3.clone(vec3A);
-outVec3 = vec3.fromValues(1, 2, 3);
-outVec3 = vec3.copy(outVec3, vec3A);
-outVec3 = vec3.set(outVec3, 1, 2, 3);
-outVec3 = vec3.add(outVec3, vec3A, vec3B);
-outVec3 = vec3.subtract(outVec3, vec3A, vec3B);
-outVec3 = vec3.sub(outVec3, vec3A, vec3B);
-outVec3 = vec3.multiply(outVec3, vec3A, vec3B);
-outVec3 = vec3.mul(outVec3, vec3A, vec3B);
-outVec3 = vec3.divide(outVec3, vec3A, vec3B);
-outVec3 = vec3.div(outVec3, vec3A, vec3B);
-outVec3 = vec3.ceil(outVec3, vec3A);
-outVec3 = vec3.floor(outVec3, vec3A);
-outVec3 = vec3.min(outVec3, vec3A, vec3B);
-outVec3 = vec3.max(outVec3, vec3A, vec3B);
-outVec3 = vec3.round(outVec3, vec3A);
-outVec3 = vec3.scale(outVec3, vec3A, 2);
-outVec3 = vec3.scaleAndAdd(outVec3, vec3A, vec3B, 0.5);
-outVal = vec3.distance(vec3A, vec3B);
-outVal = vec3.dist(vec3A, vec3B);
-outVal = vec3.squaredDistance(vec3A, vec3B);
-outVal = vec3.sqrDist(vec3A, vec3B);
-outVal = vec3.length(vec3A);
-outVal = vec3.len(vec3A);
-outVal = vec3.squaredLength(vec3A);
-outVal = vec3.sqrLen(vec3A);
-outVec3 = vec3.negate(outVec3, vec3A);
-outVec3 = vec3.inverse(outVec3, vec3A);
-outVec3 = vec3.normalize(outVec3, vec3A);
-outVal = vec3.dot(vec3A, vec3B);
-outVec3 = vec3.cross(outVec3, vec3A, vec3B);
-outVec3 = vec3.lerp(outVec3, vec3A, vec3B, 0.5);
-outVec3 = vec3.hermite(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
-outVec3 = vec3.bezier(outVec3, vec3A, vec3B, vec3A, vec3B, 0.5);
-outVec3 = vec3.random(outVec3);
-outVec3 = vec3.random(outVec3, 5.0);
-outVec3 = vec3.transformMat3(outVec3, vec3A, mat3A);
-outVec3 = vec3.transformMat4(outVec3, vec3A, mat4A);
-outVec3 = vec3.transformQuat(outVec3, vec3A, quatA);
-outVec3 = vec3.rotateX(outVec3, vec3A, vec3B, Math.PI);
-outVec3 = vec3.rotateY(outVec3, vec3A, vec3B, Math.PI);
-outVec3 = vec3.rotateZ(outVec3, vec3A, vec3B, Math.PI);
-vecArray = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize);
-outVal = vec3.angle(vec3A, vec3B);
-outStr = vec3.str(vec3A);
-outBool = vec3.exactEquals(vec3A, vec3B);
-outBool = vec3.equals(vec3A, vec3B);
-
-// vec4
-outVec4 = vec4.create();
-outVec4 = vec4.clone(vec4A);
-outVec4 = vec4.fromValues(1, 2, 3, 4);
-outVec4 = vec4.copy(outVec4, vec4A);
-outVec4 = vec4.set(outVec4, 1, 2, 3, 4);
-outVec4 = vec4.add(outVec4, vec4A, vec4B);
-outVec4 = vec4.subtract(outVec4, vec4A, vec4B);
-outVec4 = vec4.sub(outVec4, vec4A, vec4B);
-outVec4 = vec4.multiply(outVec4, vec4A, vec4B);
-outVec4 = vec4.mul(outVec4, vec4A, vec4B);
-outVec4 = vec4.divide(outVec4, vec4A, vec4B);
-outVec4 = vec4.div(outVec4, vec4A, vec4B);
-outVec4 = vec4.ceil(outVec4, vec4A);
-outVec4 = vec4.floor(outVec4, vec4A);
-outVec4 = vec4.min(outVec4, vec4A, vec4B);
-outVec4 = vec4.max(outVec4, vec4A, vec4B);
-outVec4 = vec4.scale(outVec4, vec4A, 2);
-outVec4 = vec4.scaleAndAdd(outVec4, vec4A, vec4B, 0.5);
-outVal = vec4.distance(vec4A, vec4B);
-outVal = vec4.dist(vec4A, vec4B);
-outVal = vec4.squaredDistance(vec4A, vec4B);
-outVal = vec4.sqrDist(vec4A, vec4B);
-outVal = vec4.length(vec4A);
-outVal = vec4.len(vec4A);
-outVal = vec4.squaredLength(vec4A);
-outVal = vec4.sqrLen(vec4A);
-outVec4 = vec4.negate(outVec4, vec4A);
-outVec4 = vec4.inverse(outVec4, vec4A);
-outVec4 = vec4.normalize(outVec4, vec4A);
-outVal = vec4.dot(vec4A, vec4B);
-outVec4 = vec4.lerp(outVec4, vec4A, vec4B, 0.5);
-outVec4 = vec4.random(outVec4);
-outVec4 = vec4.random(outVec4, 5.0);
-outVec4 = vec4.transformMat4(outVec4, vec4A, mat4A);
-outVec4 = vec4.transformQuat(outVec4, vec4A, quatA);
-vecArray = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize);
-outStr = vec4.str(vec4A);
-outBool = vec4.exactEquals(vec4A, vec4B);
-outBool = vec4.equals(vec4A, vec4B);
-
-// mat2
-outMat2 = mat2.create();
-outMat2 = mat2.clone(mat2A);
-outMat2 = mat2.copy(outMat2, mat2A);
-outMat2 = mat2.identity(outMat2);
-outMat2 = mat2.fromValues(1, 2, 3, 4);
-outMat2 = mat2.set(outMat2, 1, 2, 3, 4);
-outMat2 = mat2.transpose(outMat2, mat2A);
-outMat2 = mat2.invert(outMat2, mat2A);
-outMat2 = mat2.adjoint(outMat2, mat2A);
-outVal = mat2.determinant(mat2A);
-outMat2 = mat2.multiply(outMat2, mat2A, mat2B);
-outMat2 = mat2.mul(outMat2, mat2A, mat2B);
-outMat2 = mat2.rotate(outMat2, mat2A, Math.PI * 0.5);
-outMat2 = mat2.scale(outMat2, mat2A, vec2A);
-outMat2 = mat2.fromRotation(outMat2, 0.5);
-outMat2 = mat2.fromScaling(outMat2, vec2A);
-outStr = mat2.str(mat2A);
-outVal = mat2.frob(mat2A);
-var L = mat2.create();
-var D = mat2.create();
-var U = mat2.create();
-outMat2 = mat2.LDU(L, D, U, mat2A);
-outMat2 = mat2.add(outMat2, mat2A, mat2B);
-outMat2 = mat2.subtract(outMat2, mat2A, mat2B);
-outMat2 = mat2.sub(outMat2, mat2A, mat2B);
-outBool = mat2.exactEquals(mat2A, mat2B);
-outBool = mat2.equals(mat2A, mat2B);
-outMat2 = mat2.multiplyScalar (outMat2, mat2A, 2);
-outMat2 = mat2.multiplyScalarAndAdd (outMat2, mat2A, mat2B, 2);
-
-// mat2d
-outMat2d = mat2d.create();
-outMat2d = mat2d.clone(mat2dA);
-outMat2d = mat2d.copy(outMat2d, mat2dA);
-outMat2d = mat2d.identity(outMat2d);
-outMat2d = mat2d.fromValues(1, 2, 3, 4, 5, 6);
-outMat2d = mat2d.set(outMat2d, 1, 2, 3, 4, 5, 6);
-outMat2d = mat2d.invert(outMat2d, mat2dA);
-outVal = mat2d.determinant(mat2dA);
-outMat2d = mat2d.multiply(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.mul(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.rotate(outMat2d, mat2dA, Math.PI * 0.5);
-outMat2d = mat2d.scale(outMat2d, mat2dA, vec2A);
-outMat2d = mat2d.translate(outMat2d, mat2dA, vec2A);
-outMat2d = mat2d.fromRotation(outMat2d, 0.5);
-outMat2d = mat2d.fromScaling(outMat2d, vec2A);
-outMat2d = mat2d.fromTranslation(outMat2d, vec2A);
-outStr = mat2d.str(mat2dA);
-outVal = mat2d.frob(mat2dA);
-outMat2d = mat2d.add(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.subtract(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.sub(outMat2d, mat2dA, mat2dB);
-outMat2d = mat2d.multiplyScalar (outMat2d, mat2dA, 2);
-outMat2d = mat2d.multiplyScalarAndAdd (outMat2d, mat2dA, mat2dB, 2);
-outBool = mat2d.exactEquals(mat2dA, mat2dB);
-outBool = mat2d.equals(mat2dA, mat2dB);
-
-
-// mat3
-outMat3 = mat3.create();
-outMat3 = mat3.fromMat4(outMat3, mat4A);
-outMat3 = mat3.clone(mat3A);
-outMat3 = mat3.copy(outMat3, mat3A);
-outMat3 = mat3.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9);
-outMat3 = mat3.set(outMat3, 1, 2, 3, 4, 5, 6, 7, 8, 9);
-outMat3 = mat3.identity(outMat3);
-outMat3 = mat3.transpose(outMat3, mat3A);
-outMat3 = mat3.invert(outMat3, mat3A);
-outMat3 = mat3.adjoint(outMat3, mat3A);
-outVal = mat3.determinant(mat3A);
-outMat3 = mat3.multiply(outMat3, mat3A, mat3B);
-outMat3 = mat3.mul(outMat3, mat3A, mat3B);
-outMat3 = mat3.translate(outMat3, mat3A, vec3A);
-outMat3 = mat3.rotate(outMat3, mat3A, Math.PI/2);
-outMat3 = mat3.scale(outMat3, mat3A, vec2A);
-outMat3 = mat3.fromTranslation(outMat3, vec2A);
-outMat3 = mat3.fromRotation(outMat3, Math.PI);
-outMat3 = mat3.fromScaling(outMat3, vec2A);
-outMat3 = mat3.fromMat2d(outMat3, mat2dA);
-outMat3 = mat3.fromQuat(outMat3, quatA);
-outMat3 = mat3.normalFromMat4(outMat3, mat4A);
-outStr = mat3.str(mat3A);
-outVal = mat3.frob(mat3A);
-outMat3 = mat3.add(outMat3, mat3A, mat3B);
-outMat3 = mat3.subtract(outMat3, mat3A, mat3B);
-outMat3 = mat3.sub(outMat3, mat3A, mat3B);
-outMat3 = mat3.multiplyScalar (outMat3, mat3A, 2);
-outMat3 = mat3.multiplyScalarAndAdd (outMat3, mat3A, mat3B, 2);
-outBool = mat3.exactEquals(mat3A, mat3B);
-outBool = mat3.equals(mat3A, mat3B);
-
-//mat4
-outMat4 = mat4.create();
-outMat4 = mat4.clone(mat4A);
-outMat4 = mat4.copy(outMat4, mat4A);
-outMat4 = mat4.fromValues(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-outMat4 = mat4.set(outMat4, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16);
-outMat4 = mat4.identity(outMat4);
-outMat4 = mat4.transpose(outMat4, mat4A);
-outMat4 = mat4.invert(outMat4, mat4A);
-outMat4 = mat4.adjoint(outMat4, mat4A);
-outVal = mat4.determinant(mat4A);
-outMat4 = mat4.multiply(outMat4, mat4A, mat4B);
-outMat4 = mat4.mul(outMat4, mat4A, mat4B);
-outMat4 = mat4.translate(outMat4, mat4A, vec3A);
-outMat4 = mat4.scale(outMat4, mat4A, vec3A);
-outMat4 = mat4.rotate(outMat4, mat4A, Math.PI, vec3A);
-outMat4 = mat4.rotateX(outMat4, mat4A, Math.PI);
-outMat4 = mat4.rotateY(outMat4, mat4A, Math.PI);
-outMat4 = mat4.rotateZ(outMat4, mat4A, Math.PI);
-outMat4 = mat4.fromTranslation(outMat4, vec3A);
-outMat4 = mat4.fromRotation(outMat4, Math.PI, vec3A);
-outMat4 = mat4.fromScaling(outMat4, vec3A);
-outMat4 = mat4.fromXRotation(outMat4, Math.PI);
-outMat4 = mat4.fromYRotation(outMat4, Math.PI);
-outMat4 = mat4.fromZRotation(outMat4, Math.PI);
-outMat4 = mat4.fromRotationTranslation(outMat4, quatA, vec3A);
-outVec3 = mat4.getTranslation(outVec3, mat4A)
-outQuat = mat4.getRotation(outQuat, mat4A)
-outMat4 = mat4.fromRotationTranslationScale(outMat4, quatA, vec3A, vec3B);
-outMat4 = mat4.fromRotationTranslationScaleOrigin(outMat4, quatA, vec3A, vec3B, vec3A);
-outMat4 = mat4.fromQuat(outMat4, quatB);
-outMat4 = mat4.frustum(outMat4, -1, 1, -1, 1, -1, 1);
-outMat4 = mat4.perspective(outMat4, Math.PI, 1, 0, 1);
-outMat4 = mat4.perspectiveFromFieldOfView(outMat4, {upDegrees:Math.PI, downDegrees:-Math.PI, leftDegrees:-Math.PI, rightDegrees:Math.PI}, 1, 0);
-outMat4 = mat4.ortho(outMat4, -1, 1, -1, 1, -1, 1);
-outMat4 = mat4.lookAt(outMat4, vec3A, vec3B, vec3A);
-outStr = mat4.str(mat4A);
-outVal = mat4.frob(mat4A);
-outMat4 = mat4.add(outMat4, mat4A, mat4B);
-outMat4 = mat4.subtract(outMat4, mat4A, mat4B);
-outMat4 = mat4.sub(outMat4, mat4A, mat4B);
-outMat4 = mat4.multiplyScalar (outMat4, mat4A, 2);
-outMat4 = mat4.multiplyScalarAndAdd (outMat4, mat4A, mat4B, 2);
-outBool = mat4.exactEquals(mat4A, mat4B);
-outBool = mat4.equals(mat4A, mat4B);
-
-// quat
-var deg90 = Math.PI / 2;
-outQuat = quat.create();
-outQuat = quat.clone(quatA);
-outQuat = quat.fromValues(1, 2, 3, 4);
-outQuat = quat.copy(outQuat, quatA);
-outQuat = quat.set(outQuat, 1, 2, 3, 4);
-outQuat = quat.identity(outQuat);
-outQuat = quat.rotationTo(outQuat, vec3A, vec3B);
-outQuat = quat.setAxes(outQuat, vec3A, vec3B, vec3A);
-outQuat = quat.setAxisAngle(outQuat, vec3A, Math.PI * 0.5);
-outVal = quat.getAxisAngle (outVec3, quatA);
-outQuat = quat.add(outQuat, quatA, quatB);
-outQuat = quat.multiply(outQuat, quatA, quatB);
-outQuat = quat.mul(outQuat, quatA, quatB);
-outQuat = quat.scale(outQuat, quatA, 2);
-outVal = quat.length(quatA);
-outVal = quat.len(quatA);
-outVal = quat.squaredLength(quatA);
-outVal = quat.sqrLen(quatA);
-outQuat = quat.normalize(outQuat, quatA);
-outVal = quat.dot(quatA, quatB);
-outQuat = quat.lerp(outQuat, quatA, quatB, 0.5);
-outQuat = quat.slerp(outQuat, quatA, quatB, 0.5);
-outQuat = quat.invert(outQuat, quatA);
-outQuat = quat.conjugate(outQuat, quatA);
-outStr = quat.str(quatA);
-outQuat = quat.rotateX(outQuat, quatA, deg90);
-outQuat = quat.rotateY(outQuat, quatA, deg90);
-outQuat = quat.rotateZ(outQuat, quatA, deg90);
-outQuat = quat.fromMat3(outQuat, mat3A);
-outQuat = quat.calculateW(outQuat, quatA);
-outBool = quat.exactEquals(quatA, quatB);
-outBool = quat.equals(quatA, quatB);
\ No newline at end of file
diff --git a/gl-matrix/gl-matrix-typed.d.ts b/gl-matrix/gl-matrix-typed.d.ts
deleted file mode 100644
index e172074fec..0000000000
--- a/gl-matrix/gl-matrix-typed.d.ts
+++ /dev/null
@@ -1,3054 +0,0 @@
-// Type definitions for gl-matrix 2.2.2
-// Project: https://github.com/toji/gl-matrix
-// Definitions by: Mattijs Kneppers , based on definitions by Tat
-// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-
-// Common
-export class glMatrix {
- /**
- * Convert Degree To Radian
- *
- * @param a Angle in Degrees
- */
- public static toRadian(a: number): number;
-}
-
-// vec2
-export class vec2 extends Float32Array {
- private typeVec2:number;
-
- /**
- * Creates a new, empty vec2
- *
- * @returns a new 2D vector
- */
- public static create(): vec2;
-
- /**
- * Creates a new vec2 initialized with values from an existing vector
- *
- * @param a a vector to clone
- * @returns a new 2D vector
- */
- public static clone(a: vec2): vec2;
-
- /**
- * Creates a new vec2 initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @returns a new 2D vector
- */
- public static fromValues(x: number, y: number): vec2;
-
- /**
- * Copy the values from one vec2 to another
- *
- * @param out the receiving vector
- * @param a the source vector
- * @returns out
- */
- public static copy(out: vec2, a: vec2): vec2;
-
- /**
- * Set the components of a vec2 to the given values
- *
- * @param out the receiving vector
- * @param x X component
- * @param y Y component
- * @returns out
- */
- public static set(out: vec2, x: number, y: number): vec2;
-
- /**
- * Adds two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static add(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static subtract(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static sub(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Multiplies two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Multiplies two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Divides two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static divide(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Divides two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static div(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Math.ceil the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to ceil
- * @returns {vec2} out
- */
- public static ceil(out:vec2, a:vec2):vec2;
-
- /**
- * Math.floor the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to floor
- * @returns {vec2} out
- */
- public static floor (out:vec2, a:vec2):vec2;
-
- /**
- * Returns the minimum of two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static min(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Returns the maximum of two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static max(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Math.round the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to round
- * @returns {vec2} out
- */
- public static round(out:vec2, a:vec2):vec2;
-
-
- /**
- * Scales a vec2 by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- */
- public static scale(out: vec2, a: vec2, b: number): vec2;
-
- /**
- * Adds two vec2's after scaling the second operand by a scalar value
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param scale the amount to scale b by before adding
- * @returns out
- */
- public static scaleAndAdd(out: vec2, a: vec2, b: vec2, scale: number): vec2;
-
- /**
- * Calculates the euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static distance(a: vec2, b: vec2): number;
-
- /**
- * Calculates the euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static dist(a: vec2, b: vec2): number;
-
- /**
- * Calculates the squared euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static squaredDistance(a: vec2, b: vec2): number;
-
- /**
- * Calculates the squared euclidian distance between two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static sqrDist(a: vec2, b: vec2): number;
-
- /**
- * Calculates the length of a vec2
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static length(a: vec2): number;
-
- /**
- * Calculates the length of a vec2
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static len(a: vec2): number;
-
- /**
- * Calculates the squared length of a vec2
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static squaredLength(a: vec2): number;
-
- /**
- * Calculates the squared length of a vec2
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static sqrLen(a: vec2): number;
-
- /**
- * Negates the components of a vec2
- *
- * @param out the receiving vector
- * @param a vector to negate
- * @returns out
- */
- public static negate(out: vec2, a: vec2): vec2;
-
- /**
- * Returns the inverse of the components of a vec2
- *
- * @param out the receiving vector
- * @param a vector to invert
- * @returns out
- */
- public static inverse(out: vec2, a: vec2): vec2;
-
- /**
- * Normalize a vec2
- *
- * @param out the receiving vector
- * @param a vector to normalize
- * @returns out
- */
- public static normalize(out: vec2, a: vec2): vec2;
-
- /**
- * Calculates the dot product of two vec2's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- */
- public static dot(a: vec2, b: vec2): number;
-
- /**
- * Computes the cross product of two vec2's
- * Note that the cross product must by definition produce a 3D vector
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static cross(out: vec2, a: vec2, b: vec2): vec2;
-
- /**
- * Performs a linear interpolation between two vec2's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static lerp(out: vec2, a: vec2, b: vec2, t: number): vec2;
-
- /**
- * Generates a random unit vector
- *
- * @param out the receiving vector
- * @returns out
- */
- public static random(out: vec2): vec2;
-
- /**
- * Generates a random vector with the given scale
- *
- * @param out the receiving vector
- * @param scale Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns out
- */
- public static random(out: vec2, scale: number): vec2;
-
- /**
- * Transforms the vec2 with a mat2
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat2(out: vec2, a: vec2, m: mat2): vec2;
-
- /**
- * Transforms the vec2 with a mat2d
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat2d(out: vec2, a: vec2, m: mat2d): vec2;
-
- /**
- * Transforms the vec2 with a mat3
- * 3rd vector component is implicitly '1'
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat3(out: vec2, a: vec2, m: mat3): vec2;
-
- /**
- * Transforms the vec2 with a mat4
- * 3rd vector component is implicitly '0'
- * 4th vector component is implicitly '1'
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat4(out: vec2, a: vec2, m: mat4): vec2;
-
- /**
- * Perform some operation over an array of vec2s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec2s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @param arg additional argument to pass to fn
- * @returns a
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec2, b: vec2, arg: any) => void, arg: any): Float32Array;
-
- /**
- * Perform some operation over an array of vec2s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec2. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec2s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @returns a
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec2, b: vec2) => void): Float32Array;
-
- /**
- * Returns a string representation of a vector
- *
- * @param a vector to represent as a string
- * @returns string representation of the vector
- */
- public static str(a: vec2): string;
-
- /**
- * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
- *
- * @param {vec2} a The first vector.
- * @param {vec2} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static exactEquals (a:vec2, b:vec2): boolean;
-
- /**
- * Returns whether or not the vectors have approximately the same elements in the same position.
- *
- * @param {vec2} a The first vector.
- * @param {vec2} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static equals (a:vec2, b:vec2) : boolean;
-}
-
-// vec3
-export class vec3 extends Float32Array {
- private typeVec3:number;
-
- /**
- * Creates a new, empty vec3
- *
- * @returns a new 3D vector
- */
- public static create(): vec3;
-
- /**
- * Creates a new vec3 initialized with values from an existing vector
- *
- * @param a vector to clone
- * @returns a new 3D vector
- */
- public static clone(a: vec3): vec3;
-
- /**
- * Creates a new vec3 initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @returns a new 3D vector
- */
- public static fromValues(x: number, y: number, z: number): vec3;
-
- /**
- * Copy the values from one vec3 to another
- *
- * @param out the receiving vector
- * @param a the source vector
- * @returns out
- */
- public static copy(out: vec3, a: vec3): vec3;
-
- /**
- * Set the components of a vec3 to the given values
- *
- * @param out the receiving vector
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @returns out
- */
- public static set(out: vec3, x: number, y: number, z: number): vec3;
-
- /**
- * Adds two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static add(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static subtract(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static sub(out: vec3, a: vec3, b: vec3): vec3
-
- /**
- * Multiplies two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Multiplies two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Divides two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static divide(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Divides two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static div(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Math.ceil the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to ceil
- * @returns {vec3} out
- */
- public static ceil (out:vec3, a:vec3) : vec3;
-
- /**
- * Math.floor the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to floor
- * @returns {vec3} out
- */
- public static floor (out:vec3, a:vec3) :vec3;
-
- /**
- * Returns the minimum of two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static min(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Returns the maximum of two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static max(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Math.round the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to round
- * @returns {vec3} out
- */
- public static round (out:vec3, a:vec3) : vec3
-
- /**
- * Scales a vec3 by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- */
- public static scale(out: vec3, a: vec3, b: number): vec3;
-
- /**
- * Adds two vec3's after scaling the second operand by a scalar value
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param scale the amount to scale b by before adding
- * @returns out
- */
- public static scaleAndAdd(out: vec3, a: vec3, b: vec3, scale: number): vec3;
-
- /**
- * Calculates the euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static distance(a: vec3, b: vec3): number;
-
- /**
- * Calculates the euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static dist(a: vec3, b: vec3): number;
-
- /**
- * Calculates the squared euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static squaredDistance(a: vec3, b: vec3): number;
-
- /**
- * Calculates the squared euclidian distance between two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static sqrDist(a: vec3, b: vec3): number;
-
- /**
- * Calculates the length of a vec3
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static length(a: vec3): number;
-
- /**
- * Calculates the length of a vec3
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static len(a: vec3): number;
-
- /**
- * Calculates the squared length of a vec3
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static squaredLength(a: vec3): number;
-
- /**
- * Calculates the squared length of a vec3
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static sqrLen(a: vec3): number;
-
- /**
- * Negates the components of a vec3
- *
- * @param out the receiving vector
- * @param a vector to negate
- * @returns out
- */
- public static negate(out: vec3, a: vec3): vec3;
-
- /**
- * Returns the inverse of the components of a vec3
- *
- * @param out the receiving vector
- * @param a vector to invert
- * @returns out
- */
- public static inverse(out: vec3, a: vec3): vec3;
-
- /**
- * Normalize a vec3
- *
- * @param out the receiving vector
- * @param a vector to normalize
- * @returns out
- */
- public static normalize(out: vec3, a: vec3): vec3;
-
- /**
- * Calculates the dot product of two vec3's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- */
- public static dot(a: vec3, b: vec3): number;
-
- /**
- * Computes the cross product of two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static cross(out: vec3, a: vec3, b: vec3): vec3;
-
- /**
- * Performs a linear interpolation between two vec3's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static lerp(out: vec3, a: vec3, b: vec3, t: number): vec3;
-
- /**
- * Performs a hermite interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- public static hermite (out:vec3, a:vec3, b:vec3, c:vec3, d:vec3, t:number) : vec3;
-
- /**
- * Performs a bezier interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- public static bezier (out:vec3, a:vec3, b:vec3, c:vec3, d:vec3, t:number) :vec3;
-
- /**
- * Generates a random unit vector
- *
- * @param out the receiving vector
- * @returns out
- */
- public static random(out: vec3): vec3;
-
- /**
- * Generates a random vector with the given scale
- *
- * @param out the receiving vector
- * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned
- * @returns out
- */
- public static random(out: vec3, scale: number): vec3;
-
- /**
- * Transforms the vec3 with a mat3.
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m the 3x3 matrix to transform with
- * @returns out
- */
- public static transformMat3(out: vec3, a: vec3, m: mat3): vec3;
-
- /**
- * Transforms the vec3 with a mat4.
- * 4th vector component is implicitly '1'
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat4(out: vec3, a: vec3, m: mat4): vec3;
-
- /**
- * Transforms the vec3 with a quat
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param q quaternion to transform with
- * @returns out
- */
- public static transformQuat(out: vec3, a: vec3, q: quat): vec3;
-
-
- /**
- * Rotate a 3D vector around the x-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- public static rotateX(out: vec3, a: vec3, b: vec3, c: number): vec3;
-
- /**
- * Rotate a 3D vector around the y-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- public static rotateY(out: vec3, a: vec3, b: vec3, c: number): vec3;
-
- /**
- * Rotate a 3D vector around the z-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- public static rotateZ(out: vec3, a: vec3, b: vec3, c: number): vec3;
-
- /**
- * Perform some operation over an array of vec3s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec3s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @param arg additional argument to pass to fn
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec3, b: vec3, arg: any) => void, arg: any): Float32Array;
-
- /**
- * Perform some operation over an array of vec3s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec3. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec3s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec3, b: vec3) => void): Float32Array;
-
- /**
- * Get the angle between two 3D vectors
- * @param a The first operand
- * @param b The second operand
- * @returns The angle in radians
- */
- public static angle(a: vec3, b: vec3): number;
-
- /**
- * Returns a string representation of a vector
- *
- * @param a vector to represent as a string
- * @returns string representation of the vector
- */
- public static str(a: vec3): string;
-
- /**
- * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
- *
- * @param {vec3} a The first vector.
- * @param {vec3} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static exactEquals (a:vec3, b:vec3): boolean
-
- /**
- * Returns whether or not the vectors have approximately the same elements in the same position.
- *
- * @param {vec3} a The first vector.
- * @param {vec3} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static equals (a:vec3, b:vec3) : boolean
-}
-
-// vec4
-export class vec4 extends Float32Array {
- private typeVec3:number;
-
- /**
- * Creates a new, empty vec4
- *
- * @returns a new 4D vector
- */
- public static create(): vec4;
-
- /**
- * Creates a new vec4 initialized with values from an existing vector
- *
- * @param a vector to clone
- * @returns a new 4D vector
- */
- public static clone(a: vec4): vec4;
-
- /**
- * Creates a new vec4 initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns a new 4D vector
- */
- public static fromValues(x: number, y: number, z: number, w: number): vec4;
-
- /**
- * Copy the values from one vec4 to another
- *
- * @param out the receiving vector
- * @param a the source vector
- * @returns out
- */
- public static copy(out: vec4, a: vec4): vec4;
-
- /**
- * Set the components of a vec4 to the given values
- *
- * @param out the receiving vector
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns out
- */
- public static set(out: vec4, x: number, y: number, z: number, w: number): vec4;
-
- /**
- * Adds two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static add(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static subtract(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Subtracts vector b from vector a
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static sub(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Multiplies two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Multiplies two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Divides two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static divide(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Divides two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static div(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Math.ceil the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to ceil
- * @returns {vec4} out
- */
- public static ceil (out:vec4, a:vec4) : vec4;
-
- /**
- * Math.floor the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to floor
- * @returns {vec4} out
- */
- public static floor (out:vec4, a:vec4) : vec4;
-
- /**
- * Returns the minimum of two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static min(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Returns the maximum of two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static max(out: vec4, a: vec4, b: vec4): vec4;
-
- /**
- * Math.round the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to round
- * @returns {vec4} out
- */
- public static round (out:vec4, a:vec4): vec4;
-
- /**
- * Scales a vec4 by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- */
- public static scale(out: vec4, a: vec4, b: number): vec4;
-
- /**
- * Adds two vec4's after scaling the second operand by a scalar value
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param scale the amount to scale b by before adding
- * @returns out
- */
- public static scaleAndAdd(out: vec4, a: vec4, b: vec4, scale: number): vec4;
-
- /**
- * Calculates the euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static distance(a: vec4, b: vec4): number;
-
- /**
- * Calculates the euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns distance between a and b
- */
- public static dist(a: vec4, b: vec4): number;
-
- /**
- * Calculates the squared euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static squaredDistance(a: vec4, b: vec4): number;
-
- /**
- * Calculates the squared euclidian distance between two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns squared distance between a and b
- */
- public static sqrDist(a: vec4, b: vec4): number;
-
- /**
- * Calculates the length of a vec4
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static length(a: vec4): number;
-
- /**
- * Calculates the length of a vec4
- *
- * @param a vector to calculate length of
- * @returns length of a
- */
- public static len(a: vec4): number;
-
- /**
- * Calculates the squared length of a vec4
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static squaredLength(a: vec4): number;
-
- /**
- * Calculates the squared length of a vec4
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- */
- public static sqrLen(a: vec4): number;
-
- /**
- * Negates the components of a vec4
- *
- * @param out the receiving vector
- * @param a vector to negate
- * @returns out
- */
- public static negate(out: vec4, a: vec4): vec4;
-
- /**
- * Returns the inverse of the components of a vec4
- *
- * @param out the receiving vector
- * @param a vector to invert
- * @returns out
- */
- public static inverse(out: vec4, a: vec4): vec4;
-
- /**
- * Normalize a vec4
- *
- * @param out the receiving vector
- * @param a vector to normalize
- * @returns out
- */
- public static normalize(out: vec4, a: vec4): vec4;
-
- /**
- * Calculates the dot product of two vec4's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- */
- public static dot(a: vec4, b: vec4): number;
-
- /**
- * Performs a linear interpolation between two vec4's
- *
- * @param out the receiving vector
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static lerp(out: vec4, a: vec4, b: vec4, t: number): vec4;
-
- /**
- * Generates a random unit vector
- *
- * @param out the receiving vector
- * @returns out
- */
- public static random(out: vec4): vec4;
-
- /**
- * Generates a random vector with the given scale
- *
- * @param out the receiving vector
- * @param scale length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns out
- */
- public static random(out: vec4, scale: number): vec4;
-
- /**
- * Transforms the vec4 with a mat4.
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param m matrix to transform with
- * @returns out
- */
- public static transformMat4(out: vec4, a: vec4, m: mat4): vec4;
-
- /**
- * Transforms the vec4 with a quat
- *
- * @param out the receiving vector
- * @param a the vector to transform
- * @param q quaternion to transform with
- * @returns out
- */
-
- public static transformQuat(out: vec4, a: vec4, q: quat): vec4;
-
- /**
- * Perform some operation over an array of vec4s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec4s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @param arg additional argument to pass to fn
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec4, b: vec4, arg: any) => void, arg: any): Float32Array;
-
- /**
- * Perform some operation over an array of vec4s.
- *
- * @param a the array of vectors to iterate over
- * @param stride Number of elements between the start of each vec4. If 0 assumes tightly packed
- * @param offset Number of elements to skip at the beginning of the array
- * @param count Number of vec4s to iterate over. If 0 iterates over entire array
- * @param fn Function to call for each vector in the array
- * @returns a
- * @function
- */
- public static forEach(a: Float32Array, stride: number, offset: number, count: number,
- fn: (a: vec4, b: vec4) => void): Float32Array;
-
- /**
- * Returns a string representation of a vector
- *
- * @param a vector to represent as a string
- * @returns string representation of the vector
- */
- public static str(a: vec4): string;
-
- /**
- * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
- *
- * @param {vec4} a The first vector.
- * @param {vec4} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static exactEquals (a:vec4, b:vec4) : boolean;
-
- /**
- * Returns whether or not the vectors have approximately the same elements in the same position.
- *
- * @param {vec4} a The first vector.
- * @param {vec4} b The second vector.
- * @returns {boolean} True if the vectors are equal, false otherwise.
- */
- public static equals (a:vec4, b:vec4) : boolean;
-}
-
-// mat2
-export class mat2 extends Float32Array {
- private typeMat2:number;
-
- /**
- * Creates a new identity mat2
- *
- * @returns a new 2x2 matrix
- */
- public static create():mat2;
-
- /**
- * Creates a new mat2 initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 2x2 matrix
- */
- public static clone(a:mat2):mat2;
-
- /**
- * Copy the values from one mat2 to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out:mat2, a:mat2):mat2;
-
- /**
- * Set a mat2 to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out:mat2):mat2;
-
- /**
- * Create a new mat2 with the given values
- *
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m10 Component in column 1, row 0 position (index 2)
- * @param {number} m11 Component in column 1, row 1 position (index 3)
- * @returns {mat2} out A new 2x2 matrix
- */
- public static fromValues(m00:number, m01:number, m10:number, m11:number):mat2;
-
- /**
- * Set the components of a mat2 to the given values
- *
- * @param {mat2} out the receiving matrix
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m10 Component in column 1, row 0 position (index 2)
- * @param {number} m11 Component in column 1, row 1 position (index 3)
- * @returns {mat2} out
- */
- public static set(out:mat2, m00:number, m01:number, m10:number, m11:number):mat2;
-
- /**
- * Transpose the values of a mat2
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static transpose(out:mat2, a:mat2):mat2;
-
- /**
- * Inverts a mat2
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out:mat2, a:mat2):mat2;
-
- /**
- * Calculates the adjugate of a mat2
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static adjoint(out:mat2, a:mat2):mat2;
-
- /**
- * Calculates the determinant of a mat2
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a:mat2):number;
-
- /**
- * Multiplies two mat2's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Multiplies two mat2's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Rotates a mat2 by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotate(out:mat2, a:mat2, rad:number):mat2;
-
- /**
- * Scales the mat2 by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- public static scale(out:mat2, a:mat2, v:vec2):mat2;
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.rotate(dest, dest, rad);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat2} out
- */
- public static fromRotation(out:mat2, rad:number):mat2;
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.scale(dest, dest, vec);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2} out
- */
- public static fromScaling(out:mat2, v:vec2):mat2;
-
- /**
- * Returns a string representation of a mat2
- *
- * @param a matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(a:mat2):string;
-
- /**
- * Returns Frobenius norm of a mat2
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a:mat2):number;
-
- /**
- * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
- * @param L the lower triangular matrix
- * @param D the diagonal matrix
- * @param U the upper triangular matrix
- * @param a the input matrix to factorize
- */
- public static LDU(L:mat2, D:mat2, U:mat2, a:mat2):mat2;
-
- /**
- * Adds two mat2's
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- public static add(out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- public static subtract (out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- public static sub (out:mat2, a:mat2, b:mat2):mat2;
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat2} a The first matrix.
- * @param {mat2} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals (a:mat2, b:mat2):boolean;
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat2} a The first matrix.
- * @param {mat2} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals (a:mat2, b:mat2) :boolean;
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat2} out
- */
- public static multiplyScalar (out:mat2, a:mat2, b:number) :mat2
-
- /**
- * Adds two mat2's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat2} out the receiving vector
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat2} out
- */
- public static multiplyScalarAndAdd (out:mat2, a:mat2, b:mat2, scale:number): mat2
-
-
-
-}
-
-// mat2d
-export class mat2d extends Float32Array {
- private typeMat2d:number;
-
- /**
- * Creates a new identity mat2d
- *
- * @returns a new 2x3 matrix
- */
- public static create(): mat2d;
-
- /**
- * Creates a new mat2d initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 2x3 matrix
- */
- public static clone(a: mat2d): mat2d;
-
- /**
- * Copy the values from one mat2d to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out: mat2d, a: mat2d): mat2d;
-
- /**
- * Set a mat2d to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out: mat2d): mat2d;
-
- /**
- * Create a new mat2d with the given values
- *
- * @param {number} a Component A (index 0)
- * @param {number} b Component B (index 1)
- * @param {number} c Component C (index 2)
- * @param {number} d Component D (index 3)
- * @param {number} tx Component TX (index 4)
- * @param {number} ty Component TY (index 5)
- * @returns {mat2d} A new mat2d
- */
- public static fromValues (a:number, b:number, c:number, d:number, tx:number, ty:number) : mat2d
-
-
- /**
- * Set the components of a mat2d to the given values
- *
- * @param {mat2d} out the receiving matrix
- * @param {number} a Component A (index 0)
- * @param {number} b Component B (index 1)
- * @param {number} c Component C (index 2)
- * @param {number} d Component D (index 3)
- * @param {number} tx Component TX (index 4)
- * @param {number} ty Component TY (index 5)
- * @returns {mat2d} out
- */
- public static set (out:mat2d, a:number, b:number, c:number, d:number, tx:number, ty:number) :mat2d
-
- /**
- * Inverts a mat2d
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out: mat2d, a: mat2d): mat2d;
-
- /**
- * Calculates the determinant of a mat2d
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a: mat2d): number;
-
- /**
- * Multiplies two mat2d's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d;
-
- /**
- * Multiplies two mat2d's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d;
-
- /**
- * Rotates a mat2d by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotate(out: mat2d, a: mat2d, rad: number): mat2d;
-
- /**
- * Scales the mat2d by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- public static scale(out: mat2d, a: mat2d, v: vec2): mat2d;
-
- /**
- * Translates the mat2d by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v the vec2 to translate the matrix by
- * @returns out
- **/
- public static translate(out: mat2d, a: mat2d, v: vec2): mat2d;
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.rotate(dest, dest, rad);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat2d} out
- */
- public static fromRotation (out:mat2d, rad:number): mat2d;
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.scale(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2d} out
- */
- public static fromScaling (out:mat2d, v:vec2):mat2d;
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.translate(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat2d} out
- */
- public static fromTranslation (out:mat2d, v:vec2):mat2d
-
- /**
- * Returns a string representation of a mat2d
- *
- * @param a matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(a: mat2d): string;
-
- /**
- * Returns Frobenius norm of a mat2d
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a: mat2d): number;
-
- /**
- * Adds two mat2d's
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- public static add (out: mat2d, a: mat2d, b: mat2d): mat2d
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat2d} out
- */
- public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d;
-
- /**
- * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat2d} out the receiving vector
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat2d} out
- */
- public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale:number) : mat2d
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat2d} a The first matrix.
- * @param {mat2d} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals (a: mat2d, b: mat2d): boolean;
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat2d} a The first matrix.
- * @param {mat2d} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals (a: mat2d, b: mat2d): boolean
-}
-
-// mat3
-export class mat3 extends Float32Array {
- private typeMat3:number;
-
- /**
- * Creates a new identity mat3
- *
- * @returns a new 3x3 matrix
- */
- public static create():mat3;
-
- /**
- * Copies the upper-left 3x3 values into the given mat3.
- *
- * @param {mat3} out the receiving 3x3 matrix
- * @param {mat4} a the source 4x4 matrix
- * @returns {mat3} out
- */
- public static fromMat4(out:mat3, a:mat4):mat3
-
- /**
- * Creates a new mat3 initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 3x3 matrix
- */
- public static clone(a:mat3):mat3;
-
- /**
- * Copy the values from one mat3 to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out:mat3, a:mat3):mat3;
-
- /**
- * Create a new mat3 with the given values
- *
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m10 Component in column 1, row 0 position (index 3)
- * @param {number} m11 Component in column 1, row 1 position (index 4)
- * @param {number} m12 Component in column 1, row 2 position (index 5)
- * @param {number} m20 Component in column 2, row 0 position (index 6)
- * @param {number} m21 Component in column 2, row 1 position (index 7)
- * @param {number} m22 Component in column 2, row 2 position (index 8)
- * @returns {mat3} A new mat3
- */
- public static fromValues(m00:number, m01:number, m02:number, m10:number, m11:number, m12:number, m20:number, m21:number, m22:number):mat3;
-
-
- /**
- * Set the components of a mat3 to the given values
- *
- * @param {mat3} out the receiving matrix
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m10 Component in column 1, row 0 position (index 3)
- * @param {number} m11 Component in column 1, row 1 position (index 4)
- * @param {number} m12 Component in column 1, row 2 position (index 5)
- * @param {number} m20 Component in column 2, row 0 position (index 6)
- * @param {number} m21 Component in column 2, row 1 position (index 7)
- * @param {number} m22 Component in column 2, row 2 position (index 8)
- * @returns {mat3} out
- */
- public static set(out:mat3, m00:number, m01:number, m02:number, m10:number, m11:number, m12:number, m20:number, m21:number, m22:number):mat3
-
- /**
- * Set a mat3 to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out:mat3):mat3;
-
- /**
- * Transpose the values of a mat3
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static transpose(out:mat3, a:mat3):mat3;
-
- /**
- * Inverts a mat3
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out:mat3, a:mat3):mat3;
-
- /**
- * Calculates the adjugate of a mat3
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static adjoint(out:mat3, a:mat3):mat3;
-
- /**
- * Calculates the determinant of a mat3
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a:mat3):number;
-
- /**
- * Multiplies two mat3's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out:mat3, a:mat3, b:mat3):mat3;
-
- /**
- * Multiplies two mat3's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out:mat3, a:mat3, b:mat3):mat3;
-
-
- /**
- * Translate a mat3 by the given vector
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v vector to translate by
- * @returns out
- */
- public static translate(out:mat3, a:mat3, v:vec3):mat3;
-
- /**
- * Rotates a mat3 by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotate(out:mat3, a:mat3, rad:number):mat3;
-
- /**
- * Scales the mat3 by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- public static scale(out:mat3, a:mat3, v:vec2):mat3;
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.translate(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat3} out
- */
- public static fromTranslation(out:mat3, v:vec2):mat3
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.rotate(dest, dest, rad);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat3} out
- */
- public static fromRotation(out:mat3, rad:number):mat3
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.scale(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat3} out
- */
- public static fromScaling(out:mat3, v:vec2):mat3
-
- /**
- * Copies the values from a mat2d into a mat3
- *
- * @param out the receiving matrix
- * @param {mat2d} a the matrix to copy
- * @returns out
- **/
- public static fromMat2d(out:mat3, a:mat2d):mat3;
-
- /**
- * Calculates a 3x3 matrix from the given quaternion
- *
- * @param out mat3 receiving operation result
- * @param q Quaternion to create matrix from
- *
- * @returns out
- */
- public static fromQuat(out:mat3, q:quat):mat3;
-
- /**
- * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
- *
- * @param out mat3 receiving operation result
- * @param a Mat4 to derive the normal matrix from
- *
- * @returns out
- */
- public static normalFromMat4(out:mat3, a:mat4):mat3;
-
- /**
- * Returns a string representation of a mat3
- *
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(mat:mat3):string;
-
- /**
- * Returns Frobenius norm of a mat3
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a:mat3):number;
-
- /**
- * Adds two mat3's
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- public static add(out:mat3, a:mat3, b:mat3):mat3
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- public static subtract(out:mat3, a:mat3, b:mat3):mat3
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- public static sub(out:mat3, a:mat3, b:mat3):mat3
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat3} out
- */
- public static multiplyScalar(out:mat3, a:mat3, b:number):mat3
-
- /**
- * Adds two mat3's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat3} out the receiving vector
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat3} out
- */
- public static multiplyScalarAndAdd(out:mat3, a:mat3, b:mat3, scale:number):mat3
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat3} a The first matrix.
- * @param {mat3} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals(a:mat3, b:mat3):boolean;
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat3} a The first matrix.
- * @param {mat3} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals(a:mat3, b:mat3):boolean
-}
-
-// mat4
-export class mat4 extends Float32Array {
- private typeMat4:number;
-
- /**
- * Creates a new identity mat4
- *
- * @returns a new 4x4 matrix
- */
- public static create():mat4;
-
- /**
- * Creates a new mat4 initialized with values from an existing matrix
- *
- * @param a matrix to clone
- * @returns a new 4x4 matrix
- */
- public static clone(a:mat4):mat4;
-
- /**
- * Copy the values from one mat4 to another
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static copy(out:mat4, a:mat4):mat4;
-
-
- /**
- * Create a new mat4 with the given values
- *
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m03 Component in column 0, row 3 position (index 3)
- * @param {number} m10 Component in column 1, row 0 position (index 4)
- * @param {number} m11 Component in column 1, row 1 position (index 5)
- * @param {number} m12 Component in column 1, row 2 position (index 6)
- * @param {number} m13 Component in column 1, row 3 position (index 7)
- * @param {number} m20 Component in column 2, row 0 position (index 8)
- * @param {number} m21 Component in column 2, row 1 position (index 9)
- * @param {number} m22 Component in column 2, row 2 position (index 10)
- * @param {number} m23 Component in column 2, row 3 position (index 11)
- * @param {number} m30 Component in column 3, row 0 position (index 12)
- * @param {number} m31 Component in column 3, row 1 position (index 13)
- * @param {number} m32 Component in column 3, row 2 position (index 14)
- * @param {number} m33 Component in column 3, row 3 position (index 15)
- * @returns {mat4} A new mat4
- */
- public static fromValues(m00:number, m01:number, m02:number, m03:number, m10:number, m11:number, m12:number, m13:number, m20:number, m21:number, m22:number, m23:number, m30:number, m31:number, m32:number, m33:number):mat4;
-
- /**
- * Set the components of a mat4 to the given values
- *
- * @param {mat4} out the receiving matrix
- * @param {number} m00 Component in column 0, row 0 position (index 0)
- * @param {number} m01 Component in column 0, row 1 position (index 1)
- * @param {number} m02 Component in column 0, row 2 position (index 2)
- * @param {number} m03 Component in column 0, row 3 position (index 3)
- * @param {number} m10 Component in column 1, row 0 position (index 4)
- * @param {number} m11 Component in column 1, row 1 position (index 5)
- * @param {number} m12 Component in column 1, row 2 position (index 6)
- * @param {number} m13 Component in column 1, row 3 position (index 7)
- * @param {number} m20 Component in column 2, row 0 position (index 8)
- * @param {number} m21 Component in column 2, row 1 position (index 9)
- * @param {number} m22 Component in column 2, row 2 position (index 10)
- * @param {number} m23 Component in column 2, row 3 position (index 11)
- * @param {number} m30 Component in column 3, row 0 position (index 12)
- * @param {number} m31 Component in column 3, row 1 position (index 13)
- * @param {number} m32 Component in column 3, row 2 position (index 14)
- * @param {number} m33 Component in column 3, row 3 position (index 15)
- * @returns {mat4} out
- */
- public static set(out:mat4, m00:number, m01:number, m02:number, m03:number, m10:number, m11:number, m12:number, m13:number, m20:number, m21:number, m22:number, m23:number, m30:number, m31:number, m32:number, m33:number):mat4;
-
- /**
- * Set a mat4 to the identity matrix
- *
- * @param out the receiving matrix
- * @returns out
- */
- public static identity(out:mat4):mat4;
-
- /**
- * Transpose the values of a mat4
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static transpose(out:mat4, a:mat4):mat4;
-
- /**
- * Inverts a mat4
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static invert(out:mat4, a:mat4):mat4;
-
- /**
- * Calculates the adjugate of a mat4
- *
- * @param out the receiving matrix
- * @param a the source matrix
- * @returns out
- */
- public static adjoint(out:mat4, a:mat4):mat4;
-
- /**
- * Calculates the determinant of a mat4
- *
- * @param a the source matrix
- * @returns determinant of a
- */
- public static determinant(a:mat4):number;
-
- /**
- * Multiplies two mat4's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out:mat4, a:mat4, b:mat4):mat4;
-
- /**
- * Multiplies two mat4's
- *
- * @param out the receiving matrix
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out:mat4, a:mat4, b:mat4):mat4;
-
- /**
- * Translate a mat4 by the given vector
- *
- * @param out the receiving matrix
- * @param a the matrix to translate
- * @param v vector to translate by
- * @returns out
- */
- public static translate(out:mat4, a:mat4, v:vec3):mat4;
-
- /**
- * Scales the mat4 by the dimensions in the given vec3
- *
- * @param out the receiving matrix
- * @param a the matrix to scale
- * @param v the vec3 to scale the matrix by
- * @returns out
- **/
- public static scale(out:mat4, a:mat4, v:vec3):mat4;
-
- /**
- * Rotates a mat4 by the given angle
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @param axis the axis to rotate around
- * @returns out
- */
- public static rotate(out:mat4, a:mat4, rad:number, axis:vec3):mat4;
-
- /**
- * Rotates a matrix by the given angle around the X axis
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotateX(out:mat4, a:mat4, rad:number):mat4;
-
- /**
- * Rotates a matrix by the given angle around the Y axis
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotateY(out:mat4, a:mat4, rad:number):mat4;
-
- /**
- * Rotates a matrix by the given angle around the Z axis
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param rad the angle to rotate the matrix by
- * @returns out
- */
- public static rotateZ(out:mat4, a:mat4, rad:number):mat4;
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Translation vector
- * @returns {mat4} out
- */
- public static fromTranslation(out:mat4, v:vec3):mat4
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.scale(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Scaling vector
- * @returns {mat4} out
- */
- public static fromScaling(out:mat4, v:vec3):mat4
-
- /**
- * Creates a matrix from a given angle around a given axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotate(dest, dest, rad, axis);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @param {vec3} axis the axis to rotate around
- * @returns {mat4} out
- */
- public static fromRotation(out:mat4, rad:number, axis:vec3):mat4
-
- /**
- * Creates a matrix from the given angle around the X axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateX(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- public static fromXRotation(out:mat4, rad:number):mat4
-
- /**
- * Creates a matrix from the given angle around the Y axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateY(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- public static fromYRotation(out:mat4, rad:number):mat4
-
-
- /**
- * Creates a matrix from the given angle around the Z axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateZ(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- public static fromZRotation(out:mat4, rad:number):mat4
-
- /**
- * Creates a matrix from a quaternion rotation and vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- *
- * @param out mat4 receiving operation result
- * @param q Rotation quaternion
- * @param v Translation vector
- * @returns out
- */
- public static fromRotationTranslation(out:mat4, q:quat, v:vec3):mat4;
-
- /**
- * Returns the translation vector component of a transformation
- * matrix. If a matrix is built with fromRotationTranslation,
- * the returned vector will be the same as the translation vector
- * originally supplied.
- * @param {vec3} out Vector to receive translation component
- * @param {mat4} mat Matrix to be decomposed (input)
- * @return {vec3} out
- */
- public static getTranslation(out:vec3, mat:mat4):vec3;
-
- /**
- * Returns a quaternion representing the rotational component
- * of a transformation matrix. If a matrix is built with
- * fromRotationTranslation, the returned quaternion will be the
- * same as the quaternion originally supplied.
- * @param {quat} out Quaternion to receive the rotation component
- * @param {mat4} mat Matrix to be decomposed (input)
- * @return {quat} out
- */
- public static getRotation(out:quat, mat:mat4):quat;
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- *
- * @param out mat4 receiving operation result
- * @param q Rotation quaternion
- * @param v Translation vector
- * @param s Scaling vector
- * @returns out
- */
- public static fromRotationTranslationScale(out:mat4, q:quat, v:vec3, s:vec3):mat4;
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * mat4.translate(dest, origin);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- * mat4.translate(dest, negativeOrigin);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @param {vec3} s Scaling vector
- * @param {vec3} o The origin vector around which to scale and rotate
- * @returns {mat4} out
- */
- public static fromRotationTranslationScaleOrigin(out:mat4, q:quat, v:vec3, s:vec3, o:vec3):mat4
-
- /**
- * Calculates a 4x4 matrix from the given quaternion
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat} q Quaternion to create matrix from
- *
- * @returns {mat4} out
- */
- public static fromQuat(out:mat4, q:quat):mat4
-
- /**
- * Generates a frustum matrix with the given bounds
- *
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
- */
- public static frustum(out:mat4, left:number, right:number,
- bottom:number, top:number, near:number, far:number):mat4;
-
- /**
- * Generates a perspective projection matrix with the given bounds
- *
- * @param out mat4 frustum matrix will be written into
- * @param fovy Vertical field of view in radians
- * @param aspect Aspect ratio. typically viewport width/height
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
- */
- public static perspective(out:mat4, fovy:number, aspect:number,
- near:number, far:number):mat4;
-
- /**
- * Generates a perspective projection matrix with the given field of view.
- * This is primarily useful for generating projection matrices to be used
- * with the still experimental WebVR API.
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
- public static perspectiveFromFieldOfView(out:mat4,
- fov:{upDegrees:number, downDegrees:number, leftDegrees:number, rightDegrees:number},
- near:number, far:number):mat4
-
- /**
- * Generates a orthogonal projection matrix with the given bounds
- *
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
- */
- public static ortho(out:mat4, left:number, right:number,
- bottom:number, top:number, near:number, far:number):mat4;
-
- /**
- * Generates a look-at matrix with the given eye position, focal point, and up axis
- *
- * @param out mat4 frustum matrix will be written into
- * @param eye Position of the viewer
- * @param center Point the viewer is looking at
- * @param up vec3 pointing up
- * @returns out
- */
- public static lookAt(out:mat4, eye:vec3, center:vec3, up:vec3):mat4;
-
- /**
- * Returns a string representation of a mat4
- *
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
- */
- public static str(mat:mat4):string;
-
- /**
- * Returns Frobenius norm of a mat4
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- public static frob(a:mat4):number;
-
- /**
- * Adds two mat4's
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- public static add(out:mat4, a:mat4, b:mat4):mat4
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- public static subtract(out:mat4, a:mat4, b:mat4):mat4
-
- /**
- * Subtracts matrix b from matrix a
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- public static sub(out:mat4, a:mat4, b:mat4):mat4
-
- /**
- * Multiply each element of the matrix by a scalar.
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to scale
- * @param {number} b amount to scale the matrix's elements by
- * @returns {mat4} out
- */
- public static multiplyScalar(out:mat4, a:mat4, b:number):mat4
-
- /**
- * Adds two mat4's after multiplying each element of the second operand by a scalar value.
- *
- * @param {mat4} out the receiving vector
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @param {number} scale the amount to scale b's elements by before adding
- * @returns {mat4} out
- */
- public static multiplyScalarAndAdd (out:mat4, a:mat4, b:mat4, scale:number):mat4
-
- /**
- * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
- *
- * @param {mat4} a The first matrix.
- * @param {mat4} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static exactEquals (a:mat4, b:mat4) :boolean
-
- /**
- * Returns whether or not the matrices have approximately the same elements in the same position.
- *
- * @param {mat4} a The first matrix.
- * @param {mat4} b The second matrix.
- * @returns {boolean} True if the matrices are equal, false otherwise.
- */
- public static equals (a:mat4, b:mat4): boolean
-
-}
-
-// quat
-export class quat extends Float32Array {
- private typeQuat:number;
-
- /**
- * Creates a new identity quat
- *
- * @returns a new quaternion
- */
- public static create(): quat;
-
- /**
- * Creates a new quat initialized with values from an existing quaternion
- *
- * @param a quaternion to clone
- * @returns a new quaternion
- * @function
- */
- public static clone(a: quat): quat;
-
- /**
- * Creates a new quat initialized with the given values
- *
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns a new quaternion
- * @function
- */
- public static fromValues(x: number, y: number, z: number, w: number): quat;
-
- /**
- * Copy the values from one quat to another
- *
- * @param out the receiving quaternion
- * @param a the source quaternion
- * @returns out
- * @function
- */
- public static copy(out: quat, a: quat): quat;
-
- /**
- * Set the components of a quat to the given values
- *
- * @param out the receiving quaternion
- * @param x X component
- * @param y Y component
- * @param z Z component
- * @param w W component
- * @returns out
- * @function
- */
- public static set(out: quat, x: number, y: number, z: number, w: number): quat;
-
- /**
- * Set a quat to the identity quaternion
- *
- * @param out the receiving quaternion
- * @returns out
- */
- public static identity(out: quat): quat;
-
- /**
- * Sets a quaternion to represent the shortest rotation from one
- * vector to another.
- *
- * Both vectors are assumed to be unit length.
- *
- * @param {quat} out the receiving quaternion.
- * @param {vec3} a the initial vector
- * @param {vec3} b the destination vector
- * @returns {quat} out
- */
- public static rotationTo (out:quat, a:vec3, b:vec3): quat;
-
- /**
- * Sets the specified quaternion with values corresponding to the given
- * axes. Each axis is a vec3 and is expected to be unit length and
- * perpendicular to all other specified axes.
- *
- * @param {vec3} view the vector representing the viewing direction
- * @param {vec3} right the vector representing the local "right" direction
- * @param {vec3} up the vector representing the local "up" direction
- * @returns {quat} out
- */
- public static setAxes (out:quat, view:vec3, right:vec3, up:vec3):quat
-
-
-
- /**
- * Sets a quat from the given angle and rotation axis,
- * then returns it.
- *
- * @param out the receiving quaternion
- * @param axis the axis around which to rotate
- * @param rad the angle in radians
- * @returns out
- **/
- public static setAxisAngle(out: quat, axis: vec3, rad: number): quat;
-
- /**
- * Gets the rotation axis and angle for a given
- * quaternion. If a quaternion is created with
- * setAxisAngle, this method will return the same
- * values as providied in the original parameter list
- * OR functionally equivalent values.
- * Example: The quaternion formed by axis [0, 0, 1] and
- * angle -90 is the same as the quaternion formed by
- * [0, 0, 1] and 270. This method favors the latter.
- * @param {vec3} out_axis Vector receiving the axis of rotation
- * @param {quat} q Quaternion to be decomposed
- * @return {number} Angle, in radians, of the rotation
- */
- public static getAxisAngle (out_axis:vec3, q:quat) :number
-
- /**
- * Adds two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @returns out
- * @function
- */
- public static add(out: quat, a: quat, b: quat): quat;
-
- /**
- * Multiplies two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static multiply(out: quat, a: quat, b: quat): quat;
-
- /**
- * Multiplies two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @returns out
- */
- public static mul(out: quat, a: quat, b: quat): quat;
-
- /**
- * Scales a quat by a scalar number
- *
- * @param out the receiving vector
- * @param a the vector to scale
- * @param b amount to scale the vector by
- * @returns out
- * @function
- */
- public static scale(out: quat, a: quat, b: number): quat;
-
- /**
- * Calculates the length of a quat
- *
- * @param a vector to calculate length of
- * @returns length of a
- * @function
- */
- public static length(a: quat): number;
-
- /**
- * Calculates the length of a quat
- *
- * @param a vector to calculate length of
- * @returns length of a
- * @function
- */
- public static len(a: quat): number;
-
- /**
- * Calculates the squared length of a quat
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- * @function
- */
- public static squaredLength(a: quat): number;
-
- /**
- * Calculates the squared length of a quat
- *
- * @param a vector to calculate squared length of
- * @returns squared length of a
- * @function
- */
- public static sqrLen(a: quat): number;
-
- /**
- * Normalize a quat
- *
- * @param out the receiving quaternion
- * @param a quaternion to normalize
- * @returns out
- * @function
- */
- public static normalize(out: quat, a: quat): quat;
-
- /**
- * Calculates the dot product of two quat's
- *
- * @param a the first operand
- * @param b the second operand
- * @returns dot product of a and b
- * @function
- */
- public static dot(a: quat, b: quat): number;
-
- /**
- * Performs a linear interpolation between two quat's
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- * @function
- */
- public static lerp(out: quat, a: quat, b: quat, t: number): quat;
-
- /**
- * Performs a spherical linear interpolation between two quat
- *
- * @param out the receiving quaternion
- * @param a the first operand
- * @param b the second operand
- * @param t interpolation amount between the two inputs
- * @returns out
- */
- public static slerp(out:quat, a:quat, b:quat, t:number): quat;
-
- /**
- * Performs a spherical linear interpolation with two control points
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {quat} c the third operand
- * @param {quat} d the fourth operand
- * @param {number} t interpolation amount
- * @returns {quat} out
- */
- public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat;
-
- /**
- * Calculates the inverse of a quat
- *
- * @param out the receiving quaternion
- * @param a quat to calculate inverse of
- * @returns out
- */
- public static invert(out: quat, a: quat): quat;
-
- /**
- * Calculates the conjugate of a quat
- * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
- *
- * @param out the receiving quaternion
- * @param a quat to calculate conjugate of
- * @returns out
- */
- public static conjugate(out: quat, a: quat): quat;
-
- /**
- * Returns a string representation of a quaternion
- *
- * @param a quat to represent as a string
- * @returns string representation of the quat
- */
- public static str(a: quat): string;
-
- /**
- * Rotates a quaternion by the given angle about the X axis
- *
- * @param out quat receiving operation result
- * @param a quat to rotate
- * @param rad angle (in radians) to rotate
- * @returns out
- */
- public static rotateX(out: quat, a: quat, rad: number): quat;
-
- /**
- * Rotates a quaternion by the given angle about the Y axis
- *
- * @param out quat receiving operation result
- * @param a quat to rotate
- * @param rad angle (in radians) to rotate
- * @returns out
- */
- public static rotateY(out: quat, a: quat, rad: number): quat;
-
- /**
- * Rotates a quaternion by the given angle about the Z axis
- *
- * @param out quat receiving operation result
- * @param a quat to rotate
- * @param rad angle (in radians) to rotate
- * @returns out
- */
- public static rotateZ(out: quat, a: quat, rad: number): quat;
-
- /**
- * Creates a quaternion from the given 3x3 rotation matrix.
- *
- * NOTE: The resultant quaternion is not normalized, so you should be sure
- * to renormalize the quaternion yourself where necessary.
- *
- * @param out the receiving quaternion
- * @param m rotation matrix
- * @returns out
- * @function
- */
- public static fromMat3(out: quat, m: mat3): quat;
-
- /**
- * Sets the specified quaternion with values corresponding to the given
- * axes. Each axis is a vec3 and is expected to be unit length and
- * perpendicular to all other specified axes.
- *
- * @param out the receiving quat
- * @param view the vector representing the viewing direction
- * @param right the vector representing the local "right" direction
- * @param up the vector representing the local "up" direction
- * @returns out
- */
- public static setAxes(out: quat, view: vec3, right: vec3, up: vec3): quat;
-
- /**
- * Sets a quaternion to represent the shortest rotation from one
- * vector to another.
- *
- * Both vectors are assumed to be unit length.
- *
- * @param out the receiving quaternion.
- * @param a the initial vector
- * @param b the destination vector
- * @returns out
- */
- public static rotationTo(out: quat, a: vec3, b: vec3): quat;
-
- /**
- * Calculates the W component of a quat from the X, Y, and Z components.
- * Assumes that quaternion is 1 unit in length.
- * Any existing W component will be ignored.
- *
- * @param out the receiving quaternion
- * @param a quat to calculate W component of
- * @returns out
- */
- public static calculateW(out: quat, a: quat): quat;
-
- /**
- * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
- *
- * @param {quat} a The first vector.
- * @param {quat} b The second vector.
- * @returns {boolean} True if the quaternions are equal, false otherwise.
- */
- public static exactEquals (a:quat, b:quat) : boolean;
-
- /**
- * Returns whether or not the quaternions have approximately the same elements in the same position.
- *
- * @param {quat} a The first vector.
- * @param {quat} b The second vector.
- * @returns {boolean} True if the quaternions are equal, false otherwise.
- */
- public static equals (a:quat, b:quat) : boolean;
-}
diff --git a/gl-matrix/gl-matrix.d.ts b/gl-matrix/gl-matrix.d.ts
index 16366f263a..2edbbd8bb5 100644
--- a/gl-matrix/gl-matrix.d.ts
+++ b/gl-matrix/gl-matrix.d.ts
@@ -1,36 +1,18 @@
// Type definitions for gl-matrix 2.2.2
// Project: https://github.com/toji/gl-matrix
-// Definitions by: Tat
+// Definitions by: Mattijs Kneppers , based on definitions by Tat
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-declare namespace GLM {
- interface IArray
- {
- /**
- * Must be indexable like an array
- */
- [index: number]: number;
- }
-}
-
-// Common
-declare namespace glMatrix {
- /**
- * Convert Degree To Radian
- *
- * @param a Angle in Degrees
- */
- export function toRadian(a: number): number;
-}
-
// vec2
-declare namespace vec2 {
+export class vec2 extends Float32Array {
+ private typeVec2: number;
+
/**
* Creates a new, empty vec2
*
* @returns a new 2D vector
*/
- export function create(): GLM.IArray;
+ public static create(): vec2;
/**
* Creates a new vec2 initialized with values from an existing vector
@@ -38,7 +20,7 @@ declare namespace vec2 {
* @param a a vector to clone
* @returns a new 2D vector
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: vec2 | number[]): vec2;
/**
* Creates a new vec2 initialized with the given values
@@ -47,7 +29,7 @@ declare namespace vec2 {
* @param y Y component
* @returns a new 2D vector
*/
- export function fromValues(x: number, y: number): GLM.IArray;
+ public static fromValues(x: number, y: number): vec2;
/**
* Copy the values from one vec2 to another
@@ -56,7 +38,7 @@ declare namespace vec2 {
* @param a the source vector
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: vec2, a: vec2 | number[]): vec2;
/**
* Set the components of a vec2 to the given values
@@ -66,7 +48,7 @@ declare namespace vec2 {
* @param y Y component
* @returns out
*/
- export function set(out: GLM.IArray, x: number, y: number): GLM.IArray;
+ public static set(out: vec2, x: number, y: number): vec2;
/**
* Adds two vec2's
@@ -76,7 +58,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Subtracts vector b from vector a
@@ -86,7 +68,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static subtract(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Subtracts vector b from vector a
@@ -96,7 +78,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static sub(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Multiplies two vec2's
@@ -106,7 +88,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Multiplies two vec2's
@@ -116,7 +98,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Divides two vec2's
@@ -126,7 +108,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static divide(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Divides two vec2's
@@ -136,7 +118,25 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static div(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
+
+ /**
+ * Math.ceil the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to ceil
+ * @returns {vec2} out
+ */
+ public static ceil(out: vec2, a: vec2 | number[]): vec2;
+
+ /**
+ * Math.floor the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to floor
+ * @returns {vec2} out
+ */
+ public static floor (out: vec2, a: vec2 | number[]): vec2;
/**
* Returns the minimum of two vec2's
@@ -146,7 +146,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static min(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Returns the maximum of two vec2's
@@ -156,7 +156,17 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static max(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
+
+ /**
+ * Math.round the components of a vec2
+ *
+ * @param {vec2} out the receiving vector
+ * @param {vec2} a vector to round
+ * @returns {vec2} out
+ */
+ public static round(out: vec2, a: vec2 | number[]): vec2;
+
/**
* Scales a vec2 by a scalar number
@@ -166,7 +176,7 @@ declare namespace vec2 {
* @param b amount to scale the vector by
* @returns out
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: vec2, a: vec2 | number[], b: number): vec2;
/**
* Adds two vec2's after scaling the second operand by a scalar value
@@ -177,7 +187,7 @@ declare namespace vec2 {
* @param scale the amount to scale b by before adding
* @returns out
*/
- export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+ public static scaleAndAdd(out: vec2, a: vec2 | number[], b: vec2 | number[], scale: number): vec2;
/**
* Calculates the euclidian distance between two vec2's
@@ -186,7 +196,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns distance between a and b
*/
- export function distance(a: GLM.IArray, b: GLM.IArray): number;
+ public static distance(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the euclidian distance between two vec2's
@@ -195,7 +205,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns distance between a and b
*/
- export function dist(a: GLM.IArray, b: GLM.IArray): number;
+ public static dist(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec2's
@@ -204,7 +214,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+ public static squaredDistance(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec2's
@@ -213,7 +223,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+ public static sqrDist(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Calculates the length of a vec2
@@ -221,7 +231,7 @@ declare namespace vec2 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: vec2 | number[]): number;
/**
* Calculates the length of a vec2
@@ -229,7 +239,7 @@ declare namespace vec2 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: vec2 | number[]): number;
/**
* Calculates the squared length of a vec2
@@ -237,7 +247,7 @@ declare namespace vec2 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: vec2 | number[]): number;
/**
* Calculates the squared length of a vec2
@@ -245,7 +255,7 @@ declare namespace vec2 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: vec2 | number[]): number;
/**
* Negates the components of a vec2
@@ -254,7 +264,7 @@ declare namespace vec2 {
* @param a vector to negate
* @returns out
*/
- export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static negate(out: vec2, a: vec2 | number[]): vec2;
/**
* Returns the inverse of the components of a vec2
@@ -263,7 +273,7 @@ declare namespace vec2 {
* @param a vector to invert
* @returns out
*/
- export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static inverse(out: vec2, a: vec2 | number[]): vec2;
/**
* Normalize a vec2
@@ -272,7 +282,7 @@ declare namespace vec2 {
* @param a vector to normalize
* @returns out
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: vec2, a: vec2 | number[]): vec2;
/**
* Calculates the dot product of two vec2's
@@ -281,7 +291,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns dot product of a and b
*/
- export function dot(a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: vec2 | number[], b: vec2 | number[]): number;
/**
* Computes the cross product of two vec2's
@@ -292,7 +302,7 @@ declare namespace vec2 {
* @param b the second operand
* @returns out
*/
- export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static cross(out: vec2, a: vec2 | number[], b: vec2 | number[]): vec2;
/**
* Performs a linear interpolation between two vec2's
@@ -303,7 +313,7 @@ declare namespace vec2 {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: vec2, a: vec2 | number[], b: vec2 | number[], t: number): vec2;
/**
* Generates a random unit vector
@@ -311,7 +321,7 @@ declare namespace vec2 {
* @param out the receiving vector
* @returns out
*/
- export function random(out: GLM.IArray): GLM.IArray;
+ public static random(out: vec2): vec2;
/**
* Generates a random vector with the given scale
@@ -320,7 +330,7 @@ declare namespace vec2 {
* @param scale Length of the resulting vector. If ommitted, a unit vector will be returned
* @returns out
*/
- export function random(out: GLM.IArray, scale: number): GLM.IArray;
+ public static random(out: vec2, scale: number): vec2;
/**
* Transforms the vec2 with a mat2
@@ -330,7 +340,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat2(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat2(out: vec2, a: vec2 | number[], m: mat2): vec2;
/**
* Transforms the vec2 with a mat2d
@@ -340,7 +350,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat2d(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat2d(out: vec2, a: vec2 | number[], m: mat2d): vec2;
/**
* Transforms the vec2 with a mat3
@@ -351,7 +361,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat3(out: vec2, a: vec2 | number[], m: mat3): vec2;
/**
* Transforms the vec2 with a mat4
@@ -363,7 +373,7 @@ declare namespace vec2 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat4(out: vec2, a: vec2 | number[], m: mat4): vec2;
/**
* Perform some operation over an array of vec2s.
@@ -376,8 +386,8 @@ declare namespace vec2 {
* @param arg additional argument to pass to fn
* @returns a
*/
- export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec2 | number[], b: vec2 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Perform some operation over an array of vec2s.
@@ -389,27 +399,46 @@ declare namespace vec2 {
* @param fn Function to call for each vector in the array
* @returns a
*/
- export function forEach(a: GLM.IArray, stride: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec2 | number[], b: vec2 | number[]) => void): Float32Array;
/**
* Returns a string representation of a vector
*
- * @param vec vector to represent as a string
+ * @param a vector to represent as a string
* @returns string representation of the vector
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: vec2 | number[]): string;
+
+ /**
+ * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===)
+ *
+ * @param {vec2} a The first vector.
+ * @param {vec2} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static exactEquals (a: vec2 | number[], b: vec2 | number[]): boolean;
+
+ /**
+ * Returns whether or not the vectors have approximately the same elements in the same position.
+ *
+ * @param {vec2} a The first vector.
+ * @param {vec2} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static equals (a: vec2 | number[], b: vec2 | number[]): boolean;
}
// vec3
-declare namespace vec3 {
+export class vec3 extends Float32Array {
+ private typeVec3: number;
/**
* Creates a new, empty vec3
*
* @returns a new 3D vector
*/
- export function create(): GLM.IArray;
+ public static create(): vec3;
/**
* Creates a new vec3 initialized with values from an existing vector
@@ -417,7 +446,7 @@ declare namespace vec3 {
* @param a vector to clone
* @returns a new 3D vector
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: vec3 | number[]): vec3;
/**
* Creates a new vec3 initialized with the given values
@@ -427,7 +456,7 @@ declare namespace vec3 {
* @param z Z component
* @returns a new 3D vector
*/
- export function fromValues(x: number, y: number, z: number): GLM.IArray;
+ public static fromValues(x: number, y: number, z: number): vec3;
/**
* Copy the values from one vec3 to another
@@ -436,7 +465,7 @@ declare namespace vec3 {
* @param a the source vector
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: vec3, a: vec3 | number[]): vec3;
/**
* Set the components of a vec3 to the given values
@@ -447,7 +476,7 @@ declare namespace vec3 {
* @param z Z component
* @returns out
*/
- export function set(out: GLM.IArray, x: number, y: number, z: number): GLM.IArray;
+ public static set(out: vec3, x: number, y: number, z: number): vec3;
/**
* Adds two vec3's
@@ -457,7 +486,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Subtracts vector b from vector a
@@ -467,7 +496,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static subtract(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Subtracts vector b from vector a
@@ -477,7 +506,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray
+ public static sub(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3
/**
* Multiplies two vec3's
@@ -487,7 +516,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Multiplies two vec3's
@@ -497,7 +526,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Divides two vec3's
@@ -507,7 +536,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static divide(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Divides two vec3's
@@ -517,7 +546,25 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static div(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
+
+ /**
+ * Math.ceil the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to ceil
+ * @returns {vec3} out
+ */
+ public static ceil (out: vec3, a: vec3 | number[]): vec3;
+
+ /**
+ * Math.floor the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to floor
+ * @returns {vec3} out
+ */
+ public static floor (out: vec3, a: vec3 | number[]): vec3;
/**
* Returns the minimum of two vec3's
@@ -527,7 +574,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static min(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Returns the maximum of two vec3's
@@ -537,7 +584,16 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static max(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
+
+ /**
+ * Math.round the components of a vec3
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a vector to round
+ * @returns {vec3} out
+ */
+ public static round (out: vec3, a: vec3 | number[]): vec3
/**
* Scales a vec3 by a scalar number
@@ -547,7 +603,7 @@ declare namespace vec3 {
* @param b amount to scale the vector by
* @returns out
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: vec3, a: vec3 | number[], b: number): vec3;
/**
* Adds two vec3's after scaling the second operand by a scalar value
@@ -558,7 +614,7 @@ declare namespace vec3 {
* @param scale the amount to scale b by before adding
* @returns out
*/
- export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+ public static scaleAndAdd(out: vec3, a: vec3 | number[], b: vec3 | number[], scale: number): vec3;
/**
* Calculates the euclidian distance between two vec3's
@@ -567,7 +623,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns distance between a and b
*/
- export function distance(a: GLM.IArray, b: GLM.IArray): number;
+ public static distance(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the euclidian distance between two vec3's
@@ -576,7 +632,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns distance between a and b
*/
- export function dist(a: GLM.IArray, b: GLM.IArray): number;
+ public static dist(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec3's
@@ -585,7 +641,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+ public static squaredDistance(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec3's
@@ -594,7 +650,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+ public static sqrDist(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Calculates the length of a vec3
@@ -602,7 +658,7 @@ declare namespace vec3 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: vec3 | number[]): number;
/**
* Calculates the length of a vec3
@@ -610,7 +666,7 @@ declare namespace vec3 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: vec3 | number[]): number;
/**
* Calculates the squared length of a vec3
@@ -618,7 +674,7 @@ declare namespace vec3 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: vec3 | number[]): number;
/**
* Calculates the squared length of a vec3
@@ -626,7 +682,7 @@ declare namespace vec3 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: vec3 | number[]): number;
/**
* Negates the components of a vec3
@@ -635,7 +691,7 @@ declare namespace vec3 {
* @param a vector to negate
* @returns out
*/
- export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static negate(out: vec3, a: vec3 | number[]): vec3;
/**
* Returns the inverse of the components of a vec3
@@ -644,7 +700,7 @@ declare namespace vec3 {
* @param a vector to invert
* @returns out
*/
- export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static inverse(out: vec3, a: vec3 | number[]): vec3;
/**
* Normalize a vec3
@@ -653,7 +709,7 @@ declare namespace vec3 {
* @param a vector to normalize
* @returns out
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: vec3, a: vec3 | number[]): vec3;
/**
* Calculates the dot product of two vec3's
@@ -662,7 +718,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns dot product of a and b
*/
- export function dot(a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Computes the cross product of two vec3's
@@ -672,7 +728,7 @@ declare namespace vec3 {
* @param b the second operand
* @returns out
*/
- export function cross(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static cross(out: vec3, a: vec3 | number[], b: vec3 | number[]): vec3;
/**
* Performs a linear interpolation between two vec3's
@@ -683,7 +739,33 @@ declare namespace vec3 {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: vec3, a: vec3 | number[], b: vec3 | number[], t: number): vec3;
+
+ /**
+ * Performs a hermite interpolation with two control points
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {vec3} c the third operand
+ * @param {vec3} d the fourth operand
+ * @param {number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ public static hermite (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3;
+
+ /**
+ * Performs a bezier interpolation with two control points
+ *
+ * @param {vec3} out the receiving vector
+ * @param {vec3} a the first operand
+ * @param {vec3} b the second operand
+ * @param {vec3} c the third operand
+ * @param {vec3} d the fourth operand
+ * @param {number} t interpolation amount between the two inputs
+ * @returns {vec3} out
+ */
+ public static bezier (out: vec3, a: vec3 | number[], b: vec3 | number[], c: vec3 | number[], d: vec3 | number[], t: number): vec3;
/**
* Generates a random unit vector
@@ -691,46 +773,16 @@ declare namespace vec3 {
* @param out the receiving vector
* @returns out
*/
- export function random(out: GLM.IArray): GLM.IArray;
+ public static random(out: vec3): vec3;
/**
* Generates a random vector with the given scale
*
* @param out the receiving vector
- * @param [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @param [scale] Length of the resulting vector. If omitted, a unit vector will be returned
* @returns out
*/
- export function random(out: GLM.IArray, scale: number): GLM.IArray;
-
- /**
- * Rotate a 3D vector around the x-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- export function rotateX(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
-
- /**
- * Rotate a 3D vector around the y-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- export function rotateY(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
-
- /**
- * Rotate a 3D vector around the z-axis
- * @param out The receiving vec3
- * @param a The vec3 point to rotate
- * @param b The origin of the rotation
- * @param c The angle of rotation
- * @returns out
- */
- export function rotateZ(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, c: number): GLM.IArray;
+ public static random(out: vec3, scale: number): vec3;
/**
* Transforms the vec3 with a mat3.
@@ -740,7 +792,7 @@ declare namespace vec3 {
* @param m the 3x3 matrix to transform with
* @returns out
*/
- export function transformMat3(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat3(out: vec3, a: vec3 | number[], m: mat3): vec3;
/**
* Transforms the vec3 with a mat4.
@@ -751,9 +803,9 @@ declare namespace vec3 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat4(out: GLM.IArray, a: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static transformMat4(out: vec3, a: vec3 | number[], m: mat4): vec3;
- /**
+ /**
* Transforms the vec3 with a quat
*
* @param out the receiving vector
@@ -761,9 +813,39 @@ declare namespace vec3 {
* @param q quaternion to transform with
* @returns out
*/
- export function transformQuat(out: GLM.IArray, a: GLM.IArray, q: GLM.IArray): GLM.IArray;
+ public static transformQuat(out: vec3, a: vec3 | number[], q: quat): vec3;
+ /**
+ * Rotate a 3D vector around the x-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ public static rotateX(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3;
+
+ /**
+ * Rotate a 3D vector around the y-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ public static rotateY(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3;
+
+ /**
+ * Rotate a 3D vector around the z-axis
+ * @param out The receiving vec3
+ * @param a The vec3 point to rotate
+ * @param b The origin of the rotation
+ * @param c The angle of rotation
+ * @returns out
+ */
+ public static rotateZ(out: vec3, a: vec3 | number[], b: vec3 | number[], c: number): vec3;
+
/**
* Perform some operation over an array of vec3s.
*
@@ -776,8 +858,8 @@ declare namespace vec3 {
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec3 | number[], b: vec3 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Perform some operation over an array of vec3s.
@@ -790,8 +872,8 @@ declare namespace vec3 {
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- fn: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec3 | number[], b: vec3 | number[]) => void): Float32Array;
/**
* Get the angle between two 3D vectors
@@ -799,26 +881,45 @@ declare namespace vec3 {
* @param b The second operand
* @returns The angle in radians
*/
- export function angle(a: GLM.IArray, b: GLM.IArray): number;
+ public static angle(a: vec3 | number[], b: vec3 | number[]): number;
/**
* Returns a string representation of a vector
*
- * @param vec vector to represent as a string
+ * @param a vector to represent as a string
* @returns string representation of the vector
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: vec3 | number[]): string;
+
+ /**
+ * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {vec3} a The first vector.
+ * @param {vec3} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static exactEquals (a: vec3 | number[], b: vec3 | number[]): boolean
+
+ /**
+ * Returns whether or not the vectors have approximately the same elements in the same position.
+ *
+ * @param {vec3} a The first vector.
+ * @param {vec3} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static equals (a: vec3 | number[], b: vec3 | number[]): boolean
}
// vec4
-declare namespace vec4 {
+export class vec4 extends Float32Array {
+ private typeVec3: number;
/**
* Creates a new, empty vec4
*
* @returns a new 4D vector
*/
- export function create(): GLM.IArray;
+ public static create(): vec4;
/**
* Creates a new vec4 initialized with values from an existing vector
@@ -826,7 +927,7 @@ declare namespace vec4 {
* @param a vector to clone
* @returns a new 4D vector
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: vec4 | number[]): vec4;
/**
* Creates a new vec4 initialized with the given values
@@ -837,7 +938,7 @@ declare namespace vec4 {
* @param w W component
* @returns a new 4D vector
*/
- export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+ public static fromValues(x: number, y: number, z: number, w: number): vec4;
/**
* Copy the values from one vec4 to another
@@ -846,7 +947,7 @@ declare namespace vec4 {
* @param a the source vector
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: vec4, a: vec4 | number[]): vec4;
/**
* Set the components of a vec4 to the given values
@@ -858,7 +959,7 @@ declare namespace vec4 {
* @param w W component
* @returns out
*/
- export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+ public static set(out: vec4, x: number, y: number, z: number, w: number): vec4;
/**
* Adds two vec4's
@@ -868,7 +969,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Subtracts vector b from vector a
@@ -878,7 +979,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function subtract(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static subtract(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Subtracts vector b from vector a
@@ -888,7 +989,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function sub(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static sub(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Multiplies two vec4's
@@ -898,7 +999,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Multiplies two vec4's
@@ -908,7 +1009,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Divides two vec4's
@@ -918,7 +1019,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function divide(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static divide(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Divides two vec4's
@@ -928,7 +1029,25 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function div(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static div(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
+
+ /**
+ * Math.ceil the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to ceil
+ * @returns {vec4} out
+ */
+ public static ceil (out: vec4, a: vec4 | number[]): vec4;
+
+ /**
+ * Math.floor the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to floor
+ * @returns {vec4} out
+ */
+ public static floor (out: vec4, a: vec4 | number[]): vec4;
/**
* Returns the minimum of two vec4's
@@ -938,7 +1057,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function min(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static min(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
/**
* Returns the maximum of two vec4's
@@ -948,7 +1067,16 @@ declare namespace vec4 {
* @param b the second operand
* @returns out
*/
- export function max(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static max(out: vec4, a: vec4 | number[], b: vec4 | number[]): vec4;
+
+ /**
+ * Math.round the components of a vec4
+ *
+ * @param {vec4} out the receiving vector
+ * @param {vec4} a vector to round
+ * @returns {vec4} out
+ */
+ public static round (out: vec4, a: vec4 | number[]): vec4;
/**
* Scales a vec4 by a scalar number
@@ -958,7 +1086,7 @@ declare namespace vec4 {
* @param b amount to scale the vector by
* @returns out
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: vec4, a: vec4 | number[], b: number): vec4;
/**
* Adds two vec4's after scaling the second operand by a scalar value
@@ -969,7 +1097,7 @@ declare namespace vec4 {
* @param scale the amount to scale b by before adding
* @returns out
*/
- export function scaleAndAdd(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, scale: number): GLM.IArray;
+ public static scaleAndAdd(out: vec4, a: vec4 | number[], b: vec4 | number[], scale: number): vec4;
/**
* Calculates the euclidian distance between two vec4's
@@ -978,7 +1106,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns distance between a and b
*/
- export function distance(a: GLM.IArray, b: GLM.IArray): number;
+ public static distance(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the euclidian distance between two vec4's
@@ -987,7 +1115,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns distance between a and b
*/
- export function dist(a: GLM.IArray, b: GLM.IArray): number;
+ public static dist(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec4's
@@ -996,7 +1124,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function squaredDistance(a: GLM.IArray, b: GLM.IArray): number;
+ public static squaredDistance(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the squared euclidian distance between two vec4's
@@ -1005,7 +1133,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns squared distance between a and b
*/
- export function sqrDist(a: GLM.IArray, b: GLM.IArray): number;
+ public static sqrDist(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Calculates the length of a vec4
@@ -1013,7 +1141,7 @@ declare namespace vec4 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: vec4 | number[]): number;
/**
* Calculates the length of a vec4
@@ -1021,7 +1149,7 @@ declare namespace vec4 {
* @param a vector to calculate length of
* @returns length of a
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: vec4 | number[]): number;
/**
* Calculates the squared length of a vec4
@@ -1029,7 +1157,7 @@ declare namespace vec4 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: vec4 | number[]): number;
/**
* Calculates the squared length of a vec4
@@ -1037,7 +1165,7 @@ declare namespace vec4 {
* @param a vector to calculate squared length of
* @returns squared length of a
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: vec4 | number[]): number;
/**
* Negates the components of a vec4
@@ -1046,7 +1174,7 @@ declare namespace vec4 {
* @param a vector to negate
* @returns out
*/
- export function negate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static negate(out: vec4, a: vec4 | number[]): vec4;
/**
* Returns the inverse of the components of a vec4
@@ -1055,7 +1183,7 @@ declare namespace vec4 {
* @param a vector to invert
* @returns out
*/
- export function inverse(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static inverse(out: vec4, a: vec4 | number[]): vec4;
/**
* Normalize a vec4
@@ -1064,7 +1192,7 @@ declare namespace vec4 {
* @param a vector to normalize
* @returns out
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: vec4, a: vec4 | number[]): vec4;
/**
* Calculates the dot product of two vec4's
@@ -1073,7 +1201,7 @@ declare namespace vec4 {
* @param b the second operand
* @returns dot product of a and b
*/
- export function dot(a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: vec4 | number[], b: vec4 | number[]): number;
/**
* Performs a linear interpolation between two vec4's
@@ -1084,7 +1212,7 @@ declare namespace vec4 {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: vec4, a: vec4 | number[], b: vec4 | number[], t: number): vec4;
/**
* Generates a random unit vector
@@ -1092,16 +1220,16 @@ declare namespace vec4 {
* @param out the receiving vector
* @returns out
*/
- export function random(out: GLM.IArray): GLM.IArray;
+ public static random(out: vec4): vec4;
/**
* Generates a random vector with the given scale
*
* @param out the receiving vector
- * @param Length of the resulting vector. If ommitted, a unit vector will be returned
+ * @param scale length of the resulting vector. If ommitted, a unit vector will be returned
* @returns out
*/
- export function random(out: GLM.IArray, scale: number): GLM.IArray;
+ public static random(out: vec4, scale: number): vec4;
/**
* Transforms the vec4 with a mat4.
@@ -1111,7 +1239,7 @@ declare namespace vec4 {
* @param m matrix to transform with
* @returns out
*/
- export function transformMat4(out: GLM.IArray, a: GLM.IArray, mat: GLM.IArray): GLM.IArray;
+ public static transformMat4(out: vec4, a: vec4 | number[], m: mat4): vec4;
/**
* Transforms the vec4 with a quat
@@ -1121,7 +1249,8 @@ declare namespace vec4 {
* @param q quaternion to transform with
* @returns out
*/
- export function transformQuat(out: GLM.IArray, a: GLM.IArray, quat: GLM.IArray): GLM.IArray;
+
+ public static transformQuat(out: vec4, a: vec4 | number[], q: quat): vec4;
/**
* Perform some operation over an array of vec4s.
@@ -1131,12 +1260,12 @@ declare namespace vec4 {
* @param offset Number of elements to skip at the beginning of the array
* @param count Number of vec4s to iterate over. If 0 iterates over entire array
* @param fn Function to call for each vector in the array
- * @param additional argument to pass to fn
+ * @param arg additional argument to pass to fn
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- callback: (a: GLM.IArray, b: GLM.IArray, arg: any) => void, arg: any): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec4 | number[], b: vec4 | number[], arg: any) => void, arg: any): Float32Array;
/**
* Perform some operation over an array of vec4s.
@@ -1149,27 +1278,46 @@ declare namespace vec4 {
* @returns a
* @function
*/
- export function forEach(out: GLM.IArray, string: number, offset: number, count: number,
- callback: (a: GLM.IArray, b: GLM.IArray) => void): GLM.IArray;
+ public static forEach(a: Float32Array, stride: number, offset: number, count: number,
+ fn: (a: vec4 | number[], b: vec4 | number[]) => void): Float32Array;
/**
* Returns a string representation of a vector
*
- * @param vec vector to represent as a string
+ * @param a vector to represent as a string
* @returns string representation of the vector
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: vec4 | number[]): string;
+
+ /**
+ * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {vec4} a The first vector.
+ * @param {vec4} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static exactEquals (a: vec4 | number[], b: vec4 | number[]): boolean;
+
+ /**
+ * Returns whether or not the vectors have approximately the same elements in the same position.
+ *
+ * @param {vec4} a The first vector.
+ * @param {vec4} b The second vector.
+ * @returns {boolean} True if the vectors are equal, false otherwise.
+ */
+ public static equals (a: vec4 | number[], b: vec4 | number[]): boolean;
}
// mat2
-declare namespace mat2 {
+export class mat2 extends Float32Array {
+ private typeMat2: number;
/**
* Creates a new identity mat2
*
* @returns a new 2x2 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat2;
/**
* Creates a new mat2 initialized with values from an existing matrix
@@ -1177,7 +1325,7 @@ declare namespace mat2 {
* @param a matrix to clone
* @returns a new 2x2 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat2): mat2;
/**
* Copy the values from one mat2 to another
@@ -1186,7 +1334,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat2, a: mat2): mat2;
/**
* Set a mat2 to the identity matrix
@@ -1194,7 +1342,30 @@ declare namespace mat2 {
* @param out the receiving matrix
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: mat2): mat2;
+
+ /**
+ * Create a new mat2 with the given values
+ *
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m10 Component in column 1, row 0 position (index 2)
+ * @param {number} m11 Component in column 1, row 1 position (index 3)
+ * @returns {mat2} out A new 2x2 matrix
+ */
+ public static fromValues(m00: number, m01: number, m10: number, m11: number): mat2;
+
+ /**
+ * Set the components of a mat2 to the given values
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m10 Component in column 1, row 0 position (index 2)
+ * @param {number} m11 Component in column 1, row 1 position (index 3)
+ * @returns {mat2} out
+ */
+ public static set(out: mat2, m00: number, m01: number, m10: number, m11: number): mat2;
/**
* Transpose the values of a mat2
@@ -1203,7 +1374,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static transpose(out: mat2, a: mat2): mat2;
/**
* Inverts a mat2
@@ -1212,7 +1383,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat2, a: mat2): mat2;
/**
* Calculates the adjugate of a mat2
@@ -1221,7 +1392,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns out
*/
- export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static adjoint(out: mat2, a: mat2): mat2;
/**
* Calculates the determinant of a mat2
@@ -1229,7 +1400,7 @@ declare namespace mat2 {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat2): number;
/**
* Multiplies two mat2's
@@ -1239,7 +1410,7 @@ declare namespace mat2 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat2, a: mat2, b: mat2): mat2;
/**
* Multiplies two mat2's
@@ -1249,7 +1420,7 @@ declare namespace mat2 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat2, a: mat2, b: mat2): mat2;
/**
* Rotates a mat2 by the given angle
@@ -1259,7 +1430,7 @@ declare namespace mat2 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotate(out: mat2, a: mat2, rad: number): mat2;
/**
* Scales the mat2 by the dimensions in the given vec2
@@ -1269,7 +1440,33 @@ declare namespace mat2 {
* @param v the vec2 to scale the matrix by
* @returns out
**/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static scale(out: mat2, a: mat2, v: vec2 | number[]): mat2;
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat2.identity(dest);
+ * mat2.rotate(dest, dest, rad);
+ *
+ * @param {mat2} out mat2 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat2} out
+ */
+ public static fromRotation(out: mat2, rad: number): mat2;
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat2.identity(dest);
+ * mat2.scale(dest, dest, vec);
+ *
+ * @param {mat2} out mat2 receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat2} out
+ */
+ public static fromScaling(out: mat2, v: vec2 | number[]): mat2;
/**
* Returns a string representation of a mat2
@@ -1277,7 +1474,7 @@ declare namespace mat2 {
* @param a matrix to represent as a string
* @returns string representation of the matrix
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: mat2): string;
/**
* Returns Frobenius norm of a mat2
@@ -1285,7 +1482,7 @@ declare namespace mat2 {
* @param a the matrix to calculate Frobenius norm of
* @returns Frobenius norm
*/
- export function frob(a: GLM.IArray): number;
+ public static frob(a: mat2): number;
/**
* Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
@@ -1294,18 +1491,91 @@ declare namespace mat2 {
* @param U the upper triangular matrix
* @param a the input matrix to factorize
*/
- export function LDU(L: GLM.IArray, D: GLM.IArray, U: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static LDU(L: mat2, D: mat2, U: mat2, a: mat2): mat2;
+
+ /**
+ * Adds two mat2's
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @returns {mat2} out
+ */
+ public static add(out: mat2, a: mat2, b: mat2): mat2;
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @returns {mat2} out
+ */
+ public static subtract (out: mat2, a: mat2, b: mat2): mat2;
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @returns {mat2} out
+ */
+ public static sub (out: mat2, a: mat2, b: mat2): mat2;
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat2} a The first matrix.
+ * @param {mat2} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals (a: mat2, b: mat2): boolean;
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat2} a The first matrix.
+ * @param {mat2} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals (a: mat2, b: mat2): boolean;
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat2} out the receiving matrix
+ * @param {mat2} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat2} out
+ */
+ public static multiplyScalar (out: mat2, a: mat2, b: number): mat2
+
+ /**
+ * Adds two mat2's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat2} out the receiving vector
+ * @param {mat2} a the first operand
+ * @param {mat2} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat2} out
+ */
+ public static multiplyScalarAndAdd (out: mat2, a: mat2, b: mat2, scale: number): mat2
+
+
+
}
// mat2d
-declare namespace mat2d {
+export class mat2d extends Float32Array {
+ private typeMat2d: number;
/**
* Creates a new identity mat2d
*
* @returns a new 2x3 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat2d;
/**
* Creates a new mat2d initialized with values from an existing matrix
@@ -1313,7 +1583,7 @@ declare namespace mat2d {
* @param a matrix to clone
* @returns a new 2x3 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat2d): mat2d;
/**
* Copy the values from one mat2d to another
@@ -1322,7 +1592,7 @@ declare namespace mat2d {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat2d, a: mat2d): mat2d;
/**
* Set a mat2d to the identity matrix
@@ -1330,7 +1600,35 @@ declare namespace mat2d {
* @param out the receiving matrix
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: mat2d): mat2d;
+
+ /**
+ * Create a new mat2d with the given values
+ *
+ * @param {number} a Component A (index 0)
+ * @param {number} b Component B (index 1)
+ * @param {number} c Component C (index 2)
+ * @param {number} d Component D (index 3)
+ * @param {number} tx Component TX (index 4)
+ * @param {number} ty Component TY (index 5)
+ * @returns {mat2d} A new mat2d
+ */
+ public static fromValues (a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
+
+
+ /**
+ * Set the components of a mat2d to the given values
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {number} a Component A (index 0)
+ * @param {number} b Component B (index 1)
+ * @param {number} c Component C (index 2)
+ * @param {number} d Component D (index 3)
+ * @param {number} tx Component TX (index 4)
+ * @param {number} ty Component TY (index 5)
+ * @returns {mat2d} out
+ */
+ public static set (out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
/**
* Inverts a mat2d
@@ -1339,7 +1637,7 @@ declare namespace mat2d {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat2d, a: mat2d): mat2d;
/**
* Calculates the determinant of a mat2d
@@ -1347,7 +1645,7 @@ declare namespace mat2d {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat2d): number;
/**
* Multiplies two mat2d's
@@ -1357,7 +1655,7 @@ declare namespace mat2d {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat2d, a: mat2d, b: mat2d): mat2d;
/**
* Multiplies two mat2d's
@@ -1367,7 +1665,7 @@ declare namespace mat2d {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat2d, a: mat2d, b: mat2d): mat2d;
/**
* Rotates a mat2d by the given angle
@@ -1377,7 +1675,7 @@ declare namespace mat2d {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotate(out: mat2d, a: mat2d, rad: number): mat2d;
/**
* Scales the mat2d by the dimensions in the given vec2
@@ -1387,7 +1685,7 @@ declare namespace mat2d {
* @param v the vec2 to scale the matrix by
* @returns out
**/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static scale(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d;
/**
* Translates the mat2d by the dimensions in the given vec2
@@ -1397,7 +1695,46 @@ declare namespace mat2d {
* @param v the vec2 to translate the matrix by
* @returns out
**/
- export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static translate(out: mat2d, a: mat2d, v: vec2 | number[]): mat2d;
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.rotate(dest, dest, rad);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat2d} out
+ */
+ public static fromRotation (out: mat2d, rad: number): mat2d;
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.scale(dest, dest, vec);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat2d} out
+ */
+ public static fromScaling (out: mat2d, v: vec2 | number[]): mat2d;
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat2d.identity(dest);
+ * mat2d.translate(dest, dest, vec);
+ *
+ * @param {mat2d} out mat2d receiving operation result
+ * @param {vec2} v Translation vector
+ * @returns {mat2d} out
+ */
+ public static fromTranslation (out: mat2d, v: vec2 | number[]): mat2d
/**
* Returns a string representation of a mat2d
@@ -1405,7 +1742,7 @@ declare namespace mat2d {
* @param a matrix to represent as a string
* @returns string representation of the matrix
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: mat2d): string;
/**
* Returns Frobenius norm of a mat2d
@@ -1413,18 +1750,97 @@ declare namespace mat2d {
* @param a the matrix to calculate Frobenius norm of
* @returns Frobenius norm
*/
- export function frob(a: GLM.IArray): number;
+ public static frob(a: mat2d): number;
+
+ /**
+ * Adds two mat2d's
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ public static add (out: mat2d, a: mat2d, b: mat2d): mat2d
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ public static subtract(out: mat2d, a: mat2d, b: mat2d): mat2d
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @returns {mat2d} out
+ */
+ public static sub(out: mat2d, a: mat2d, b: mat2d): mat2d
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat2d} out the receiving matrix
+ * @param {mat2d} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat2d} out
+ */
+ public static multiplyScalar (out: mat2d, a: mat2d, b: number): mat2d;
+
+ /**
+ * Adds two mat2d's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat2d} out the receiving vector
+ * @param {mat2d} a the first operand
+ * @param {mat2d} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat2d} out
+ */
+ public static multiplyScalarAndAdd (out: mat2d, a: mat2d, b: mat2d, scale: number): mat2d
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat2d} a The first matrix.
+ * @param {mat2d} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals (a: mat2d, b: mat2d): boolean;
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat2d} a The first matrix.
+ * @param {mat2d} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals (a: mat2d, b: mat2d): boolean
}
// mat3
-declare namespace mat3 {
+export class mat3 extends Float32Array {
+ private typeMat3: number;
/**
* Creates a new identity mat3
*
* @returns a new 3x3 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat3;
+
+ /**
+ * Copies the upper-left 3x3 values into the given mat3.
+ *
+ * @param {mat3} out the receiving 3x3 matrix
+ * @param {mat4} a the source 4x4 matrix
+ * @returns {mat3} out
+ */
+ public static fromMat4(out: mat3, a: mat4): mat3
/**
* Creates a new mat3 initialized with values from an existing matrix
@@ -1432,7 +1848,7 @@ declare namespace mat3 {
* @param a matrix to clone
* @returns a new 3x3 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat3): mat3;
/**
* Copy the values from one mat3 to another
@@ -1441,7 +1857,41 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat3, a: mat3): mat3;
+
+ /**
+ * Create a new mat3 with the given values
+ *
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m10 Component in column 1, row 0 position (index 3)
+ * @param {number} m11 Component in column 1, row 1 position (index 4)
+ * @param {number} m12 Component in column 1, row 2 position (index 5)
+ * @param {number} m20 Component in column 2, row 0 position (index 6)
+ * @param {number} m21 Component in column 2, row 1 position (index 7)
+ * @param {number} m22 Component in column 2, row 2 position (index 8)
+ * @returns {mat3} A new mat3
+ */
+ public static fromValues(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3;
+
+
+ /**
+ * Set the components of a mat3 to the given values
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m10 Component in column 1, row 0 position (index 3)
+ * @param {number} m11 Component in column 1, row 1 position (index 4)
+ * @param {number} m12 Component in column 1, row 2 position (index 5)
+ * @param {number} m20 Component in column 2, row 0 position (index 6)
+ * @param {number} m21 Component in column 2, row 1 position (index 7)
+ * @param {number} m22 Component in column 2, row 2 position (index 8)
+ * @returns {mat3} out
+ */
+ public static set(out: mat3, m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): mat3
/**
* Set a mat3 to the identity matrix
@@ -1449,7 +1899,7 @@ declare namespace mat3 {
* @param out the receiving matrix
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: mat3): mat3;
/**
* Transpose the values of a mat3
@@ -1458,7 +1908,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static transpose(out: mat3, a: mat3): mat3;
/**
* Inverts a mat3
@@ -1467,7 +1917,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat3, a: mat3): mat3;
/**
* Calculates the adjugate of a mat3
@@ -1476,7 +1926,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns out
*/
- export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static adjoint(out: mat3, a: mat3): mat3;
/**
* Calculates the determinant of a mat3
@@ -1484,7 +1934,7 @@ declare namespace mat3 {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat3): number;
/**
* Multiplies two mat3's
@@ -1494,7 +1944,7 @@ declare namespace mat3 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat3, a: mat3, b: mat3): mat3;
/**
* Multiplies two mat3's
@@ -1504,71 +1954,8 @@ declare namespace mat3 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat3, a: mat3, b: mat3): mat3;
- /**
- * Returns a string representation of a mat3
- *
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
- */
- export function str(mat: GLM.IArray): string;
-
- /**
- * Returns Frobenius norm of a mat3
- *
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
- */
- export function frob(a: GLM.IArray): number;
-
- /**
- * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
- *
- * @param out mat3 receiving operation result
- * @param a Mat4 to derive the normal matrix from
- *
- * @returns out
- */
- export function normalFromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
-
- /**
- * Calculates a 3x3 matrix from the given quaternion
- *
- * @param out mat3 receiving operation result
- * @param q Quaternion to create matrix from
- *
- * @returns out
- */
- export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
-
- /**
- * Copies the upper-left 3x3 values into the given mat3.
- *
- * @param out the receiving 3x3 matrix
- * @param a the source 4x4 matrix
- * @returns out
- */
- export function fromMat4(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
-
- /**
- * Scales the mat3 by the dimensions in the given vec2
- *
- * @param out the receiving matrix
- * @param a the matrix to rotate
- * @param v the vec2 to scale the matrix by
- * @returns out
- **/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
-
- /**
- * Copies the values from a mat2d into a mat3
- *
- * @param out the receiving matrix
- * @param {mat2d} a the matrix to copy
- * @returns out
- **/
- export function fromMat2d(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
/**
* Translate a mat3 by the given vector
@@ -1578,7 +1965,7 @@ declare namespace mat3 {
* @param v vector to translate by
* @returns out
*/
- export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static translate(out: mat3, a: mat3, v: vec3 | number[]): mat3;
/**
* Rotates a mat3 by the given angle
@@ -1588,18 +1975,182 @@ declare namespace mat3 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotate(out: mat3, a: mat3, rad: number): mat3;
+
+ /**
+ * Scales the mat3 by the dimensions in the given vec2
+ *
+ * @param out the receiving matrix
+ * @param a the matrix to rotate
+ * @param v the vec2 to scale the matrix by
+ * @returns out
+ **/
+ public static scale(out: mat3, a: mat3, v: vec2 | number[]): mat3;
+
+ /**
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.translate(dest, dest, vec);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {vec2} v Translation vector
+ * @returns {mat3} out
+ */
+ public static fromTranslation(out: mat3, v: vec2 | number[]): mat3
+
+ /**
+ * Creates a matrix from a given angle
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.rotate(dest, dest, rad);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat3} out
+ */
+ public static fromRotation(out: mat3, rad: number): mat3
+
+ /**
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
+ *
+ * mat3.identity(dest);
+ * mat3.scale(dest, dest, vec);
+ *
+ * @param {mat3} out mat3 receiving operation result
+ * @param {vec2} v Scaling vector
+ * @returns {mat3} out
+ */
+ public static fromScaling(out: mat3, v: vec2 | number[]): mat3
+
+ /**
+ * Copies the values from a mat2d into a mat3
+ *
+ * @param out the receiving matrix
+ * @param {mat2d} a the matrix to copy
+ * @returns out
+ **/
+ public static fromMat2d(out: mat3, a: mat2d): mat3;
+
+ /**
+ * Calculates a 3x3 matrix from the given quaternion
+ *
+ * @param out mat3 receiving operation result
+ * @param q Quaternion to create matrix from
+ *
+ * @returns out
+ */
+ public static fromQuat(out: mat3, q: quat): mat3;
+
+ /**
+ * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
+ *
+ * @param out mat3 receiving operation result
+ * @param a Mat4 to derive the normal matrix from
+ *
+ * @returns out
+ */
+ public static normalFromMat4(out: mat3, a: mat4): mat3;
+
+ /**
+ * Returns a string representation of a mat3
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ public static str(mat: mat3): string;
+
+ /**
+ * Returns Frobenius norm of a mat3
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ public static frob(a: mat3): number;
+
+ /**
+ * Adds two mat3's
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ public static add(out: mat3, a: mat3, b: mat3): mat3
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ public static subtract(out: mat3, a: mat3, b: mat3): mat3
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @returns {mat3} out
+ */
+ public static sub(out: mat3, a: mat3, b: mat3): mat3
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat3} out the receiving matrix
+ * @param {mat3} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat3} out
+ */
+ public static multiplyScalar(out: mat3, a: mat3, b: number): mat3
+
+ /**
+ * Adds two mat3's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat3} out the receiving vector
+ * @param {mat3} a the first operand
+ * @param {mat3} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat3} out
+ */
+ public static multiplyScalarAndAdd(out: mat3, a: mat3, b: mat3, scale: number): mat3
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat3} a The first matrix.
+ * @param {mat3} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals(a: mat3, b: mat3): boolean;
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat3} a The first matrix.
+ * @param {mat3} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals(a: mat3, b: mat3): boolean
}
// mat4
-declare namespace mat4 {
+export class mat4 extends Float32Array {
+ private typeMat4: number;
/**
* Creates a new identity mat4
*
* @returns a new 4x4 matrix
*/
- export function create(): GLM.IArray;
+ public static create(): mat4;
/**
* Creates a new mat4 initialized with values from an existing matrix
@@ -1607,7 +2158,7 @@ declare namespace mat4 {
* @param a matrix to clone
* @returns a new 4x4 matrix
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: mat4): mat4;
/**
* Copy the values from one mat4 to another
@@ -1616,7 +2167,55 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: mat4, a: mat4): mat4;
+
+
+ /**
+ * Create a new mat4 with the given values
+ *
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m03 Component in column 0, row 3 position (index 3)
+ * @param {number} m10 Component in column 1, row 0 position (index 4)
+ * @param {number} m11 Component in column 1, row 1 position (index 5)
+ * @param {number} m12 Component in column 1, row 2 position (index 6)
+ * @param {number} m13 Component in column 1, row 3 position (index 7)
+ * @param {number} m20 Component in column 2, row 0 position (index 8)
+ * @param {number} m21 Component in column 2, row 1 position (index 9)
+ * @param {number} m22 Component in column 2, row 2 position (index 10)
+ * @param {number} m23 Component in column 2, row 3 position (index 11)
+ * @param {number} m30 Component in column 3, row 0 position (index 12)
+ * @param {number} m31 Component in column 3, row 1 position (index 13)
+ * @param {number} m32 Component in column 3, row 2 position (index 14)
+ * @param {number} m33 Component in column 3, row 3 position (index 15)
+ * @returns {mat4} A new mat4
+ */
+ public static fromValues(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4;
+
+ /**
+ * Set the components of a mat4 to the given values
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {number} m00 Component in column 0, row 0 position (index 0)
+ * @param {number} m01 Component in column 0, row 1 position (index 1)
+ * @param {number} m02 Component in column 0, row 2 position (index 2)
+ * @param {number} m03 Component in column 0, row 3 position (index 3)
+ * @param {number} m10 Component in column 1, row 0 position (index 4)
+ * @param {number} m11 Component in column 1, row 1 position (index 5)
+ * @param {number} m12 Component in column 1, row 2 position (index 6)
+ * @param {number} m13 Component in column 1, row 3 position (index 7)
+ * @param {number} m20 Component in column 2, row 0 position (index 8)
+ * @param {number} m21 Component in column 2, row 1 position (index 9)
+ * @param {number} m22 Component in column 2, row 2 position (index 10)
+ * @param {number} m23 Component in column 2, row 3 position (index 11)
+ * @param {number} m30 Component in column 3, row 0 position (index 12)
+ * @param {number} m31 Component in column 3, row 1 position (index 13)
+ * @param {number} m32 Component in column 3, row 2 position (index 14)
+ * @param {number} m33 Component in column 3, row 3 position (index 15)
+ * @returns {mat4} out
+ */
+ public static set(out: mat4, m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): mat4;
/**
* Set a mat4 to the identity matrix
@@ -1624,7 +2223,7 @@ declare namespace mat4 {
* @param out the receiving matrix
* @returns out
*/
- export function identity(a: GLM.IArray): GLM.IArray;
+ public static identity(out: mat4): mat4;
/**
* Transpose the values of a mat4
@@ -1633,7 +2232,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function transpose(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static transpose(out: mat4, a: mat4): mat4;
/**
* Inverts a mat4
@@ -1642,7 +2241,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: mat4, a: mat4): mat4;
/**
* Calculates the adjugate of a mat4
@@ -1651,7 +2250,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns out
*/
- export function adjoint(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static adjoint(out: mat4, a: mat4): mat4;
/**
* Calculates the determinant of a mat4
@@ -1659,7 +2258,7 @@ declare namespace mat4 {
* @param a the source matrix
* @returns determinant of a
*/
- export function determinant(a: GLM.IArray): number;
+ public static determinant(a: mat4): number;
/**
* Multiplies two mat4's
@@ -1669,7 +2268,7 @@ declare namespace mat4 {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: mat4, a: mat4, b: mat4): mat4;
/**
* Multiplies two mat4's
@@ -1679,7 +2278,7 @@ declare namespace mat4 {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: mat4, a: mat4, b: mat4): mat4;
/**
* Translate a mat4 by the given vector
@@ -1689,7 +2288,7 @@ declare namespace mat4 {
* @param v vector to translate by
* @returns out
*/
- export function translate(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static translate(out: mat4, a: mat4, v: vec3 | number[]): mat4;
/**
* Scales the mat4 by the dimensions in the given vec3
@@ -1699,7 +2298,7 @@ declare namespace mat4 {
* @param v the vec3 to scale the matrix by
* @returns out
**/
- export function scale(out: GLM.IArray, a: GLM.IArray, v: GLM.IArray): GLM.IArray;
+ public static scale(out: mat4, a: mat4, v: vec3 | number[]): mat4;
/**
* Rotates a mat4 by the given angle
@@ -1710,7 +2309,7 @@ declare namespace mat4 {
* @param axis the axis to rotate around
* @returns out
*/
- export function rotate(out: GLM.IArray, a: GLM.IArray, rad: number, axis: GLM.IArray): GLM.IArray;
+ public static rotate(out: mat4, a: mat4, rad: number, axis: vec3 | number[]): mat4;
/**
* Rotates a matrix by the given angle around the X axis
@@ -1720,7 +2319,7 @@ declare namespace mat4 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateX(out: mat4, a: mat4, rad: number): mat4;
/**
* Rotates a matrix by the given angle around the Y axis
@@ -1730,7 +2329,7 @@ declare namespace mat4 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateY(out: mat4, a: mat4, rad: number): mat4;
/**
* Rotates a matrix by the given angle around the Z axis
@@ -1740,78 +2339,87 @@ declare namespace mat4 {
* @param rad the angle to rotate the matrix by
* @returns out
*/
- export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateZ(out: mat4, a: mat4, rad: number): mat4;
/**
- * Generates a frustum matrix with the given bounds
+ * Creates a matrix from a vector translation
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
+ * mat4.identity(dest);
+ * mat4.translate(dest, dest, vec);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {vec3} v Translation vector
+ * @returns {mat4} out
*/
- export function frustum(out: GLM.IArray, left: number, right: number,
- bottom: number, top: number, near: number, far: number): GLM.IArray;
+ public static fromTranslation(out: mat4, v: vec3 | number[]): mat4
/**
- * Generates a perspective projection matrix with the given bounds
+ * Creates a matrix from a vector scaling
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param fovy Vertical field of view in radians
- * @param aspect Aspect ratio. typically viewport width/height
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
+ * mat4.identity(dest);
+ * mat4.scale(dest, dest, vec);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {vec3} v Scaling vector
+ * @returns {mat4} out
*/
- export function perspective(out: GLM.IArray, fovy: number, aspect: number,
- near: number, far: number): GLM.IArray;
+ public static fromScaling(out: mat4, v: vec3 | number[]): mat4
/**
- * Generates a orthogonal projection matrix with the given bounds
+ * Creates a matrix from a given angle around a given axis
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param left Left bound of the frustum
- * @param right Right bound of the frustum
- * @param bottom Bottom bound of the frustum
- * @param top Top bound of the frustum
- * @param near Near bound of the frustum
- * @param far Far bound of the frustum
- * @returns out
+ * mat4.identity(dest);
+ * mat4.rotate(dest, dest, rad, axis);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @param {vec3} axis the axis to rotate around
+ * @returns {mat4} out
*/
- export function ortho(out: GLM.IArray, left: number, right: number,
- bottom: number, top: number, near: number, far: number): GLM.IArray;
+ public static fromRotation(out: mat4, rad: number, axis: vec3 | number[]): mat4
/**
- * Generates a look-at matrix with the given eye position, focal point, and up axis
+ * Creates a matrix from the given angle around the X axis
+ * This is equivalent to (but much faster than):
*
- * @param out mat4 frustum matrix will be written into
- * @param eye Position of the viewer
- * @param center Point the viewer is looking at
- * @param up vec3 pointing up
- * @returns out
+ * mat4.identity(dest);
+ * mat4.rotateX(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
*/
- export function lookAt(out: GLM.IArray, eye: GLM.IArray,
- center: GLM.IArray, up: GLM.IArray): GLM.IArray;
+ public static fromXRotation(out: mat4, rad: number): mat4
/**
- * Returns a string representation of a mat4
+ * Creates a matrix from the given angle around the Y axis
+ * This is equivalent to (but much faster than):
*
- * @param mat matrix to represent as a string
- * @returns string representation of the matrix
+ * mat4.identity(dest);
+ * mat4.rotateY(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
*/
- export function str(mat: GLM.IArray): string;
+ public static fromYRotation(out: mat4, rad: number): mat4
+
/**
- * Returns Frobenius norm of a mat4
+ * Creates a matrix from the given angle around the Z axis
+ * This is equivalent to (but much faster than):
*
- * @param a the matrix to calculate Frobenius norm of
- * @returns Frobenius norm
+ * mat4.identity(dest);
+ * mat4.rotateZ(dest, dest, rad);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {number} rad the angle to rotate the matrix by
+ * @returns {mat4} out
*/
- export function frob(a: GLM.IArray): number;
+ public static fromZRotation(out: mat4, rad: number): mat4
/**
* Creates a matrix from a quaternion rotation and vector translation
@@ -1828,47 +2436,247 @@ declare namespace mat4 {
* @param v Translation vector
* @returns out
*/
- export function fromRotationTranslation(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray): GLM.IArray;
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale.
- *
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- *
- * @param out mat4 receiving operation result
- * @param q Rotation quaternion
- * @param v Translation vector
- * @param s Scale vector
- * @returns out
- */
- export function fromRotationTranslationScale(out: GLM.IArray, q: GLM.IArray, v: GLM.IArray, s: GLM.IArray): GLM.IArray
+ public static fromRotationTranslation(out: mat4, q: quat, v: vec3 | number[]): mat4;
/**
- * Creates a matrix from a quaternion
+ * Returns the translation vector component of a transformation
+ * matrix. If a matrix is built with fromRotationTranslation,
+ * the returned vector will be the same as the translation vector
+ * originally supplied.
+ * @param {vec3} out Vector to receive translation component
+ * @param {mat4} mat Matrix to be decomposed (input)
+ * @return {vec3} out
+ */
+ public static getTranslation(out: vec3, mat: mat4): vec3;
+
+ /**
+ * Returns a quaternion representing the rotational component
+ * of a transformation matrix. If a matrix is built with
+ * fromRotationTranslation, the returned quaternion will be the
+ * same as the quaternion originally supplied.
+ * @param {quat} out Quaternion to receive the rotation component
+ * @param {mat4} mat Matrix to be decomposed (input)
+ * @return {quat} out
+ */
+ public static getRotation(out: quat, mat: mat4): quat;
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
*
* @param out mat4 receiving operation result
* @param q Rotation quaternion
+ * @param v Translation vector
+ * @param s Scaling vector
* @returns out
*/
- export function fromQuat(out: GLM.IArray, q: GLM.IArray): GLM.IArray;
+ public static fromRotationTranslationScale(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[]): mat4;
+
+ /**
+ * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
+ * This is equivalent to (but much faster than):
+ *
+ * mat4.identity(dest);
+ * mat4.translate(dest, vec);
+ * mat4.translate(dest, origin);
+ * var quatMat = mat4.create();
+ * quat4.toMat4(quat, quatMat);
+ * mat4.multiply(dest, quatMat);
+ * mat4.scale(dest, scale)
+ * mat4.translate(dest, negativeOrigin);
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat} q Rotation quaternion
+ * @param {vec3} v Translation vector
+ * @param {vec3} s Scaling vector
+ * @param {vec3} o The origin vector around which to scale and rotate
+ * @returns {mat4} out
+ */
+ public static fromRotationTranslationScaleOrigin(out: mat4, q: quat, v: vec3 | number[], s: vec3 | number[], o: vec3 | number[]): mat4
+
+ /**
+ * Calculates a 4x4 matrix from the given quaternion
+ *
+ * @param {mat4} out mat4 receiving operation result
+ * @param {quat} q Quaternion to create matrix from
+ *
+ * @returns {mat4} out
+ */
+ public static fromQuat(out: mat4, q: quat): mat4
+
+ /**
+ * Generates a frustum matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ public static frustum(out: mat4, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): mat4;
+
+ /**
+ * Generates a perspective projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param fovy Vertical field of view in radians
+ * @param aspect Aspect ratio. typically viewport width/height
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ public static perspective(out: mat4, fovy: number, aspect: number,
+ near: number, far: number): mat4;
+
+ /**
+ * Generates a perspective projection matrix with the given field of view.
+ * This is primarily useful for generating projection matrices to be used
+ * with the still experimental WebVR API.
+ *
+ * @param {mat4} out mat4 frustum matrix will be written into
+ * @param {Object} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
+ * @param {number} near Near bound of the frustum
+ * @param {number} far Far bound of the frustum
+ * @returns {mat4} out
+ */
+ public static perspectiveFromFieldOfView(out: mat4,
+ fov:{upDegrees: number, downDegrees: number, leftDegrees: number, rightDegrees: number},
+ near: number, far: number): mat4
+
+ /**
+ * Generates a orthogonal projection matrix with the given bounds
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param left Left bound of the frustum
+ * @param right Right bound of the frustum
+ * @param bottom Bottom bound of the frustum
+ * @param top Top bound of the frustum
+ * @param near Near bound of the frustum
+ * @param far Far bound of the frustum
+ * @returns out
+ */
+ public static ortho(out: mat4, left: number, right: number,
+ bottom: number, top: number, near: number, far: number): mat4;
+
+ /**
+ * Generates a look-at matrix with the given eye position, focal point, and up axis
+ *
+ * @param out mat4 frustum matrix will be written into
+ * @param eye Position of the viewer
+ * @param center Point the viewer is looking at
+ * @param up vec3 pointing up
+ * @returns out
+ */
+ public static lookAt(out: mat4, eye: vec3 | number[], center: vec3 | number[], up: vec3 | number[]): mat4;
+
+ /**
+ * Returns a string representation of a mat4
+ *
+ * @param mat matrix to represent as a string
+ * @returns string representation of the matrix
+ */
+ public static str(mat: mat4): string;
+
+ /**
+ * Returns Frobenius norm of a mat4
+ *
+ * @param a the matrix to calculate Frobenius norm of
+ * @returns Frobenius norm
+ */
+ public static frob(a: mat4): number;
+
+ /**
+ * Adds two mat4's
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ public static add(out: mat4, a: mat4, b: mat4): mat4
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ public static subtract(out: mat4, a: mat4, b: mat4): mat4
+
+ /**
+ * Subtracts matrix b from matrix a
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @returns {mat4} out
+ */
+ public static sub(out: mat4, a: mat4, b: mat4): mat4
+
+ /**
+ * Multiply each element of the matrix by a scalar.
+ *
+ * @param {mat4} out the receiving matrix
+ * @param {mat4} a the matrix to scale
+ * @param {number} b amount to scale the matrix's elements by
+ * @returns {mat4} out
+ */
+ public static multiplyScalar(out: mat4, a: mat4, b: number): mat4
+
+ /**
+ * Adds two mat4's after multiplying each element of the second operand by a scalar value.
+ *
+ * @param {mat4} out the receiving vector
+ * @param {mat4} a the first operand
+ * @param {mat4} b the second operand
+ * @param {number} scale the amount to scale b's elements by before adding
+ * @returns {mat4} out
+ */
+ public static multiplyScalarAndAdd (out: mat4, a: mat4, b: mat4, scale: number): mat4
+
+ /**
+ * Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {mat4} a The first matrix.
+ * @param {mat4} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static exactEquals (a: mat4, b: mat4): boolean
+
+ /**
+ * Returns whether or not the matrices have approximately the same elements in the same position.
+ *
+ * @param {mat4} a The first matrix.
+ * @param {mat4} b The second matrix.
+ * @returns {boolean} True if the matrices are equal, false otherwise.
+ */
+ public static equals (a: mat4, b: mat4): boolean
+
}
// quat
-declare namespace quat {
+export class quat extends Float32Array {
+ private typeQuat: number;
/**
* Creates a new identity quat
*
* @returns a new quaternion
*/
- export function create(): GLM.IArray;
+ public static create(): quat;
/**
* Creates a new quat initialized with values from an existing quaternion
@@ -1877,7 +2685,7 @@ declare namespace quat {
* @returns a new quaternion
* @function
*/
- export function clone(a: GLM.IArray): GLM.IArray;
+ public static clone(a: quat): quat;
/**
* Creates a new quat initialized with the given values
@@ -1889,7 +2697,7 @@ declare namespace quat {
* @returns a new quaternion
* @function
*/
- export function fromValues(x: number, y: number, z: number, w: number): GLM.IArray;
+ public static fromValues(x: number, y: number, z: number, w: number): quat;
/**
* Copy the values from one quat to another
@@ -1899,7 +2707,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function copy(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static copy(out: quat, a: quat): quat;
/**
* Set the components of a quat to the given values
@@ -1912,7 +2720,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function set(out: GLM.IArray, x: number, y: number, z: number, w: number): GLM.IArray;
+ public static set(out: quat, x: number, y: number, z: number, w: number): quat;
/**
* Set a quat to the identity quaternion
@@ -1920,7 +2728,34 @@ declare namespace quat {
* @param out the receiving quaternion
* @returns out
*/
- export function identity(out: GLM.IArray): GLM.IArray;
+ public static identity(out: quat): quat;
+
+ /**
+ * Sets a quaternion to represent the shortest rotation from one
+ * vector to another.
+ *
+ * Both vectors are assumed to be unit length.
+ *
+ * @param {quat} out the receiving quaternion.
+ * @param {vec3} a the initial vector
+ * @param {vec3} b the destination vector
+ * @returns {quat} out
+ */
+ public static rotationTo (out: quat, a: vec3 | number[], b: vec3 | number[]): quat;
+
+ /**
+ * Sets the specified quaternion with values corresponding to the given
+ * axes. Each axis is a vec3 and is expected to be unit length and
+ * perpendicular to all other specified axes.
+ *
+ * @param {vec3} view the vector representing the viewing direction
+ * @param {vec3} right the vector representing the local "right" direction
+ * @param {vec3} up the vector representing the local "up" direction
+ * @returns {quat} out
+ */
+ public static setAxes (out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat
+
+
/**
* Sets a quat from the given angle and rotation axis,
@@ -1931,7 +2766,22 @@ declare namespace quat {
* @param rad the angle in radians
* @returns out
**/
- export function setAxisAngle(out: GLM.IArray, axis: GLM.IArray, rad: number): GLM.IArray;
+ public static setAxisAngle(out: quat, axis: vec3 | number[], rad: number): quat;
+
+ /**
+ * Gets the rotation axis and angle for a given
+ * quaternion. If a quaternion is created with
+ * setAxisAngle, this method will return the same
+ * values as providied in the original parameter list
+ * OR functionally equivalent values.
+ * Example: The quaternion formed by axis [0, 0, 1] and
+ * angle -90 is the same as the quaternion formed by
+ * [0, 0, 1] and 270. This method favors the latter.
+ * @param {vec3} out_axis Vector receiving the axis of rotation
+ * @param {quat} q Quaternion to be decomposed
+ * @return {number} Angle, in radians, of the rotation
+ */
+ public static getAxisAngle (out_axis: vec3 | number[], q: quat): number
/**
* Adds two quat's
@@ -1942,7 +2792,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function add(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static add(out: quat, a: quat, b: quat): quat;
/**
* Multiplies two quat's
@@ -1952,7 +2802,7 @@ declare namespace quat {
* @param b the second operand
* @returns out
*/
- export function multiply(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static multiply(out: quat, a: quat, b: quat): quat;
/**
* Multiplies two quat's
@@ -1962,7 +2812,7 @@ declare namespace quat {
* @param b the second operand
* @returns out
*/
- export function mul(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static mul(out: quat, a: quat, b: quat): quat;
/**
* Scales a quat by a scalar number
@@ -1973,7 +2823,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function scale(out: GLM.IArray, a: GLM.IArray, b: number): GLM.IArray;
+ public static scale(out: quat, a: quat, b: number): quat;
/**
* Calculates the length of a quat
@@ -1982,7 +2832,7 @@ declare namespace quat {
* @returns length of a
* @function
*/
- export function length(a: GLM.IArray): number;
+ public static length(a: quat): number;
/**
* Calculates the length of a quat
@@ -1991,7 +2841,7 @@ declare namespace quat {
* @returns length of a
* @function
*/
- export function len(a: GLM.IArray): number;
+ public static len(a: quat): number;
/**
* Calculates the squared length of a quat
@@ -2000,7 +2850,7 @@ declare namespace quat {
* @returns squared length of a
* @function
*/
- export function squaredLength(a: GLM.IArray): number;
+ public static squaredLength(a: quat): number;
/**
* Calculates the squared length of a quat
@@ -2009,7 +2859,7 @@ declare namespace quat {
* @returns squared length of a
* @function
*/
- export function sqrLen(a: GLM.IArray): number;
+ public static sqrLen(a: quat): number;
/**
* Normalize a quat
@@ -2019,7 +2869,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function normalize(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static normalize(out: quat, a: quat): quat;
/**
* Calculates the dot product of two quat's
@@ -2029,7 +2879,7 @@ declare namespace quat {
* @returns dot product of a and b
* @function
*/
- export function dot(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): number;
+ public static dot(a: quat, b: quat): number;
/**
* Performs a linear interpolation between two quat's
@@ -2041,7 +2891,7 @@ declare namespace quat {
* @returns out
* @function
*/
- export function lerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static lerp(out: quat, a: quat, b: quat, t: number): quat;
/**
* Performs a spherical linear interpolation between two quat
@@ -2052,7 +2902,20 @@ declare namespace quat {
* @param t interpolation amount between the two inputs
* @returns out
*/
- export function slerp(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray, t: number): GLM.IArray;
+ public static slerp(out: quat, a: quat, b: quat, t: number): quat;
+
+ /**
+ * Performs a spherical linear interpolation with two control points
+ *
+ * @param {quat} out the receiving quaternion
+ * @param {quat} a the first operand
+ * @param {quat} b the second operand
+ * @param {quat} c the third operand
+ * @param {quat} d the fourth operand
+ * @param {number} t interpolation amount
+ * @returns {quat} out
+ */
+ public static sqlerp(out: quat, a: quat, b: quat, c: quat, d: quat, t: number): quat;
/**
* Calculates the inverse of a quat
@@ -2061,7 +2924,7 @@ declare namespace quat {
* @param a quat to calculate inverse of
* @returns out
*/
- export function invert(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static invert(out: quat, a: quat): quat;
/**
* Calculates the conjugate of a quat
@@ -2071,15 +2934,15 @@ declare namespace quat {
* @param a quat to calculate conjugate of
* @returns out
*/
- export function conjugate(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static conjugate(out: quat, a: quat): quat;
/**
- * Returns a string representation of a quatenion
+ * Returns a string representation of a quaternion
*
- * @param vec vector to represent as a string
- * @returns string representation of the vector
+ * @param a quat to represent as a string
+ * @returns string representation of the quat
*/
- export function str(a: GLM.IArray): string;
+ public static str(a: quat): string;
/**
* Rotates a quaternion by the given angle about the X axis
@@ -2089,7 +2952,7 @@ declare namespace quat {
* @param rad angle (in radians) to rotate
* @returns out
*/
- export function rotateX(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateX(out: quat, a: quat, rad: number): quat;
/**
* Rotates a quaternion by the given angle about the Y axis
@@ -2099,7 +2962,7 @@ declare namespace quat {
* @param rad angle (in radians) to rotate
* @returns out
*/
- export function rotateY(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateY(out: quat, a: quat, rad: number): quat;
/**
* Rotates a quaternion by the given angle about the Z axis
@@ -2109,7 +2972,7 @@ declare namespace quat {
* @param rad angle (in radians) to rotate
* @returns out
*/
- export function rotateZ(out: GLM.IArray, a: GLM.IArray, rad: number): GLM.IArray;
+ public static rotateZ(out: quat, a: quat, rad: number): quat;
/**
* Creates a quaternion from the given 3x3 rotation matrix.
@@ -2122,20 +2985,20 @@ declare namespace quat {
* @returns out
* @function
*/
- export function fromMat3(out: GLM.IArray, m: GLM.IArray): GLM.IArray;
+ public static fromMat3(out: quat, m: mat3): quat;
/**
* Sets the specified quaternion with values corresponding to the given
* axes. Each axis is a vec3 and is expected to be unit length and
* perpendicular to all other specified axes.
*
+ * @param out the receiving quat
* @param view the vector representing the viewing direction
* @param right the vector representing the local "right" direction
* @param up the vector representing the local "up" direction
* @returns out
*/
- export function setAxes(out: GLM.IArray, view: GLM.IArray, right: GLM.IArray,
- up: GLM.IArray): GLM.IArray;
+ public static setAxes(out: quat, view: vec3 | number[], right: vec3 | number[], up: vec3 | number[]): quat;
/**
* Sets a quaternion to represent the shortest rotation from one
@@ -2148,7 +3011,7 @@ declare namespace quat {
* @param b the destination vector
* @returns out
*/
- export function rotationTo(out: GLM.IArray, a: GLM.IArray, b: GLM.IArray): GLM.IArray;
+ public static rotationTo(out: quat, a: vec3 | number[], b: vec3 | number[]): quat;
/**
* Calculates the W component of a quat from the X, Y, and Z components.
@@ -2159,5 +3022,23 @@ declare namespace quat {
* @param a quat to calculate W component of
* @returns out
*/
- export function calculateW(out: GLM.IArray, a: GLM.IArray): GLM.IArray;
+ public static calculateW(out: quat, a: quat): quat;
+
+ /**
+ * Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)
+ *
+ * @param {quat} a The first vector.
+ * @param {quat} b The second vector.
+ * @returns {boolean} True if the quaternions are equal, false otherwise.
+ */
+ public static exactEquals (a: quat, b: quat): boolean;
+
+ /**
+ * Returns whether or not the quaternions have approximately the same elements in the same position.
+ *
+ * @param {quat} a The first vector.
+ * @param {quat} b The second vector.
+ * @returns {boolean} True if the quaternions are equal, false otherwise.
+ */
+ public static equals (a: quat, b: quat): boolean;
}
diff --git a/heatmap.js/heatmap.d.ts b/heatmap.js/heatmap.d.ts
index 7cd14fc214..fb2b4eea3d 100644
--- a/heatmap.js/heatmap.d.ts
+++ b/heatmap.js/heatmap.d.ts
@@ -3,7 +3,7 @@
// Definitions by: Yang Guan
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
+///
/*
* Configuration object of a heatmap
diff --git a/i18next-xhr-backend/i18next-xhr-backend-tests.ts b/i18next-xhr-backend/i18next-xhr-backend-tests.ts
new file mode 100644
index 0000000000..404eb30297
--- /dev/null
+++ b/i18next-xhr-backend/i18next-xhr-backend-tests.ts
@@ -0,0 +1,21 @@
+///
+///
+
+import * as i18next from 'i18next';
+import XHR from 'i18next-xhr-backend';
+
+let options = {
+ loadPath: '',
+ addPath: '',
+ allowMultiLoading: false,
+ parse: function(data:string) { return data.replace(/a/g, ''); },
+ crossDomain: false,
+ withCredentials: false,
+ ajax: function (url:string, options:Object, callback: Function, data: Object) {}
+};
+
+i18next.use(XHR).init({
+ backend: options
+});
+
+let xhr = new XHR(null, options);
\ No newline at end of file
diff --git a/i18next-xhr-backend/i18next-xhr-backend.d.ts b/i18next-xhr-backend/i18next-xhr-backend.d.ts
new file mode 100644
index 0000000000..d1c95a0bd3
--- /dev/null
+++ b/i18next-xhr-backend/i18next-xhr-backend.d.ts
@@ -0,0 +1,36 @@
+// Type definitions for i18next-xhr-backend 1.2.0
+// Project: https://github.com/i18next/i18next-xhr-backend
+// Definitions by: Jan Mühlemann
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+
+declare module 'i18next-xhr-backend' {
+
+ interface Interpolator {
+ interpolate: () => string
+ }
+ interface Services {
+ interpolator: Interpolator
+ }
+
+ interface BackendOptions {
+ loadPath?: string | Function,
+ addPath?: string,
+ allowMultiLoading?: boolean,
+ parse?: Function,
+ crossDomain?: boolean,
+ withCredentials?: boolean,
+ ajax?: Function
+ }
+
+ export default class Backend {
+ type: 'backend';
+ services: Services;
+ options: BackendOptions;
+ constructor(services?: Services, options?: BackendOptions);
+ init(services?: Services, options?: BackendOptions): void;
+ readMulti(languages: any[], namespaces: any[], callback: Function): void;
+ read(language: {}, namespace: {}, callback: Function): void;
+ loadUrl(url: string, callback: Function): void;
+ create(languages: any[], namespace: string, key: string, fallbackValue: string): void;
+ }
+}
\ No newline at end of file
diff --git a/jest/jest-tests.ts b/jest/jest-tests.ts
index f3e33c4061..b547bd40ad 100644
--- a/jest/jest-tests.ts
+++ b/jest/jest-tests.ts
@@ -1,4 +1,5 @@
///
+///
// Tests based on the Jest website
jest.unmock('../sum');
@@ -37,8 +38,6 @@ describe('fetchCurrentUser', function() {
// unmock is the recommended approach for unmocking...
jest.unmock('../displayUser.js')
-// ...but dontMock also still works.
-jest.dontMock('jquery');
describe('displayUser', function() {
it('displays a user after a click', function() {
@@ -100,6 +99,157 @@ describe('CheckboxWithLabel', function() {
});
});
+jest.runAllTicks();
+xdescribe('Hooks and Suits', function () {
+ let tested: boolean;
+
+ beforeEach(function () {
+ tested = false;
+ });
+
+ afterEach(function () {
+ tested = true;
+ });
+
+ test('tested', function () {
+ expect(tested).toBeTruthy();
+ expect(tested).not.toBeFalsy();
+ });
+
+ fit('tested', function () {
+ expect(tested).toBeDefined();
+ expect(tested).not.toBeUndefined();
+ });
+
+ xit('expect null to be null', function () {
+ expect(null).toBeNull();
+ });
+});
+
+describe('compartion', function () {
+ var sum: (a: number, b: number) => number = require.requireMock('../sum');
+
+ it('compares is 7 + 2 greater than 3', function () {
+ expect(sum(7, 2)).toBeGreaterThan(3);
+ });
+
+ it('compares is 2 + 7 greater than or equal to 3', function () {
+ expect(sum(2, 7)).toBeGreaterThanOrEqual(3);
+ });
+
+ it('compares is 3 less than 3 + 4', function () {
+ expect(3).toBeLessThan(sum(3, 4));
+ });
+
+ it('compares is 3 less than or equal to 4 + 3', function () {
+ expect(3).toBeLessThanOrEqual(sum(4, 3));
+ });
+
+ it('works sanely with simple decimals', function () {
+ expect(0.2 + 0.1).toBeCloseTo(0.3, 5);
+ });
+});
+
+describe('toThrow API', function () {
+ function throwTypeError(): void {
+ throw new TypeError('toThrow Definition was out of date');
+ }
+
+ it('throws', function () {
+ expect(throwTypeError()).toThrow();
+ });
+
+ it('throws TypeError', function () {
+ expect(throwTypeError()).toThrowError(TypeError);
+ });
+
+ it('throws \'Definition was out of date\'', function () {
+ expect(throwTypeError()).toThrowError(/Definition was out of date/);
+ });
+
+ it('throws \'toThorow Definition was out of date\'', function () {
+ expect(throwTypeError()).toThrowError('toThrow Definition was out of date');
+ });
+});
+
+describe('missing tests', function () {
+ it('creates closures', function () {
+ class Closure {
+ private arg: T;
+
+ public constructor(private fn: (arg: T) => void) {
+ this.fn = fn;
+ }
+
+ public bind(arg: T): void {
+ this.arg = arg;
+ }
+
+ public call(): void {
+ this.fn(this.arg);
+ }
+ }
+
+ type StringClosure = (arg: string) => void;
+ let spy: jest.Mock = jest.fn();
+ let closure: Closure = new Closure(spy);
+ closure.bind('jest');
+ closure.call();
+ expect(spy).lastCalledWith('jest');
+ expect(spy).toBeCalledWith('jest');
+ expect(jest.isMockFunction(spy)).toBeTruthy();
+ });
+
+ it('tests all mising Mocks functionality', function () {
+ type FruitsGetter = () => Array;
+ let mock: jest.Mock = jest.fn();
+ mock.mockImplementationOnce(() => ['Orange', 'Apple', 'Plum'])
+ jest.setMock('./../tesks/getFruits', mock);
+ const getFruits: FruitsGetter = require('./../tesks/getFruits');
+ expect(getFruits()).toContain('Orange');
+ mock.mockReturnValueOnce(['Apple', 'Plum']);
+ expect(mock()).not.toContain('Orange');
+ mock.mockReturnValue([]); //Deprecated: Use jest.fn(() => value) instead.
+ mock.mockClear();
+ let thisMock: jest.Mock = jest.fn().mockReturnThis();
+ expect(thisMock()).toBe(this);
+ });
+
+ it('creates snapshoter', function () {
+ jest.disableAutomock();
+ jest.mock('./render', () => jest.fn((): string => "{Link to: \"facebook\"}"), { virtual: true });
+ const render: () => string = require('./render');
+ expect(render()).toMatch(/Link/);
+ jest.enableAutomock();
+ });
+
+ it('runs only pending timers', function () {
+ jest.useRealTimers();
+ setTimeout(() => expect(1).not.toEqual(0), 3000);
+ jest.runOnlyPendingTimers();
+ });
+
+ it('runs all timers', function () {
+ jest.clearAllTimers();
+ jest.useFakeTimers();
+ setTimeout(() => expect(0).not.toEqual(1), 3000);
+ jest.runAllTimers();
+ });
+
+ it('cleares cache', function () {
+ const sum1 = require('../sum');
+ jest.resetModules();
+ const sum2 = require('../sum');
+ expect(sum1).not.toBe(sum2);
+ })
+});
+
+describe('toMatchSnapshot', function () {
+ it('compares snapshots', function () {
+ expect({ type: 'a', props: { href: 'https://www.facebook.com/' }, children: [ 'Facebook' ] }).toMatchSnapshot();
+ });
+});
+
function testInstances() {
var mockFn = jest.fn();
var a = new mockFn();
@@ -123,3 +273,82 @@ function testMockImplementation() {
mockFn.mock.calls[0][0] === 0; // true
mockFn.mock.calls[1][0] === 1; // true
}
+
+// Test from jest Docs:
+describe('genMockFromModule', function () {
+ // Interfaces:
+ interface MockFiles {
+ [index: string]: string;
+ }
+
+ interface MockedFS {
+ readdirSync: (dir: string) => string[];
+ __setMockFiles: (newMockFiles: MockFiles) => void ;
+ }
+
+ // ------------------------------------------------------------------------------------
+ // FileSummarizer.ts
+
+ const fs = require('fs');
+
+ function summarizeFilesInDirectorySync(directory: string): string[] {
+ return fs.readdirSync(directory).map((fileName: string) => ({
+ fileName,
+ directory,
+ }));
+ }
+
+ //export default summarizeFilesInDirectorySync; // For sake of compilation
+
+ // ------------------------------------------------------------------------------------
+ // __mocks__/fs.js
+
+ const path = require('path');
+
+ const mockedFS: MockedFS = jest.genMockFromModule('fs');
+
+ let mockFiles: any = Object.create(null);
+ function __setMockFiles(newMockFiles: MockFiles): void {
+ mockFiles = Object.create(null);
+ for(const file in newMockFiles) {
+ const dir: string = path.dirname(file);
+
+ if (!mockFiles[dir]) {
+ mockFiles[dir] = [];
+ }
+ mockFiles[dir].push(path.basename(file));
+ }
+ }
+
+ function readdirSync(directoryPath: string): string[] {
+ return mockFiles[directoryPath] || [];
+ }
+
+ mockedFS.readdirSync = readdirSync;
+ mockedFS.__setMockFiles = __setMockFiles;
+
+ //export = mockedFS; // For sake of compilation
+ // ------------------------------------------------------------------------------------
+ // __tests__/FileSummarizer-test.js
+
+ jest.mock('fs');
+
+ describe('listFilesInDirectorySync', () => {
+ const MOCK_FILE_INFO: MockFiles = {
+ '/path/to/file1.js': 'console.log("file1 contents");',
+ '/path/to/file2.txt': 'file2 contents',
+ };
+
+ beforeEach(() => {
+ // Set up some mocked out file info before each test
+ (require('fs') as MockedFS).__setMockFiles(MOCK_FILE_INFO);
+ });
+
+ it('includes all files in the directory in the summary', () => {
+ const FileSummarizer: (dir: string) => string[] = require('../FileSummarizer');
+ const fileSummary = FileSummarizer('/path/to');
+
+ expect(fileSummary.length).toBe(2);
+ });
+ });
+});
diff --git a/jest/jest.d.ts b/jest/jest.d.ts
index b2484dfcc5..d0660193f6 100644
--- a/jest/jest.d.ts
+++ b/jest/jest.d.ts
@@ -1,79 +1,150 @@
-// Type definitions for Jest 0.9.0
+// Type definitions for Jest 15.1.1
// Project: http://facebook.github.io/jest/
-// Definitions by: Asana
+// Definitions by: Asana , Ivo Stratev , jwbay
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
-///
-
-declare function afterEach(fn: jest.EmptyFunction): void;
-declare function beforeEach(fn: jest.EmptyFunction): void;
-declare function describe(name: string, fn: jest.EmptyFunction): void;
+declare var beforeAll: jest.Lifecycle;
+declare var beforeEach: jest.Lifecycle;
+declare var afterAll: jest.Lifecycle;
+declare var afterEach: jest.Lifecycle;
+declare var describe: jest.Describe;
+declare var fdescribe: jest.Describe;
+declare var xdescribe: jest.Describe;
declare var it: jest.It;
-declare function pit(name: string, fn: jest.EmptyFunction): void;
-
-declare function xdescribe(name: string, fn: jest.EmptyFunction): void;
-declare function xit(name: string, fn: jest.EmptyFunction): void;
+declare var fit: jest.It;
+declare var xit: jest.It;
+declare var test: jest.It;
+declare var xtest: jest.It;
declare function expect(actual: any): jest.Matchers;
interface NodeRequire {
+ /** Returns the actual module instead of a mock, bypassing all checks on whether the module should receive a mock implementation or not. */
requireActual(moduleName: string): any;
+ /** Returns a mock module instead of the actual module, bypassing all checks on whether the module should be required normally or not. */
+ requireMock(moduleName: string): any;
}
declare namespace jest {
- function addMatchers(matchers: CustomMatcherFactories): void;
+ function addMatchers(matchers: jasmine.CustomMatcherFactories): void;
+ /** Disables automatic mocking in the module loader. */
function autoMockOff(): void;
+ /** Enables automatic mocking in the module loader. */
function autoMockOn(): void;
+ /** Removes any pending timers from the timer system. If any timers have been scheduled, they will be cleared and will never have the opportunity to execute in the future. */
function clearAllTimers(): void;
- function currentTestPath(): string;
+ /** Indicates that the module system should never return a mocked version of the specified module, including all of the specificied module's dependencies. */
+ function deepUnmock(moduleName: string): void;
+ /** Disables automatic mocking in the module loader. */
function disableAutomock(): void;
- function fn(implementation?: Function): Mock;
+ /** Mocks a module with an auto-mocked version when it is being required. */
+ function doMock(moduleName: string): void;
+ /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */
function dontMock(moduleName: string): void;
- function genMockFromModule(moduleName: string): Mock;
- function mock(moduleName: string, factory?: Function): void;
+ /** Enables automatic mocking in the module loader. */
+ function enableAutomock(): void;
+ /** Creates a mock function. Optionally takes a mock implementation. */
+ function fn(implementation?: Function): Mock;
+ /** Use the automatic mocking system to generate a mocked version of the given module. */
+ function genMockFromModule(moduleName: string): T;
+ /** Returns whether the given function is a mock function. */
+ function isMockFunction(fn: any): fn is Mock;
+ /** Mocks a module with an auto-mocked version when it is being required. */
+ function mock(moduleName: string, factory?: any, options?: MockOptions): void;
+ /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */
+ function resetModuleRegistry(): void;
+ /** Resets the module registry - the cache of all required modules. This is useful to isolate modules where local state might conflict between tests. */
+ function resetModules(): void;
+ /** Exhausts tasks queued by setImmediate(). */
+ function runAllImmediates(): void;
+ /** Exhausts the micro-task queue (usually interfaced in node via process.nextTick). */
function runAllTicks(): void;
+ /** Exhausts the macro-task queue (i.e., all tasks queued by setTimeout() and setInterval()). */
function runAllTimers(): void;
+ /** Executes only the macro-tasks that are currently pending (i.e., only the tasks that have been queued by setTimeout() or setInterval() up to this point).
+ * If any of the currently pending macro-tasks schedule new macro-tasks, those new tasks will not be executed by this call. */
function runOnlyPendingTimers(): void;
+ /** Explicitly supplies the mock object that the module system should return for the specified module. */
function setMock(moduleName: string, moduleExports: T): void;
+ /** Indicates that the module system should never return a mocked version of the specified module from require() (e.g. that it should always return the real module). */
function unmock(moduleName: string): void;
+ /** Instructs Jest to use fake versions of the standard timer functions. */
+ function useFakeTimers(): void;
+ /** Instructs Jest to use the real versions of the standard timer functions. */
+ function useRealTimers(): void;
+
+ interface MockOptions {
+ virtual?: boolean;
+ }
interface EmptyFunction {
(): void;
}
- interface Matchers {
- not: Matchers;
- toThrow(expected?: any): boolean;
- toThrowError(expected?: any): boolean;
- toBe(expected: any): boolean;
- toEqual(expected: any): boolean;
- toBeFalsy(): boolean;
- toBeTruthy(): boolean;
- toBeNull(): boolean;
- toBeDefined(): boolean;
- toBeUndefined(): boolean;
- toMatch(expected: RegExp): boolean;
- toContain(expected: string): boolean;
- toBeCloseTo(expected: number, delta: number): boolean;
- toBeGreaterThan(expected: number): boolean;
- toBeLessThan(expected: number): boolean;
- toBeCalled(): boolean;
- toBeCalledWith(...args: any[]): boolean;
- lastCalledWith(...args: any[]): boolean;
+ interface DoneCallback {
+ (...args: any[]): any
+ fail(error?: string | { message: string }): any;
+ }
+
+ interface ProvidesCallback {
+ (cb?: DoneCallback): any;
+ }
+
+ interface Lifecycle {
+ (fn: ProvidesCallback): any;
}
interface It {
- (name: string, fn: EmptyFunction): void;
- only(name: string, fn: EmptyFunction): void;
+ (name: string, fn: ProvidesCallback): void;
+ only: It;
+ skip: It;
}
- interface Mock {
+ interface Describe {
+ (name: string, fn: EmptyFunction): void
+ only: Describe;
+ skip: Describe;
+ }
+
+ interface Matchers {
+ not: Matchers;
+ lastCalledWith(...args: any[]): void;
+ toBe(expected: any): void;
+ toBeCalled(): void;
+ toBeCalledWith(...args: any[]): void;
+ toBeCloseTo(expected: number, delta: number): void;
+ toBeDefined(): void;
+ toBeFalsy(): void;
+ toBeGreaterThan(expected: number): void;
+ toBeGreaterThanOrEqual(expected: number): void;
+ toBeInstanceOf(expected: any): void
+ toBeLessThan(expected: number): void;
+ toBeLessThanOrEqual(expected: number): void;
+ toBeNull(): void;
+ toBeTruthy(): void;
+ toBeUndefined(): void;
+ toContain(expected: any): void;
+ toEqual(expected: any): void;
+ toHaveBeenCalled(): boolean;
+ toHaveBeenCalledTimes(expected: number): boolean;
+ toHaveBeenCalledWith(...params: any[]): boolean;
+ toMatch(expected: string | RegExp): void;
+ toMatchSnapshot(): void;
+ toThrow(): void;
+ toThrowError(error?: string | Constructable | RegExp): void;
+ }
+
+ interface Constructable {
+ new (...args: any[]): any
+ }
+
+ interface Mock extends Function {
new (): T;
- (...args: any[]): any; // TODO please fix this line! added for TypeScript 1.1.0-1 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/2932
+ (...args: any[]): any;
mock: MockContext;
mockClear(): void;
mockImplementation(fn: Function): Mock;
- mockImpl(fn: Function): Mock;
+ mockImplementationOnce(fn: Function): Mock;
mockReturnThis(): Mock;
mockReturnValue(value: any): Mock;
mockReturnValueOnce(value: any): Mock;
@@ -83,42 +154,138 @@ declare namespace jest {
calls: any[][];
instances: T[];
}
+}
+
+//Jest ships with a copy of Jasmine. They monkey-patch its APIs and divergence/deprecation are expected.
+//Relevant parts of Jasmine's API are below so they can be changed and removed over time.
+//This file can't reference jasmine.d.ts since the globals aren't compatible.
+
+declare function spyOn(object: any, method: string): jasmine.Spy;
+/** If you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending. */
+declare function pending(reason?: string): void;
+/** Fails a test when called within one. */
+declare function fail(error?: any): void;
+declare namespace jasmine {
+ var clock: () => Clock;
+ function any(aclass: any): Any;
+ function anything(): Any;
+ function arrayContaining(sample: any[]): ArrayContaining;
+ function objectContaining(sample: any): ObjectContaining;
+ function createSpy(name: string, originalFn?: Function): Spy;
+ function createSpyObj(baseName: string, methodNames: any[]): any;
+ function createSpyObj(baseName: string, methodNames: any[]): T;
+ function pp(value: any): string;
+ function addCustomEqualityTester(equalityTester: CustomEqualityTester): void;
+ function addMatchers(matchers: CustomMatcherFactories): void;
+ function stringMatching(value: string | RegExp): Any;
+
+ interface Clock {
+ install(): void;
+ uninstall(): void;
+ /** Calls to any registered callback are triggered when the clock is ticked forward via the jasmine.clock().tick function, which takes a number of milliseconds. */
+ tick(ms: number): void;
+ mockDate(date?: Date): void;
+ }
+
+ interface Any {
+ new (expectedClass: any): any;
+ jasmineMatches(other: any): boolean;
+ jasmineToString(): string;
+ }
+
+ interface ArrayContaining {
+ new (sample: any[]): any;
+ asymmetricMatch(other: any): boolean;
+ jasmineToString(): string;
+ }
+
+ interface ObjectContaining {
+ new (sample: any): any;
+ jasmineMatches(other: any, mismatchKeys: any[], mismatchValues: any[]): boolean;
+ jasmineToString(): string;
+ }
+
+ interface Spy {
+ (...params: any[]): any;
+ identity: string;
+ and: SpyAnd;
+ calls: Calls;
+ mostRecentCall: { args: any[]; };
+ argsForCall: any[];
+ wasCalled: boolean;
+ }
+
+ interface SpyAnd {
+ /** By chaining the spy with and.callThrough, the spy will still track all calls to it but in addition it will delegate to the actual implementation. */
+ callThrough(): Spy;
+ /** By chaining the spy with and.returnValue, all calls to the function will return a specific value. */
+ returnValue(val: any): Spy;
+ /** By chaining the spy with and.returnValues, all calls to the function will return specific values in order until it reaches the end of the return values list. */
+ returnValues(...values: any[]): Spy;
+ /** By chaining the spy with and.callFake, all calls to the spy will delegate to the supplied function. */
+ callFake(fn: Function): Spy;
+ /** By chaining the spy with and.throwError, all calls to the spy will throw the specified value. */
+ throwError(msg: string): Spy;
+ /** When a calling strategy is used for a spy, the original stubbing behavior can be returned at any time with and.stub. */
+ stub(): Spy;
+ }
+
+ interface Calls {
+ /** By chaining the spy with calls.any(), will return false if the spy has not been called at all, and then true once at least one call happens. */
+ any(): boolean;
+ /** By chaining the spy with calls.count(), will return the number of times the spy was called */
+ count(): number;
+ /** By chaining the spy with calls.argsFor(), will return the arguments passed to call number index */
+ argsFor(index: number): any[];
+ /** By chaining the spy with calls.allArgs(), will return the arguments to all calls */
+ allArgs(): any[];
+ /** By chaining the spy with calls.all(), will return the context (the this) and arguments passed all calls */
+ all(): CallInfo[];
+ /** By chaining the spy with calls.mostRecent(), will return the context (the this) and arguments for the most recent call */
+ mostRecent(): CallInfo;
+ /** By chaining the spy with calls.first(), will return the context (the this) and arguments for the first call */
+ first(): CallInfo;
+ /** By chaining the spy with calls.reset(), will clears all tracking for a spy */
+ reset(): void;
+ }
+
+ interface CallInfo {
+ /** The context (the this) for the call */
+ object: any;
+ /** All arguments passed to the call */
+ args: any[];
+ /** The return value of the call */
+ returnValue: any;
+ }
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcherFactories {
[index: string]: CustomMatcherFactory;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcherFactory {
(util: MatchersUtil, customEqualityTesters: Array): CustomMatcher;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface MatchersUtil {
equals(a: any, b: any, customTesters?: Array): boolean;
contains(haystack: ArrayLike | string, needle: any, customTesters?: Array): boolean;
buildFailureMessage(matcherName: string, isNot: boolean, actual: any, ...expected: Array): string;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomEqualityTester {
(first: any, second: any): boolean;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcher {
compare(actual: T, expected: T): CustomMatcherResult;
compare(actual: any, expected: any): CustomMatcherResult;
}
- // taken from Jasmine since addMatchers calls into the jasmine api
interface CustomMatcherResult {
pass: boolean;
- message: string;
+ message: string | (() => string);
}
- // taken from Jasmine which takes from TypeScript lib.core.es6.d.ts, applicable to CustomMatchers.contains()
interface ArrayLike {
length: number;
[n: number]: T;
diff --git a/jquery.dataTables/jquery.dataTables-tests.ts b/jquery.dataTables/jquery.dataTables-tests.ts
index 4d1d114cb4..6329861604 100644
--- a/jquery.dataTables/jquery.dataTables-tests.ts
+++ b/jquery.dataTables/jquery.dataTables-tests.ts
@@ -82,21 +82,21 @@ $(document).ready(function () {
width: "200px"
}
col =
- {
- data: "",
- orderData: [10, 11, 20],
- render: "",
- }
+ {
+ data: "",
+ orderData: [10, 11, 20],
+ render: "",
+ }
col =
- {
- data: colDataObject,
- render: colRenderObject,
- }
+ {
+ data: colDataObject,
+ render: colRenderObject,
+ }
col =
- {
- data: colDataFunc,
- render: colRenderFunc,
- }
+ {
+ data: colDataFunc,
+ render: colRenderFunc,
+ }
//#endregion "Column"
@@ -124,16 +124,16 @@ $(document).ready(function () {
};
colDef =
- {
- targets: "2",
- cellType: "th",
- };
+ {
+ targets: "2",
+ cellType: "th",
+ };
colDef =
- {
- targets: ["2", 5],
- cellType: "th",
- };
+ {
+ targets: ["2", 5],
+ cellType: "th",
+ };
//#endregion "ColumnDef"
@@ -159,7 +159,7 @@ $(document).ready(function () {
var ajaxFunc: DataTables.FunctionAjax = function (data, callback, settings) { };
- var ajaxDataFunc: DataTables.FunctionAjaxData = function (data) {
+ var ajaxDataFunc: DataTables.FunctionAjaxData = function (data, settings) {
return data;
};
@@ -229,41 +229,41 @@ $(document).ready(function () {
config =
- {
- ajax: ajaxFunc,
- deferLoading: [10, 100],
- lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
- order: [0, 'asc'],
- orderFixed: [[0, 'asc'], [1, 'asc']],
- renderer: {
- header: "bootstrap",
- pageButton: "jqueryui"
- },
- search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true },
- searchCols: [
- null,
- { "search": "", "smart": true, "regex": false, "caseInsensitive": true },
- { "search": "" },
- { "search": "", "smart": true },
- null
- ],
- };
+ {
+ ajax: ajaxFunc,
+ deferLoading: [10, 100],
+ lengthMenu: [[10, 25, 50, -1], [10, 25, 50, "All"]],
+ order: [0, 'asc'],
+ orderFixed: [[0, 'asc'], [1, 'asc']],
+ renderer: {
+ header: "bootstrap",
+ pageButton: "jqueryui"
+ },
+ search: { "search": "", "smart": true, "regex": false, "caseInsensitive": true },
+ searchCols: [
+ null,
+ { "search": "", "smart": true, "regex": false, "caseInsensitive": true },
+ { "search": "" },
+ { "search": "", "smart": true },
+ null
+ ],
+ };
config =
- {
- ajax: {
- data: {},
- dataSrc: "",
- },
- };
+ {
+ ajax: {
+ data: {},
+ dataSrc: "",
+ },
+ };
config =
- {
- ajax: {
- data: ajaxDataFunc,
- dataSrc: function (data) { },
- },
- };
+ {
+ ajax: {
+ data: ajaxDataFunc,
+ dataSrc: function (data) { },
+ },
+ };
//#endregion "Settings"
@@ -309,6 +309,8 @@ $(document).ready(function () {
draw = dt.draw(true);
draw.$("");
+ var initSettings = dt.init();
+
var off = dt.off("event");
off = dt.off("event", function () { });
off.$("");
@@ -385,11 +387,11 @@ $(document).ready(function () {
var select = $('')
.appendTo('body')
.on('change', function () {
- dt
- .column(0)
- .search($(this).val())
- .draw();
- });
+ dt
+ .column(0)
+ .search($(this).val())
+ .draw();
+ });
// Get the search data for the first column and add to the select list
var data = dt
.cells('', 0)
@@ -397,8 +399,8 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
- select.append($(''));
- });
+ select.append($(''));
+ });
var cells_data = cells.data();
var data = dt
@@ -438,6 +440,9 @@ $(document).ready(function () {
console.log(data);
});
+ cells.every(function () { });
+ cells.every(function (cellRowIdx, cellColIdx, tableLoop, cellLoop) { });
+
var cell = dt.cell(":contains('Not shipped')");
cell = dt.cell(function () { });
cell = dt.cell($(""));
@@ -519,12 +524,12 @@ $(document).ready(function () {
dt.column(colIdx).footer()
)
.on('change', function () {
- dt
- .column(colIdx)
- .search($(this).val())
- .draw();
- });
-
+ dt
+ .column(colIdx)
+ .search($(this).val())
+ .draw();
+ });
+
// Get the search data for the first column and add to the select list
dt
.column(colIdx)
@@ -532,8 +537,8 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
- select.append($(''));
- });
+ select.append($(''));
+ });
});
var columns_data = columns.data();
@@ -545,7 +550,7 @@ $(document).ready(function () {
.sort() // Sort data alphabetically
.unique() // Reduce to unique values
.join(' ')
- );
+ );
//var idx = dt
// .columns('.check')
@@ -603,12 +608,12 @@ $(document).ready(function () {
dt.column(0).footer()
)
.on('change', function () {
- dt
- .column(0)
- .search($(this).val())
- .draw();
- });
-
+ dt
+ .column(0)
+ .search($(this).val())
+ .draw();
+ });
+
// Get the search data for the first column and add to the select list
dt
.column(0)
@@ -616,18 +621,18 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
- select.append($(''));
- });
+ select.append($(''));
+ });
var column_data = column.data();
alert('Column 4 sum: ' +
dt
.column(4)
.data()
- .reduce(function (a, b) {
- return a + b;
- })
- );
+ .reduce(function (a, b) {
+ return a + b;
+ })
+ );
var column_dataSrc = column.dataSrc();
$('#example').on('click', 'tbody td', function () {
@@ -688,11 +693,11 @@ $(document).ready(function () {
)
.on('change', function () {
dt
- .column(colIdx)
- .search($(this).val())
- .draw();
- });
-
+ .column(colIdx)
+ .search($(this).val())
+ .draw();
+ });
+
// Get the search data for the first column and add to the select list
dt
.column(colIdx)
@@ -700,8 +705,8 @@ $(document).ready(function () {
.sort()
.unique()
.each(function (d) {
- select.append($(''));
- });
+ select.append($(''));
+ });
});
var column_visible_get = column.visible();
@@ -709,12 +714,15 @@ $(document).ready(function () {
column_visible_set = column.visible(false, true);
alert('Column index 0 is ' +
(dt.column(0).visible() === true ? 'visible' : 'not visible')
- );
+ );
for (var i = 0; i < 4; i++) {
dt.column(i).visible(false, false);
}
dt.columns.adjust().draw(false); // adjust column sizing and redraw
+ dt.columns().every(function () { });
+ dt.columns().every(function (colIdx, tableLoop, colLoop) { });
+
//#endregion "Methods-Column"
//#region "Methods-Row"
@@ -754,6 +762,8 @@ $(document).ready(function () {
var rows_11 = dt.rows("selector").remove();
var rows_12 = dt.rows("selector").nodes();
var rows_13 = dt.rows.add([{}, {}]);
+ dt.rows().every(function () { });
+ dt.rows().every(function (rowIdx, tableLoop, rowLoop) { });
var table3 = $('#example').DataTable();
table3.row.add({
@@ -791,9 +801,9 @@ $(document).ready(function () {
pupil,
])
.draw();
- //.nodes()
- //.to$()
- //.addClass('new');
+ //.nodes()
+ //.to$()
+ //.addClass('new');
$('#example tbody').on('click', 'td.details-control', function () {
var tr = $(this).parents('tr');
@@ -829,7 +839,7 @@ $(document).ready(function () {
'