Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.title = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material);
this.add(this.title);
var subtitleTexture = textures['subtitle'];
var subtitleImage = subtitleTexture.image;
var uniforms = {
time: { value: 0 },
resolution: { value: [window.innerWidth, window.innerHeight] },
imageResolution: { value: [subtitleImage.width, subtitleImage.height] },
target: { value: [0,-1,0] },
subtitle: { value: subtitleTexture },
};
var material = new THREE.ShaderMaterial({
vertexShader: shaders['subtitle.vert'],
fragmentShader: shaders['subtitle.frag'],
uniforms: uniforms,
side: THREE.DoubleSide,
transparent: true,
depthTest: false,
})
this.subtitle = new THREE.Mesh(new THREE.PlaneGeometry(1, 1), material);
this.add(this.subtitle);
this.resize = function(width, height) {
this.subtitle.material.uniforms.resolution.value[0] = width;
this.subtitle.material.uniforms.resolution.value[1] = height;
this.title.material.uniforms.resolution.value[0] = width;
this.title.material.uniforms.resolution.value[1] = height;
}
}