Let shaders be returned as arrays

This commit is contained in:
Christoph Diehl 2017-06-10 05:54:06 +02:00
parent 562ba9ebb7
commit 56d3cb3851
1 changed files with 125 additions and 133 deletions

View File

@ -3,8 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
make.shaders = {
fragment1: function () {
return random.pick([
fragment1: [
[
'#ifdef GL_ES',
'precision mediump float;',
@ -23,10 +22,8 @@ make.shaders = {
'gl_FragColor = vec4(texelColor.rgb * vLighting, texelColor.a);',
'}'
]
])
},
vertex1: function () {
return random.pick([
],
vertex1: [
[
'attribute vec4 aVertex;',
'attribute vec4 aColor;',
@ -56,10 +53,8 @@ make.shaders = {
'vLighting = ambientLight + (directionalLightColor * directional);',
'}'
]
])
},
fragment2: function () {
return random.pick([
],
fragment2: [
[
'varying highp vec2 vTextureCoord;',
'varying highp vec3 vLighting;',
@ -88,10 +83,8 @@ make.shaders = {
'gl_FragData[2]=vec4(specularFactor,specularHardness*0.1,0.0,1.0);',
'}'
]
])
},
vertex2: function () {
return random.pick([
],
vertex2: [
[
'attribute highp vec3 aVertexNormal;',
'attribute highp vec3 aVertexPosition;',
@ -134,8 +127,7 @@ make.shaders = {
'varyingUV = vertexUV;',
'}'
]
])
},
],
shaderPair: function (v, f) {
let i = random.number(v.length)
return {