I have set up a spherical mesh with a texture and positioned a perspective camera to enable a 360-degree view inside out.
this.camera = new THREE.PerspectiveCamera(this.fov, $(this.element).width() / $(this.element).height(), 0.1, 1000);
this.camera.setLens(this.fov);
this.mesh = new THREE.Mesh( new THREE.SphereGeometry( 500, 80, 50 ), new THREE.MeshBasicMaterial( { map: this.texture } ) );
this.mesh.scale.x = -1;
this.camera.lookAt(new THREE.Vector3(cx, cy, cz));
this.renderer.render( this.scene, this.camera );
I am interested in calculating the current view area and position of the viewer within the mesh, essentially determining the visible area of the plane.
When I refer to the viewable area, I am talking about what section of the image texture is currently visible in the browser window, such as
(0,0)(x,y)(400,500)(width,height)
. If the user moves the mouse, it might change to something like (50,0)(x,y)(400,500)(width,height)
, and if they zoom in, perhaps (50,40)(x,y)(300,400)(width,height)
. While I've come across formulas for calculating width and height based on the camera's field of view, I haven't been able to find a solution for determining x and y coordinates.