aboutsummaryrefslogtreecommitdiff
path: root/js/lib
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib')
-rwxr-xr-xjs/lib/NJUtils.js30
-rwxr-xr-xjs/lib/drawing/world.js54
-rwxr-xr-xjs/lib/geom/anchor-point.js30
-rwxr-xr-xjs/lib/geom/brush-stroke.js30
-rwxr-xr-xjs/lib/geom/circle.js1572
-rwxr-xr-xjs/lib/geom/geom-obj.js57
-rwxr-xr-xjs/lib/geom/line.js89
-rwxr-xr-xjs/lib/geom/rectangle.js335
-rw-r--r--js/lib/geom/shape-primitive.js213
-rwxr-xr-xjs/lib/geom/sub-path.js30
-rwxr-xr-xjs/lib/math/matrix.js30
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js44
-rw-r--r--js/lib/rdge/materials/cloud-material.js30
-rw-r--r--js/lib/rdge/materials/deform-material.js42
-rw-r--r--js/lib/rdge/materials/flag-material.js44
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js32
-rw-r--r--js/lib/rdge/materials/fly-material.js42
-rw-r--r--js/lib/rdge/materials/julia-material.js41
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js42
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js100
-rw-r--r--js/lib/rdge/materials/mandel-material.js41
-rwxr-xr-xjs/lib/rdge/materials/material-parser.js30
-rwxr-xr-xjs/lib/rdge/materials/material.js115
-rw-r--r--js/lib/rdge/materials/plasma-material.js44
-rw-r--r--js/lib/rdge/materials/pulse-material.js44
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js40
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js126
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js40
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js40
-rw-r--r--js/lib/rdge/materials/star-material.js40
-rw-r--r--js/lib/rdge/materials/taper-material.js59
-rw-r--r--js/lib/rdge/materials/tunnel-material.js42
-rw-r--r--js/lib/rdge/materials/twist-material.js40
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js44
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js49
-rw-r--r--js/lib/rdge/materials/water-material.js43
-rw-r--r--js/lib/rdge/materials/z-invert-material.js40
-rw-r--r--js/lib/rdge/texture.js30
38 files changed, 2740 insertions, 1054 deletions
diff --git a/js/lib/NJUtils.js b/js/lib/NJUtils.js
index b35e29bc..1406ad98 100755
--- a/js/lib/NJUtils.js
+++ b/js/lib/NJUtils.js
@@ -1,7 +1,31 @@
1/* <copyright> 1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 2Copyright (c) 2012, Motorola Mobility, Inc
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3All Rights Reserved.
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4BSD License.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
5</copyright> */ 29</copyright> */
6 30
7var Montage = require("montage/core/core").Montage, 31var Montage = require("montage/core/core").Montage,
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 8068284e..2b76161f 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -1,7 +1,31 @@
1/* <copyright> 1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 2Copyright (c) 2012, Motorola Mobility, Inc
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3All Rights Reserved.
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4BSD License.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.
14 - Neither the name of Motorola Mobility nor the names of its contributors
15 may be used to endorse or promote products derived from this software
16 without specific prior written permission.
17
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28POSSIBILITY OF SUCH DAMAGE.
5</copyright> */ 29</copyright> */
6 30
7 31
@@ -442,6 +466,7 @@ World.prototype.updateObject = function (obj) {
442 if (prims.length != materialNodes.length) 466 if (prims.length != materialNodes.length)
443 throw new Error("inconsistent material and primitive counts"); 467 throw new Error("inconsistent material and primitive counts");
444 var nPrims = prims.length; 468 var nPrims = prims.length;
469 var iPrim = 0;
445 var ctrTrNode; 470 var ctrTrNode;
446 if (nPrims > 0) 471 if (nPrims > 0)
447 { 472 {
@@ -459,8 +484,12 @@ World.prototype.updateObject = function (obj) {
459 ); 484 );
460 ctrTrNode.meshes = []; 485 ctrTrNode.meshes = [];
461 486
462 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]);
463 ctrTrNode.attachMaterial(materialNodes[0]); 487 ctrTrNode.attachMaterial(materialNodes[0]);
488 while ((iPrim < nPrims) && (materialNodes[iPrim] == materialNodes[0]))
489 {
490 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[iPrim]);
491 iPrim++;
492 }
464 } 493 }
465 494
466 // delete all of the child nodes 495 // delete all of the child nodes
@@ -481,16 +510,18 @@ World.prototype.updateObject = function (obj) {
481 } 510 }
482 ctrTrNode.children = []; 511 ctrTrNode.children = [];
483 512
484 for (var i = 1; i < nPrims; i++) 513 while (iPrim < nPrims)
485 { 514 {
486 // get the next primitive
487 childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++); 515 childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++);
488 ctrTrNode.insertAsChild(childTrNode); 516 ctrTrNode.insertAsChild(childTrNode);
517 var matNode = materialNodes[iPrim];
518 childTrNode.attachMaterial(matNode);
489 519
490 // attach the instanced box goe 520 while ((iPrim < nPrims) && (materialNodes[iPrim] == matNode))
491 var prim = prims[i]; 521 {
492 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim); 522 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[iPrim]);
493 childTrNode.attachMaterial(materialNodes[i]); 523 iPrim++;
524 }
494 } 525 }
495 526
496 // send a notification that the tree has changed 527 // send a notification that the tree has changed
@@ -623,6 +654,7 @@ World.prototype.clearTree = function()
623 654
624 if (this._useWebGL) 655 if (this._useWebGL)
625 { 656 {
657 this.stop();
626 var root = this._rootNode; 658 var root = this._rootNode;
627 root.children = new Array(); 659 root.children = new Array();
628 RDGE.globals.engine.unregisterCanvas( this._canvas.rdgeid ); 660 RDGE.globals.engine.unregisterCanvas( this._canvas.rdgeid );
@@ -1078,4 +1110,4 @@ function Notifier()
1078if (typeof exports === "object") { 1110if (typeof exports === "object") {
1079 exports.World = World; 1111 exports.World = World;
1080 exports.Notifier = Notifier; 1112 exports.Notifier = Notifier;
1081} \ No newline at end of file 1113}
diff --git a/js/lib/geom/anchor-point.js b/js/lib/geom/anchor-point.js
index d254681c..a1fcfc0d 100755
--- a/js/lib/geom/anchor-point.js
+++ b/js/lib/geom/anchor-point.js
@@ -1,7 +1,31 @@
1/* <copyright> 1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/> 2Copyright (c) 2012, Motorola Mobility, Inc
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> 3All Rights Reserved.
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4BSD License.
5
6Redistribution and use in source and binary forms, with or without
7modification, are permitted provided that the following conditions are met:
8
9 - Redistributions of source code must retain the above copyright notice,
10 this list of conditions and the following disclaimer.
11 - Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in the
13 documentation and/or other materials provided with the distribution.