#extension GL_OES_element_index : enable // This shader is basic attribute vec3 aVertexPosition; attribute vec4 aVertexColour; attribute vec3 aVertexNormal; uniform mat4 uMVMatrix; uniform mat4 uMVINVMatrix; uniform mat4 uPMatrix; varying lowp vec4 vColor; varying lowp vec4 eyePos; uniform float pixelZoom; void main(void) { vec4 screenZ = uMVINVMatrix*vec4(0.0,0.0,1.0,1.0); // vec3 norm = normalize(aVertexNormal); vec3 lineY = vec3(norm.y*screenZ.z-norm.z*screenZ.y, norm.z*screenZ.x-norm.x*screenZ.z, norm.x*screenZ.y-norm.y*screenZ.x); lineY = normalize(lineY); float lineSize = pixelZoom*sqrt(aVertexNormal.x*aVertexNormal.x+aVertexNormal.y*aVertexNormal.y+aVertexNormal.z*aVertexNormal.z); gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition+lineSize*lineY,1.0); vColor = aVertexColour; eyePos = uMVMatrix * vec4(aVertexPosition,1.0); // //vec4 theVert = vec4(aVertexPosition+aVertexNormal,1.0); //gl_Position = uPMatrix * uMVMatrix * theVert; //vColor = aVertexColour; //eyePos = uMVMatrix * theVert; }