aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE
diff options
context:
space:
mode:
authorJohn Mayhew2012-04-02 16:28:39 -0700
committerJohn Mayhew2012-04-02 16:28:39 -0700
commitb4155fb4c33675a8a7cd37473513718043fdf0ba (patch)
tree3d8c802473f2395d53d599ec9d8b70b60a4db50c /js/helper-classes/RDGE
parent5ba9aeac94c86049423fd5d4b37b277263939c13 (diff)
parentc6de22bf42be90b403491b5f87b1818d9020310c (diff)
downloadninja-b4155fb4c33675a8a7cd37473513718043fdf0ba.tar.gz
Merge branch 'master' of github.com:Motorola-Mobility/ninja-internal into WorkingBranch
Conflicts: js/helper-classes/RDGE/rdge-compiled.js js/helper-classes/RDGE/runtime/GLRuntime.js js/helper-classes/RDGE/src/core/script/MeshManager.js js/helper-classes/RDGE/src/core/script/engine.js js/helper-classes/RDGE/src/core/script/fx/ssao.js js/helper-classes/RDGE/src/core/script/init_state.js js/helper-classes/RDGE/src/core/script/run_state.js js/helper-classes/RDGE/src/core/script/scenegraphNodes.js js/helper-classes/RDGE/src/core/script/utilities.js js/helper-classes/RDGE/src/tools/compile-rdge-core.bat js/helper-classes/RDGE/src/tools/compile-rdge-core.sh js/helper-classes/RDGE/src/tools/rdge-compiled.js js/lib/drawing/world.js js/lib/rdge/materials/bump-metal-material.js js/lib/rdge/materials/deform-material.js js/lib/rdge/materials/flat-material.js js/lib/rdge/materials/fly-material.js js/lib/rdge/materials/julia-material.js js/lib/rdge/materials/keleidoscope-material.js js/lib/rdge/materials/linear-gradient-material.js js/lib/rdge/materials/mandel-material.js js/lib/rdge/materials/plasma-material.js js/lib/rdge/materials/pulse-material.js js/lib/rdge/materials/radial-blur-material.js js/lib/rdge/materials/radial-gradient-material.js js/lib/rdge/materials/relief-tunnel-material.js js/lib/rdge/materials/square-tunnel-material.js js/lib/rdge/materials/star-material.js js/lib/rdge/materials/taper-material.js js/lib/rdge/materials/tunnel-material.js js/lib/rdge/materials/twist-material.js js/lib/rdge/materials/twist-vert-material.js js/lib/rdge/materials/uber-material.js js/lib/rdge/materials/water-material.js js/lib/rdge/materials/z-invert-material.js js/preloader/Preloader.js
Diffstat (limited to 'js/helper-classes/RDGE')
-rw-r--r--js/helper-classes/RDGE/runtime/CanvasDataManager.js98
-rw-r--r--js/helper-classes/RDGE/runtime/GLRuntime.js159
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/MeshManager.js116
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/engine.js290
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/fx/ssao.js90
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/init_state.js298
-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/run_state.js416
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/scenegraphNodes.js543
-rwxr-xr-xjs/helper-classes/RDGE/src/core/script/utilities.js152
-rw-r--r--js/helper-classes/RDGE/src/tools/compile-rdge-core.bat4
-rw-r--r--js/helper-classes/RDGE/src/tools/compile-rdge-core.sh3
-rw-r--r--js/helper-classes/RDGE/src/tools/compiler.jarbin4927265 -> 0 bytes
14 files changed, 970 insertions, 1208 deletions
diff --git a/js/helper-classes/RDGE/runtime/CanvasDataManager.js b/js/helper-classes/RDGE/runtime/CanvasDataManager.js
deleted file mode 100644
index 4985fc9a..00000000
--- a/js/helper-classes/RDGE/runtime/CanvasDataManager.js
+++ /dev/null
@@ -1,98 +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
8
9///////////////////////////////////////////////////////////////////////
10// Class ShapeRuntime
11// Manages runtime shape display
12///////////////////////////////////////////////////////////////////////
13function CanvasDataManager()
14{
15 this.loadGLData = function(root, valueArray)
16 {
17 var value = valueArray;
18 var nWorlds = value.length;
19 for (var i=0; i<nWorlds; i++)
20 {
21 var importStr = value[i];
22 var startIndex = importStr.indexOf( "id: " );
23 if (startIndex >= 0)
24 {
25 var endIndex = importStr.indexOf( "\n", startIndex );
26 if (endIndex > 0)
27 {
28 var id = importStr.substring( startIndex+4, endIndex );
29 var canvas = this.findCanvasWithID( id, root );
30 if (canvas)
31 {
32 var loadForAuthoring = true;
33 var index = importStr.indexOf( "scenedata: " );
34 if (index >= 0) loadForAuthoring = false;
35
36 if (loadForAuthoring)
37 {
38 if (!canvas.elementModel)
39 {
40 NJUtils.makeElementModel(canvas, "Canvas", "shape", true);
41 }
42
43 if (canvas.elementModel)
44 {
45 if (canvas.elementModel.shapeModel.GLWorld)
46 canvas.elementModel.shapeModel.GLWorld.clearTree();
47
48 var world = new GLWorld( canvas );
49 canvas.elementModel.shapeModel.GLWorld = world;
50 world.import( importStr );
51 }
52 }
53 else
54 {
55 var rt = new GLRuntime( canvas, importStr );
56 }
57 }
58 }
59 }
60 }
61 }
62
63 this.collectGLData = function( elt, dataArray )
64 {
65 if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld)
66 {
67 var data = elt.elementModel.shapeModel.GLWorld.export();
68 dataArray.push( data );
69 }
70
71 if (elt.children)
72 {
73 var nKids = elt.children.length;
74 for (var i=0; i<nKids; i++)
75 {
76 var child = elt.children[i];
77 this.collectGLData( child, dataArray );
78 }
79 }
80 }
81
82 this.findCanvasWithID = function( id, elt )
83 {
84 var cid = elt.getAttribute( "data-RDGE-id" );
85 if (cid == id) return elt;
86
87 if (elt.children)
88 {
89 var nKids = elt.children.length;
90 for (var i=0; i<nKids; i++)
91 {
92 var child = elt.children[i];
93 this.findCanvasWithID( id, child );
94 }
95 }
96 }
97}
98
diff --git a/js/helper-classes/RDGE/runtime/GLRuntime.js b/js/helper-classes/RDGE/runtime/GLRuntime.js
deleted file mode 100644
index 80162f91..00000000
--- a/js/helper-classes/RDGE/runtime/GLRuntime.js
+++ /dev/null
@@ -1,159 +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
8
9///////////////////////////////////////////////////////////////////////
10// Class GLRuntime
11// Manages runtime fora WebGL canvas
12///////////////////////////////////////////////////////////////////////
13function GLRuntime( canvas, importStr )
14{
15 ///////////////////////////////////////////////////////////////////////
16 // Instance variables
17 ///////////////////////////////////////////////////////////////////////
18 this._canvas = canvas;
19 this._importStr = importStr;
20
21 this.renderer = null;
22 this.myScene = null;
23 this.light = null;
24 this.light2 = null;
25 this._rootNode = null;
26
27 this._firstRender = true;
28
29 ///////////////////////////////////////////////////////////////////////
30 // initialization code
31 ///////////////////////////////////////////////////////////////////////
32 var id = canvas.getAttribute( "data-RDGE-id" );
33 canvas.rdgeid = id;
34 RDGE.globals.engine.registerCanvas(canvas, this);
35 RDGE.RDGEStart( canvas );
36
37 this.loadScene = function()
38 {
39 // parse the data
40 // the GL runtime must start with a "sceneData: "
41 var index = importStr.indexOf( "scenedata: " );
42 if (index >= 0)
43 {
44 var rdgeStr = importStr.substr( index+11 );
45 var endIndex = rdgeStr.indexOf( "endscene\n" );
46 if (endIndex < 0) throw new Error( "ill-formed WebGL data" );
47 var len = endIndex - index + 11;
48 rdgeStr = rdgeStr.substr( 0, endIndex );
49
50 this.myScene.importJSON( rdgeStr );
51 }
52 }
53
54 this.init = function()
55 {
56 var ctx1 = RDGE.globals.engine.ctxMan.handleToObject(this._canvas.rdgeCtxHandle),
57 ctx2 = RDGE.globals.engine.getContext();
58 if (ctx1 != ctx2) console.log( "***** different contexts *****" );
59 this.renderer = ctx1.renderer;
60
61 // create a camera, set its perspective, and then point it at the origin
62 var cam = new RDGE.camera();
63 this._camera = cam;
64 cam.setPerspective(this.getFOV(), this.getAspect(), this.getZNear(), this.getZFar());
65 cam.setLookAt([0, 0, this.getViewDistance()], [0, 0, 0], RDGE.vec3.up());
66
67 // make this camera the active camera
68 this.renderer.cameraManager().setActiveCamera(cam);
69
70 // change clear color
71 this.renderer.setClearColor([1.0, 1.0, 1.0, 0.0]);
72
73 // create an empty scene graph
74 this.myScene = new SceneGraph();
75 this.loadScene();
76
77 /*
78 // create some lights
79 // light 1
80 this.light = RDGE.createLightNode("myLight");
81 this.light.setPosition([0,0,1.2]);
82 this.light.setDiffuseColor([0.75,0.9,1.0,1.0]);