b0VIM 8.0|ZCLangus17Anguss-MacBook-Pro.local~angus17/Dropbox/MAMP_htdocs/ccl_UCSC/courses/cmpm163/code/week5/w5_3_implicitFuncs2D_merge.htmlutf-8 3210#"! UtpWN[ad\Wxb]RIA@#"baB. | r q f e , +   u s r S Q B @ ? 1 0  X W  j i d 9    Q $ rB@  YrPONcbUTAzyxJ654 ][VU/. camera.updateProjectionMatrix(); camera.aspect = window.innerWidth / window.innerHeight; function onWindowResize( event ) { } window.addEventListener( 'resize', onWindowResize, true ); container.appendChild( renderer.domElement ); renderer.setSize( window.innerWidth, window.innerHeight ); renderer = new THREE.WebGLRenderer(); scene.add( mesh ); mesh = new THREE.Mesh( geometry, material ); } ); fragmentShader: fs, vertexShader: vs, uniforms: uniforms, var material = new THREE.RawShaderMaterial( { }; u_resolution: { type: "v2", value: new THREE.Vector2(width, height) }, var uniforms = { // material var geometry = new THREE.PlaneGeometry( width, height, 1, 1 ); // geometry scene = new THREE.Scene(); camera.position.z = 10; camera = new THREE.OrthographicCamera( width / -2, width / 2, height / 2, height / -2, 0.1, 1000 ); var height = window.innerHeight; var width = window.innerWidth; container = document.getElementById( 'container' );function init() {animate();init(); var mouseY = 0.0; var mouseX = 0.0;var fs = document.getElementById( 'fragmentShader' ).textContent;var vs = documen } else if (distFinal < } else if ( } else if (distFinal < 0.0) { } else if (distFinal } else if (distFinal < 0.0) { gl_FragColor = vec } else if (distFinal < 0.0) { gl_FragColor = } else if (distFinal < 0.0) { gl_FragCo } else if (distFinal < 0.0) { gl_FragColor = vec4(0 } else if } else if (distFinal < 0.0) { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); } else if (distA < 0.0 && distB < 0.0) { gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0); } else if (distB < 0.0 && distC < 0.0) { gl_FragColor = vec4(0.0, 1.0, 1.0, 1.0); if (distA < 0.0 && distB < 0.0 && distC < 0.0) { distFinal = merge(distFinal, distC); float distFinal = merge(distA, distB); float distC = circleDist( translate(gl_FragCoord.xy, centerPtC), 150.0 ); float distB = circleDist( translate(gl_FragCoord.xy, centerPtB), 150.0 ); float distA = circleDist( translate(gl_FragCoord.xy, centerPtA), 150.0 ); vec2 centerPtC = vec2(x_inc*3.0, y_pos); vec2 centerPtB = vec2(x_inc*2.0, y_pos); vec2 centerPtA = vec2(x_inc*1.0, y_pos); float y_pos = u_resolution.y / 2.0; float x_inc = u_resolution.x / 4.0;void main() {} return p - t;{vec2 translate(vec2 p, vec2 t)} return min(d1, d2);{float merge(float d1, float d2)} return length(p) - radius;{float circleDist(vec2 p, float radius)uniform vec2 u_resolution;precision mediump float; } gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 ); void main() { precision mediump float; attribute vec3 normal; attribute vec2 uv; attribute vec3 position; uniform mat4 projectionMatrix; uniform mat4 viewMatrix; uniform mat4 modelMatrix;
} overflow: hidden; margin: 0px; body {