diff options
author | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-09 14:35:44 -0700 |
commit | 84b3327bd92faafab7954b5eb64c7abe24a3fe13 (patch) | |
tree | 3f56cbed2f08c5a81ea79eaf0bcb9bd031d8a627 /js/helper-classes/RDGE/src/core/script/scenegraphNodes.js | |
parent | c0a42c56f768a873ba637f5b86d5f6a84d4a3312 (diff) | |
parent | 40c6eb2c06b34f65a74d59ef9687251952858bab (diff) | |
download | ninja-84b3327bd92faafab7954b5eb64c7abe24a3fe13.tar.gz |
Merge branch 'normalize' of https://github.com/kriskowal/ninja-internal
Conflicts:
js/components/gradientpicker.reel/gradientpicker.js
js/components/tools-properties/text-properties.reel/text-properties.js
js/document/views/base.js
js/document/views/design.js
js/helper-classes/3D/StageLine.js
js/helper-classes/3D/draw-utils.js
js/lib/drawing/world.js
js/lib/geom/circle.js
js/lib/geom/line.js
js/lib/geom/rectangle.js
js/lib/geom/shape-primitive.js
js/lib/rdge/materials/bump-metal-material.js
js/lib/rdge/materials/flag-material.js
js/lib/rdge/materials/fly-material.js
js/lib/rdge/materials/julia-material.js
js/lib/rdge/materials/keleidoscope-material.js
js/lib/rdge/materials/mandel-material.js
js/lib/rdge/materials/material.js
js/lib/rdge/materials/plasma-material.js
js/lib/rdge/materials/pulse-material.js
js/lib/rdge/materials/radial-gradient-material.js
js/lib/rdge/materials/taper-material.js
js/lib/rdge/materials/twist-vert-material.js
js/lib/rdge/materials/water-material.js
js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
js/panels/Materials/materials-popup.reel/materials-popup.html
js/panels/Materials/materials-popup.reel/materials-popup.js
js/tools/LineTool.js
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/scenegraphNodes.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/scenegraphNodes.js | 1140 |
1 files changed, 570 insertions, 570 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js index 7fa4ff27..367c93af 100755 --- a/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js +++ b/js/helper-classes/RDGE/src/core/script/scenegraphNodes.js | |||
@@ -1,570 +1,570 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility, Inc |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | 4 | BSD License. |
5 | 5 | ||
6 | Redistribution and use in source and binary forms, with or without | 6 | Redistribution and use in source and binary forms, with or without |
7 | modification, are permitted provided that the following conditions are met: | 7 | modification, are permitted provided that the following conditions are met: |
8 | 8 | ||
9 | - Redistributions of source code must retain the above copyright notice, | 9 | - Redistributions of source code must retain the above copyright notice, |
10 | this list of conditions and the following disclaimer. | 10 | this list of conditions and the following disclaimer. |
11 | - Redistributions in binary form must reproduce the above copyright | 11 | - Redistributions in binary form must reproduce the above copyright |
12 | notice, this list of conditions and the following disclaimer in the | 12 | notice, this list of conditions and the following disclaimer in the |
13 | documentation and/or other materials provided with the distribution. | 13 | documentation and/or other materials provided with the distribution. |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 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 | 15 | may be used to endorse or promote products derived from this software |
16 | without specific prior written permission. | 16 | without specific prior written permission. |
17 | 17 | ||
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 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 | 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 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 | 25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 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 | 27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | POSSIBILITY OF SUCH DAMAGE. |
29 | </copyright> */ | 29 | </copyright> */ |
30 | 30 | ||
31 | // RDGE namespaces | 31 | // RDGE namespaces |
32 | var RDGE = RDGE || {}; | 32 | var RDGE = RDGE || {}; |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * Creates a unique node id | 35 | * Creates a unique node id |
36 | */ | 36 | */ |
37 | RDGE.nodeIdGen = {}; | 37 | RDGE.nodeIdGen = {}; |
38 | 38 | ||
39 | RDGE.nodeIdGen.counter = 0; | 39 | RDGE.nodeIdGen.counter = 0; |
40 | 40 | ||
41 | RDGE.nodeIdGen.getId = function () { | 41 | RDGE.nodeIdGen.getId = function () { |
42 | return "gen_" + RDGE.nodeIdGen.counter++; | 42 | return "gen_" + RDGE.nodeIdGen.counter++; |
43 | }; | 43 | }; |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Constructs a new transform node | 46 | * Constructs a new transform node |
47 | */ | 47 | */ |
48 | RDGE.createTransformNode = function (nodeName) { | 48 | RDGE.createTransformNode = function (nodeName) { |
49 | node = { 'name': nodeName }; | 49 | node = { 'name': nodeName }; |
50 | 50 | ||
51 | node.transformNodeTemplate = new RDGE.transformNodeTemplate(node); | 51 | node.transformNodeTemplate = new RDGE.transformNodeTemplate(node); |
52 | 52 | ||
53 | return node; | 53 | return node; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * Constructs a new material node | 57 | * Constructs a new material node |
58 | */ | 58 | */ |
59 | RDGE.createMaterialNode = function (nodeName) { | 59 | RDGE.createMaterialNode = function (nodeName) { |
60 | node = { 'name': nodeName }; | 60 | node = { 'name': nodeName }; |
61 | 61 | ||
62 | node.materialNodeTemplate = new RDGE.materialNodeTemplate(node); | 62 | node.materialNodeTemplate = new RDGE.materialNodeTemplate(node); |
63 | 63 | ||
64 | return node; | 64 | return node; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | /* | 67 | /* |
68 | * Constructs a new mesh node | 68 | * Constructs a new mesh node |
69 | */ | 69 | */ |
70 | RDGE.createMeshNode = function (nodeName, primitive) { | 70 | RDGE.createMeshNode = function (nodeName, primitive) { |
71 | meshNode = { 'mesh':{}, 'meshNodeTemplate':{} }; | 71 | meshNode = { 'mesh':{}, 'meshNodeTemplate':{} }; |
72 | 72 | ||
73 | var renderer = RDGE.globals.engine.getContext().renderer; | 73 | var renderer = RDGE.globals.engine.getContext().renderer; |
74 | 74 | ||
75 | if (!primitive.built) { | 75 | if (!primitive.built) { |
76 | renderer.createPrimitive(primitive); | 76 | renderer.createPrimitive(primitive); |
77 | } | 77 | } |
78 | 78 | ||
79 | var model = RDGE.globals.meshMan.getModelByName(nodeName); | 79 | var model = RDGE.globals.meshMan.getModelByName(nodeName); |
80 | if (!model) { | 80 | if (!model) { |
81 | meshNode.mesh.meshNodeTemplate = new RDGE.meshNodeTemplate(meshNode.mesh, primitive, nodeName); | 81 | meshNode.mesh.meshNodeTemplate = new RDGE.meshNodeTemplate(meshNode.mesh, primitive, nodeName); |
82 | 82 | ||
83 | RDGE.globals.meshMan.modelMap[nodeName] = meshNode.mesh; | 83 | RDGE.globals.meshMan.modelMap[nodeName] = meshNode.mesh; |
84 | return meshNode; // --early out-- | 84 | return meshNode; // --early out-- |
85 | } | 85 | } |
86 | else if (!renderer.buffers[model.primitive.buffersID]) { | 86 | else if (!renderer.buffers[model.primitive.buffersID]) { |
87 | renderer.createPrimitive(model.primitive); | 87 | renderer.createPrimitive(model.primitive); |
88 | } | 88 | } |
89 | 89 | ||
90 | meshNode.mesh.meshNodeTemplate = new RDGE.meshNodeTemplate(meshNode.mesh, model.primitive, nodeName); | 90 | meshNode.mesh.meshNodeTemplate = new RDGE.meshNodeTemplate(meshNode.mesh, model.primitive, nodeName); |
91 | 91 | ||
92 | return meshNode; | 92 | return meshNode; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * Construct a light node | 96 | * Construct a light node |
97 | */ | 97 | */ |
98 | RDGE.createLightNode = function (nodeName) { | 98 | RDGE.createLightNode = function (nodeName) { |
99 | node = { 'name': nodeName }; | 99 | node = { 'name': nodeName }; |
100 | node.lightNodeTemplate = new RDGE.lightNodeTemplate(node); | 100 | node.lightNodeTemplate = new RDGE.lightNodeTemplate(node); |
101 | 101 | ||
102 | return node; | 102 | return node; |
103 | }; | 103 | }; |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * creates a specialized mesh node representing a screen aligned quad with identity transform | 106 | * creates a specialized mesh node representing a screen aligned quad with identity transform |
107 | */ | 107 | */ |
108 | RDGE.createScreenQuadNode = function () { | 108 | RDGE.createScreenQuadNode = function () { |
109 | var trNode = RDGE.createTransformNode(); | 109 | var trNode = RDGE.createTransformNode(); |
110 | trNode.attachMeshNode("screenQuad", RDGE.renderUtils.createScreenAlignedQuad()); | 110 | trNode.attachMeshNode("screenQuad", RDGE.renderUtils.createScreenAlignedQuad()); |
111 | return trNode; | 111 | return trNode; |
112 | }; | 112 | }; |
113 | 113 | ||
114 | RDGE.verifyTransformNode = function (node) { | 114 | RDGE.verifyTransformNode = function (node) { |
115 | if (node.transformNodeTemplate == undefined) { | 115 | if (node.transformNodeTemplate == undefined) { |
116 | node.transformNodeTemplate = new RDGE.transformNodeTemplate(node); | 116 | node.transformNodeTemplate = new RDGE.transformNodeTemplate(node); |
117 | } | 117 | } |
118< |