aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/RDGE/Materials/FlatMaterial.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/helper-classes/RDGE/Materials/FlatMaterial.js')
-rw-r--r--js/helper-classes/RDGE/Materials/FlatMaterial.js33
1 files changed, 18 insertions, 15 deletions
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js
index e2f23d75..a250dc0a 100644
--- a/js/helper-classes/RDGE/Materials/FlatMaterial.js
+++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js
@@ -26,10 +26,13 @@ function FlatMaterial()
26 /////////////////////////////////////////////////////////////////////// 26 ///////////////////////////////////////////////////////////////////////
27 // Property Accessors 27 // Property Accessors
28 /////////////////////////////////////////////////////////////////////// 28 ///////////////////////////////////////////////////////////////////////
29 this.getColor = function() { return this._color; } 29 this.getColor = function() { return this._color; }
30 this.getShaderName = function() { return this._shaderName; } 30 this.getShaderName = function() { return this._shaderName; }
31 31
32 this.isAnimated = function() { return false; } 32 this.isAnimated = function() { return false; }
33 this.hasVertexDeformation = function() { return true; }
34 this._hasVertexDeformation = true;
35 this._vertexDeformationTolerance = 0.2;
33 36
34 //////////////////////////////////s///////////////////////////////////// 37 //////////////////////////////////s/////////////////////////////////////
35 // Methods 38 // Methods
@@ -55,6 +58,7 @@ function FlatMaterial()
55// this._shader.colorMe.u_limit1.set( [0.25] ); 58// this._shader.colorMe.u_limit1.set( [0.25] );
56// this._shader.colorMe.u_limit2.set( [0.5] ); 59// this._shader.colorMe.u_limit2.set( [0.5] );
57// this._shader.colorMe.u_limit3.set( [0.75] ); 60// this._shader.colorMe.u_limit3.set( [0.75] );
61// this._shader.colorMe.u_center.set( [0.0] );
58// this._shader.colorMe.u_taperAmount.set( [0.5] ); 62// this._shader.colorMe.u_taperAmount.set( [0.5] );
59 } 63 }
60 64
@@ -76,7 +80,7 @@ function FlatMaterial()
76 { 80 {
77 this._propValues[prop] = value; 81 this._propValues[prop] = value;
78 if (this._shader && this._shader.colorMe) 82 if (this._shader && this._shader.colorMe)
79 this._shader.colorMe[prop].set(value); 83 this._shader.colorMe[prop].set(value);
80 } 84 }
81 } 85 }
82 /////////////////////////////////////////////////////////////////////// 86 ///////////////////////////////////////////////////////////////////////
@@ -96,11 +100,11 @@ function FlatMaterial()
96 return exportStr; 100 return exportStr;
97 } 101 }
98 102
99 this.import = function( importStr ) 103 this.import = function( importStr )
100 { 104 {
101 var pu = new ParseUtils( importStr ); 105 var pu = new ParseUtils( importStr );
102 var material = pu.nextValue( "material: " ); 106 var material = pu.nextValue( "material: " );
103 if (material != this.getShaderName()) throw new Error( "ill-formed material" ); 107 if (material != this.getShaderName()) throw new Error( "ill-formed material" );
104 this.setName( pu.nextValue( "name: ") ); 108 this.setName( pu.nextValue( "name: ") );
105 109
106 var rtnStr; 110 var rtnStr;
@@ -110,7 +114,7 @@ function FlatMaterial()
110 114
111 this.setProperty( "color", color); 115 this.setProperty( "color", color);
112 116
113 var endKey = "endMaterial\n"; 117 var endKey = "endMaterial\n";
114 var index = importStr.indexOf( endKey ); 118 var index = importStr.indexOf( endKey );
115 index += endKey.length; 119 index += endKey.length;
116 rtnStr = importStr.substr( index ); 120 rtnStr = importStr.substr( index );
@@ -120,16 +124,13 @@ function FlatMaterial()
120 throw new Error( "could not import material: " + importStr ); 124 throw new Error( "could not import material: " + importStr );
121 } 125 }
122 126
123 return rtnStr; 127 return rtnStr;
124 } 128 }
125 129
126 this.update = function( time ) 130 this.update = function( time )
127 { 131 {
128 } 132 }
129
130} 133}
131// used to create unique names
132var flatMaterialCounter = 0;
133 134
134/////////////////////////////////////////////////////////////////////////////////////// 135///////////////////////////////////////////////////////////////////////////////////////
135// RDGE shader 136// RDGE shader
@@ -138,6 +139,7 @@ var flatMaterialCounter = 0;
138flatShaderDef = 139flatShaderDef =
139{ 140{
140 'shaders': { // shader files 141 'shaders': { // shader files
142 //'defaultVShader':"assets/shaders/Taper.vert.glsl",
141 'defaultVShader':"assets/shaders/Basic.vert.glsl", 143 'defaultVShader':"assets/shaders/Basic.vert.glsl",
142 'defaultFShader':"assets/shaders/Basic.frag.glsl", 144 'defaultFShader':"assets/shaders/Basic.frag.glsl",
143 }, 145 },
@@ -162,6 +164,7 @@ flatShaderDef =
162 //'u_limit1': { 'type': 'float' }, 164 //'u_limit1': { 'type': 'float' },
163 //'u_limit2': { 'type': 'float' }, 165 //'u_limit2': { 'type': 'float' },
164 //'u_limit3': { 'type': 'float' }, 166 //'u_limit3': { 'type': 'float' },
167 //'u_center': { 'type': 'float' },
165 //'u_taperAmount': { 'type': 'float' } 168 //'u_taperAmount': { 'type': 'float' }
166 }, 169 },
167 }, 170 },