aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-04-11 13:33:43 -0700
committerAlon Zakai <alonzakai@gmail.com>2012-04-11 13:33:43 -0700
commit36b98fa522ef3946168379f5b555fa7aabdbabfe (patch)
tree0a84cb7b87bbe0f3985cfccd0c37f6aedaacb019
parent9d26ce563f81e8540d3eeaa37b81d42f0978d6e4 (diff)
modify glMatrix for emscripten
-rw-r--r--src/gl-matrix.js73
1 files changed, 34 insertions, 39 deletions
diff --git a/src/gl-matrix.js b/src/gl-matrix.js
index c3ba8335..a21cd431 100644
--- a/src/gl-matrix.js
+++ b/src/gl-matrix.js
@@ -1,9 +1,13 @@
+(function() {
+
/**
* @fileoverview gl-matrix - High performance matrix and vector operations for WebGL
* @author Brandon Jones
* @version 1.2.4
*/
+// Modifed for emscripten: Global scoping etc.
+
/*
* Copyright (c) 2011 Brandon Jones
*
@@ -27,50 +31,32 @@
* distribution.
*/
-"use strict";
-
-// Type declarations
-(function(_global) {
- // account for CommonJS environments
- _global.glMatrixArrayType = _global.MatrixArray = null;
-
- /**
- * @class 3 Dimensional Vector
- * @name vec3
- */
- _global.vec3 = {};
- /**
- * @class 3x3 Matrix
- * @name mat3
- */
- _global.mat3 = {};
-
- /**
- * @class 4x4 Matrix
- * @name mat4
- */
- _global.mat4 = {};
+/**
+ * @class 3 Dimensional Vector
+ * @name vec3
+ */
+var vec3 = {};
- /**
- * @class Quaternion
- * @name quat4
- */
- _global.quat4 = {};
+/**
+ * @class 3x3 Matrix
+ * @name mat3
+ */
+var mat3 = {};
- // explicitly sets and returns the type of array to use within glMatrix
- _global.setMatrixArrayType = function(type) {
- return glMatrixArrayType = MatrixArray = type;
- };
+/**
+ * @class 4x4 Matrix
+ * @name mat4
+ */
+var mat4 = {};
- // auto-detects and returns the best type of array to use within glMatrix, falling
- // back to Array if typed arrays are unsupported
- _global.determineMatrixArrayType = function() {
- return setMatrixArrayType((typeof Float32Array !== 'undefined') ? Float32Array : Array);
- };
+/**
+ * @class Quaternion
+ * @name quat4
+ */
+var quat4 = {};
- determineMatrixArrayType();
-})((typeof(exports) != 'undefined') ? global : this);
+var MatrixArray = Float32Array;
/*
* vec3
@@ -1955,3 +1941,12 @@ quat4.str = function (quat) {
};
+return {
+ vec3: vec3,
+ mat3: mat3,
+ mat4: mat4,
+ quat4: quat4
+};
+
+})();
+