From 947bad893335e1023bcbe177ff8db454c27c4bf8 Mon Sep 17 00:00:00 2001
From: hwc487
Date: Fri, 30 Mar 2012 06:23:53 -0700
Subject: converted materials to new texture structure

---
 js/lib/rdge/materials/z-invert-material.js | 5 +++++
 1 file changed, 5 insertions(+)

(limited to 'js/lib/rdge/materials/z-invert-material.js')

diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js
index a0d20de5..0d62d1b0 100644
--- a/js/lib/rdge/materials/z-invert-material.js
+++ b/js/lib/rdge/materials/z-invert-material.js
@@ -6,6 +6,7 @@
 
 
 var PulseMaterial = require("js/lib/rdge/materials/pulse-material").PulseMaterial;
+var Texture = require("js/lib/rdge/texture").Texture;
 
 var ZInvertMaterial = function ZInvertMaterial() {
     ///////////////////////////////////////////////////////////////////////
@@ -63,6 +64,10 @@ var ZInvertMaterial = function ZInvertMaterial() {
 			this._shader['default'].u_time.set( [this._time] );
         }
 
+        // set up the texture
+        var texMapName = this._propValues[this._propNames[0]];
+        this._glTex = new Texture( world, texMapName );
+
 		// set the shader values in the shader
 		this.updateTexture();
 		this.setResolution( [world.getViewportWidth(),world.getViewportHeight()] );
-- 
cgit v1.2.3


From 5a1965bf2ed9a54601ca16fd67555335c510ce08 Mon Sep 17 00:00:00 2001
From: hwc487
Date: Thu, 26 Apr 2012 16:40:05 -0700
Subject: Update materials to the new texture model.

Create local world for deleted source canvases
---
 js/lib/rdge/materials/z-invert-material.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'js/lib/rdge/materials/z-invert-material.js')

diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js
index c35b7d7f..e1149f8b 100644
--- a/js/lib/rdge/materials/z-invert-material.js
+++ b/js/lib/rdge/materials/z-invert-material.js
@@ -32,16 +32,17 @@ var ZInvertMaterial = function ZInvertMaterial() {
     ///////////////////////////////////////////////////////////////////////
     // duplicate method required
     this.dup = function (world) {
-        // allocate a new uber material
-        var newMat = new ZInvertMaterial();
-
-        // copy over the current values;
+        // get the current values;
         var propNames = [], propValues = [], propTypes = [], propLabels = [];
         this.getAllProperties(propNames, propValues, propTypes, propLabels);
+        
+        // allocate a new material
+        var newMat = new ZInvertMaterial();
+
+		// copy over the current values;
         var n = propNames.length;
-        for (var i = 0; i < n; i++) {
+        for (var i = 0; i < n; i++)
             newMat.setProperty(propNames[i], propValues[i]);
-        }
 
         return newMat;
     };
-- 
cgit v1.2.3


From d4ca478ad313c6c20834e410ba14ad3a5e7b20bf Mon Sep 17 00:00:00 2001
From: hwc487
Date: Tue, 12 Jun 2012 10:28:26 -0700
Subject: Material cleanup & bug fixes.

---
 js/lib/rdge/materials/z-invert-material.js | 49 +++++++++++++-----------------
 1 file changed, 21 insertions(+), 28 deletions(-)

(limited to 'js/lib/rdge/materials/z-invert-material.js')

diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js
index e1149f8b..99b835b3 100644
--- a/js/lib/rdge/materials/z-invert-material.js
+++ b/js/lib/rdge/materials/z-invert-material.js
@@ -15,37 +15,33 @@ var ZInvertMaterial = function ZInvertMaterial() {
     this._name = "ZInvertMaterial";
     this._shaderName = "zinvert";
 
-    this._texMap = 'assets/images/rocky-normal.jpg';
+    this._defaultTexMap = 'assets/images/rocky-normal.jpg';
 
     this._time = 0.0;
     this._dTime = 0.01;
 
-    ///////////////////////////////////////////////////////////////////////
-    // Properties
-    ///////////////////////////////////////////////////////////////////////
-    // all defined in parent PulseMaterial.js
-    // load the local default value
-    this._propValues[this._propNames[0]] = this._texMap.slice(0);
+	this.isAnimated			= function()			{  return true;				};
+	this.getShaderDef		= function()			{  return zInvertMaterialDef;	};
+
+	///////////////////////////////////////////////////////////////////////
+	// Properties
+	///////////////////////////////////////////////////////////////////////
+	// all defined in parent PulseMaterial.js
+	// load the local default value
+	this._propNames			= ["u_tex0",		"u_speed"];
+	this._propLabels		= ["Texture map",	"Speed"];
+	this._propTypes			= ["file",			"float"];
+
+	var u_tex_index			= 0,
+		u_speed_index		= 1;
+
+	this._propValues		= [];
+	this._propValues[ this._propNames[u_tex_index		] ]	= this._defaultTexMap.slice(0);
+	this._propValues[ this._propNames[u_speed_index		] ]	= 1.0;
 
     ///////////////////////////////////////////////////////////////////////
     // Methods
     ///////////////////////////////////////////////////////////////////////
-    // duplicate method required
-    this.dup = function (world) {
-        // get the current values;
-        var propNames = [], propValues = [], propTypes = [], propLabels = [];
-        this.getAllProperties(propNames, propValues, propTypes, propLabels);
-        
-        // allocate a new material
-        var newMat = new ZInvertMaterial();
-
-		// copy over the current values;
-        var n = propNames.length;
-        for (var i = 0; i < n; i++)
-            newMat.setProperty(propNames[i], propValues[i]);
-
-        return newMat;
-    };
 
     this.init = function (world) {
         // save the world
@@ -65,12 +61,8 @@ var ZInvertMaterial = function ZInvertMaterial() {
             this._shader['default'].u_time.set([this._time]);
         }
 
-        // set up the texture
-        var texMapName = this._propValues[this._propNames[0]];
-        this._glTex = new Texture( world, texMapName );
-
         // set the shader values in the shader
-        this.updateTexture();
+		this.setShaderValues();
         this.setResolution([world.getViewportWidth(), world.getViewportHeight()]);
         this.update(0);
     };
@@ -105,6 +97,7 @@ var zInvertMaterialDef =
 				{
 				    'u_tex0': { 'type': 'tex2d' },
 				    'u_time': { 'type': 'float' },
+				    'u_speed': { 'type': 'float' },
 				    'u_resolution': { 'type': 'vec2' }
 				},
 
-- 
cgit v1.2.3


From a7aa51e6b91623772eef54b827616432838b560e Mon Sep 17 00:00:00 2001
From: hwc487
Date: Wed, 13 Jun 2012 13:56:10 -0700
Subject: Material bug fixes - reset texture array.

---
 js/lib/rdge/materials/z-invert-material.js | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'js/lib/rdge/materials/z-invert-material.js')

diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js
index 99b835b3..f1526b39 100644
--- a/js/lib/rdge/materials/z-invert-material.js
+++ b/js/lib/rdge/materials/z-invert-material.js
@@ -20,6 +20,9 @@ var ZInvertMaterial = function ZInvertMaterial() {
     this._time = 0.0;
     this._dTime = 0.01;
 
+    // array textures indexed by shader uniform name
+    this._glTextures = [];
+
 	this.isAnimated			= function()			{  return true;				};
 	this.getShaderDef		= function()			{  return zInvertMaterialDef;	};
 
-- 
cgit v1.2.3


From f0fc7a5678093cce986bd99fef2c5c88add19b68 Mon Sep 17 00:00:00 2001
From: hwc487
Date: Thu, 14 Jun 2012 16:09:31 -0700
Subject: Fix for line color.

Name change for all materials
---
 js/lib/rdge/materials/z-invert-material.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'js/lib/rdge/materials/z-invert-material.js')

diff --git a/js/lib/rdge/materials/z-invert-material.js b/js/lib/rdge/materials/z-invert-material.js
index f1526b39..b8870eb4 100644
--- a/js/lib/rdge/materials/z-invert-material.js
+++ b/js/lib/rdge/materials/z-invert-material.js
@@ -12,7 +12,7 @@ var ZInvertMaterial = function ZInvertMaterial() {
     ///////////////////////////////////////////////////////////////////////
     // Instance variables
     ///////////////////////////////////////////////////////////////////////
-    this._name = "ZInvertMaterial";
+    this._name = "Z-Invert";
     this._shaderName = "zinvert";
 
     this._defaultTexMap = 'assets/images/rocky-normal.jpg';
-- 
cgit v1.2.3