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.js53
1 files changed, 32 insertions, 21 deletions
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js
index 5177a8a0..de039231 100644
--- a/js/helper-classes/RDGE/Materials/FlatMaterial.js
+++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js
@@ -26,8 +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
32 this.isAnimated = function() { return false; }
33 this.hasVertexDeformation = function() { return true; }
34 this._hasVertexDeformation = true;
35 this._vertexDeformationTolerance = 0.2;
31 36
32 //////////////////////////////////s///////////////////////////////////// 37 //////////////////////////////////s/////////////////////////////////////
33 // Methods 38 // Methods
@@ -48,6 +53,13 @@ function FlatMaterial()
48 // set up the material node 53 // set up the material node
49 this._materialNode = createMaterialNode("flatMaterial"); 54 this._materialNode = createMaterialNode("flatMaterial");
50 this._materialNode.setShader(this._shader); 55 this._materialNode.setShader(this._shader);
56
57 // initialize the taper properties
58// this._shader.colorMe.u_limit1.set( [0.25] );
59// this._shader.colorMe.u_limit2.set( [0.5] );
60// this._shader.colorMe.u_limit3.set( [0.75] );
61// this._shader.colorMe.u_center.set( [0.0] );
62// this._shader.colorMe.u_taperAmount.set( [0.5] );
51 } 63 }
52 64
53 65
@@ -100,10 +112,11 @@ function FlatMaterial()
100 var rtnStr = importStr.substr( index ); 112 var rtnStr = importStr.substr( index );
101 return rtnStr; 113 return rtnStr;
102 } 114 }
103}
104 115
105// used to create unique names 116 this.update = function( time )
106var flatMaterialCounter = 0; 117 {
118 }
119}
107 120
108/////////////////////////////////////////////////////////////////////////////////////// 121///////////////////////////////////////////////////////////////////////////////////////
109// RDGE shader 122// RDGE shader
@@ -112,35 +125,33 @@ var flatMaterialCounter = 0;
112flatShaderDef = 125flatShaderDef =
113{ 126{
114 'shaders': { // shader files 127 'shaders': { // shader files
115 'defaultVShader': "\ 128 //'defaultVShader':"assets/shaders/Taper.vert.glsl",
116 uniform mat4 u_mvMatrix;\ 129 'defaultVShader':"assets/shaders/Basic.vert.glsl",
117 uniform mat4 u_projMatrix;\ 130 'defaultFShader':"assets/shaders/Basic.frag.glsl",
118 attribute vec3 a_pos;\
119 void main() {\
120 gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\
121 }",
122 'defaultFShader': "\
123 precision highp float;\
124 uniform vec4 color;\
125 void main() {\
126 gl_FragColor = color;\
127 }",
128 }, 131 },
129 'techniques': { // rendering control 132 'techniques': { // rendering control
130 'colorMe':[ // simple color pass 133 'colorMe':[ // simple color pass
131 { 134 {
132 'vshader' : 'defaultVShader', 135 'vshader' : 'defaultVShader',
133 'fshader' : 'defaultFShader', 136 'fshader' : 'defaultFShader',
134 137
135 // attributes 138 // attributes
136 'attributes' : 139 'attributes' :
137 { 140 {
138 'a_pos' : { 'type' : 'vec3' } // only using position for this shader 141 'vert' : { 'type' : 'vec3' },
142 'normal' : { 'type' : 'vec3' },
143 'texcoord' : { 'type' : 'vec2' },
139 }, 144 },
140 // attributes 145 // attributes
141 'params' : 146 'params' :
142 { 147 {
143 'color' : { 'type' : 'vec4' } 148 'color' : { 'type' : 'vec4' },
149
150 //'u_limit1': { 'type': 'float' },
151 //'u_limit2': { 'type': 'float' },
152 //'u_limit3': { 'type': 'float' },
153 //'u_center': { 'type': 'float' },
154 //'u_taperAmount': { 'type': 'float' }
144 }, 155 },
145 }, 156 },
146 ] 157 ]