Open sgrove opened 9 years ago
This shader:
(def program-source (p/program {:vertex-shader {(g/gl-position) (-> u-p-matrix (g/* u-mv-matrix) (g/* (g/vec4 a-position 1))) v-texture-coord a-texture-coord v-light-weighting (g/if u-use-lighting (let [transformed-normal (g/* u-n-matrix a-vertex-normal) directional-light-weighting (g/max (g/dot transformed-normal u-lighting-direction) 0.0)] (g/* directional-light-weighting (g/+ u-ambient-color u-directional-color))) (g/vec3 1 1 1))}})}))
is output as:
uniform mat3 uNMatrix; uniform mat4 uMVMatrix; uniform mat4 uPMatrix; uniform vec3 uAmbientColor; uniform vec3 uDirectionalColor; uniform vec3 uLightingDirection; attribute vec3 aVertexNormal; attribute vec3 aVertexPosition; attribute vec2 aTextureCoord; uniform bool uUseLighting; varying mediump vec2 vTextureCoord; varying mediump vec3 vLightWeighting; void main(void){ vec3 v90; if(uUseLighting){ (v90 = (max(dot((uNMatrix * aVertexNormal), uLightingDirection), 0) * (uAmbientColor + uDirectionalColor)));} else { (v90 = vec3(1, 1, 1));} (gl_Position = ((uPMatrix * uMVMatrix) * vec4(aVertexPosition, 1))); (vTextureCoord = aTextureCoord); (vLightWeighting = v90); }
And will fail because the 0.0 is output as 0, and according to this max requires a float. There also doesn't seem to be any casting functions to manually work around this for the time being.
0.0
0
max
This shader:
is output as:
And will fail because the
0.0
is output as0
, and according to thismax
requires a float. There also doesn't seem to be any casting functions to manually work around this for the time being.