diff options
Diffstat (limited to 'js/helper-classes/RDGE/Materials/FlatMaterial.js')
-rw-r--r-- | js/helper-classes/RDGE/Materials/FlatMaterial.js | 53 |
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 a5c079a8..a250dc0a 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 | ||
@@ -114,10 +126,11 @@ function FlatMaterial() | |||
114 | 126 | ||
115 | return rtnStr; | 127 | return rtnStr; |
116 | } | 128 | } |
117 | } | ||
118 | 129 | ||
119 | // used to create unique names | 130 | this.update = function( time ) |
120 | var flatMaterialCounter = 0; | 131 | { |
132 | } | ||
133 | } | ||
121 | 134 | ||
122 | /////////////////////////////////////////////////////////////////////////////////////// | 135 | /////////////////////////////////////////////////////////////////////////////////////// |
123 | // RDGE shader | 136 | // RDGE shader |
@@ -126,35 +139,33 @@ var flatMaterialCounter = 0; | |||
126 | flatShaderDef = | 139 | flatShaderDef = |
127 | { | 140 | { |
128 | 'shaders': { // shader files | 141 | 'shaders': { // shader files |
129 | 'defaultVShader': "\ | 142 | //'defaultVShader':"assets/shaders/Taper.vert.glsl", |
130 | uniform mat4 u_mvMatrix;\ | 143 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", |
131 | uniform mat4 u_projMatrix;\ | 144 | 'defaultFShader':"assets/shaders/Basic.frag.glsl", |
132 | attribute vec3 a_pos;\ | ||
133 | void main() {\ | ||
134 | gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ | ||
135 | }", | ||
136 | 'defaultFShader': "\ | ||
137 | precision highp float;\ | ||
138 | uniform vec4 color;\ | ||
139 | void main() {\ | ||
140 | gl_FragColor = color;\ | ||
141 | }", | ||
142 | }, | 145 | }, |
143 | 'techniques': { // rendering control | 146 | 'techniques': { // rendering control |
144 | 'colorMe':[ // simple color pass | 147 | 'colorMe':[ // simple color pass |
145 | { | 148 | { |
146 | 'vshader' : 'defaultVShader', | 149 | 'vshader' : 'defaultVShader', |
147 | 'fshader' : 'defaultFShader', | 150 | 'fshader' : 'defaultFShader', |
148 | 151 | ||
149 | // attributes | 152 | // attributes |
150 | 'attributes' : | 153 | 'attributes' : |
151 | { | 154 | { |
152 | 'a_pos' : { 'type' : 'vec3' } // only using position for this shader | 155 | 'vert' : { 'type' : 'vec3' }, |
156 | 'normal' : { 'type' : 'vec3' }, | ||
157 | 'texcoord' : { 'type' : 'vec2' }, | ||
153 | }, | 158 | }, |
154 | // attributes | 159 | // attributes |
155 | 'params' : | 160 | 'params' : |
156 | { | 161 | { |
157 | 'color' : { 'type' : 'vec4' } | 162 | 'color' : { 'type' : 'vec4' }, |
163 | |||
164 | //'u_limit1': { 'type': 'float' }, | ||
165 | //'u_limit2': { 'type': 'float' }, | ||
166 | //'u_limit3': { 'type': 'float' }, | ||
167 | //'u_center': { 'type': 'float' }, | ||
168 | //'u_taperAmount': { 'type': 'float' } | ||
158 | }, | 169 | }, |
159 | }, | 170 | }, |
160 | ] | 171 | ] |