diff options
-rwxr-xr-x | js/controllers/elements/shapes-controller.js | 4 | ||||
-rw-r--r-- | js/lib/rdge/materials/cloud-material.js | 13 | ||||
-rwxr-xr-x | js/lib/rdge/materials/linear-gradient-material.js | 4 | ||||
-rwxr-xr-x | js/lib/rdge/materials/radial-gradient-material.js | 4 | ||||
-rwxr-xr-x | js/panels/Materials/materials-library-panel.reel/materials-library-panel.js | 13 | ||||
-rwxr-xr-x | js/panels/Materials/materials-popup.reel/materials-popup.js | 80 | ||||
-rwxr-xr-x | js/tools/TagTool.js | 2 |
7 files changed, 78 insertions, 42 deletions
diff --git a/js/controllers/elements/shapes-controller.js b/js/controllers/elements/shapes-controller.js index 8d7b74f0..acf3b63d 100755 --- a/js/controllers/elements/shapes-controller.js +++ b/js/controllers/elements/shapes-controller.js | |||
@@ -166,10 +166,10 @@ exports.ShapesController = Montage.create(CanvasController, { | |||
166 | } | 166 | } |
167 | break; | 167 | break; |
168 | case "editStrokeMaterial": | 168 | case "editStrokeMaterial": |
169 | NJevent("showMaterialPopup",{materialId : this.getProperty(el, "strokeMaterial")}); | 169 | NJevent("showMaterialPopup",{materialId : this.getProperty(el, "strokeMaterial"), useSelection: true, whichMaterial: 'stroke'}); |
170 | break; | 170 | break; |
171 | case "editFillMaterial": | 171 | case "editFillMaterial": |
172 | NJevent("showMaterialPopup",{materialId : this.getProperty(el, "fillMaterial")}); | 172 | NJevent("showMaterialPopup",{materialId : this.getProperty(el, "fillMaterial"), useSelection: true, whichMaterial: 'fill'}); |
173 | break; | 173 | break; |
174 | case "animate": | 174 | case "animate": |
175 | if(value) | 175 | if(value) |
diff --git a/js/lib/rdge/materials/cloud-material.js b/js/lib/rdge/materials/cloud-material.js index 0cf428b0..b7670178 100644 --- a/js/lib/rdge/materials/cloud-material.js +++ b/js/lib/rdge/materials/cloud-material.js | |||
@@ -183,7 +183,8 @@ var CloudMaterial = function CloudMaterial() | |||
183 | if (material) | 183 | if (material) |
184 | { | 184 | { |
185 | var technique = material.shaderProgram['default']; | 185 | var technique = material.shaderProgram['default']; |
186 | var renderer = RDGE.globals.engine.getContext().renderer; | 186 | var saveContext = RDGE.globals.engine.getContext(); |
187 | var renderer = RDGE.globals.engine.getContext().renderer; | ||
187 | if (renderer && technique) | 188 | if (renderer && technique) |
188 | { | 189 | { |
189 | var texMapName = this._propValues[this._propNames[0]]; | 190 | var texMapName = this._propValues[this._propNames[0]]; |
@@ -215,6 +216,10 @@ var CloudMaterial = function CloudMaterial() | |||
215 | } | 216 | } |
216 | } | 217 | } |
217 | 218 | ||
219 | this.updateColor = function() | ||
220 | { | ||
221 | } | ||
222 | |||
218 | this.update = function( time ) | 223 | this.update = function( time ) |
219 | { | 224 | { |
220 | if (this._srcWorld) | 225 | if (this._srcWorld) |
@@ -264,6 +269,7 @@ var CloudMaterial = function CloudMaterial() | |||
264 | this.getWorld().stop(); | 269 | this.getWorld().stop(); |
265 | 270 | ||
266 | // build a world to do the rendering | 271 | // build a world to do the rendering |
272 | if (!GLWorld) GLWorld = require("js/lib/drawing/world").World; | ||
267 | this._srcWorld = new GLWorld( this._srcCanvas, true, true ); | 273 | this._srcWorld = new GLWorld( this._srcCanvas, true, true ); |
268 | var srcWorld = this._srcWorld; | 274 | var srcWorld = this._srcWorld; |
269 | if (!this._srcCanvas) throw new Error( "No source canvas in Cloud material" ); | 275 | if (!this._srcCanvas) throw new Error( "No source canvas in Cloud material" ); |
@@ -273,13 +279,13 @@ var CloudMaterial = function CloudMaterial() | |||
273 | var prim = this.buildGeometry( srcWorld, srcCanvas.width, srcCanvas.height ); | 279 | var prim = this.buildGeometry( srcWorld, srcCanvas.width, srcCanvas.height ); |
274 | 280 | ||
275 | // set up the shader | 281 | // set up the shader |
276 | var shader = new jshader(); | 282 | var shader = new RDGE.jshader(); |
277 | shader.def = cloudMaterialDef; | 283 | shader.def = cloudMaterialDef; |
278 | shader.init(); | 284 | shader.init(); |
279 | this._srcShader = shader; | 285 | this._srcShader = shader; |
280 | 286 | ||
281 | // set up the material node | 287 | // set up the material node |
282 | var materialNode = createMaterialNode("cloudMaterial" + "_" + srcWorld.generateUniqueNodeID()); | 288 | var materialNode = RDGE.createMaterialNode("cloudMaterial" + "_" + srcWorld.generateUniqueNodeID()); |
283 | materialNode.setShader(shader); | 289 | materialNode.setShader(shader); |
284 | this._srcMaterialNode = materialNode; | 290 | this._srcMaterialNode = materialNode; |
285 | 291 | ||
@@ -322,7 +328,6 @@ var CloudMaterial = function CloudMaterial() | |||
322 | this.buildGeometry = function(world, canvasWidth, canvasHeight) | 328 | this.buildGeometry = function(world, canvasWidth, canvasHeight) |
323 | { | 329 | { |
324 | var RectangleGeometry = require("js/lib/geom/rectangle").RectangleGeometry; | 330 | var RectangleGeometry = require("js/lib/geom/rectangle").RectangleGeometry; |
325 | |||
326 | RectangleGeometry.init(); | 331 | RectangleGeometry.init(); |
327 | 332 | ||
328 | // get the normalized device coordinates (NDC) for | 333 | // get the normalized device coordinates (NDC) for |
diff --git a/js/lib/rdge/materials/linear-gradient-material.js b/js/lib/rdge/materials/linear-gradient-material.js index 2d8e6ca7..586948bb 100755 --- a/js/lib/rdge/materials/linear-gradient-material.js +++ b/js/lib/rdge/materials/linear-gradient-material.js | |||
@@ -42,6 +42,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
42 | 42 | ||
43 | this.setColor1 = function (c) { | 43 | this.setColor1 = function (c) { |
44 | this._color1 = c.slice(); | 44 | this._color1 = c.slice(); |
45 | this._propValues[this._propNames[0]] = this._color1.slice(0); | ||
45 | 46 | ||
46 | if (this._shader && this._shader['default']) { | 47 | if (this._shader && this._shader['default']) { |
47 | this._shader['default'].u_color1.set(c); | 48 | this._shader['default'].u_color1.set(c); |
@@ -54,6 +55,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
54 | 55 | ||
55 | this.setColor2 = function (c) { | 56 | this.setColor2 = function (c) { |
56 | this._color2 = c.slice(); | 57 | this._color2 = c.slice(); |
58 | this._propValues[this._propNames[1]] = this._color2.slice(0); | ||
57 | 59 | ||
58 | if (this._shader && this._shader['default']) { | 60 | if (this._shader && this._shader['default']) { |
59 | this._shader['default'].u_color2.set(c); | 61 | this._shader['default'].u_color2.set(c); |
@@ -66,6 +68,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
66 | 68 | ||
67 | this.setColor3 = function (c) { | 69 | this.setColor3 = function (c) { |
68 | this._color3 = c.slice(); | 70 | this._color3 = c.slice(); |
71 | this._propValues[this._propNames[2]] = this._color3.slice(0); | ||
69 | 72 | ||
70 | if (this._shader && this._shader['default']) { | 73 | if (this._shader && this._shader['default']) { |
71 | this._shader['default'].u_color3.set(c); | 74 | this._shader['default'].u_color3.set(c); |
@@ -78,6 +81,7 @@ var LinearGradientMaterial = function LinearGradientMaterial() { | |||
78 | 81 | ||
79 | this.setColor4 = function (c) { | 82 | this.setColor4 = function (c) { |
80 | this._color4 = c.slice(); | 83 | this._color4 = c.slice(); |
84 | this._propValues[this._propNames[3]] = this._color4.slice(0); | ||
81 | 85 | ||
82 | if (this._shader && this._shader['default']) { | 86 | if (this._shader && this._shader['default']) { |
83 | this._shader['default'].u_color4.set(c); | 87 | this._shader['default'].u_color4.set(c); |
diff --git a/js/lib/rdge/materials/radial-gradient-material.js b/js/lib/rdge/materials/radial-gradient-material.js index dd40d31d..65679429 100755 --- a/js/lib/rdge/materials/radial-gradient-material.js +++ b/js/lib/rdge/materials/radial-gradient-material.js | |||
@@ -41,6 +41,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() { | |||
41 | 41 | ||
42 | this.setColor1 = function (c) { | 42 | this.setColor1 = function (c) { |
43 | this._color1 = c.slice(); | 43 | this._color1 = c.slice(); |
44 | this._propValues[this._propNames[0]] = this._color1.slice(0); | ||
44 | if (this._shader && this._shader['default']) { | 45 | if (this._shader && this._shader['default']) { |
45 | this._shader['default'].u_color1.set(c); | 46 | this._shader['default'].u_color1.set(c); |
46 | } | 47 | } |
@@ -52,6 +53,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() { | |||
52 | 53 | ||
53 | this.setColor2 = function (c) { | 54 | this.setColor2 = function (c) { |
54 | this._color2 = c.slice(); | 55 | this._color2 = c.slice(); |
56 | this._propValues[this._propNames[1]] = this._color2.slice(0); | ||
55 | if (this._shader && this._shader['default']) { | 57 | if (this._shader && this._shader['default']) { |
56 | this._shader['default'].u_color2.set(c); | 58 | this._shader['default'].u_color2.set(c); |
57 | } | 59 | } |
@@ -64,6 +66,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() { | |||
64 | 66 | ||
65 | this.setColor3 = function (c) { | 67 | this.setColor3 = function (c) { |
66 | this._color3 = c.slice(); | 68 | this._color3 = c.slice(); |
69 | this._propValues[this._propNames[2]] = this._color3.slice(0); | ||
67 | if (this._shader && this._shader['default']) { | 70 | if (this._shader && this._shader['default']) { |
68 | this._shader['default'].u_color3.set(c); | 71 | this._shader['default'].u_color3.set(c); |
69 | } | 72 | } |
@@ -75,6 +78,7 @@ var RadialGradientMaterial = function RadialGradientMaterial() { | |||
75 | 78 | ||
76 | this.setColor4 = function (c) { | 79 | this.setColor4 = function (c) { |
77 | this._color4 = c.slice(); | 80 | this._color4 = c.slice(); |
81 | this._propValues[this._propNames[3]] = this._color4.slice(0); | ||
78 | if (this._shader && this._shader['default']) { | 82 | if (this._shader && this._shader['default']) { |
79 | this._shader['default'].u_color4.set(c); | 83 | this._shader['default'].u_color4.set(c); |
80 | } | 84 | } |
diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js index 2176c6d5..205ecd90 100755 --- a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js +++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js | |||
@@ -51,14 +51,15 @@ exports.MaterialsLibraryPanel = Montage.create(Component, { | |||
51 | 51 | ||
52 | handleNodeActivation: { | 52 | handleNodeActivation: { |
53 | value:function(obj) { | 53 | value:function(obj) { |
54 | this._showMaterialPopup(obj.id); | 54 | this._showMaterialPopup({ materialId: obj.id }); |
55 | } | 55 | } |
56 | }, | 56 | }, |
57 | 57 | ||
58 | handleShowMaterialPopup: { | 58 | handleShowMaterialPopup: { |
59 | enumerable: false, | 59 | enumerable: false, |
60 | value: function (event) { | 60 | value: function (event) { |
61 | this._showMaterialPopup(event.detail.materialId); | 61 | //this._showMaterialPopup(event.detail.materialId); |
62 | this._showMaterialPopup(event.detail); | ||
62 | } | 63 | } |
63 | }, | 64 | }, |
64 | 65 | ||
@@ -73,9 +74,9 @@ exports.MaterialsLibraryPanel = Montage.create(Component, { | |||
73 | 74 | ||
74 | _showMaterialPopup: { |