diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/io/system/ninjalibrary.json | 2 | ||||
-rwxr-xr-x | js/lib/drawing/world.js | 2 | ||||
-rwxr-xr-x | js/lib/geom/circle.js | 22 | ||||
-rwxr-xr-x | js/lib/geom/geom-obj.js | 21 | ||||
-rwxr-xr-x | js/lib/geom/rectangle.js | 23 | ||||
-rwxr-xr-x | js/lib/rdge/materials/bump-metal-material.js | 2 | ||||
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 17 | ||||
-rw-r--r-- | js/lib/rdge/materials/deform-material.js | 16 | ||||
-rw-r--r-- | js/lib/rdge/materials/flag-material.js | 16 | ||||
-rwxr-xr-x | js/lib/rdge/materials/flat-material.js | 18 | ||||
-rw-r--r-- | js/lib/rdge/materials/fly-material.js | 1 | ||||
-rwxr-xr-x | js/lib/rdge/materials/material.js | 219 | ||||
-rw-r--r-- | js/lib/rdge/materials/pulse-material.js | 189 | ||||
-rw-r--r-- | js/lib/rdge/materials/taper-material.js | 102 | ||||
-rw-r--r-- | js/lib/rdge/materials/water-material.js | 45 | ||||
-rwxr-xr-x | js/models/materials-model.js | 89 | ||||
-rwxr-xr-x | js/panels/Materials/materials-popup.reel/materials-popup.js | 16 |
17 files changed, 406 insertions, 394 deletions
diff --git a/js/io/system/ninjalibrary.json b/js/io/system/ninjalibrary.json index 5c1eb875..5038bd21 100644 --- a/js/io/system/ninjalibrary.json +++ b/js/io/system/ninjalibrary.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "libraries": [ | 2 | "libraries": [ |
3 | {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.10.0.0"}, | 3 | {"name": "Montage", "path": "/node_modules/descriptor.json", "version": "0.10.0.0"}, |
4 | {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.7.0"} | 4 | {"name": "RDGE", "path": "/assets/descriptor.json", "version": "0.5.8.2"} |
5 | ] | 5 | ] |
6 | } \ No newline at end of file | 6 | } \ No newline at end of file |
diff --git a/js/lib/drawing/world.js b/js/lib/drawing/world.js index 228c0d94..8068284e 100755 --- a/js/lib/drawing/world.js +++ b/js/lib/drawing/world.js | |||
@@ -484,11 +484,11 @@ World.prototype.updateObject = function (obj) { | |||
484 | for (var i = 1; i < nPrims; i++) | 484 | for (var i = 1; i < nPrims; i++) |
485 | { | 485 | { |
486 | // get the next primitive | 486 | // get the next primitive |
487 | var prim = prims[i]; | ||
488 | childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++); | 487 | childTrNode = RDGE.createTransformNode("objNode_" + this._nodeCounter++); |
489 | ctrTrNode.insertAsChild(childTrNode); | 488 | ctrTrNode.insertAsChild(childTrNode); |
490 | 489 | ||
491 | // attach the instanced box goe | 490 | // attach the instanced box goe |
491 | var prim = prims[i]; | ||
492 | childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim); | 492 | childTrNode.attachMeshNode(this.renderer.id + "_prim_" + this._nodeCounter++, prim); |
493 | childTrNode.attachMaterial(materialNodes[i]); | 493 | childTrNode.attachMaterial(materialNodes[i]); |
494 | } | 494 | } |
diff --git a/js/lib/geom/circle.js b/js/lib/geom/circle.js index b2709ce4..6627b4b7 100755 --- a/js/lib/geom/circle.js +++ b/js/lib/geom/circle.js | |||
@@ -57,16 +57,18 @@ exports.Circle = Object.create(GeomObj, { | |||
57 | this.m_world = world; | 57 | this.m_world = world; |
58 | 58 | ||
59 | if(strokeMaterial) { | 59 | if(strokeMaterial) { |
60 | this._strokeMaterial = strokeMaterial; | 60 | this._strokeMaterial = strokeMaterial.dup(); |
61 | } else { | 61 | } else { |
62 | this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 62 | this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
63 | } | 63 | } |
64 | if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor ); | ||
64 | 65 | ||
65 | if(fillMaterial) { | 66 | if(fillMaterial) { |
66 | this._fillMaterial = fillMaterial; | 67 | this._fillMaterial = fillMaterial.dup(); |
67 | } else { | 68 | } else { |
68 | this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 69 | this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
69 | } | 70 | } |
71 | if (fillColor && this._fillMaterial.hasProperty( "color" )) this._fillMaterial.setProperty( "color", this._fillColor ); | ||
70 | } | 72 | } |
71 | }, | 73 | }, |
72 | 74 | ||
@@ -702,19 +704,23 @@ exports.Circle = Object.create(GeomObj, { | |||
702 | var strokeMaterialName = jObj.strokeMat; | 704 | var strokeMaterialName = jObj.strokeMat; |
703 | var fillMaterialName = jObj.fillMat; | 705 | var fillMaterialName = jObj.fillMat; |
704 | 706 | ||
705 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); | 707 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ).dup(); |
706 | if (!strokeMat) { | 708 | if (!strokeMat) { |
707 | console.log( "object material not found in library: " + strokeMaterialName ); | 709 | console.log( "object material not found in library: " + strokeMaterialName ); |
708 | strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 710 | strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
709 | } | 711 | } |
710 | this._strokeMaterial = strokeMat; | 712 | this._strokeMaterial = strokeMat; |
713 | if (this._strokeMaterial.hasProperty( 'color' )) | ||
714 | this._strokeMaterial.setProperty( 'color', this._strokeColor ); | ||
711 | 715 | ||
712 | var fillMat = MaterialsModel.getMaterial( fillMaterialName ); | 716 | var fillMat = MaterialsModel.getMaterial( fillMaterialName ).dup(); |
713 | if (!fillMat) { | 717 | if (!fillMat) { |
714 | console.log( "object material not found in library: " + fillMaterialName ); | 718 | console.log( "object material not found in library: " + fillMaterialName ); |
715 | fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 719 | fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
716 | } | 720 | } |
717 | this._fillMaterial = fillMat; | 721 | this._fillMaterial = fillMat; |
722 | if (this._fillMaterial.hasProperty( 'color' )) | ||
723 | this._fillMaterial.setProperty( 'color', this._fillColor ); | ||
718 | 724 | ||
719 | this.importMaterialsJSON( jObj.materials ); | 725 | this.importMaterialsJSON( jObj.materials ); |
720 | } | 726 | } |
diff --git a/js/lib/geom/geom-obj.js b/js/lib/geom/geom-obj.js index 417c8731..3a7a5619 100755 --- a/js/lib/geom/geom-obj.js +++ b/js/lib/geom/geom-obj.js | |||
@@ -281,9 +281,11 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
281 | this._materialArray.push(strokeMaterial); | 281 | this._materialArray.push(strokeMaterial); |
282 | this._materialTypeArray.push("stroke"); | 282 | this._materialTypeArray.push("stroke"); |
283 | 283 | ||
284 | if (this._strokeColor) { | 284 | // don't set the value here. The material editor may set a color directly |
285 | this.setStrokeColor(this._strokeColor); | 285 | // to the material without setting this value in the obj. The following |
286 | } | 286 | // lines of code will clobber the value in the material |
287 | //if (this._strokeColor) | ||
288 | // this.setStrokeColor(this._strokeColor); | ||
287 | 289 | ||
288 | this._strokeMaterial = strokeMaterial; | 290 | this._strokeMaterial = strokeMaterial; |
289 | 291 | ||
@@ -306,12 +308,14 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
306 | 308 | ||
307 | this._materialArray.push(fillMaterial); | 309 | this._materialArray.push(fillMaterial); |
308 | this._materialTypeArray.push("fill"); | 310 | this._materialTypeArray.push("fill"); |
311 | |||
312 | // don't set the value here. The material editor may set a color directly | ||
313 | // to the material without setting this value in the obj. The following | ||
314 | // lines of code will clobber the value in the material | ||
315 | //if (this._fillColor) | ||
316 | // this.setFillColor(this._fillColor); | ||
309 | 317 | ||
310 | if (this._fillColor) { | 318 | this._fillMaterial = fillMaterial; |
311 | this.setFillColor(this._fillColor); | ||
312 | } | ||
313 | |||
314 | this._fillMaterial = fillMaterial; | ||
315 | 319 | ||
316 | return fillMaterial; | 320 | return fillMaterial; |
317 | } | 321 | } |
@@ -389,6 +393,7 @@ exports.GeomObj = Object.create(Object.prototype, { | |||
389 | case "radialBlur": | 393 | case "radialBlur": |
390 | case "pulse": | 394 | case "pulse": |
391 | case "twistVert": | 395 | case "twistVert": |
396 | case "taper": | ||
392 | mat = MaterialsModel.getMaterialByShader(shaderName); | 397 | mat = MaterialsModel.getMaterialByShader(shaderName); |
393 | if (mat) mat = mat.dup(); | 398 | if (mat) mat = mat.dup(); |
394 | break; | 399 | break; |
diff --git a/js/lib/geom/rectangle.js b/js/lib/geom/rectangle.js index 42d51e74..81a8556d 100755 --- a/js/lib/geom/rectangle.js +++ b/js/lib/geom/rectangle.js | |||
@@ -73,16 +73,19 @@ exports.Rectangle = Object.create(GeomObj, { | |||
73 | this._materialSpecular = [0.4, 0.4, 0.4, 1.0]; | 73 | this._materialSpecular = [0.4, 0.4, 0.4, 1.0]; |
74 | 74 | ||
75 | if(strokeMaterial) { | 75 | if(strokeMaterial) { |
76 | this._strokeMaterial = strokeMaterial; | 76 | this._strokeMaterial = strokeMaterial.dup(); |
77 | } else { | 77 | } else { |
78 | this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 78 | this._strokeMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
79 | } | 79 | } |
80 | if (strokeColor && this._strokeMaterial.hasProperty( "color" )) this._strokeMaterial.setProperty( "color", this._strokeColor ); | ||
81 | |||
80 | 82 | ||
81 | if(fillMaterial) { | 83 | if(fillMaterial) { |
82 | this._fillMaterial = fillMaterial; | 84 | this._fillMaterial = fillMaterial.dup(); |
83 | } else { | 85 | } else { |
84 | this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 86 | this._fillMaterial = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
85 | } | 87 | } |
88 | if (fillColor && this._fillMaterial.hasProperty( "color" )) this._fillMaterial.setProperty( "color", this._fillColor ); | ||
86 | } | 89 | } |
87 | }, | 90 | }, |
88 | 91 | ||
@@ -289,19 +292,23 @@ exports.Rectangle = Object.create(GeomObj, { | |||
289 | var strokeMaterialName = jObj.strokeMat; | 292 | var strokeMaterialName = jObj.strokeMat; |
290 | var fillMaterialName = jObj.fillMat; | 293 | var fillMaterialName = jObj.fillMat; |
291 | 294 | ||
292 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ); | 295 | var strokeMat = MaterialsModel.getMaterial( strokeMaterialName ).dup(); |
293 | if (!strokeMat) { | 296 | if (!strokeMat) { |
294 | console.log( "object material not found in library: " + strokeMaterialName ); | 297 | console.log( "object material not found in library: " + strokeMaterialName ); |
295 | strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 298 | strokeMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
296 | } | 299 | } |
297 | this._strokeMaterial = strokeMat; | 300 | this._strokeMaterial = strokeMat; |
301 | if (this._strokeMaterial.hasProperty( 'color' )) | ||
302 | this._strokeMaterial.setProperty( 'color', this._strokeColor ); | ||
298 | 303 | ||
299 | var fillMat = MaterialsModel.getMaterial( fillMaterialName ); | 304 | var fillMat = MaterialsModel.getMaterial( fillMaterialName ).dup(); |
300 | if (!fillMat) { | 305 | if (!fillMat) { |
301 | console.log( "object material not found in library: " + fillMaterialName ); | 306 | console.log( "object material not found in library: " + fillMaterialName ); |
302 | fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ); | 307 | fillMat = MaterialsModel.getMaterial( MaterialsModel.getDefaultMaterialName() ).dup(); |
303 | } | 308 | } |
304 | this._fillMaterial = fillMat; | 309 | this._fillMaterial = fillMat; |