diff options
Diffstat (limited to 'js/lib')
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> |
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | All Rights Reserved. |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | BSD License. |
5 | |||
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, 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 | |||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
28 | POSSIBILITY OF SUCH DAMAGE. | ||
5 | </copyright> */ | 29 | </copyright> */ |
6 | 30 | ||
7 | var Montage = require("montage/core/core").Montage, | 31 | var 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> |
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | All Rights Reserved. |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | BSD License. |
5 | |||
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, 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 | |||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
28 | POSSIBILITY 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() | |||
1078 | if (typeof exports === "object") { | 1110 | if (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> |
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | 3 | All Rights Reserved. |
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | BSD License. |
5 | |||
6 | Redistribution and use in source and binary forms, with or without | ||
7 | modification, 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 pr |