diff options
author | Nivesh Rajbhandari | 2012-03-27 09:35:12 -0700 |
---|---|---|
committer | Nivesh Rajbhandari | 2012-03-27 09:35:12 -0700 |
commit | 71b2d1f4ece0f0760bc15900ee0b1f937a9b9431 (patch) | |
tree | 4c0da519620ecb318640e201a7f503952025b3bf /js/lib | |
parent | 406bbfc63f8ed42d7da105dbd068a49ff8fb5f09 (diff) | |
parent | 2d94104653667e93e0f7e5f8d12bc4f7b82e64fa (diff) | |
download | ninja-71b2d1f4ece0f0760bc15900ee0b1f937a9b9431.tar.gz |
Merge branch 'refs/heads/WebGLFileIO' into WebGLMaterials
Diffstat (limited to 'js/lib')
-rwxr-xr-x | js/lib/drawing/world.js | 21 | ||||
-rwxr-xr-x | js/lib/geom/geom-obj.js | 2 | ||||
-rw-r--r-- | js/lib/rdge/materials/radial-blur-material.js | 18 |
3 files changed, 35 insertions, 6 deletions
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 781695b6..fec6a478 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -761,13 +761,10 @@ World.prototype.exportJSON = function() | |||
761 | // We need to rebuild everything | 761 | // We need to rebuild everything |
762 | if (this._useWebGL) | 762 | if (this._useWebGL) |
763 | { | 763 | { |
764 | var root = this._rootNode; | ||
765 | root.children = new Array(); | ||
766 | if (worldObj.children && (worldObj.children.length === 1)) | 764 | if (worldObj.children && (worldObj.children.length === 1)) |
767 | { | 765 | { |
768 | this.init(); | 766 | this.rebuildTree(this._geomRoot); |
769 | this._geomRoot = undefined; | 767 | this.restartRenderLoop(); |
770 | this.importObjectsJSON( worldObj.children[0] ); | ||
771 | } | 768 | } |
772 | } | 769 | } |
773 | 770 | ||
@@ -783,6 +780,20 @@ World.prototype.exportJSON = function() | |||
783 | return jStr; | 780 | return jStr; |
784 | } | 781 | } |
785 | 782 | ||
783 | World.prototype.rebuildTree = function( obj ) | ||
784 | { | ||
785 | if (!obj) return; | ||
786 | |||
787 | obj.buildBuffers(); | ||
788 | |||
789 | if (obj.getChild()) { | ||
790 | this.rebuildTree( obj.getChild () ); | ||
791 | } | ||
792 | |||
793 | if (obj.getNext()) | ||
794 | this.rebuildTree( obj.getNext() ); | ||
795 | } | ||
796 | |||
786 | World.prototype.exportObjectsJSON = function( obj, parentObj ) | 797 | World.prototype.exportObjectsJSON = function( obj, parentObj ) |
787 | { | 798 | { |
788 | if (!obj) return; | 799 | if (!obj) return; |
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index a87bdbf5..3c4e4bbf 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js | |||
@@ -302,6 +302,7 @@ var GeomObj = function GLGeomObj() { | |||
302 | case "deform": | 302 | case "deform": |
303 | case "water": | 303 | case "water": |
304 | case "paris": | 304 | case "paris": |
305 | case "raiders": | ||
305 | case "tunnel": | 306 | case "tunnel": |
306 | case "reliefTunnel": | 307 | case "reliefTunnel": |
307 | case "squareTunnel": | 308 | case "squareTunnel": |
@@ -375,6 +376,7 @@ var GeomObj = function GLGeomObj() { | |||
375 | case "deform": | 376 | case "deform": |
376 | case "water": | 377 | case "water": |
377 | case "paris": | 378 | case "paris": |
379 | case "raiders": | ||
378 | case "tunnel": | 380 | case "tunnel": |
379 | case "reliefTunnel": | 381 | case "reliefTunnel": |
380 | case "squareTunnel": | 382 | case "squareTunnel": |
diff --git a/js/lib/rdge/materials/radial-blur-material.js b/js/lib/rdge/materials/radial-blur-material.js index f4a4baa2..fee02a1d 100644 --- a/js/lib/rdge/materials/radial-blur-material.js +++ b/js/lib/rdge/materials/radial-blur-material.js | |||
@@ -282,10 +282,26 @@ var RaidersMaterial = function RaidersMaterial() | |||
282 | this.inheritedFrom(); | 282 | this.inheritedFrom(); |
283 | 283 | ||
284 | this._name = "RaidersMaterial"; | 284 | this._name = "RaidersMaterial"; |
285 | this._shaderName = "radialBlur"; | 285 | this._shaderName = "raiders"; |
286 | 286 | ||
287 | this._texMap = 'assets/images/raiders.png'; | 287 | this._texMap = 'assets/images/raiders.png'; |
288 | this._propValues[ this._propNames[0] ] = this._texMap.slice(0); | 288 | this._propValues[ this._propNames[0] ] = this._texMap.slice(0); |
289 | |||
290 | |||
291 | // duplcate method requirde | ||
292 | this.dup = function( world ) { | ||
293 | // allocate a new uber material | ||
294 | var newMat = new RaidersMaterial(); | ||
295 | |||
296 | // copy over the current values; | ||
297 | var propNames = [], propValues = [], propTypes = [], propLabels = []; | ||
298 | this.getAllProperties( propNames, propValues, propTypes, propLabels); | ||
299 | var n = propNames.length; | ||
300 | for (var i=0; i<n; i++) | ||
301 | newMat.setProperty( propNames[i], propValues[i] ); | ||
302 | |||
303 | return newMat; | ||
304 | }; | ||
289 | } | 305 | } |
290 | 306 | ||
291 | RaidersMaterial.prototype = new Material(); | 307 | RaidersMaterial.prototype = new Material(); |