diff options
100 files changed, 2481 insertions, 682 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js new file mode 100644 index 00000000..655e52fa --- /dev/null +++ b/assets/canvas-runtime.js | |||
@@ -0,0 +1,1376 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No 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 | |||
7 | /////////////////////////////////////////////////////////////////////// | ||
8 | //Loading webGL/canvas data | ||
9 | function initWebGl (rootElement, directory) { | ||
10 | var cvsDataMngr, ninjaWebGlData = JSON.parse((document.querySelectorAll(['script[data-ninja-webgl]'])[0].innerHTML.replace('(', '')).replace(')', '')); | ||
11 | if (ninjaWebGlData && ninjaWebGlData.data) { | ||
12 | for (var n=0; ninjaWebGlData.data[n]; n++) { | ||
13 | ninjaWebGlData.data[n] = unescape(ninjaWebGlData.data[n]); | ||
14 | } | ||
15 | } | ||
16 | //Creating data manager | ||
17 | cvsDataMngr = new CanvasDataManager(); | ||
18 | //Loading data to canvas(es) | ||
19 | cvsDataMngr.loadGLData(rootElement, ninjaWebGlData.data, directory); | ||
20 | } | ||
21 | |||
22 | /////////////////////////////////////////////////////////////////////// | ||
23 | // Class ShapeRuntime | ||
24 | // Manages runtime shape display | ||
25 | /////////////////////////////////////////////////////////////////////// | ||
26 | function CanvasDataManager() | ||
27 | { | ||
28 | this.loadGLData = function(root, valueArray, assetPath ) | ||
29 | { | ||
30 | this._assetPath = assetPath.slice(); | ||
31 | |||
32 | var value = valueArray; | ||
33 | var nWorlds = value.length; | ||
34 | for (var i=0; i<nWorlds; i++) | ||
35 | { | ||
36 | var importStr = value[i]; | ||
37 | var startIndex = importStr.indexOf( "id: " ); | ||
38 | if (startIndex >= 0) | ||
39 | { | ||
40 | var endIndex = importStr.indexOf( "\n", startIndex ); | ||
41 | if (endIndex > 0) | ||
42 | { | ||
43 | var id = importStr.substring( startIndex+4, endIndex ); | ||
44 | var canvas = this.findCanvasWithID( id, root ); | ||
45 | if (canvas) | ||
46 | { | ||
47 | var rt = new GLRuntime( canvas, importStr, assetPath ); | ||