diff options
author | hwc487 | 2012-02-01 13:05:32 -0800 |
---|---|---|
committer | hwc487 | 2012-02-01 13:05:32 -0800 |
commit | b2ce8b819cc85a558d862c04965b7e65a6ce8640 (patch) | |
tree | 520fb12c07ba78f93d22f693369db45248c448d1 /js/helper-classes/RDGE/Materials | |
parent | aa1b4b78d9e1b9cc15529dbf7196b7ac8a88e260 (diff) | |
download | ninja-b2ce8b819cc85a558d862c04965b7e65a6ce8640.tar.gz |
changes to allow minimal rendering ofnon-animated materials.
Diffstat (limited to 'js/helper-classes/RDGE/Materials')
-rw-r--r-- | js/helper-classes/RDGE/Materials/FlatMaterial.js | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/js/helper-classes/RDGE/Materials/FlatMaterial.js b/js/helper-classes/RDGE/Materials/FlatMaterial.js index f342eef8..3e3ae25e 100644 --- a/js/helper-classes/RDGE/Materials/FlatMaterial.js +++ b/js/helper-classes/RDGE/Materials/FlatMaterial.js | |||
@@ -50,6 +50,12 @@ function FlatMaterial() | |||
50 | // set up the material node | 50 | // set up the material node |
51 | this._materialNode = createMaterialNode("flatMaterial"); | 51 | this._materialNode = createMaterialNode("flatMaterial"); |
52 | 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] ); | ||
53 | } | 59 | } |
54 | 60 | ||
55 | 61 | ||
@@ -102,10 +108,11 @@ function FlatMaterial() | |||
102 | var rtnStr = importStr.substr( index ); | 108 | var rtnStr = importStr.substr( index ); |
103 | return rtnStr; | 109 | return rtnStr; |
104 | } | 110 | } |
105 | } | ||
106 | 111 | ||
107 | // used to create unique names | 112 | this.update = function( time ) |
108 | var flatMaterialCounter = 0; | 113 | { |
114 | } | ||
115 | } | ||
109 | 116 | ||
110 | /////////////////////////////////////////////////////////////////////////////////////// | 117 | /////////////////////////////////////////////////////////////////////////////////////// |
111 | // RDGE shader | 118 | // RDGE shader |
@@ -114,35 +121,31 @@ var flatMaterialCounter = 0; | |||
114 | flatShaderDef = | 121 | flatShaderDef = |
115 | { | 122 | { |
116 | 'shaders': { // shader files | 123 | 'shaders': { // shader files |
117 | 'defaultVShader': "\ | 124 | 'defaultVShader':"assets/shaders/Basic.vert.glsl", |
118 | uniform mat4 u_mvMatrix;\ | 125 | 'defaultFShader':"assets/shaders/Basic.frag.glsl", |
119 | uniform mat4 u_projMatrix;\ | ||
120 | attribute vec3 a_pos;\ | ||
121 | void main() {\ | ||
122 | gl_Position = u_projMatrix * u_mvMatrix * vec4(a_pos,1.0);\ | ||
123 | }", | ||
124 | 'defaultFShader': "\ | ||
125 | precision highp float;\ | ||
126 | uniform vec4 color;\ | ||
127 | void main() {\ | ||
128 | gl_FragColor = color;\ | ||
129 | }", | ||
130 | }, | 126 | }, |
131 | 'techniques': { // rendering control | 127 | 'techniques': { // rendering control |
132 | 'colorMe':[ // simple color pass | 128 | 'colorMe':[ // simple color pass |
133 | { | 129 | { |
134 | 'vshader' : 'defaultVShader', | 130 | 'vshader' : 'defaultVShader', |
135 | 'fshader' : 'defaultFShader', | 131 | 'fshader' : 'defaultFShader', |
136 | 132 | ||
137 | // attributes | 133 | // attributes |
138 | 'attributes' : | 134 | 'attributes' : |
139 | { | 135 | { |
140 | 'a_pos' : { 'type' : 'vec3' } // only using position for this shader | 136 | 'vert' : { 'type' : 'vec3' }, |
137 | 'normal' : { 'type' : 'vec3' }, | ||
138 | 'texcoord' : { 'type' : 'vec2' }, | ||
141 | }, | 139 | }, |
142 | // attributes | 140 | // attributes |
143 | 'params' : | 141 | 'params' : |
144 | { | 142 | { |
145 | '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' } | ||
146 | }, | 149 | }, |
147 | }, | 150 | }, |
148 | ] | 151 | ] |