diff options
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/jpass.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/jpass.js | 1346 |
1 files changed, 673 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 5fbbb708..7d7a5ab9 100755 --- a/js/helper-classes/RDGE/src/core/script/jpass.js +++ b/js/helper-classes/RDGE/src/core/script/jpass.js | |||
@@ -1,673 +1,673 @@ | |||
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 | 31 | ||
32 | // RDGE namespaces | 32 | // RDGE namespaces |
33 | var RDGE = RDGE || {}; | 33 | var RDGE = RDGE || {}; |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * jpass geometry set - determines the category(s) of geometry that a pass will render | 36 | * jpass geometry set - determines the category(s) of geometry that a pass will render |
37 | * can be OR'ed together | 37 | * can be OR'ed together |
38 | */ | 38 | */ |
39 | RDGE.jpassGeoSet = | 39 | RDGE.jpassGeoSet = |
40 | { | 40 | { |
41 | 'BACKGROUND': 1, | 41 | 'BACKGROUND': 1, |
42 | 'OPAQUE': 2, | 42 | 'OPAQUE': 2, |
43 | 'TRANSPARENT': 4, | 43 | 'TRANSPARENT': 4, |
44 | 'ADDITIVE': 8, | 44 | 'ADDITIVE': 8, |
45 | 'TRANSLUCENT': 16, | 45 | 'TRANSLUCENT': 16, |
46 | 'FOREGROUND': 32, | 46 | 'FOREGROUND': 32, |
47 | 'ALL': 127, | 47 | 'ALL': 127, |
48 | 'SCREEN_QUAD': 128, // a screen aligned quad - for rendering a texture to screen | 48 | 'SCREEN_QUAD': 128, // a screen aligned quad - for rendering a texture to screen |
49 | 'SHADOW': 256, // the opaque geometry from shadow light's point of view | 49 | 'SHADOW': 256, // the opaque geometry from shadow light's point of view |
50 | 'MAXSETS': 9 | 50 | 'MAXSETS': 9 |
51 | }; | 51 | }; |
52 | 52 | ||
53 | 53 | ||
54 | /* | 54 | /* |
55 | * The abstract base class that defines a jpass | 55 | * The abstract base class that defines a jpass |
56 | * a jpass represents a single render pass of the scene graph | 56 | * a jpass represents a single render pass of the scene graph |
57 | */ | 57 | */ |
58 | RDGE._jpassBaseClass = function () { | 58 | RDGE._jpassBaseClass = function () { |
59 | this.context = RDGE.globals.engine.getContext(); | 59 | this.context = RDGE.globals.engine.getContext(); |
60 | this.renderer = RDGE.globals.engine.getContext().renderer; | 60 | this.renderer = RDGE.globals.engine.getContext().renderer; |
61 | this.sortCats = RDGE.rdgeConstants.categoryEnumeration; | 61 | this.sortCats = RDGE.rdgeConstants.categoryEnumeration; |
62 | this.bucketCount = RDGE.rdgeConstants.categoryEnumeration.MAX_CAT; | 62 | this.bucketCount = RDGE.rdgeConstants.categoryEnumeration.MAX_CAT; |
63 | 63 | ||
64 | // render order | 64 | // render order |
65 | this.renderOrder = []; | 65 | this.renderOrder = []; |
66 | this.renderOrder[this.sortCats.BACKGROUND] = 0; | 66 | this.renderOrder[this.sortCats.BACKGROUND] = 0; |
67 | this.renderOrder[this.sortCats.OPAQUE] = 1; | 67 | this.renderOrder[this.sortCats.OPAQUE] = 1; |
68 | this.renderOrder[this.sortCats.TRANSPARENT] = 2; | 68 | this.renderOrder[this.sortCats.TRANSPARENT] = 2; |
69 | this.renderOrder[this.sortCats.ADDITIVE] = 3 | 69 | this.renderOrder[this.sortCats.ADDITIVE] = 3 |
70 | this.renderOrder[this.sortCats.TRANSLUCENT] = 4; | 70 | this.renderOrder[this.sortCats.TRANSLUCENT] = 4; |
71 | this.renderOrder[this.sortCats.FOREGROUND] = 5; | 71 | this.renderOrder[this.sortCats.FOREGROUND] = 5; |
72 | 72 | ||
73 | // the name of this pass | 73 | // the name of this pass |
74 | this.name = "renderPass_" + RDGE.nodeIdGen.getId(); | 74 | this.name = "renderPass_" + RDGE.nodeIdGen.getId(); |
75 | 75 | ||
76 | /* | 76 | /* |
77 | * if 0 this pass and children are culled from rendering | 77 | * if 0 this pass and children are culled from rendering |
78 | */ | 78 | */ |
79 | this.visibility = 1; | 79 | this.visibility = 1; |
80 | 80 | ||
81 | /* | 81 | /* |
82 | * called when the pass is hidden - override for customication | 82 | * called when the pass is hidden - override for customication |
83 | */ | 83 | */ |
84 | this.onHide = function () { | 84 | this.onHide = function () { |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* | 87 | /* |
88 | * Called by the system to hide the pass and its children | 88 | * Called by the system to hide the pass and its children |
89 | */ | 89 | */ |
90 | this.hidePass = function () { | 90 | this.hidePass = function () { |
91 | this.onHide(); | 91 | this.onHide(); |
92 | 92 | ||
93 | for (var i = 0, len = this.children.length; i < len; ++i) { | 93 | for (var i = 0, len = this.children.length; i < len; ++i) { |
94 | this.children[i].hidePass(); | 94 | this.children[i].hidePass(); |
95 | } | 95 | } |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* | 98 | /* |
99 | * the default output render targets that this pass will create | 99 | * the default output render targets that this pass will create |
100 | */ | 100 | */ |
101 | this.defaultTargetOut = {}; | 101 | this.defaultTargetOut = {}; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * All the outputs required by the pass | 104 | * All the outputs required by the pass |
105 | */ | 105 | */ |
106 | this.outputs = | 106 | this.outputs = |
107 | [ | 107 | [ |
108 | // example | 108 | // example |
109 | // {'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false} | 109 | // {'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false} |
110 | ]; | 110 | ]; |
111 | 111 | ||
112 | /* | 112 | /* |
113 | * notifies the the renderer that the viewport was modified and needs to be reset | 113 | * notifies the the renderer that the viewport was modified and needs to be reset |
114 | */ | 114 | */ |
115 | this.dirty = false; | 115 | this.dirty = false; |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * Index of the currently selected output target | 118 | * Index of the currently selected output target |
119 | */ | 119 | */ |
120 | this.outputIndex = 0; | 120 | this.outputIndex = 0; |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * outputs from the previous pass are set as inputs for this pass | 123 | * outputs from the previous pass are set as inputs for this pass |
124 | */ | 124 | */ |
125 | this.inputs = []; | 125 | this.inputs = []; |
126 | 126 | ||
127 | /* | 127 | /* |
128 | * other textures requested for this pass | 128 | * other textures requested for this pass |
129 | */ | 129 | */ |
130 | this.textures = []; | 130 | this.textures = []; |
131 | 131 | ||
132 | /* | 132 | /* |
133 | * the flags that control how the pass is rendered | 133 | * the flags that control how the pass is rendered |