b0VIM 8.0qZmA#angus17eduroam-169-233-226-45.ucsc.edu~angus17/Dropbox/MAMP_htdocs/ccl_UCSC/courses/cmpm163/code/week4/w4_1_VoronoiCells.htmlutf-8 3210#"! Utp1adNxb]RIA@#"rX21 L B A 6 5 ~ h V D 2    o Z E * ) U 6  Z B A  WV20%$ hgTA@8-,: F^ mYCB<;: scene.add( mesh1 ); var mesh1 = new THREE scene.ad scene.add( mesh1 ); var mesh1 = new THREE.Mesh( geometry1, material1 ); } ); fragmentShader: fs, vertexShader: vs, uniforms: uniforms1, var material1 = new THREE.RawShaderMaterial( { }; pt4 : { type: "v2", value: new THREE.Vector2(Math.random(), Math.random()) }, pt3 : { type: "v2", value: new THREE.Vector2(Math.random(), Math.random()) }, pt2 : { type: "v2", value: new THREE.Vector2(Math.random(), Math.random()) }, pt1 : { type: "v2", value: new THREE.Vector2(Math.random(), Math.random()) }, 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 = vec4(color,1.0); color.b -= abs(sin(93.0*m_dist))*1.0; color.g -= abs(sin(63.0*m_dist))*1.0; color.r -= abs(sin(180.0*m_dist))*1.0; // Show isolines color.rg = vec2(1.0); //m_point; // tint acording the closest point position color += m_dist*2.; // Add distance field to closest point center } } m_point = point[i]; // Keep the position of the closer point m_dist = dist; // Keep the closer distance if ( dist < m_dist ) { float dist = distance(st, point[i]); for (int i = 0; i < 5; i++) { // Iterate through the points positions vec2 m_point; // minimum position float m_dist = 1.; // minimum distance point[4] = u_mouse.xy; point[3] = pt4; point[2] = pt3; point[1] = pt2; point[0] = pt1; vec2 point[5]; // Cell positions vec3 color = vec3(0.0); vec2 st = gl_FragCoord.xy/(u_resolution.xy);void main() {uniform vec2 pt4;uniform vec2 pt3;uniform vec2 pt2;uniform vec2 pt1;uniform float u_time;uniform vec2 u_mouse;uniform vec2 u_resolution;precision mediump float;// Title: 5 cells voronoi// Author: @patriciogv } 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 {