aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/deform-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/deform-material.js')
-rw-r--r--js/lib/rdge/materials/deform-material.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/js/lib/rdge/materials/deform-material.js b/js/lib/rdge/materials/deform-material.js
index 328330bf..c7f9cadc 100644
--- a/js/lib/rdge/materials/deform-material.js
+++ b/js/lib/rdge/materials/deform-material.js
@@ -5,6 +5,7 @@
5 </copyright> */ 5 </copyright> */
6 6
7var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; 7var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial;
8var Texture = require("js/lib/rdge/texture").Texture;
8 9
9var DeformMaterial = function DeformMaterial() { 10var DeformMaterial = function DeformMaterial() {
10 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
@@ -36,13 +37,16 @@ var DeformMaterial = function DeformMaterial() {
36 // Methods 37 // Methods
37 /////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////
38 // duplcate method requirde 39 // duplcate method requirde
39 this.dup = function (world) { 40 this.dup = function (world)
40 // allocate a new uber material 41 {
41 var newMat = new DeformMaterial(); 42 // get the current values;
42
43 // copy over the current values;
44 var propNames = [], propValues = [], propTypes = [], propLabels = []; 43 var propNames = [], propValues = [], propTypes = [], propLabels = [];
45 this.getAllProperties(propNames, propValues, propTypes, propLabels); 44 this.getAllProperties(propNames, propValues, propTypes, propLabels);
45
46 // allocate a new material
47 var newMat = new DeformMaterial();
48
49 // copy over the current values;
46 var n = propNames.length; 50 var n = propNames.length;
47 for (var i = 0; i < n; i++) 51 for (var i = 0; i < n; i++)
48 newMat.setProperty(propNames[i], propValues[i]); 52 newMat.setProperty(propNames[i], propValues[i]);
@@ -68,6 +72,10 @@ var DeformMaterial = function DeformMaterial() {
68 this._shader['default'].u_time.set([this._time]); 72 this._shader['default'].u_time.set([this._time]);
69 } 73 }
70 74
75 // set up the texture
76 var texMapName = this._propValues[this._propNames[0]];
77 this._glTex = new Texture( world, texMapName );
78
71 // set the shader values in the shader 79 // set the shader values in the shader
72 this.updateTexture(); 80 this.updateTexture();
73 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); 81 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);