diff options
author | John Mayhew | 2012-07-09 17:28:24 -0700 |
---|---|---|
committer | John Mayhew | 2012-07-09 17:28:24 -0700 |
commit | 770bcb52422742ff741a88a75ecefbeb90bc9247 (patch) | |
tree | 64cb3e09a8daeb340261dd7f3869c73f7b90b643 /js/helper-classes/RDGE/src/core/script/jpass.js | |
parent | 8c5ecaf90062f9e030386f338bdc19fd62b826c8 (diff) | |
parent | 2b2b5fbb4b6a786daa4e9d4ee9eba9ac78924842 (diff) | |
download | ninja-770bcb52422742ff741a88a75ecefbeb90bc9247.tar.gz |
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal
Conflicts:
manifest.json
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/jpass.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/jpass.js | 1347 |
1 files changed, 674 insertions, 673 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/jpass.js b/js/helper-classes/RDGE/src/core/script/jpass.js index e3c5a342..9cc8c28a 100755 --- a/js/helper-classes/RDGE/src/core/script/jpass.js +++ b/js/helper-classes/RDGE/src/core/script/jpass.js | |||
@@ -1,673 +1,674 @@ | |||
1 | /* <copyright> | 1 | /* <copyright> |
2 | Copyright (c) 2012, Motorola Mobility, Inc | 2 | Copyright (c) 2012, Motorola Mobility LLC. |
3 | All Rights Reserved. | 3 | All Rights Reserved. |
4 | BSD License. | 4 | |
5 | 5 | Redistribution and use in source and binary forms, with or without | |
6 | Redistribution and use in source and binary forms, with or without | 6 | modification, are permitted provided that the following conditions are met: |
7 | modification, are permitted provided that the following conditions are met: | 7 | |
8 | 8 | * Redistributions of source code must retain the above copyright notice, | |
9 | - Redistributions of source code must retain the above copyright notice, | 9 | this list of conditions and the following disclaimer. |
10 | this list of conditions and the following disclaimer. | 10 | |
11 | - Redistributions in binary form must reproduce the above copyright | 11 | * Redistributions in binary form must reproduce the above copyright notice, |
12 | notice, this list of conditions and the following disclaimer in the | 12 | this list of conditions and the following disclaimer in the documentation |
13 | documentation and/or other materials provided with the distribution. | 13 | and/or other materials provided with the distribution. |
14 | - Neither the name of Motorola Mobility nor the names of its contributors | 14 | |
15 | may be used to endorse or promote products derived from this software | 15 | * Neither the name of Motorola Mobility LLC nor the names of its |
16 | without specific prior written permission. | 16 | contributors may be used to endorse or promote products derived from this |
17 | 17 | software without specific prior written permission. | |
18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | 18 | |
19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
21 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
22 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
23 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | POSSIBILITY OF SUCH DAMAGE. | 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | </copyright> */ | 29 | POSSIBILITY OF SUCH DAMAGE. |
30 | 30 | </copyright> */ | |
31 | 31 | ||
32 | // RDGE namespaces | 32 | |
33 | var RDGE = RDGE || {}; | 33 | // RDGE namespaces |
34 | 34 | var RDGE = RDGE || {}; | |
35 | /* | 35 | |
36 | * jpass geometry set - determines the category(s) of geometry that a pass will render | 36 | /* |
37 | * can be OR'ed together | 37 | * jpass geometry set - determines the category(s) of geometry that a pass will render |
38 | */ | 38 | * can be OR'ed together |
39 | RDGE.jpassGeoSet = | 39 | */ |
40 | { | 40 | RDGE.jpassGeoSet = |
41 | 'BACKGROUND': 1, | 41 | { |
42 | 'OPAQUE': 2, | 42 | 'BACKGROUND': 1, |
43 | 'TRANSPARENT': 4, | 43 | 'OPAQUE': 2, |
44 | 'ADDITIVE': 8, | 44 | 'TRANSPARENT': 4, |
45 | 'TRANSLUCENT': 16, | 45 | 'ADDITIVE': 8, |
46 | 'FOREGROUND': 32, | 46 | 'TRANSLUCENT': 16, |
47 | 'ALL': 127, | 47 | 'FOREGROUND': 32, |
48 | 'SCREEN_QUAD': 128, // a screen aligned quad - for rendering a texture to screen | 48 | 'ALL': 127, |
49 | 'SHADOW': 256, // the opaque geometry from shadow light's point of view | 49 | 'SCREEN_QUAD': 128, // a screen aligned quad - for rendering a texture to screen |
50 | 'MAXSETS': 9 | 50 | 'SHADOW': 256, // the opaque geometry from shadow light's point of view |
51 | }; | 51 | 'MAXSETS': 9 |
52 | 52 | }; | |
53 | 53 | ||
54 | /* | 54 | |
55 | * The abstract base class that defines a jpass | 55 | /* |
56 | * a jpass represents a single render pass of the scene graph | 56 | * The abstract base class that defines a jpass |
57 | */ | 57 | * a jpass represents a single render pass of the scene graph |
58 | RDGE._jpassBaseClass = function () { | 58 | */ |
59 | this.context = RDGE.globals.engine.getContext(); | 59 | RDGE._jpassBaseClass = function () { |
60 | this.renderer = RDGE.globals.engine.getContext().renderer; | 60 | this.context = RDGE.globals.engine.getContext(); |
61 | this.sortCats = RDGE.rdgeConstants.categoryEnumeration; | 61 | this.renderer = RDGE.globals.engine.getContext().renderer; |
62 | this.bucketCount = RDGE.rdgeConstants.categoryEnumeration.MAX_CAT; | 62 | this.sortCats = RDGE.rdgeConstants.categoryEnumeration; |
63 | 63 | this.bucketCount = RDGE.rdgeConstants.categoryEnumeration.MAX_CAT; | |
64 | // render order | 64 | |
65 | this.renderOrder = []; | 65 | // render order |
66 | this.renderOrder[this.sortCats.BACKGROUND] = 0; | 66 | this.renderOrder = []; |
67 | this.renderOrder[this.sortCats.OPAQUE] = 1; | 67 | this.renderOrder[this.sortCats.BACKGROUND] = 0; |
68 | this.renderOrder[this.sortCats.TRANSPARENT] = 2; | 68 | this.renderOrder[this.sortCats.OPAQUE] = 1; |
69 | this.renderOrder[this.sortCats.ADDITIVE] = 3 | 69 | this.renderOrder[this.sortCats.TRANSPARENT] = 2; |
70 | this.renderOrder[this.sortCats.TRANSLUCENT] = 4; | 70 | this.renderOrder[this.sortCats.ADDITIVE] = 3 |
71 | this.renderOrder[this.sortCats.FOREGROUND] = 5; | 71 | this.renderOrder[this.sortCats.TRANSLUCENT] = 4; |
72 | 72 | this.renderOrder[this.sortCats.FOREGROUND] = 5; | |
73 | // the name of this pass | 73 | |
74 | this.name = "renderPass_" + RDGE.nodeIdGen.getId(); | 74 | // the name of this pass |
75 | 75 | this.name = "renderPass_" + RDGE.nodeIdGen.getId(); | |
76 | /* | 76 | |
77 | * if 0 this pass and children are culled from rendering | 77 | /* |
78 | */ | 78 | * if 0 this pass and children are culled from rendering |
79 | this.visibility = 1; | 79 | */ |
80 | 80 | this.visibility = 1; | |
81 | /* | 81 | |
82 | * called when the pass is hidden - override for customication | 82 | /* |
83 | */ | 83 | * called when the pass is hidden - override for customication |
84 | this.onHide = function () { | 84 | */ |
85 | }; | 85 | this.onHide = function () { |
86 | 86 | }; | |
87 | /* | 87 | |
88 | * Called by the system to hide the pass and its children | 88 | /* |
89 | */ | 89 | * Called by the system to hide the pass and its children |
90 | this.hidePass = function () { | 90 | */ |
91 | this.onHide(); | 91 | this.hidePass = function () { |
92 | 92 | this.onHide(); | |
93 | for (var i = 0, len = this.children.length; i < len; ++i) { | 93 | |
94 | this.children[i].hidePass(); | 94 | for (var i = 0, len = this.children.length; i < len; ++i) { |
95 | } | 95 | this.children[i].hidePass(); |
96 | }; | 96 | } |
97 | 97 | }; | |
98 | /* | 98 | |
99 | * the default output render targets that this pass will create | 99 | /* |
100 | */ | 100 | * the default output render targets that this pass will create |
101 | this.defaultTargetOut = {}; | 101 | */ |
102 | 102 | this.defaultTargetOut = {}; | |
103 | /* | 103 | |
104 | * All the outputs required by the pass | 104 | /* |
105 | */ | 105 | * All the outputs required by the pass |
106 | this.outputs = | 106 | */ |
107 | [ | 107 | this.outputs = |
108 | // example | 108 | [ |
109 | // {'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false} | 109 | // example |
110 | ]; | 110 | // {'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false} |
111 | 111 | ]; | |
112 | /* | 112 | |
113 | * notifies the the renderer that the viewport was modified and needs to be reset | 113 | /* |
114 | */ | 114 | * notifies the the renderer that the viewport was modified and needs to be reset |
115 | this.dirty = false; | 115 | */ |
116 | 116 | this.dirty = false; | |
117 | /* | 117 | |
118 | * Index of the currently selected output target | 118 | /* |
119 | */ | 119 | * Index of the currently selected output target |
120 | this.outputIndex = 0; | 120 | */ |
121 | 121 | this.outputIndex = 0; | |
122 | /* | 122 | |
123 | * outputs from the previous pass are set as inputs for this pass | 123 | /* |
124 | */ | 124 | * outputs from the previous pass are set as inputs for this pass |
125 | this.inputs = []; | 125 | */ |
126 | 126 | this.inputs = []; | |
127 | /* | 127 | |
128 | * other textures requested for this pass | 128 | /* |
129 | */ | 129 | * other textures requested for this pass |
130 | this.textures = []; | 130 | */ |
131 | 131 | this.textures = []; | |
132 | /* | 132 | |
133 | * the flags that control how the pass is rendered | 133 | /* |
134 | */ | 134 | * the flags that control how the pass is rendered |
135 | this.frustum_culling = "enable"; // disable/enable frustum culling during the pass | 135 | */ |
136 | this.clear = null; // flags to clear the output target with before rendering | 136 |