diff options
author | Kris Kowal | 2012-07-06 12:34:53 -0700 |
---|---|---|
committer | Kris Kowal | 2012-07-06 15:01:48 -0700 |
commit | 3644cb6def4f681c99959e5729e78ea353441fad (patch) | |
tree | f8a886f4829e507cc4956db37cff2580cae6003d /js/helper-classes/RDGE/src/core/script/scenegraph.js | |
parent | 04343eda8c2f870b0da55cfdc8003c99fe1cc4de (diff) | |
download | ninja-3644cb6def4f681c99959e5729e78ea353441fad.tar.gz |
Normalize to unix line terminators
Diffstat (limited to 'js/helper-classes/RDGE/src/core/script/scenegraph.js')
-rwxr-xr-x | js/helper-classes/RDGE/src/core/script/scenegraph.js | 2006 |
1 files changed, 1003 insertions, 1003 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/scenegraph.js b/js/helper-classes/RDGE/src/core/script/scenegraph.js index 789f69e5..99f9f289 100755 --- a/js/helper-classes/RDGE/src/core/script/scenegraph.js +++ b/js/helper-classes/RDGE/src/core/script/scenegraph.js | |||
@@ -1,1003 +1,1003 @@ | |||
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 | // default render proc | 34 | // default render proc |
35 | // render scene nodes | 35 | // render scene nodes |
36 | RDGE.DefaultRender = function () { | 36 | RDGE.DefaultRender = function () { |
37 | // setup the default shader | 37 | // setup the default shader |
38 | this.renderer = RDGE.globals.engine.getContext().renderer; | 38 | this.renderer = RDGE.globals.engine.getContext().renderer; |
39 | //this.shaderProgram = this.renderer.defaultShader; | 39 | //this.shaderProgram = this.renderer.defaultShader; |
40 | this.jshaderProgram = new RDGE.jshader(); | 40 | this.jshaderProgram = new RDGE.jshader(); |
41 | this.jshaderProgram.def = this.renderer.defaultShaderDefintion; | 41 | this.jshaderProgram.def = this.renderer.defaultShaderDefintion; |
42 | this.jshaderProgram.init(); | 42 | this.jshaderProgram.init(); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | RDGE.DefaultRender.prototype.process = function (context, trNode, parent) { | 45 | RDGE.DefaultRender.prototype.process = function (context, trNode, parent) { |
46 | }; | 46 | }; |
47 | 47 | ||
48 | function renderObject(trNode, renderCtx, parent) { | 48 | function renderObject(trNode, renderCtx, parent) { |
49 | this.node = trNode ? trNode : RDGE.createTransformNode(); | 49 | this.node = trNode ? trNode : RDGE.createTransformNode(); |
50 | this.context = renderCtx ? renderCtx : new RDGE.RenderContext(); | 50 | this.context = renderCtx ? renderCtx : new RDGE.RenderContext(); |
51 | this.parent = parent ? parent : null; | 51 | this.parent = parent ? parent : null; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | 54 | ||
55 | // Scene graph contains set of tools for manipulating the graph | 55 | // Scene graph contains set of tools for manipulating the graph |
56 | RDGE.SceneGraph = function (scene) { | 56 | RDGE.SceneGraph = function (scene) { |
57 | if (scene == undefined || scene == null) | 57 | if (scene == undefined || scene == null) |
58 | scene = {}; | 58 | scene = {}; |
59 | 59 | ||
60 | this.scene = scene; | 60 | this.scene = scene; |
61 | 61 | ||
62 | if (this.scene.root != undefined) | 62 | if (this.scene.root != undefined) |
63 | this.scene = this.scene.root; | 63 | this.scene = this.scene.root; |
64 | else | 64 | else |
65 | this.scene = { 'children': [] }; | 65 | this.scene = { 'children': [] }; |
66 | 66 | ||
67 | this.tick = 0; | 67 | this.tick = 0; |
68 | this.lastTick = -1; | 68 | this.lastTick = -1; |
69 | this.frustumCulling = true; | 69 | this.frustumCulling = true; |
70 | 70 | ||
71 | // the main light for the scene - also casts shadows | 71 | // the main light for the scene - also casts shadows |
72 | this.mainLight = new RDGE.shadowLight(); | 72 | this.mainLight = new RDGE.shadowLight(); |
73 | 73 | ||
74 | this.bckTypes = RDGE.rdgeConstants.categoryEnumeration; | 74 | this.bckTypes = RDGE.rdgeConstants.categoryEnumeration; |
75 | 75 | ||
76 | this.renderList = new Array(this.bckTypes.MAX_CAT); | 76 | this.renderList = new Array(this.bckTypes.MAX_CAT); |
77 | this.renderList[this.bckTypes.BACKGROUND] = []; //BACKGROUND | 77 | this.renderList[this.bckTypes.BACKGROUND] = []; //BACKGROUND |
78 | this.renderList[this.bckTypes.OPAQUE] = []; //OPAQUE | 78 | this.renderList[this.bckTypes.OPAQUE] = []; //OPAQUE |
79 | this.renderList[this.bckTypes.TRANSPARENT] = []; //TRANSPARENT | 79 | this.renderList[this.bckTypes.TRANSPARENT] = []; //TRANSPARENT |
80 | this.renderList[this.bckTypes.ADDITIVE] = []; //ADDITIVE | 80 | this.renderList[this.bckTypes.ADDITIVE] = []; //ADDITIVE |
81 | this.renderList[this.bckTypes.TRANSLUCENT] = []; //TRANSLUCENT | 81 | this.renderList[this.bckTypes.TRANSLUCENT] = []; //TRANSLUCENT |
82 | this.renderList[this.bckTypes.FOREGROUND] = []; //FOREGROUND | 82 | this.renderList[this.bckTypes.FOREGROUND] = []; //FOREGROUND |
83 | 83 | ||
84 | // a list of shadow geometry | 84 | // a list of shadow geometry |
85 | this.shadowRenderList = []; | 85 | this.shadowRenderList = []; |
86 | 86 | ||
87 | // scene traversal functor for creating a culled list of shadow geometry | 87 | // scene traversal functor for creating a culled list of shadow geometry |
88 | this.shadowCuller = null; | 88 | this.shadowCuller = null; |
89 | 89 | ||
90 | // define passes to render geometry and handle post-processing | 90 | // define passes to render geometry and handle post-processing |
91 | this.defaultPassDef = | 91 | this.defaultPassDef = |
92 | { | 92 | { |
93 | // a pass can have children that will receive their parents output as input | 93 | // a pass can have children that will receive their parents output as input |
94 | 94 | ||
95 | // this pass renders the depth map to an off-screen target - from the shadow lights view | 95 | // this pass renders the depth map to an off-screen target - from the shadow lights view |
96 | // you can specify what your output should be | 96 | // you can specify what your output should be |
97 | // @param name - this tells jshader's of child passes (which receive the parents output as input) | 97 | // @param name - this tells jshader's of child passes (which receive the parents output as input) |
98 | // what the sampler2d uniform name will be for this output texture | 98 | // what the sampler2d uniform name will be for this output texture |
99 | // @param type - the type of output could be tex2d or target | 99 | // @param type - the type of output could be tex2d or target |
100 | // @param width - optional width of the render target | 100 | // @param width - optional width of the render target |
101 | // @param height - optional height of the render target | 101 | // @param height - optional height of the render target |
102 | // @param mips - optional flag indicating whether the render target will support mip-mapping | 102 | // @param mips - optional flag indicating whether the render target will support mip-mapping |
103 | 103 | ||
104 | // the geometry pass | 104 | // the geometry pass |
105 | 'name': "geoPass", | 105 | 'name': "geoPass", |
106 | 'geometrySet': "ALL" | 106 | 'geometrySet': "ALL" |
107 | // 'outputs':[{ 'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false }], | 107 | // 'outputs':[{ 'name':"u_mainRT", 'type':"target", 'width':1024, 'height':1024, 'mips':false }], |
108 | // 'children': | 108 | // 'children': |
109 | // [ | 109 | // [ |
110 | // // shadow pass | 110 | // // shadow pass |
111 | // { | 111 | // { |
112 | // 'outputs':[{ 'name':"u_shadowDepthMap", 'type':"target", 'width':1024, 'height':1024, 'mips':false }], | 112 | // 'outputs':[{ 'name':"u_shadowDepthMap", 'type':"target", 'width':1024, 'height':1024, 'mips':false }], |
113 | // // custom parameter | 113 | // // custom parameter |
114 | // 'name':"shadowDepthMap", | 114 | // 'name':"shadowDepthMap", |
115 | // 'shader': RDGE.rdgeDepthMapShaderDef, | 115 | // 'shader': RDGE.rdgeDepthMapShaderDef, |
116 | // 'technique':"shadowDepthMap", | 116 | // 'technique':"shadowDepthMap", |
117 | // 'geometrySet':"SHADOW", | 117 | // 'geometrySet':"SHADOW", |
118 | // 'children': | 118 | // 'children': |
119 | // [ | 119 | // [ |
120 | // // create shadow rt |