2021-04-29 00:07:58 +08:00
|
|
|
{"version":3,"file":"trois.module.cdn.min.js","sources":["../src/core/useRaycaster.ts","../src/core/usePointer.ts","../src/core/useThree.ts","../src/core/Renderer.ts","../src/tools.ts","../src/core/Camera.ts","../src/core/OrthographicCamera.ts","../src/core/PerspectiveCamera.ts","../src/core/Scene.ts","../src/core/Object3D.ts","../src/core/Group.ts","../src/core/Raycaster.ts","../src/core/CubeCamera.ts","../src/meshes/Mesh.ts","../src/geometries/Geometry.ts","../src/geometries/BoxGeometry.ts","../src/geometries/CircleGeometry.ts","../src/geometries/ConeGeometry.ts","../src/geometries/CylinderGeometry.ts","../src/geometries/DodecahedronGeometry.ts","../src/geometries/IcosahedronGeometry.ts","../src/geometries/LatheGeometry.ts","../src/geometries/OctahedronGeometry.ts","../src/geometries/PlaneGeometry.ts","../src/geometries/PolyhedronGeometry.ts","../src/geometries/RingGeometry.ts","../src/geometries/SphereGeometry.ts","../src/geometries/TetrahedronGeometry.ts","../src/geometries/TorusGeometry.ts","../src/geometries/TorusKnotGeometry.ts","../src/geometries/TubeGeometry.ts","../src/lights/Light.ts","../src/lights/AmbientLight.ts","../src/lights/DirectionalLight.ts","../src/lights/HemisphereLight.ts","../src/lights/PointLight.ts","../src/lights/RectAreaLight.ts","../src/lights/SpotLight.ts","../src/materials/Material.ts","../src/materials/BasicMaterial.ts","../src/materials/LambertMaterial.ts","../src/materials/MatcapMaterial.ts","../src/materials/PhongMaterial.ts","../src/materials/StandardMaterial.ts","../src/materials/PhysicalMaterial.ts","../src/materials/ShaderMaterial.ts","../src/materials/SubsurfaceScatteringShader.ts","../src/materials/SubSurfaceMaterial.ts","../src/materials/ToonMaterial.ts","../src/materials/Texture.ts","../src/materials/CubeTexture.ts","../src/meshes/Box.ts","../src/meshes/Circle.ts","../src/meshes/Cone.ts","../src/meshes/Cylinder.ts","../src/meshes/Dodecahedron.ts","../src/meshes/Icosahedron.ts","../src/meshes/Lathe.ts","../src/meshes/Octahedron.ts","../src/meshes/Plane.ts","../src/meshes/Polyhedron.ts","../src/meshes/Ring.ts","../src/meshes/Sphere.ts","../src/meshes/Tetrahedron.ts","../src/meshes/Text.ts","../src/meshes/Torus.ts","../src/meshes/TorusKnot.ts","../src/meshes/Tube.ts","../src/meshes/Image.ts","../src/meshes/InstancedMesh.ts","../src/meshes/Sprite.ts","../src/models/Model.ts","../src/models/GLTF.ts","../src/models/FBX.ts","../src/effects/EffectComposer.ts","../src/effects/EffectPass.ts","../src/effects/RenderPass.ts","../src/effects/BokehPass.ts","../src/effects/FilmPass.ts","../src/effects/FXAAPass.ts","../src/effects/HalftonePass.ts","../src/effects/SMAAPass.ts","../src/effects/SSAOPass.ts","../src/shaders/default.ts","../src/shaders/TiltShift.ts","../src/effects/TiltShiftPass.ts","../src/effects/UnrealBloomPass.ts","../src/shaders/ZoomBlur.ts","../src/effects/ZoomBlurPass.ts","../src/plugin.ts","../src/use/useTextures.ts"],"sourcesContent":["import { Camera, Intersection, Plane, Raycaster, Vector2, Vector3 } from 'three'\nimport { IntersectObject } from './usePointer'\n\nexport interface RaycasterInterface {\n position: Vector3\n updatePosition(coords: Vector2): void\n intersect(coords: Vector2, objects: IntersectObject[]): Intersection[],\n}\n\nexport interface RaycasterConfigInterface {\n camera: Camera\n resetPosition?: Vector3\n}\n\nexport default function useRaycaster(options: RaycasterConfigInterface): RaycasterInterface {\n const {\n camera,\n resetPosition = new Vector3(0, 0, 0),\n } = options\n\n const raycaster = new Raycaster()\n const position = resetPosition.clone()\n const plane = new Plane(new Vector3(0, 0, 1), 0)\n\n const updatePosition = (coords: Vector2) => {\n raycaster.setFromCamera(coords, camera)\n camera.getWorldDirection(plane.normal)\n raycaster.ray.intersectPlane(plane, position)\n }\n\n const intersect = (coords: Vector2, objects: IntersectObject[]) => {\n raycaster.setFromCamera(coords, camera)\n return raycaster.intersectObjects(objects)\n }\n\n return {\n position,\n updatePosition,\n intersect,\n }\n}\
|