aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
authorKruti Shah2012-07-17 12:40:00 -0700
committerKruti Shah2012-07-17 12:40:00 -0700
commitbf2d7bdb22c28089dc1067bc9094ebc590daac87 (patch)
tree2156d9920ea1b7db49ed6460545fea7cda121bae /js/helper-classes/RDGE
parent7e2c2dbd040ed79a3f0678f91bd4b6db9cf69231 (diff)
parentb4b3e45d6684e77d361b4f8ca5be4889428320c5 (diff)
downloadninja-bf2d7bdb22c28089dc1067bc9094ebc590daac87.tar.gz
Merge branch 'refs/heads/TimelineUberJD' into Timeline-local-kruti
Diffstat (limited to 'js/helper-classes/RDGE')
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/MeshManager.js495
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/RenderInitProcs.js519
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/RenderProcs.js1023
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/ScreenQuad.js107
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/ShaderManager.js221
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/animation.js691
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/box.js325
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/camera.js551
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js923
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/fx/blur.js435
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/fx/ssao.js279
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/init_state.js593
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jpass.js1347
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jshader.js1529
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/lightmanager.js239
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/mat4.js1539
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/quat.js501
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec2.js433
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec3.js749
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/math/vec4.js567
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/objectManager.js197
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/particle.js1595
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/precompiled.js197
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderUtils.js793
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/rendercontext.js579
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js3371
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/run_state.js753
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/runtime.js447
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraph.js2007
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js1141
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/shadowLight.js153
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/sockets.js363
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js531
33 files changed, 12613 insertions, 12580 deletions
diff --git a/js/helper-classes/RDGE/src/core/script/MeshManager.js b/js/helper-classes/RDGE/src/core/script/MeshManager.js
index 768b7213..4ff95cc4 100755
--- a/js/helper-classes/RDGE/src/core/script/MeshManager.js
+++ b/js/helper-classes/RDGE/src/core/script/MeshManager.js
@@ -1,247 +1,248 @@
1/* <copyright> 1/* <copyright>
2Copyright (c) 2012, Motorola Mobility, Inc 2Copyright (c) 2012, Motorola Mobility LLC.
3All Rights Reserved. 3All Rights Reserved.
4BSD License. 4
5 5Redistribution and use in source and binary forms, with or without
6Redistribution and use in source and binary forms, with or without 6modification, are permitted provided that the following conditions are met:
7modification, 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.
18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18
19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 21IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28POSSIBILITY OF SUCH DAMAGE. 28ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29</copyright> */ 29POSSIBILITY OF SUCH DAMAGE.
30 30</copyright> */
31// RDGE namespaces 31
32var RDGE = RDGE || {}; 32// RDGE namespaces
33 33var RDGE = RDGE || {};
34RDGE.Model = function (name, mesh) { 34
35 this.name = name; 35RDGE.Model = function (name, mesh) {
36 this.mesh = mesh; 36 this.name = name;
37 this.camera = null; 37 this.mesh = mesh;
38}; 38 this.camera = null;
39 39};
40/* 40
41 * Maintains a list of meshes to allow instancing of data 41/*
42 */ 42 * Maintains a list of meshes to allow instancing of data
43RDGE.MeshManager = function () { 43 */
44 this.contentUrl = "assets_web/mesh/"; 44RDGE.MeshManager = function () {
45 this.modelMap = {}; 45 this.contentUrl = "assets_web/mesh/";
46 this.readyList = []; // meshes that have data ready 46 this.modelMap = {};
47 this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading 47 this.readyList = []; // meshes that have data ready
48 this.postMeshLoadCallbackList = []; 48 this.meshesLoading = true; // indicates that no meshes have loaded or that they are still loading
49 this.tempSphere = null; 49 this.postMeshLoadCallbackList = [];
50 this.requestCounter = 0; 50 this.tempSphere = null;
51}; 51 this.requestCounter = 0;
52 52};
53/* 53
54 * Pass the scene meshNode stump, loads temp object while real mesh is downloading 54/*
55 */ 55 * Pass the scene meshNode stump, loads temp object while real mesh is downloading
56RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) { 56 */
57 // if it exists already, return the mesh requested 57RDGE.MeshManager.prototype.loadMesh = function (meshStump, tempMesh) {
58 if ( this.modelMap[meshStump.name] !== undefined ) 58 // if it exists already, return the mesh requested
59 return this.modelMap[meshStump.name]; 59 if ( this.modelMap[meshStump.name] !== undefined )
60 60 return this.modelMap[meshStump.name];
61 meshStump.ready = false; 61
62 meshStump.addr = this.contentUrl + meshStump.name + "_mesh.json"; 62 meshStump.ready = false;
63 meshStump.ctxID = RDGE.globals.engine.getContext().renderer.id; 63 meshStump.addr = this.contentUrl + meshStump.name + "_mesh.json";
64 64 meshStump.ctxID = RDGE.globals.engine.getContext().renderer.id;
65 // sets a temp mesh up in place of the final mesh to load 65
66 if (!tempMesh) { 66 // sets a temp mesh up in place of the final mesh to load
67 if (this.tempSphere == null) { 67 if (!tempMesh) {
68 this.tempSphere = RDGE.renderUtils.makeSphere(RDGE.globals.engine.getContext().renderer.ctx, 25, 5, 5); 68 if (this.tempSphere == null) {
69 } 69 this.tempSphere = RDGE.renderUtils.makeSphere(RDGE.globals.engine.getContext().renderer.ctx, 25, 5, 5);
70 70 }
71 tempMesh = this.tempSphere; 71
72 } 72 tempMesh = this.tempSphere;
73 73 }
74 // add the temp mesh to the map of loaded meshes 74
75 this.modelMap[meshStump.name] = tempMesh; 75 // add the temp mesh to the map of loaded meshes
76 76 this.modelMap[meshStump.name] = tempMesh;
77 // update the request counter - we now have one more mesh to load 77
78 this.requestCounter++; 78 // update the request counter - we now have one more mesh to load
79 79 this.requestCounter++;
80 RDGE.requestMesh(meshStump); 80
81 81 RDGE.requestMesh(meshStump);
82 return null; 82
83}; 83 return null;
84 84};
85/* 85
86 * Deletes the passed mesh from the manager as well as all renderers 86/*
87 */ 87 * Deletes the passed mesh from the manager as well as all renderers
88RDGE.MeshManager.prototype.deleteMesh = function (name) { 88 */
89 var model = this.modelMap[name]; 89RDGE.MeshManager.prototype.deleteMesh = function (name) {
90 90 var model = this.modelMap[name];
91 if (model) { 91
92 RDGE.globals.engine.ctxMan.forEach(function (context) { 92 if (model) {
93 context.renderer.deletePrimitive(model.primitive); 93 RDGE.globals.engine.ctxMan.forEach(function (context) {
94 }); 94 context.renderer.deletePrimitive(model.primitive);
95 95 });