aboutsummaryrefslogtreecommitdiff
path: root/js/lib/rdge/materials/star-material.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/lib/rdge/materials/star-material.js')
-rw-r--r--js/lib/rdge/materials/star-material.js18
1 files changed, 12 insertions, 6 deletions
diff --git a/js/lib/rdge/materials/star-material.js b/js/lib/rdge/materials/star-material.js
index f3f4474d..000d44b0 100644
--- a/js/lib/rdge/materials/star-material.js
+++ b/js/lib/rdge/materials/star-material.js
@@ -5,6 +5,7 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
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 StarMaterial = function StarMaterial() { 10var StarMaterial = function StarMaterial() {
10 /////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////
@@ -30,16 +31,17 @@ var StarMaterial = function StarMaterial() {
30 /////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////
31 // duplcate method requirde 32 // duplcate method requirde
32 this.dup = function () { 33 this.dup = function () {
33 // allocate a new uber material 34 // get the current values;
34 var newMat = new StarMaterial();
35
36 // copy over the current values;
37 var propNames = [], propValues = [], propTypes = [], propLabels = []; 35 var propNames = [], propValues = [], propTypes = [], propLabels = [];
38 this.getAllProperties(propNames, propValues, propTypes, propLabels); 36 this.getAllProperties(propNames, propValues, propTypes, propLabels);
37
38 // allocate a new material
39 var newMat = new StarMaterial();
40
41 // copy over the current values;
39 var n = propNames.length; 42 var n = propNames.length;
40 for (var i = 0; i < n; i++) { 43 for (var i = 0; i < n; i++)
41 newMat.setProperty(propNames[i], propValues[i]); 44 newMat.setProperty(propNames[i], propValues[i]);
42 }
43 45
44 return newMat; 46 return newMat;
45 }; 47 };
@@ -62,6 +64,10 @@ var StarMaterial = function StarMaterial() {
62 this._shader['default'].u_time.set([this._time]); 64 this._shader['default'].u_time.set([this._time]);
63 } 65 }
64 66
67 // set up the texture
68 var texMapName = this._propValues[this._propNames[0]];
69 this._glTex = new Texture( world, texMapName );
70
65 // set the shader values in the shader 71 // set the shader values in the shader
66 this.updateTexture(); 72 this.updateTexture();
67 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]); 73 this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);