aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/julia-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/julia-material.js')
-rw-r--r--js/lib/rdge/materials/julia-material.js23
1 files changed, 15 insertions, 8 deletions
diff --git a/js/lib/rdge/materials/julia-material.js b/js/lib/rdge/materials/julia-material.js
index 7aeec3dc..a06b1771 100644
--- a/js/lib/rdge/materials/julia-material.js
+++ b/js/lib/rdge/materials/julia-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 JuliaMaterial = function JuliaMaterial() { 10var JuliaMaterial = function JuliaMaterial() {
10 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
@@ -28,17 +29,19 @@ var JuliaMaterial = function JuliaMaterial() {
28 /////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////
29 // duplcate method requirde 30 // duplcate method requirde
30 this.dup = function( world ) { 31 this.dup = function( world ) {
31 // allocate a new uber material 32 // get the current values;
32 var newMat = new JuliaMaterial(); 33 var propNames = [], propValues = [], propTypes = [], propLabels = [];
34 this.getAllProperties(propNames, propValues, propTypes, propLabels);
35
36 // allocate a new material
37 var newMat = new JuliaMaterial();
33 38
34 // copy over the current values; 39 // copy over the current values;
35 var propNames = [], propValues = [], propTypes = [], propLabels = []; 40 var n = propNames.length;
36 this.getAllProperties( propNames, propValues, propTypes, propLabels); 41 for (var i = 0; i < n; i++)
37 var n = propNames.length; 42 newMat.setProperty(propNames[i], propValues[i]);
38 for (var i=0; i<n; i++)
39 newMat.setProperty( propNames[i], propValues[i] );
40 43
41 return newMat; 44 return newMat;
42 }; 45 };
43 46
44 this.init = function( world ) { 47 this.init = function( world ) {
@@ -59,6 +62,10 @@ var JuliaMaterial = function JuliaMaterial() {
59 this._shader['default'].u_time.set( [this._time] ); 62 this._shader['default'].u_time.set( [this._time] );
60 } 63 }
61 64
65 // set up the texture
66 var texMapName = this._propValues[this._propNames[0]];
67 this._glTex = new Texture( world, texMapName );
68
62 // set the shader values in the shader 69 // set the shader values in the shader
63 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] ); 70 this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
64 this.update( 0 ); 71 this.update( 0 );