diff options
-rw-r--r-- | assets/canvas-runtime.js | 28 | ||||
-rwxr-xr-x | js/document/html-document.js | 8 | ||||
-rwxr-xr-x | js/lib/drawing/world.js | 400 | ||||
-rwxr-xr-x | js/lib/geom/brush-stroke.js | 12 | ||||
-rwxr-xr-x | js/lib/geom/circle.js | 94 | ||||
-rwxr-xr-x | js/lib/geom/geom-obj.js | 442 | ||||
-rwxr-xr-x | js/lib/geom/line.js | 70 | ||||
-rwxr-xr-x | js/lib/geom/rectangle.js | 110 | ||||
-rwxr-xr-x | js/lib/rdge/materials/bump-metal-material.js | 54 | ||||
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 41 | ||||
-rwxr-xr-x | js/lib/rdge/materials/flat-material.js | 28 | ||||
-rwxr-xr-x | js/lib/rdge/materials/linear-gradient-material.js | 63 | ||||
-rwxr-xr-x | js/lib/rdge/materials/material.js | 15 | ||||
-rw-r--r-- | js/lib/rdge/materials/pulse-material.js | 42 | ||||
-rw-r--r-- | js/lib/rdge/materials/radial-blur-material.js | 38 | ||||
-rwxr-xr-x | js/lib/rdge/materials/radial-gradient-material.js | 59 | ||||
-rw-r--r-- | js/lib/rdge/materials/taper-material.js | 38 | ||||
-rw-r--r-- | js/lib/rdge/materials/twist-vert-material.js | 38 | ||||
-rwxr-xr-x | js/lib/rdge/materials/uber-material.js | 187 |
19 files changed, 296 insertions, 1471 deletions
diff --git a/assets/canvas-runtime.js b/assets/canvas-runtime.js index 6e9d1121..6278fdac 100644 --- a/assets/canvas-runtime.js +++ b/assets/canvas-runtime.js | |||
@@ -290,17 +290,17 @@ NinjaCvsRt.GLRuntime = function ( canvas, jObj, assetPath ) | |||
290 | { | 290 | { |
291 | case 1: | 291 | case 1: |
292 | obj = new NinjaCvsRt.RuntimeRectangle(); | 292 | obj = new NinjaCvsRt.RuntimeRectangle(); |
293 | obj.import( jObj, parent ); | 293 | obj.importJSON( jObj, parent ); |
294 | break; | 294 | break; |
295 | 295 | ||
296 | case 2: // circle | 296 | case 2: // circle |
297 | obj = new NinjaCvsRt.RuntimeOval(); | 297 | obj = new NinjaCvsRt.RuntimeOval(); |
298 | obj.import( jObj, parent ); | 298 | obj.importJSON( jObj, parent ); |
299 | break; | 299 | break; |
300 | 300 | ||
301 | case 3: // line | 301 | case 3: // line |
302 | obj = new NinjaCvsRt.RuntimeLine(); | 302 | obj = new NinjaCvsRt.RuntimeLine(); |
303 | obj.import( jObj, parent ); | 303 | obj.importJSON( jObj, parent ); |
304 | break; | 304 | break; |
305 | 305 | ||
306 | default: | 306 | default: |
@@ -481,7 +481,7 @@ NinjaCvsRt.RuntimeGeomObj = function () | |||
481 | this._children.push( child ); | 481 | this._children.push( child ); |
482 | }; | 482 | }; |
483 | 483 | ||
484 | this.import = function() | 484 | this.importJSON = function() |
485 | { | 485 | { |
486 | }; | 486 | }; |
487 | 487 | ||
@@ -530,7 +530,7 @@ NinjaCvsRt.RuntimeGeomObj = function () | |||
530 | 530 | ||
531 | if (mat) | 531 | if (mat) |
532 | { | 532 | { |
533 | mat.import( matObj ); | 533 | mat.importJSON( matObj ); |
534 | mat._materialNodeName = matNodeName; | 534 | mat._materialNodeName = matNodeName; |
535 | this._materials.push( mat ); | 535 | this._materials.push( mat ); |
536 | } | 536 | } |
@@ -671,7 +671,7 @@ NinjaCvsRt.RuntimeRectangle = function () | |||
671 | this.inheritedFrom = NinjaCvsRt.RuntimeGeomObj; | 671 | this.inheritedFrom = NinjaCvsRt.RuntimeGeomObj; |
672 | this.inheritedFrom(); | 672 | this.inheritedFrom(); |
673 | 673 | ||
674 | this.import = function( jObj ) | 674 | this.importJSON = function( jObj ) |
675 | { | 675 | { |
676 | this._xOffset = jObj.xoff; | 676 | this._xOffset = jObj.xoff; |
677 | this._yOffset = jObj.yoff; | 677 | this._yOffset = jObj.yoff; |
@@ -820,7 +820,7 @@ NinjaCvsRt.RuntimeLine = function () | |||
820 | this.inheritedFrom = NinjaCvsRt.RuntimeGeomObj; | 820 | this.inheritedFrom = NinjaCvsRt.RuntimeGeomObj; |
821 | this.inheritedFrom(); | 821 | this.inheritedFrom(); |
822 | 822 | ||
823 | this.import = function( jObj ) | 823 | this.importJSON = function( jObj ) |
824 | { | 824 | { |
825 | this._xOffset = jObj.xoff; | 825 | this._xOffset = jObj.xoff; |
826 | this._yOffset = jObj.yoff; | 826 | this._yOffset = jObj.yoff; |
@@ -918,7 +918,7 @@ NinjaCvsRt.RuntimeOval = function () | |||
918 | this.inheritedFrom = NinjaCvsRt.RuntimeGeomObj; | 918 | this.inheritedFrom = NinjaCvsRt.RuntimeGeomObj; |
919 | this.inheritedFrom(); | 919 | this.inheritedFrom(); |
920 | 920 | ||
921 | this.import = function( jObj ) | 921 | this.importJSON = function( jObj ) |
922 | { | 922 | { |
923 | this._xOffset = jObj.xoff; | 923 | this._xOffset = jObj.xoff; |
924 | this._yOffset = jObj.yoff; | 924 | this._yOffset = jObj.yoff; |
@@ -1191,7 +1191,7 @@ NinjaCvsRt.RuntimeMaterial = function ( world ) | |||
1191 | { | 1191 | { |
1192 | }; | 1192 | }; |
1193 | 1193 | ||
1194 | this.import = function( jObj ) | 1194 | this.importJSON = function( jObj ) |
1195 | { | 1195 | { |
1196 | }; | 1196 | }; |
1197 | }; | 1197 | }; |
@@ -1208,7 +1208,7 @@ NinjaCvsRt.RuntimeFlatMaterial = function () | |||
1208 | // assign a default color | 1208 | // assign a default color |
1209 | this._color = [1,0,0,1]; | 1209 | this._color = [1,0,0,1]; |
1210 | 1210 | ||
1211 | this.import = function( jObj ) | 1211 | this.importJSON = function( jObj ) |
1212 | { | 1212 | { |
1213 | this._color = jObj.color; | 1213 | this._color = jObj.color; |
1214 | }; | 1214 | }; |
@@ -1236,7 +1236,7 @@ NinjaCvsRt.RuntimePulseMaterial = function () | |||
1236 | this.isAnimated = function() { return true; }; | 1236 | this.isAnimated = function() { return true; }; |
1237 | 1237 | ||
1238 | 1238 | ||
1239 | this.import = function( jObj ) | 1239 | this.importJSON = function( jObj ) |
1240 | { | 1240 | { |
1241 | this._texMap = jObj.texture; | 1241 | this._texMap = jObj.texture; |
1242 | if (jObj.dTime) this._dTime = jObj.dTime; | 1242 | if (jObj.dTime) this._dTime = jObj.dTime; |
@@ -1331,7 +1331,7 @@ NinjaCvsRt.RuntimeRadialGradientMaterial = function () | |||
1331 | } | 1331 | } |
1332 | }; | 1332 | }; |
1333 | 1333 | ||
1334 | this.import = function( jObj ) | 1334 | this.importJSON = function( jObj ) |
1335 | { | 1335 | { |
1336 | this._color1 = jObj.color1, | 1336 | this._color1 = jObj.color1, |
1337 | this._color2 = jObj.color2, | 1337 | this._color2 = jObj.color2, |
@@ -1374,7 +1374,7 @@ NinjaCvsRt.RuntimeBumpMetalMaterial = function () | |||
1374 | this._specularTexture = "assets/images/silver.png"; | 1374 | this._specularTexture = "assets/images/silver.png"; |
1375 | this._normalTexture = "assets/images/normalMap.png"; | 1375 | this._normalTexture = "assets/images/normalMap.png"; |
1376 | 1376 | ||
1377 | this.import = function( jObj ) | 1377 | this.importJSON = function( jObj ) |
1378 | { | 1378 | { |
1379 | this._lightDiff = jObj.lightDiff; | 1379 | this._lightDiff = jObj.lightDiff; |
1380 | this._diffuseTexture = jObj.diffuseTexture; | 1380 | this._diffuseTexture = jObj.diffuseTexture; |
@@ -1515,7 +1515,7 @@ NinjaCvsRt.RuntimeUberMaterial = function () | |||
1515 | { | 1515 | { |
1516 | }; | 1516 | }; |
1517 | 1517 | ||
1518 | this.import = function( jObj ) | 1518 | this.importJSON = function( jObj ) |
1519 | { | 1519 | { |
1520 | if (jObj.materialProps) | 1520 | if (jObj.materialProps) |
1521 | { | 1521 | { |
diff --git a/js/document/html-document.js b/js/document/html-document.js index c9887b88..953f909c 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -276,13 +276,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
276 | var world = new GLWorld( canvas, useWebGL ); | 276 | var world = new GLWorld( canvas, useWebGL ); |
277 | world.importJSON( jObj ); | 277 | world.importJSON( jObj ); |
278 | } | 278 | } |
279 | else | ||
280 | { | ||
281 | var index = importStr.indexOf( "webGL: " ); | ||
282 | var useWebGL = (index >= 0); | ||
283 | var world = new GLWorld( canvas, useWebGL ); | ||
284 | world.import( importStr ); | ||
285 | } | ||
286 | 279 | ||
287 | this.buildShapeModel( canvas.elementModel, world ); | 280 | this.buildShapeModel( canvas.elementModel, world ); |
288 | } | 281 | } |
@@ -432,7 +425,6 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
432 | if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) | 425 | if (elt.elementModel && elt.elementModel.shapeModel && elt.elementModel.shapeModel.GLWorld) |
433 | { | 426 | { |
434 | var data = elt.elementModel.shapeModel.GLWorld.exportJSON(); | 427 | var data = elt.elementModel.shapeModel.GLWorld.exportJSON(); |
435 | //var data = elt.elementModel.shapeModel.GLWorld.export(); | ||
436 | dataArray.push( data ); | 428 | dataArray.push( data ); |
437 | } | 429 | } |
438 | 430 | ||
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 801c199a..ae8c2cce 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -435,38 +435,38 @@ World.prototype.updateObject = function (obj) { | |||
435 | } | 435 | } |
436 | }; | 436 | }; |
437 | 437 | ||
438 | World.prototype.addObject = function( obj ) { | 438 | World.prototype.addObject = function (obj) { |
439 | if (!obj) return; | 439 | if (!obj) return; |
440 | 440 | ||
441 | try { | 441 | try { |
442 | // undefine all the links of the object | 442 | // undefine all the links of the object |
443 | obj.setChild( undefined ); | 443 | obj.setChild(undefined); |
444 | obj.setNext( undefined ); | 444 | obj.setNext(undefined); |
445 | obj.setPrev( undefined ); | 445 | obj.setPrev(undefined); |
446 | obj.setParent( undefined ); | 446 | obj.setParent(undefined); |
447 | 447 | ||
448 | obj.setWorld( this ); | 448 | obj.setWorld(this); |
449 | 449 | ||
450 | if (this._geomRoot == null) { | 450 | if (this._geomRoot == null) { |
451 | this._geomRoot = obj; | 451 | this._geomRoot = obj; |
452 | } else { | 452 | } else { |