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

View file

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