-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshaders.js
More file actions
10 lines (10 loc) · 5.51 KB
/
Copy pathshaders.js
File metadata and controls
10 lines (10 loc) · 5.51 KB
1
2
3
4
5
6
7
8
9
10
shaders = { "X":"",
"fragment_shader_passage":" uniform float closedist; uniform float selindexlo; uniform float selindexhi; uniform float redalt; uniform float vfac; varying float altitude; varying vec4 vflat4; varying float vindex; float midlump(float v, float offset) { float lv = (mod(v*vfac + offset, 1.0) - 0.5)/0.5; return clamp(1.0 - lv*lv, 0.0, 1.0); } void main(void) { gl_FragColor = vec4(midlump(altitude, redalt), midlump(altitude, redalt-0.667)*0.98, midlump(altitude, redalt-0.333), 1.0); vec4 closecolour = vec4(1.0, 1.0, 1.0, 1.0); float fdepth = gl_FragCoord.z / gl_FragCoord.w; float cfac = clamp((closedist - fdepth)*0.1, 0.0, 0.81); gl_FragColor = mix(gl_FragColor, closecolour, cfac); float flatfac = max(0.0, max(max(abs(vflat4.x), abs(vflat4.y)), max(abs(vflat4.z), abs(vflat4.w))) - 510.0); gl_FragColor = mix(gl_FragColor, vec4(0.0, 0.0, 0.0, 1.0), flatfac); if ((selindexlo <= vindex) && (vindex < selindexhi)) gl_FragColor = mix(gl_FragColor, vec4(0.0, 1.0, 1.0, 1.0), 0.75); } ",
"vertex_shader_passage":" varying float altitude; varying vec4 vflat4; varying float vindex; attribute vec4 flat4; attribute float passageindex; void main() { altitude = position.y; vflat4 = flat4; vindex = passageindex; vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * mvPosition; } ",
"fragment_shader_centreline":" uniform float closedist; uniform float selindexlo; uniform float selindexhi; uniform float redalt; uniform float vfac; varying float altitude; varying float vcosslope; varying float vindex; float midlump(float v, float offset) { float lv = (mod(v*vfac + offset, 1.0) - 0.5)/0.5; return clamp(1.0 - lv*lv, 0.0, 1.0); } void main(void) { gl_FragColor = vec4(midlump(altitude, redalt), midlump(altitude, redalt-0.667)*0.98, midlump(altitude, redalt-0.333), 1.0); gl_FragColor = mix(gl_FragColor, vec4(0.0, 0.0, 0.0, 1.0), 0.6*(1.0-vcosslope)); vec4 closecolour = vec4(1.0, 1.0, 1.0, 1.0); float fdepth = gl_FragCoord.z / gl_FragCoord.w; float cfac = clamp((closedist - fdepth)*0.1, 0.0, 0.81); gl_FragColor = mix(gl_FragColor, closecolour, cfac); if ((selindexlo <= vindex) && (vindex < selindexhi)) gl_FragColor = mix(gl_FragColor, vec4(0.0, 1.0, 1.0, 1.0), 0.8); } ",
"vertex_shader_centreline":" attribute float cosslope; attribute float legindex; varying float altitude; varying float vcosslope; varying float vindex; void main() { altitude = position.y; vcosslope = cosslope; vindex = legindex; vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * mvPosition; } ",
"fragment_shader_textlabel":" uniform float closedist; uniform sampler2D texture; uniform float bselindex; varying vec2 vUv; void main() { vec2 uv = vec2(vUv.x, vUv.y); vec3 color = texture2D(texture, uv).rgb; if (color.y == 0.0) discard; gl_FragColor = vec4(color, 1.0); vec4 closecolour = vec4(1.0, 1.0, 1.0, 1.0); float fdepth = gl_FragCoord.z / gl_FragCoord.w; float cfac = clamp((closedist - fdepth)*0.1, 0.0, 0.81); gl_FragColor = mix(gl_FragColor, closecolour, (color.y >= 0.5 ? cfac : 0.0)); if (bselindex == 1.0) gl_FragColor = mix(gl_FragColor, vec4(0.0, 1.0, 1.0, 1.0), 0.8); } ",
"vertex_shader_textlabel":" uniform float aspect; uniform float pixelsize; uniform float textureaspect; varying vec2 vUv; void main() { vUv = uv; vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * mvPosition; float spixelsize = pixelsize*gl_Position.z; gl_Position.x += uv.x*spixelsize*textureaspect; gl_Position.y += uv.y*spixelsize*aspect; } ",
"vertex_shader_peaktriangle":" uniform float trianglesize; uniform float aspect; attribute float pcorner; void main() { vec4 position1 = vec4(position, 1.0); vec4 mvPosition = modelViewMatrix * position1; gl_Position = projectionMatrix * mvPosition; if (pcorner != 0.0) { position1.y += 1.0; vec4 glposition1 = projectionMatrix * (modelViewMatrix * position1); vec2 v = vec2(glposition1) - vec2(gl_Position); float xv = v.x; float yv = v.y; float strianglesize = trianglesize*gl_Position.z; float d = length(v); float dfac = (d > 0.000001 ? 1.0/d : 1.0)*strianglesize; float dsfac = dfac*0.57735*(pcorner == 1.0 ? 1.0 : -1.0); gl_Position.x += (-v.x*dfac + v.y*dsfac); gl_Position.y += (-v.y*dfac - v.x*dsfac)*aspect; } } ",
"vertex_shader_enttriangle":" uniform float trianglesize; uniform float aspect; uniform float closedist; attribute float pcorner; attribute float entindex; attribute float entvisibledistance; varying float altitude; varying float vcosslope; varying float vindex; void main() { altitude = position.y; vcosslope = 1.0; vindex = entindex; vec4 mvPosition = modelViewMatrix * vec4(position, 1.0); gl_Position = projectionMatrix * mvPosition; float fdepth = gl_Position.z; float strianglesize = trianglesize*gl_Position.z*1.0; if ((fdepth < closedist) || (fdepth < entvisibledistance)) strianglesize *= 10.0; if (pcorner != 0.0) { gl_Position.y += strianglesize*aspect; gl_Position.x += (pcorner == 1.0 ? 1.0 : -1.0) * 0.57735*strianglesize*0.5; } } "
}