aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/flag-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/flag-material.js')
-rw-r--r--js/lib/rdge/materials/flag-material.js27
1 files changed, 15 insertions, 12 deletions
diff --git a/js/lib/rdge/materials/flag-material.js b/js/lib/rdge/materials/flag-material.js
index 8d4d1ee3..312ca1c1 100644
--- a/js/lib/rdge/materials/flag-material.js
+++ b/js/lib/rdge/materials/flag-material.js
@@ -5,6 +5,7 @@
5 </copyright> */ 5 </copyright> */
6 6
7 7
8var Material = require("js/lib/rdge/materials/material").Material;
8var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial; 9var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial;
9var Texture = require("js/lib/rdge/texture").Texture; 10var Texture = require("js/lib/rdge/texture").Texture;
10 11
@@ -47,19 +48,21 @@ var FlagMaterial = function FlagMaterial() {
47 // Methods 48 // Methods
48 /////////////////////////////////////////////////////////////////////// 49 ///////////////////////////////////////////////////////////////////////
49 // duplcate method requirde 50 // duplcate method requirde
50 this.dup = function( world ) { 51 this.dup = function( world )
51 // allocate a new uber material 52 {
52 var newMat = new FlagMaterial(); 53 // get the current values;
54 var propNames = [], propValues = [], propTypes = [], propLabels = [];
55 this.getAllProperties(propNames, propValues, propTypes, propLabels);
56
57 // allocate a new uber material
58 var newMat = new FlagMaterial();
53 59
54 // copy over the current values; 60 // copy over the current values;
55 var propNames = [], propValues = [], propTypes = [], propLabels = []; 61 var n = propNames.length;
56 this.getAllProperties( propNames, propValues, propTypes, propLabels); 62 for (var i = 0; i < n; i++)
57 var n = propNames.length; 63 newMat.setProperty(propNames[i], propValues[i]);
58 for (var i=0; i<n; i++) {
59 newMat.setProperty( propNames[i], propValues[i] );
60 }
61 64
62 return newMat; 65 return newMat;
63 }; 66 };
64 67
65 this.init = function( world ) 68 this.init = function( world )
@@ -68,12 +71,12 @@ var FlagMaterial = function FlagMaterial() {
68 if (world) this.setWorld( world ); 71 if (world) this.setWorld( world );
69 72
70 // set up the shader 73 // set up the shader
71 this._shader = new jshader(); 74 this._shader = new RDGE.jshader();
72 this._shader.def = flagMaterialDef; 75 this._shader.def = flagMaterialDef;
73 this._shader.init(); 76 this._shader.init();
74 77
75 // set up the material node 78 // set up the material node
76 this._materialNode = createMaterialNode("flagMaterial" + "_" + world.generateUniqueNodeID()); 79 this._materialNode = RDGE.createMaterialNode("flagMaterial" + "_" + world.generateUniqueNodeID());
77 this._materialNode.setShader(this._shader); 80 this._materialNode.setShader(this._shader);
78 81
79 this._time = 0; 82 this._time = 0;