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/taper-material.js | 74 ++++----------------------------- 1 file changed, 9 insertions(+), 65 deletions(-) (limited to 'js/lib/rdge/materials/taper-material.js') diff --git a/js/lib/rdge/materials/taper-material.js b/js/lib/rdge/materials/taper-material.js index c491fe61..a44314b6 100644 --- a/js/lib/rdge/materials/taper-material.js +++ b/js/lib/rdge/materials/taper-material.js @@ -31,6 +31,8 @@ var TaperMaterial = function TaperMaterial() this.getShaderName = function () { return this._shaderName; }; this.isAnimated = function () { return true; }; + this.getShaderDef = function() { return taperShaderDef; }; + this.hasVertexDeformation = function () { return this._hasVertexDeformation; }; this._hasVertexDeformation = true; this._vertexDeformationTolerance = 0.02; // should be a property @@ -38,8 +40,6 @@ var TaperMaterial = function TaperMaterial() /////////////////////////////////////////////////////////////////////// // Methods /////////////////////////////////////////////////////////////////////// - // duplcate method requirde - this.init = function (world) { this.setWorld(world); @@ -50,10 +50,15 @@ var TaperMaterial = function TaperMaterial() // set up the material node this._materialNode = RDGE.createMaterialNode("taperMaterial" + "_" + world.generateUniqueNodeID()); - this._materialNode.setShader(this._shader); + + this._time = 0; + if (this._shader && this._shader['default']) { + this._shader['default'].u_time.set([this._time]); + } + this._materialNode.setShader(this._shader); // initialize the taper properties - this.updateShaderValues(); + this.setShaderValues(); }; @@ -75,54 +80,6 @@ var TaperMaterial = function TaperMaterial() this._propValues[this._propNames[6]] = 0.9; this._propValues[this._propNames[7]] = 1.0; - this.setProperty = function (prop, value) - { - // make sure we have legitimate input - if (this.validateProperty(prop, value)) - this._propValues[prop] = value; - - this.updateShaderValues(); - }; - - this.exportJSON = function () { - var jObj = - { - 'material': this.getShaderName(), - 'name': this.getName() - }; - - var n = this._propNames.length; - for (var i=0; i