From 3ba2be686e1981c8af3054ead1c7bb59af8b5d66 Mon Sep 17 00:00:00 2001 From: Nivesh Rajbhandari Date: Thu, 9 Feb 2012 14:18:20 -0800 Subject: Updated linear and radial gradient materials import/export routines. Signed-off-by: Nivesh Rajbhandari --- js/helper-classes/RDGE/Materials/FlatMaterial.js | 45 +++++++++--------------- 1 file changed, 16 insertions(+), 29 deletions(-) (limited to 'js/helper-classes/RDGE/Materials/FlatMaterial.js') diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js index a250dc0a..570e7f9e 100644 --- a/js/helper-classes/RDGE/Materials/FlatMaterial.js +++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js @@ -26,11 +26,11 @@ function FlatMaterial() /////////////////////////////////////////////////////////////////////// // Property Accessors /////////////////////////////////////////////////////////////////////// - this.getColor = function() { return this._color; } - this.getShaderName = function() { return this._shaderName; } + this.getColor = function() { return this._color; }; + this.getShaderName = function() { return this._shaderName; }; - this.isAnimated = function() { return false; } - this.hasVertexDeformation = function() { return true; } + this.isAnimated = function() { return false; }; + this.hasVertexDeformation = function() { return true; }; this._hasVertexDeformation = true; this._vertexDeformationTolerance = 0.2; @@ -38,7 +38,7 @@ function FlatMaterial() // Methods /////////////////////////////////////////////////////////////////////// // duplcate method requirde - this.dup = function() { return new FlatMaterial(); } + this.dup = function() { return new FlatMaterial(); } ; this.init = function() { @@ -53,14 +53,7 @@ function FlatMaterial() // set up the material node this._materialNode = createMaterialNode("flatMaterial"); this._materialNode.setShader(this._shader); - - // initialize the taper properties -// this._shader.colorMe.u_limit1.set( [0.25] ); -// this._shader.colorMe.u_limit2.set( [0.5] ); -// this._shader.colorMe.u_limit3.set( [0.75] ); -// this._shader.colorMe.u_center.set( [0.0] ); -// this._shader.colorMe.u_taperAmount.set( [0.5] ); - } + }; /////////////////////////////////////////////////////////////////////// @@ -82,7 +75,7 @@ function FlatMaterial() if (this._shader && this._shader.colorMe) this._shader.colorMe[prop].set(value); } - } + }; /////////////////////////////////////////////////////////////////////// this.export = function() @@ -98,7 +91,7 @@ function FlatMaterial() exportStr += "endMaterial\n"; return exportStr; - } + }; this.import = function( importStr ) { @@ -125,11 +118,12 @@ function FlatMaterial() } return rtnStr; - } + }; this.update = function( time ) { - } + }; + } /////////////////////////////////////////////////////////////////////////////////////// @@ -139,9 +133,8 @@ function FlatMaterial() flatShaderDef = { 'shaders': { // shader files - //'defaultVShader':"assets/shaders/Taper.vert.glsl", 'defaultVShader':"assets/shaders/Basic.vert.glsl", - 'defaultFShader':"assets/shaders/Basic.frag.glsl", + 'defaultFShader':"assets/shaders/Basic.frag.glsl" }, 'techniques': { // rendering control 'colorMe':[ // simple color pass @@ -154,20 +147,14 @@ flatShaderDef = { 'vert' : { 'type' : 'vec3' }, 'normal' : { 'type' : 'vec3' }, - 'texcoord' : { 'type' : 'vec2' }, + 'texcoord' : { 'type' : 'vec2' } }, // attributes 'params' : { - 'color' : { 'type' : 'vec4' }, - - //'u_limit1': { 'type': 'float' }, - //'u_limit2': { 'type': 'float' }, - //'u_limit3': { 'type': 'float' }, - //'u_center': { 'type': 'float' }, - //'u_taperAmount': { 'type': 'float' } - }, - }, + 'color' : { 'type' : 'vec4' } + } + } ] } }; -- cgit v1.2.3