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