aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
authorKris Kowal2012-07-06 11:52:06 -0700
committerKris Kowal2012-07-06 15:01:48 -0700
commit648ee61ae84216d0236e0dbc211addc13b2cfa3a (patch)
tree8f0f55557bd0c47a84e49c1977c950645d284607 /js/lib
parentaedd14b18695d031f695d27dfbd94df5614495bb (diff)
downloadninja-648ee61ae84216d0236e0dbc211addc13b2cfa3a.tar.gz
Expand tabs
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/NJUtils.js102
-rwxr-xr-xjs/lib/drawing/world.js1238
-rwxr-xr-xjs/lib/geom/circle.js216
-rwxr-xr-xjs/lib/geom/geom-obj.js40
-rwxr-xr-xjs/lib/geom/line.js68
-rwxr-xr-xjs/lib/geom/rectangle.js1132
-rw-r--r--js/lib/geom/shape-primitive.js336
-rwxr-xr-xjs/lib/math/matrix.js68
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js154
-rw-r--r--js/lib/rdge/materials/cloud-material.js704
-rw-r--r--js/lib/rdge/materials/deform-material.js88
-rw-r--r--js/lib/rdge/materials/flag-material.js160
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js60
-rw-r--r--js/lib/rdge/materials/fly-material.js136
-rw-r--r--js/lib/rdge/materials/julia-material.js128
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js136
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js214
-rw-r--r--js/lib/rdge/materials/mandel-material.js130
-rwxr-xr-xjs/lib/rdge/materials/material-parser.js4
-rwxr-xr-xjs/lib/rdge/materials/material.js574
-rw-r--r--js/lib/rdge/materials/plasma-material.js160
-rw-r--r--js/lib/rdge/materials/pulse-material.js308
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js84
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js170
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js84
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js84
-rw-r--r--js/lib/rdge/materials/star-material.js100
-rw-r--r--js/lib/rdge/materials/taper-material.js56
-rw-r--r--js/lib/rdge/materials/tunnel-material.js86
-rw-r--r--js/lib/rdge/materials/twist-material.js84
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js290
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js262
-rw-r--r--js/lib/rdge/materials/water-material.js272
-rw-r--r--js/lib/rdge/materials/z-invert-material.js102
-rw-r--r--js/lib/rdge/texture.js600
35 files changed, 4215 insertions, 4215 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index 1406ad98..e924e1b8 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -65,9 +65,9 @@ exports.NJUtils = Montage.create(Component, {
65 children : { 65 children : {
66 value : function(el, filter) { 66 value : function(el, filter) {
67 var f = filter || function(item) { 67 var f = filter || function(item) {
68 return item.nodeType === 1; 68 return item.nodeType === 1;
69 }; 69 };
70 return this.toArray(el.childNodes).filter(f); 70 return this.toArray(el.childNodes).filter(f);
71 } 71 }
72 }, 72 },
73 73
@@ -185,54 +185,54 @@ exports.NJUtils = Montage.create(Component, {
185 }, 185 },
186 186
187 queryParentSelector : { 187 queryParentSelector : {
188 value: function(el, strSelector) { 188 value: function(el, strSelector) {
189 // queryParentSelector: 189 // queryParentSelector:
190 // Given a DOM element el (required), walk up the DOM tree 190 // Given a DOM element el (required), walk up the DOM tree
191 // and find the first parent that matches selector strSelector (required). 191 // and find the first parent that matches selector strSelector (required).
192 // Returns: The element that matches, or false if there is no match 192 // Returns: The element that matches, or false if there is no match
193 // or if insufficient parameters are supplied. 193 // or if insufficient parameters are supplied.
194 194
195 if ((typeof(el) === "undefined") || (typeof(strSelector) === "undefined")) { 195 if ((typeof(el) === "undefined") || (typeof(strSelector) === "undefined")) {
196 // Parameters are required, m'kay? 196 // Parameters are required, m'kay?
197 return false; 197 return false;
198 } else if ((typeof(el) !== "object") || (typeof(strSelector) !== "string" )) { 198 } else if ((typeof(el) !== "object") || (typeof(strSelector) !== "string" )) {
199 // You also have to use the right parameters. 199 // You also have to use the right parameters.
200 return false; 200 return false;
201 } 201 }
202 202
203 // First, get an empty clone of the parent. 203 // First, get an empty clone of the parent.
204 var myParent = el.parentNode; 204 var myParent = el.parentNode;
205 var clone = myParent.cloneNode(false); 205 var clone = myParent.cloneNode(false);
206 if (clone === null) { 206 if (clone === null) {
207 return false; 207 return false;
208 } 208 }
209 209
210 // If we're at the top of the DOM, our clone will be an htmlDocument. 210 // If we're at the top of the DOM, our clone will be an htmlDocument.
211 // htmlDocument has no tagName. 211 // htmlDocument has no tagName.
212 if (typeof(clone.tagName) !== "undefined") { 212 if (typeof(clone.tagName) !== "undefined") {
213 // create a bogus div to use as a base for querySelector 213 // create a bogus div to use as a base for querySelector
214 var temp = document.createElement("div"); 214 var temp = document.createElement("div");
215 215
216 // Append the clone to the bogus div 216 // Append the clone to the bogus div
217 temp.appendChild(clone); 217 temp.appendChild(clone);
218 218
219 // Now we can use querySelector! Sweet. 219 // Now we can use querySelector! Sweet.
220 var selectorTest = temp.querySelector(strSelector); 220 var selectorTest = temp.querySelector(strSelector);
221 221
222 // What has querySelector returned? 222 // What has querySelector returned?
223 if (selectorTest === null) { 223 if (selectorTest === null) {
224 // No match, so recurse. 224 // No match, so recurse.
225 return this.queryParentSelector(myParent, strSelector); 225 return this.queryParentSelector(myParent, strSelector);
226 } else { 226 } else {
227 // Match! Return the element. 227 // Match! Return the element.
228 return myParent; 228 return myParent;
229 } 229 }
230 } else { 230 } else {
231 // We're at the top of the DOM so we're done. 231 // We're at the top of the DOM so we're done.
232 return false; 232 return false;
233 } 233 }
234 } 234 }
235 235
236 }, 236 },
237 237
238 // Returns the numerical value and unit string from a string. 238 // Returns the numerical value and unit string from a string.
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index fb70d18c..b20b0a5d 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -46,66 +46,66 @@ var World = function GLWorld( canvas, use3D, preserveDrawingBuffer ) {
46 // Instance variables 46 // Instance variables
47 /////////////////////////////////////////////////////////////////////// 47 ///////////////////////////////////////////////////////////////////////
48 48
49 // flag to do the drawing with WebGL 49 // flag to do the drawing with WebGL
50 this._useWebGL = false; 50 this._useWebGL = false;
51 if(use3D) { 51 if(use3D) {
52 this._useWebGL = use3D; 52 this._useWebGL = use3D;
53 } 53 }
54 54
55 this._canvas = canvas; 55 this._canvas = canvas;
56 if (this._useWebGL) 56 if (this._useWebGL)
57 { 57 {
58 if(preserveDrawingBuffer) 58 if(preserveDrawingBuffer)
59 { 59 {
60 this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true}); 60 this._glContext = canvas.getContext("experimental-webgl", {preserveDrawingBuffer: true});
61 } 61 }
62 else 62 else
63 { 63 {
64 this._glContext = canvas.getContext("experimental-webgl"); 64 this._glContext = canvas.getContext("experimental-webgl");
65 } 65 }
66 } 66 }
67 else 67 else
68 { 68 {
69 this._2DContext = canvas.getContext( "2d" ); 69 this._2DContext = canvas.getContext( "2d" );
70 } 70 }
71 71
72 this._viewportWidth = canvas.width; 72 this._viewportWidth = canvas.width;
73 this._viewportHeight = canvas.height; 73 this._viewportHeight = canvas.height;
74 74
75 // view parameters 75 // view parameters
76 this._fov = 45.0; 76 this._fov = 45.0;
77 this._zNear = 0.1; 77 this._zNear = 0.1;
78 this._zFar = 100.0; 78 this._zFar = 100.0;
79 this._viewDist = 5.0; 79 this._viewDist = 5.0;
80 80
81 // default light parameters 81 // default light parameters
82 this._ambientLightColor = [0.1, 0.1, 0.1, 1.0]; 82 this._ambientLightColor = [0.1, 0.1, 0.1, 1.0];
83 this._diffuseLightColor = [0.1, 0.1, 0.1, 1.0]; 83 this._diffuseLightColor = [0.1, 0.1, 0.1, 1.0];
84 this._specularLightColor = [0.6, 0.6, 0.6, 1.0]; 84 this._specularLightColor = [0.6, 0.6, 0.6, 1.0];
85 this._pointLightLoc = [0.0, 0.0, 0.05]; 85 this._pointLightLoc = [0.0, 0.0, 0.05];
86 86
87 // default material properties. Material properties should be overridden 87 // default material properties. Material properties should be overridden
88 // by the materials used by the objects 88 // by the materials used by the objects
89 this._materialShininess = 20.0; 89 this._materialShininess = 20.0;
90 90
91 this._geomRoot = undefined; 91 this._geomRoot = undefined;
92 92
93 this._cameraMat = Matrix.I(4); 93 this._cameraMat = Matrix.I(4);