aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rwxr-xr-xjs/document/html-document.js13
-rwxr-xr-xjs/lib/drawing/world.js90
-rwxr-xr-xjs/lib/geom/circle.js3
-rwxr-xr-xjs/lib/geom/geom-obj.js47
-rwxr-xr-xjs/lib/geom/rectangle.js4
-rwxr-xr-xjs/lib/rdge/materials/bump-metal-material.js4
-rw-r--r--js/lib/rdge/materials/deform-material.js2
-rwxr-xr-xjs/lib/rdge/materials/flat-material.js41
-rw-r--r--js/lib/rdge/materials/fly-material.js2
-rw-r--r--js/lib/rdge/materials/julia-material.js2
-rw-r--r--js/lib/rdge/materials/keleidoscope-material.js2
-rwxr-xr-xjs/lib/rdge/materials/linear-gradient-material.js2
-rw-r--r--js/lib/rdge/materials/mandel-material.js2
-rw-r--r--js/lib/rdge/materials/plasma-material.js7
-rw-r--r--js/lib/rdge/materials/pulse-material.js7
-rw-r--r--js/lib/rdge/materials/radial-blur-material.js2
-rwxr-xr-xjs/lib/rdge/materials/radial-gradient-material.js7
-rw-r--r--js/lib/rdge/materials/relief-tunnel-material.js2
-rw-r--r--js/lib/rdge/materials/square-tunnel-material.js2
-rw-r--r--js/lib/rdge/materials/star-material.js2
-rw-r--r--js/lib/rdge/materials/taper-material.js6
-rw-r--r--js/lib/rdge/materials/tunnel-material.js2
-rw-r--r--js/lib/rdge/materials/twist-material.js2
-rw-r--r--js/lib/rdge/materials/twist-vert-material.js6
-rwxr-xr-xjs/lib/rdge/materials/uber-material.js71
-rw-r--r--js/lib/rdge/materials/water-material.js2
-rw-r--r--js/lib/rdge/materials/z-invert-material.js2
-rw-r--r--js/lib/rdge/runtime/CanvasDataManager.js (renamed from js/helper-classes/RDGE/runtime/CanvasDataManager.js)10
-rw-r--r--js/lib/rdge/runtime/GLRuntime.js (renamed from js/helper-classes/RDGE/runtime/GLRuntime.js)11
-rw-r--r--js/lib/rdge/runtime/RuntimeGeomObj.js (renamed from js/helper-classes/RDGE/runtime/RuntimeGeomObj.js)27
-rw-r--r--js/lib/rdge/runtime/RuntimeMaterial.js (renamed from js/helper-classes/RDGE/runtime/RuntimeMaterial.js)67
31 files changed, 336 insertions, 113 deletions
diff --git a/js/document/html-document.js b/js/document/html-document.js
index 8592a445..44f90d41 100755
--- a/js/document/html-document.js
+++ b/js/document/html-document.js
@@ -8,7 +8,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
8// 8//
9var Montage = require("montage/core/core").Montage, 9var Montage = require("montage/core/core").Montage,
10 TextDocument = require("js/document/text-document").TextDocument, 10 TextDocument = require("js/document/text-document").TextDocument,
11 NJUtils = require("js/lib/NJUtils").NJUtils; 11 NJUtils = require("js/lib/NJUtils").NJUtils,
12 CanvasDataManager = require("js/lib/rdge/runtime/CanvasDataManager").CanvasDataManager,
13 GLWorld = require("js/lib/drawing/world").World;
12//////////////////////////////////////////////////////////////////////// 14////////////////////////////////////////////////////////////////////////
13// 15//
14exports.HTMLDocument = Montage.create(TextDocument, { 16exports.HTMLDocument = Montage.create(TextDocument, {
@@ -185,7 +187,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
185 var elt = this.documentRoot; 187 var elt = this.documentRoot;
186 if (elt) 188 if (elt)
187 { 189 {
188 var loadForRuntime = false; 190 var loadForRuntime = true;
189 if (loadForRuntime) 191 if (loadForRuntime)
190 { 192 {
191 //console.log( "load canvas data: " , value ); 193 //console.log( "load canvas data: " , value );
@@ -224,7 +226,6 @@ exports.HTMLDocument = Montage.create(TextDocument, {
224 var useWebGL = (index >= 0) 226 var useWebGL = (index >= 0)
225 var world = new GLWorld( canvas, useWebGL ); 227 var world = new GLWorld( canvas, useWebGL );
226 world.import( importStr ); 228 world.import( importStr );
227 canvas.elementModel.shapeModel.GLWorld = world;
228 229
229 this.buildShapeModel( canvas.elementModel, world ); 230 this.buildShapeModel( canvas.elementModel, world );
230 } 231 }
@@ -789,8 +790,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
789 } 790 }
790 } 791 }
791 } 792 }
792 //return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; 793 return {mode: 'html', document: this._userDocument, webgl: this.glData, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML};
793 return {mode: 'html', document: this._userDocument, styles: styles, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML};
794 } else if (this.currentView === "code"){ 794 } else if (this.currentView === "code"){
795 //TODO: Would this get call when we are in code of HTML? 795 //TODO: Would this get call when we are in code of HTML?
796 } else { 796 } else {
@@ -813,8 +813,7 @@ exports.HTMLDocument = Montage.create(TextDocument, {
813 } 813 }
814 } 814 }
815 } 815 }
816 //return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML}; 816 return {mode: 'html', document: this._userDocument, webgl: this.glData, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML};
817 return {mode: 'html', document: this._userDocument, css: css, head: this._templateDocument.head.innerHTML, body: this._templateDocument.body.innerHTML};
818 } else if (this.currentView === "code"){ 817 } else if (this.currentView === "code"){
819 //TODO: Would this get call when we are in code of HTML? 818 //TODO: Would this get call when we are in code of HTML?
820 } else { 819 } else {
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js
index 3d6c6fc4..b8bceda6 100755
--- a/js/lib/drawing/world.js
+++ b/js/lib/drawing/world.js
@@ -4,17 +4,6 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. 4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */ 5</copyright> */
6 6
7// Useless Global variables.
8// TODO: Remove this as soon as QE test pass
9/*
10var shaderProgramArray = new Array;
11var glContextArray = new Array;
12var vertexShaderSource = "";
13var fragmentShaderSource = "";
14var rdgeStarted = false;
15*/
16
17var nodeCounter = 0;
18 7
19var GeomObj = require("js/lib/geom/geom-obj").GeomObj; 8var GeomObj = require("js/lib/geom/geom-obj").GeomObj;
20var Line = require("js/lib/geom/line").Line; 9var Line = require("js/lib/geom/line").Line;
@@ -22,6 +11,8 @@ var Rectangle = require("js/lib/geom/rectangle").Rectangle;
22var Circle = require("js/lib/geom/circle").Circle; 11var Circle = require("js/lib/geom/circle").Circle;
23var MaterialsModel = require("js/models/materials-model").MaterialsModel; 12var MaterialsModel = require("js/models/materials-model").MaterialsModel;
24 13
14var worldCounter = 0;
15
25/////////////////////////////////////////////////////////////////////// 16///////////////////////////////////////////////////////////////////////
26// Class GLWorld 17// Class GLWorld
27// Manages display in a canvas 18// Manages display in a canvas
@@ -76,6 +67,12 @@ var World = function GLWorld( canvas, use3D ) {
76 // no animated materials 67 // no animated materials
77 this._firstRender = true; 68 this._firstRender = true;
78 69
70 this._worldCount = worldCounter;
71 worldCounter++;
72
73 // keep a counter for generating node names
74 this._nodeCounter = 0;
75
79 /////////////////////////////////////////////////////////////////////// 76 ///////////////////////////////////////////////////////////////////////
80 // Property accessors 77 // Property accessors
81 /////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////
@@ -350,9 +347,12 @@ var World = function GLWorld( canvas, use3D ) {
350 return false; 347 return false;
351 }; 348 };
352 349
353 350 this.generateUniqueNodeID = function()
354 // END RDGE 351 {
355 //////////////////////////////////////////////////////////////////////////////////// 352 var str = String( this._nodeCounter );
353 this._nodeCounter++;
354 return str;
355 }
356 356
357 357
358 // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state 358 // start RDGE passing your runtime object, and false to indicate we don't need a an initialization state
@@ -391,7 +391,7 @@ World.prototype.updateObject = function (obj) {
391 if (nPrims > 0) { 391 if (nPrims > 0) {
392 ctrTrNode = obj.getTransformNode(); 392 ctrTrNode = obj.getTransformNode();
393 if (ctrTrNode == null) { 393 if (ctrTrNode == null) {
394 ctrTrNode = createTransformNode("objRootNode_" + nodeCounter++); 394 ctrTrNode = createTransformNode("objRootNode_" + this._nodeCounter++);
395 this._rootNode.insertAsChild( ctrTrNode ); 395 this._rootNode.insertAsChild( ctrTrNode );
396 obj.setTransformNode( ctrTrNode ); 396 obj.setTransformNode( ctrTrNode );
397 } 397 }
@@ -401,7 +401,7 @@ World.prototype.updateObject = function (obj) {
401 }); 401 });
402 ctrTrNode.meshes = []; 402 ctrTrNode.meshes = [];
403 403
404 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + nodeCounter++, prims[0]); 404 ctrTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prims[0]);
405 ctrTrNode.attachMaterial(materialNodes[0]); 405 ctrTrNode.attachMaterial(materialNodes[0]);
406 } 406 }
407 407
@@ -420,12 +420,12 @@ World.prototype.updateObject = function (obj) {
420 }); 420 });
421 childTrNode.meshes = []; 421 childTrNode.meshes = [];
422 } else { 422 } else {
423 childTrNode = createTransformNode("objNode_" + nodeCounter++); 423 childTrNode = createTransformNode("objNode_" + this._nodeCounter++);
424 ctrTrNode.insertAsChild(childTrNode); 424 ctrTrNode.insertAsChild(childTrNode);
425 } 425 }
426 426
427 // attach the instanced box goe 427 // attach the instanced box goe
428 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + nodeCounter++, prim); 428 childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim);
429 childTrNode.attachMaterial(materialNodes[i]); 429 childTrNode.attachMaterial(materialNodes[i]);
430 } 430 }
431}; 431};
@@ -727,7 +727,7 @@ World.prototype.getShapeFromPoint = function( offsetX, offsetY ) {
727 } 727 }
728}; 728};
729 729
730World.prototype.export = function() { 730World.prototype.export = function( exportForPublish ) {
731 var exportStr = "GLWorld 1.0\n"; 731 var exportStr = "GLWorld 1.0\n";
732 var id = this.getCanvas().getAttribute( "data-RDGE-id" ); 732 var id = this.getCanvas().getAttribute( "data-RDGE-id" );
733 exportStr += "id: " + id + "\n"; 733</