aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/mandel-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/mandel-material.js')
-rw-r--r--js/lib/rdge/materials/mandel-material.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/js/lib/rdge/materials/mandel-material.js b/js/lib/rdge/materials/mandel-material.js
index a82a4bfc..e75d74ba 100644
--- a/js/lib/rdge/materials/mandel-material.js
+++ b/js/lib/rdge/materials/mandel-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 MandelMaterial = function MandelMaterial() { 10var MandelMaterial = function MandelMaterial() {
10 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
@@ -38,18 +39,19 @@ var MandelMaterial = function MandelMaterial() {
38 /////////////////////////////////////////////////////////////////////// 39 ///////////////////////////////////////////////////////////////////////
39 // duplcate method requirde 40 // duplcate method requirde
40 this.dup = function( world ) { 41 this.dup = function( world ) {
41 // allocate a new uber material 42 // get the current values;
42 var newMat = new MandelMaterial(); 43 var propNames = [], propValues = [], propTypes = [], propLabels = [];
44 this.getAllProperties(propNames, propValues, propTypes, propLabels);
45
46 // allocate a new material
47 var newMat = new MandelMaterial();
43 48
44 // copy over the current values; 49 // copy over the current values;
45 var propNames = [], propValues = [], propTypes = [], propLabels = []; 50 var n = propNames.length;
46 this.getAllProperties( propNames, propValues, propTypes, propLabels); 51 for (var i = 0; i < n; i++)
47 var n = propNames.length; 52 newMat.setProperty(propNames[i], propValues[i]);
48 for (var i=0; i<n; i++) {
49 newMat.setProperty( propNames[i], propValues[i] );
50 }
51 53
52 return newMat; 54 return newMat;
53 }; 55 };
54 56
55 this.init = function( world ) { 57 this.init = function( world ) {
@@ -70,6 +72,10 @@ var MandelMaterial = function MandelMaterial() {
70 this._shader['default'].u_time.set( [this._time] ); 72 this._shader['default'].u_time.set( [this._time] );
71 } 73 }
72 74
75 // set up the texture
76 var texMapName = this._propValues[this._propNames[0]];
77 this._glTex = new Texture( world, texMapName );
78
73 // set the shader values in the shader 79 // set the shader values in the shader
74 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 80 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
75 this.update( 0 ); 81 this.update( 0 );