b0VIM 8.0sZOB/angus17Anguss-MacBook-Pro.local~angus17/Dropbox/MAMP_htdocs/ccl_UCSC/courses/cmpm163/code/week4/w4_5_pointShader.htmlutf-8 3210#"! UtpDad~kZD?4#  v u O !  { z i h N M  X W @ " !   ~ y x l k j _ ^ ? > + * z y 0  mWCBba87vu[Z^]HGBAm"!c\ blending: THREE.AdditiveBlending, fragmentShader: document.getElementById( 'fragmentshader' ).textContent, vertexShader: document.getElementById( 'vertexshader' ).textContent, }, texture: { value: tex1 } color: { value: new THREE.Color( 0xffffff ) }, amplitude: { value: 1.0 }, uniforms: { var material = new THREE.ShaderMaterial( { // geometry.addAttribute( 'size', new THREE.BufferAttribute( sizes, 1 ) ); geometry.addAttribute( 'customColor', new THREE.BufferAttribute( colors, 3 ) ); geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) ); var geometry = new THREE.BufferGeometry(); } sizes[ i ] = 20; color.toArray( colors, i * 3 ); } //color.setRGB( 0.0, 0.0, 1.0 ); color.setHSL( 0.0 + 0.1 * ( i / amount ), 0.9, 0.5 ); } else { //color.setRGB( 1.0, 0.0, 0.0 ); color.setHSL( 0.5 + 0.1 * ( i / amount ), 0.7, 0.5 ); if ( vertex.x < 0 ) { vertex.toArray( positions, i * 3 ); vertex.z = ( Math.random() * 2 - 1 ) * radius; vertex.y = ( Math.random() * 2 - 1 ) * radius; vertex.x = ( Math.random() * 2 - 1 ) * radius; for ( var i = 0; i < amount; i ++ ) { var color = new THREE.Color( 0xffffff ); var vertex = new THREE.Vector3(); var sizes = new Float32Array( amount ); var colors = new Float32Array( amount * 3 ); var positions = new Float32Array( amount * 3 ); var radius = 20; var amount = 2000; //var radius = 25; //var amount = 10000; //initialize point attributes scene = new THREE.Scene(); var controls = new THREE.OrbitControls( camera ); camera.position.z = 300; camera = new THREE.PerspectiveCamera( 40, WIDTH / HEIGHT, 1, 10000 ); function init() { animate(); init(); var tex1 = new THREE.TextureLoader().load( "spark.png" ); var HEIGHT = window.innerHeight; var WIDTH = window.innerWidth; var boxOfPoints; var renderer, scene, camera; } gl_FragColor = gl_FragColor * texture2D( texture, gl_PointCoord ); gl_FragColor = vec4( color * vColor, 1.0 ); void main() { varying vec3 vColor; uniform sampler2D texture; uniform vec3 color; } gl_Position = projectionMatrix * mvPosition; gl_PointSize = size * ( 300.0 / -mvPosition.z ); vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 ); vColor = customColor; void main() { varying vec3 vColor; attribute vec3 customColor; attribute float size; uniform float amplitude;
a { color: #ff0000 } } z-index:100; padding: 5px; top: 0px; width: 100%; position: absolute; color: #fff; #info { } overflow: hidden; margin: 0px; background-color: #000000; font-weight: bold; text-align:center; font-size:13px; font-family:Monospace; color: #ffffff; body {