b0VIM 8.0xZB==angus17Anguss-MacBook-Pro.local~angus17/Dropbox/MAMP_htdocs/ccl_UCSC/courses/cmpm163/code/week5/w5_2_implicitFuncs.htmlutf-8 3210#"! Utps-THad sxb]RIA@#"baB. | r q f e , +   ` ^ E Y    o n X E @ +   _ ^ dcbaJwIC>3 ba[V&%#   [ZG43+   -9 u_val: { type: "f", value: 0.0 }, u_mouse: { type: "v2", value: new THREE.Vector2(mouseX, mouseY) }, u_resolution: { type: "v2", value: new THREE.Vector2(width, height) }, var uniforms1 = { // material var geometry1 = new THREE.PlaneGeometry( width, height, 1, 1 ); // geometry scene = new THREE.Scene(); camera.position.z = 0.2; 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 = document.getElementById( 'vertexShader' ).textContent;var camera, scene, renderer;var container; } gl_FragColor = mix(colorA, colorB, u_val); } colorB = vec4(1.0,1.0,0.0,1.0); colorA = vec4(1.0,0.0,1.0,1.0); } else if (m_point == point[4]) { colorB = vec4(0.0,1.0,1.0,1.0); colorA //dist = merge(dist, distC); //float dist = merge(distA, distB); } gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); } else { gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0); } else if (distC < 1.0) { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); } else if (distB < 1.0) { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); if (distA < 1.0) { float distC = triangleDist( translate(gl_FragCoord.xy, centerPtC), 250.0, 230.0 ); float distB = circleDist( translate(gl_FragCoord.xy, centerPtB), 100.0 ); float distA = boxDist( translate(gl_FragCoord.xy, centerPtA), vec2(100,100)); vec2 centerPtC = vec2(900.,190.); vec2 centerPtB = vec2(600.,300.); vec2 centerPtA = vec2(300.,300.); point[4] = u_mouse.xy; point[3] = pt4; point[2] = pt3; point[1] = pt2; point[0] = pt1; vec2 point[5]; // Cell positions vec2 st = gl_FragCoord.xy/(u_resolution.xy);void main() {} return p - t;{vec2 translate(vec2 p, vec2 t)} return min(d1, d2);{float merge(float d1, float d2)} return max( abs(p).x*n.x + p.y*n.y - (height*n.y), -p.y); vec2 n = normalize(vec2(height, width / 2.0));{float triangleDist(vec2 p, float width, float height)} return length(p) - radius;{float circleDist(vec2 p, float radius)} return min(max(d.x, d.y), 0.0) + length(max(d, 0.0)); vec2 d = abs(p) - size;{float boxDist(vec2 p, vec2 size)uniform vec2 pt4;uniform vec2 pt3;uniform vec2 pt2;uniform vec2 pt1;uniform float u_val;uniform vec2 u_mouse;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 {