aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-03-11 11:29:56 -0700
committerJose Antonio Marquez2012-03-11 11:29:56 -0700
commit49e4c8695941f6bdd15893534ffb3ccce92c5396 (patch)
tree9e8327be823441717ad44684d0e3714c56116f39
parent9ab4b4306343ec2a20094c7626abb524b7720ce8 (diff)
parent242bddd5b64c4a5226daa2f4caa10bf63c56403a (diff)
downloadninja-49e4c8695941f6bdd15893534ffb3ccce92c5396.tar.gz
Merge branch 'refs/heads/FileIO-Integration' into FileIO
-rw-r--r--assets/CanvasDataManager.js83
-rw-r--r--assets/CanvasRuntime.js1362
-rw-r--r--assets/descriptor.json43
-rwxr-xr-xassets/rdge-compiled.js452
-rwxr-xr-xjs/document/html-document.js48
-rwxr-xr-xjs/helper-classes/RDGE/rdge-compiled.js64
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js15
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/fx/ssao.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/init_state.js12
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/jshader.js8
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/renderer.js1
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js2
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js4
-rw-r--r--js/helper-classes/RDGE/src/tools/rdge-compiled.js64
-rw-r--r--js/io/system/ninjalibrary.js10
-rwxr-xr-xjs/lib/drawing/world.js8
-rwxr-xr-xjs/lib/geom/circle.js5
-rwxr-xr-xjs/lib/geom/geom-obj.js42
-rwxr-xr-xjs/lib/geom/rectangle.js5
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js6
-rw-r--r--js/lib/rdge/materials/pulse-material.js8
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js6
-rw-r--r--js/lib/rdge/materials/taper-material.js2
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js46
-rw-r--r--js/lib/rdge/runtime/CanvasDataManager.js83
-rw-r--r--js/lib/rdge/runtime/GLRuntime.js357
-rw-r--r--js/lib/rdge/runtime/RuntimeGeomObj.js633
-rw-r--r--js/lib/rdge/runtime/RuntimeMaterial.js351
-rw-r--r--js/mediators/io-mediator.js38
29 files changed, 2119 insertions, 1641 deletions
diff --git a/assets/CanvasDataManager.js b/assets/CanvasDataManager.js
deleted file mode 100644
index 8afc9de0..00000000
--- a/assets/CanvasDataManager.js
+++ /dev/null
@@ -1,83 +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
7
8var GeomObj = require("js/lib/geom/geom-obj").GeomObj;
9var ShapePrimitive = require("js/lib/geom/shape-primitive").ShapePrimitive;
10var MaterialsModel = require("js/models/materials-model").MaterialsModel;
11var GLRuntime = require("js/lib/rdge/runtime/GLRuntime").GLRuntime;
12
13///////////////////////////////////////////////////////////////////////
14// Class ShapeRuntime
15// Manages runtime shape display
16///////////////////////////////////////////////////////////////////////
17var CanvasDataManager = function CanvasDataManager()
18{
19 this.loadGLData = function(root, valueArray )
20 {
21 var value = valueArray;
22 var nWorlds = value.length;
23 for (var i=0; i<nWorlds; i++)
24 {
25 var importStr = value[i];
26 var startIndex = importStr.indexOf( "id: " );
27 if (startIndex >= 0)
28 {
29 var endIndex = importStr.indexOf( "\n", startIndex );
30 if (endIndex > 0)
31 {
32 var id = importStr.substring( startIndex+4, endIndex );
33 var canvas = this.findCanvasWithID( id, root );
34 if (canvas)
35 {
36 var rt = new GLRuntime( canvas, importStr );
37 }
38 }
39 }
40 }
41 }
42
43 this.collectGLData = function( elt, dataArray )
44 {
45 if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld)
46 {
47 var data = elt.elementModel.shapeModel.GLWorld.export( true );
48 dataArray.push( data );
49 }
50
51 if (elt.children)
52 {
53 var nKids = elt.children.length;
54 for (var i=0; i<nKids; i++)
55 {
56 var child = elt.children[i];
57 this.collectGLData( child, dataArray );
58 }
59 }
60 }
61
62 this.findCanvasWithID = function( id, elt )
63 {
64 var cid = elt.getAttribute( "data-RDGE-id" );
65 if (cid == id) return elt;
66
67 if (elt.children)
68 {
69 var nKids = elt.children.length;
70 for (var i=0; i<nKids; i++)
71 {
72 var child = elt.children[i];
73 var foundElt = this.findCanvasWithID( id, child );
74 if (foundElt) return foundElt;
75 }
76 }
77 }
78}
79
80
81if (typeof exports === "object") {
82 exports.CanvasDataManager = CanvasDataManager;
83}
diff --git a/assets/CanvasRuntime.js b/assets/CanvasRuntime.js
new file mode 100644
index 00000000..5caf72ee
--- /dev/null
+++ b/assets/CanvasRuntime.js
@@ -0,0 +1,1362 @@
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
7
8///////////////////////////////////////////////////////////////////////
9// Class ShapeRuntime
10// Manages runtime shape display
11///////////////////////////////////////////////////////////////////////
12function CanvasDataManager()
13{
14 this.loadGLData = function(root, valueArray, assetPath )
15 {
16 this._assetPath = assetPath.slice();
17
18 var value = valueArray;
19 var nWorlds = value.length;
20 for (var i=0; i<nWorlds; i++)
21 {
22 var importStr = value[i];
23 var startIndex = importStr.indexOf( "id: " );
24 if (startIndex >= 0)
25 {
26 var endIndex = importStr.indexOf( "\n", startIndex );
27 if (endIndex > 0)
28 {
29 var id = importStr.substring( startIndex+4, endIndex );
30 var canvas = this.findCanvasWithID( id, root );
31 if (canvas)
32 {
33 var rt = new GLRuntime( canvas, importStr, assetPath );
34 }
35 }
36 }
37 }
38 }
39
40 this.collectGLData = function( elt, dataArray )
41 {
42 if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld)
43 {
44 var data = elt.elementModel.shapeModel.GLWorld.export( true );
45 dataArray.push( data );
46 }
47
48 if (elt.children)
49 {
50 var nKids = elt.children.length;
51 for (var i=0; i<nKids; i++)
52 {
53 var child = elt.children[i];
54 this.collectGLData( child, dataArray );
55 }
56 }
57 }
58
59 this.findCanvasWithID = function( id, elt )
60 {
61 var cid = elt.getAttribute( "data-RDGE-id" );
62 if (cid == id) return elt;
63
64 if (elt.children)
65 {
66 var nKids = elt.children.length;
67 for (var i=0; i<nKids; i++)
68 {
69 var child = elt.children[i];
70 var foundElt = this.findCanvasWithID( id, child );
71 if (foundElt) return foundElt;
72 }
73 }
74 }
75}
76
77///////////////////////////////////////////////////////////////////////
78// Class GLRuntime
79// Manages runtime fora WebGL canvas
80///////////////////////////////////////////////////////////////////////
81function GLRuntime( canvas, importStr, assetPath )
82{
83 ///////////////////////////////////////////////////////////////////////
84 // Instance variables
85 ///////////////////////////////////////////////////////////////////////
86 this._canvas = canvas;
87 this._context = null;
88 this._importStr = importStr;
89
90 this.renderer = null;
91 this.myScene = null;
92 this.light = null;
93 this.light2 = null;
94 this._rootNode = null;
95
96 this._firstRender = true;
97 this._initialized = false;
98
99 this._useWebGL = false;
100
101 // view parameters
102 this._fov = 45.0;
103 this._zNear = 0.1;
104 this._zFar = 100.0;
105 this._viewDist = 5.0;