aboutsummaryrefslogtreecommitdiff
path: root/js/preloader/Preloader.js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-15 06:31:31 -0700
committerJose Antonio Marquez2012-03-15 06:31:31 -0700
commitfe41b6702d09b2c103a35fbabf88948a4a00cfe8 (patch)
tree0262df3785972bf24566ca6e50ec914165f3fc87 /js/preloader/Preloader.js
parentd244f628723399422bb7068bda528bcc0e14c53c (diff)
parente6bfd7fb3d3324bea5dbc05350832a9e25c6c00d (diff)
downloadninja-fe41b6702d09b2c103a35fbabf88948a4a00cfe8.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into FileIO-Build-Candidate
Diffstat (limited to 'js/preloader/Preloader.js')
-rwxr-xr-xjs/preloader/Preloader.js302
1 files changed, 0 insertions, 302 deletions
diff --git a/js/preloader/Preloader.js b/js/preloader/Preloader.js
deleted file mode 100755
index feda2569..00000000
--- a/js/preloader/Preloader.js
+++ /dev/null
@@ -1,302 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component,
9 defaultEventManager = require("montage/core/event/event-manager").defaultEventManager;
10
11var codeMirrorPath = "imports/codemirror";
12
13exports.Preloader = Montage.create(Component, {
14
15 ninjaJsRequire: {
16 value:
17 [
18// {"type":"js", "url":"js/helper-classes/3D/GLMatrix/gl-matrix.js"},
19// {"type":"js", "url":"js/helper-classes/RDGE/rdge-compiled.js"},
20// {"type":"js", "url":"js/helper-classes/3D/ParseUtils.js"}
21
22// {"type":"js", "url":"js/helper-classes/RDGE/runtime/CanvasDataManager.js"},
23// {"type":"js", "url":"js/helper-classes/RDGE/runtime/GLRuntime.js"},
24
25 // source RDGE
26 /*
27 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/math/vec2.js"},
28 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/math/vec3.js"},
29 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/math/vec4.js"},
30 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/math/mat4.js"},
31 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/math/quat.js"},
32 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/util/statTracker.js"},
33 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/util/fpsTracker.js"},
34 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/objectManager.js"},
35 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/precompiled.js"},
36 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/renderer.js"},
37 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/renderUtils.js"},
38 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/jshader.js"},
39 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/jpass.js"},
40 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/RenderProcs.js"},
41 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/RenderInitProcs.js"},
42 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/MeshManager.js"},
43 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/TextureManager.js"},
44 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/ShaderManager.js"},
45 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/fx/blur.js"},
46 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/fx/ssao.js"},
47 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/ScreenQuad.js"},
48 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/box.js"},
49 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/camera.js"},
50 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/shadowLight.js"},
51 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/utilities.js"},
52 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/input.js"},
53 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/engine.js"},
54 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/scenegraphNodes.js"},
55 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/scenegraph.js"},
56 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/lightmanager.js"},
57 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/rendercontext.js"},
58 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/animation.js"},
59 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/particle.js"},
60 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/run_state.js"},
61 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/init_state.js"},
62 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/runtime.js"},
63 {"type":"js", "url":"js/helper-classes/RDGE/src/core/script/util/dbgpanel.js"},
64 */
65
66
67 {"type":"js", "url":"js/helper-classes/RDGE/runtime/RuntimeGeomObj.js"},
68 {"type":"js", "url":"js/helper-classes/RDGE/runtime/RuntimeMaterial.js"},
69
70
71
72// {"type":"js", "url":"js/helper-classes/RDGE/GLMaterial.js"},
73// {"type":"js", "url":"js/helper-classes/RDGE/Materials/FlatMaterial.js"},
74// {"type":"js", "url":"js/helper-classes/RDGE/Materials/TaperMaterial.js"},
75// {"type":"js", "url":"js/helper-classes/RDGE/Materials/TwistVertMaterial.js"},
76// {"type":"js", "url":"js/helper-classes/RDGE/Materials/UberMaterial.js"},
77// {"type":"js", "url":"js/helper-classes/RDGE/Materials/PlasmaMaterial.js"},
78// {"type":"js", "url":"js/helper-classes/RDGE/Materials/LinearGradientMaterial.js"},
79// {"type":"js", "url":"js/helper-classes/RDGE/Materials/RadialGradientMaterial.js"},
80// {"type":"js", "url":"js/helper-classes/RDGE/Materials/RadialBlurMaterial.js"},
81// {"type":"js", "url":"js/helper-classes/RDGE/Materials/PulseMaterial.js"},
82// {"type":"js", "url":"js/helper-classes/RDGE/Materials/TunnelMaterial.js"},
83// {"type":"js", "url":"js/helper-classes/RDGE/Materials/ReliefTunnelMaterial.js"},
84// {"type":"js", "url":"js/helper-classes/RDGE/Materials/SquareTunnelMaterial.js"},
85// {"type":"js", "url":"js/helper-classes/RDGE/Materials/FlyMaterial.js"},
86// {"type":"js", "url":"js/helper-classes/RDGE/Materials/WaterMaterial.js"},
87// {"type":"js", "url":"js/helper-classes/RDGE/Materials/ZInvertMaterial.js"},
88// {"type":"js", "url":"js/helper-classes/RDGE/Materials/DeformMaterial.js"},
89// {"type":"js", "url":"js/helper-classes/RDGE/Materials/StarMaterial.js"},
90// {"type":"js", "url":"js/helper-classes/RDGE/Materials/TwistMaterial.js"},
91// {"type":"js", "url":"js/helper-classes/RDGE/Materials/KeleidoscopeMaterial.js"},
92// {"type":"js", "url":"js/helper-classes/RDGE/Materials/JuliaMaterial.js"},
93// {"type":"js", "url":"js/helper-classes/RDGE/Materials/MandelMaterial.js"},
94// {"type":"js", "url":"js/helper-classes/RDGE/Materials/BumpMetalMaterial.js"},
95// {"type":"js", "url":"js/helper-classes/RDGE/MaterialsLibrary.js"},
96// {"type":"js", "url":"js/helper-classes/3D/glUtils.js"},
97// {"type":"js", "url":"js/helper-classes/RDGE/GLWorld.js"},
98// {"type":"js", "url":"js/helper-classes/RDGE/GLGeomObj.js"},
99// {"type":"js", "url":"js/helper-classes/RDGE/GLLine.js"},
100// {"type":"js", "url":"js/helper-classes/RDGE/GLCircle.js"},
101// {"type":"js", "url":"js/helper-classes/RDGE/GLRectangle.js"},
102// {"type":"js", "url":"js/helper-classes/RDGE/GLPath.js"}, // Not USED
103// {"type":"js", "url":"js/helper-classes/RDGE/GLLight.js"}, Not used anywhere.
104// {"type":"js", "url": "js/helper-classes/RDGE/GLAnchorPoint.js" },
105// {"type":"js", "url": "js/helper-classes/RDGE/GLSubpath.js" },
106// {"type":"js", "url": "js/helper-classes/RDGE/GLBrushStroke.js" },
107
108// {"type":"js", "url":"js/helper-classes/RDGE/precompiled.js"}, // Why are why adding an empty file?
109
110// {"type":"js", "url": codeMirrorPath + "/lib/codemirror.js"},
111// {"type":"js", "url": codeMirrorPath + "/mode/htmlmixed/htmlmixed.js"},
112// {"type":"js", "url": codeMirrorPath + "/mode/xml/xml.js"},
113// {"type":"js", "url": codeMirrorPath + "/mode/javascript/javascript.js"},
114// {"type":"js", "url": codeMirrorPath + "/mode/css/css.js"}
115 ]
116 },
117
118 ninjaCssRequire: {
119 value:
120 [
121// {"type":"css", "url": codeMirrorPath + "/lib/codemirror.css"}
122 ]
123 },
124
125 filesTotal: {
126 value: 0
127 },
128
129 filesLoaded: {
130 value: 0
131 },
132
133 executionHash: {
134 value: {}
135 },
136
137 lastExecutedJsIndex: {
138 value: -1
139 },
140
141 lastExecutedCssIndex: {
142 value: -1
143 },
144
145 executionInProgress: {
146 value: false
147 },
148
149 worker: {
150 value: null
151 },
152
153 deserializedFromTemplate: {
154 value: function() {
155
156 this.filesTotal = this.ninjaJsRequire.length + this.ninjaCssRequire.length;
157
158 this.loadFilesWithWorker();
159 //this.loadFilesWithWorker(this.jsFiles, this.cssFiles.reverse(), this.publishLoadingStatus);
160 }
161 },
162
163 loadFilesWithWorker: {
164 value: function() {
165 this.worker = new Worker('js/preloader/PreloaderWorker.js');
166 this.worker.addEventListener("message", this, false);
167 this.worker.addEventListener("error", this, false);
168 var filesExecuted = 0;
169
170 var baseUrl = location.href;
171 if(baseUrl.charAt(baseUrl.length-1) !== "/"){
172 baseUrl = baseUrl.substring(0, (baseUrl.lastIndexOf("/")+1));
173 }
174
175// console.log("baseUrl="+baseUrl);
176 //prepare the json command
177 var startJson = {"command":"start", "jsFiles":this.ninjaJsRequire, "cssFiles":this.ninjaCssRequire.reverse(), "baseUrl":baseUrl};//will load ninjaInitJsDependencies and ninjaInitCssDependencies
178 //start the worker thread
179 this.worker.postMessage(startJson);
180 }
181 },
182
183 handleEvent: {
184 value: function(e) {
185 e.type === "message"? this.workerOnMessage(e) : this.workerOnError(e);
186 }
187 },
188
189 workerOnMessage: {
190 value: function(e) {
191 var msgJson;
192 msgJson = e.data;
193
194 switch(msgJson.command){
195 case "newFile":
196 //console.log("**worker downloaded file: "+msgJson.url);
197 this.executionHash[""+msgJson.fileType+msgJson.fileIndex]={"url":msgJson.url, "fileContent":msgJson.fileContent};
198 this.triggerExecution(msgJson.fileIndex, msgJson.fileType);
199 break;
200 case "log":
201 console.log(""+ msgJson.logMsg);
202 break;
203 case "stop":
204 this.worker.terminate();
205 break;
206 default:
207 break;
208 }
209
210 }
211 },
212
213 workerOnError: {
214 value: function(e) {
215 console.log("error from worker: "+ e.message);
216 this.worker.terminate();
217 }
218 },
219
220 triggerExecution: {
221 val