1class WebGLView { 2 3 constructor(app, logo) { 4 this.app = app; 5 6 this.initThree(); 7 this.initParticles(); 8 this.initControls(); 9 10 this.goto(logo); 11 } 12 13 initThree() { 14 // scene 15 this.scene = new THREE.Scene(); 16 17 var rendererWrapper = this.app.container.querySelector('.ias-2023-renderer'); 18 var renderWidth = rendererWrapper.clientWidth; 19 var renderHeight = window.innerHeight; 20 21 // camera 22 this.camera = new THREE.PerspectiveCamera(50, renderWidth / renderHeight, 1, 10000); 23 this.camera.position.z = 300; 24 25 // renderer 26 this.renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true }); 27 // add to global renderer array 28 window.IAS2023.renderers = window.IAS2023.renderers || []; 29 window.IAS2023.renderers.push(this.renderer); 30 31 // clock 32 this.clock = new THREE.Clock(true); 33 34 $(window).resize(this.resize); 35 } 36 37 initControls() { 38 // this.interactive = new InteractiveControls(this.camera, this.renderer.domElement); 39 } 40 41 initParticles() { 42 this.particles = new Particles(this); 43 this.scene.add(this.particles.container); 44 } 45 46 // --------------------------------------------------------------------------------------------- 47 // PUBLIC 48 // --------------------------------------------------------------------------------------------- 49 50 update() { 51 const delta = this.clock.getDelta(); 52 53 if (this.particles) this.particles.update(delta); 54 } 55 56 draw() { 57 this.renderer.render(this.scene, this.camera); 58 } 59 60 61 goto(image) { 62 // this.particles.hide(true).then(() => { 63 // }); 64 this.particles.init(image); 65 } 66 67 // --------------------------------------------------------------------------------------------- 68 // EVENT HANDLERS 69 // --------------------------------------------------------------------------------------------- 70 71 resize() { 72 if (!this.renderer) return; 73 74 var rendererWrapper = this.app.container; 75 var renderWidth = rendererWrapper.clientWidth; 76 var renderHeight = Math.max(window.innerHeight || 0, window.outerHeight || 0); 77 78 this.camera.aspect = renderWidth / renderHeight; 79 this.camera.updateProjectionMatrix(); 80 81 this.fovHeight = 2 * Math.tan((this.camera.fov * Math.PI) / 180 / 2) * this.camera.position.z; 82 83 this.renderer.setSize(renderWidth, renderHeight); 84 85 if (this.interactive) this.interactive.resize(); 86 if (this.particles) this.particles.resize(); 87 } 88} 89
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.