2021-03-04 06:23:57 +08:00
|
|
|
import{h as e,toRef as t,watch as i}from"vue";import{Vector2 as r,Vector3 as s,Plane as n,Raycaster as a,WebGLRenderer as o,OrthographicCamera as h,PerspectiveCamera as u,Group as d,Scene as m,Color as c,BoxBufferGeometry as l,CircleBufferGeometry as f,ConeBufferGeometry as p,CylinderBufferGeometry as g,DodecahedronBufferGeometry as y,IcosahedronBufferGeometry as b,LatheBufferGeometry as v,OctahedronBufferGeometry as S,PolyhedronBufferGeometry as N,RingBufferGeometry as w,SphereBufferGeometry as x,TetrahedronBufferGeometry as _,TorusBufferGeometry as C,TorusKnotBufferGeometry as M,Curve as G,TubeBufferGeometry as I,AmbientLight as P,DirectionalLight as z,PointLight as R,SpotLight as B,FrontSide as E,MeshBasicMaterial as L,MeshLambertMaterial as j,TextureLoader as k,MeshMatcapMaterial as T,MeshPhongMaterial as O,MeshStandardMaterial as A,MeshPhysicalMaterial as F,ShaderChunk as U,UniformsUtils as D,ShaderLib as $,ShaderMaterial as H,MeshToonMaterial as W,CubeTextureLoader as V,CubeRefractionMapping as X,Mesh as q,PlaneBufferGeometry as Z,FontLoader as K,TextBufferGeometry as Y,WebGLCubeRenderTarget as J,RGBFormat as Q,LinearMipmapLinearFilter as ee,CubeCamera as te,BackSide as ie,DoubleSide as re,InstancedMesh as se,SpriteMaterial as ne,Sprite as ae}from"three";import{OrbitControls as oe}from"three/examples/jsm/controls/OrbitControls.js";import{EffectComposer as he}from"three/examples/jsm/postprocessing/EffectComposer.js";import{RenderPass as ue}from"three/examples/jsm/postprocessing/RenderPass.js";import{BokehPass as de}from"three/examples/jsm/postprocessing/BokehPass.js";import{FilmPass as me}from"three/examples/jsm/postprocessing/FilmPass.js";import{ShaderPass as ce}from"three/examples/jsm/postprocessing/ShaderPass.js";import{FXAAShader as le}from"three/examples/jsm/shaders/FXAAShader.js";import{HalftonePass as fe}from"three/examples/jsm/postprocessing/HalftonePass.js";import{SMAAPass as pe}from"three/examples/jsm/postprocessing/SMAAPass.js";import{UnrealBloomPass as ge}from"three/examples/jsm/postprocessing/UnrealBloomPass.js";function ye(){var e={canvas:null,antialias:!0,alpha:!1,autoClear:!0,orbit_ctrl:!1,mouse_move:!1,mouse_raycast:!1,mouse_over:!1,click:!1,resize:!0,width:0,height:0},t={width:1,height:1,wWidth:1,wHeight:1,ratio:1},i=[],h=[],u=[],d=new r,m=new s,c=new n(new s(0,0,1),0),l=new a,f=[],p={conf:e,renderer:null,camera:null,cameraCtrl:null,materials:{},scene:null,size:t,mouse:d,mouseV3:m,init:function(t){t&&Object.entries(t).forEach((function(t){var i=t[0],r=t[1];e[i]=r}));if(!p.scene)return void console.error("Missing Scene");if(!p.camera)return void console.error("Missing Camera");p.renderer=new o({canvas:e.canvas,antialias:e.antialias,alpha:e.alpha}),p.renderer.autoClear=e.autoClear,e.orbit_ctrl&&(p.orbitCtrl=new oe(p.camera,p.renderer.domElement),e.orbit_ctrl instanceof Object&&Object.entries(e.orbit_ctrl).forEach((function(e){var t=e[0],i=e[1];p.orbitCtrl[t]=i})));e.width&&e.height?w(e.width,e.height):e.resize&&(N(),window.addEventListener("resize",N));e.mouse_move=e.mouse_move||e.mouse_over,e.mouse_move&&("body"===e.mouse_move?p.mouse_move_element=document.body:p.mouse_move_element=p.renderer.domElement,p.mouse_move_element.addEventListener("mousemove",b),p.mouse_move_element.addEventListener("mouseleave",v));e.click&&p.renderer.domElement.addEventListener("click",y);return i.forEach((function(e){return e()})),!0},dispose:function(){u=[],window.removeEventListener("resize",N),p.mouse_move_element&&(p.mouse_move_element.removeEventListener("mousemove",b),p.mouse_move_element.removeEventListener("mouseleave",v));p.renderer.domElement.removeEventListener("click",y),p.orbitCtrl&&p.orbitCtrl.dispose();this.renderer.dispose()},render:function(){p.orbitCtrl&&p.orbitCtrl.update();u.forEach((function(e){return e()})),p.renderer.render(p.scene,p.camera)},renderC:function(){p.orbitCtrl&&p.orbitCtrl.update();u.forEach((function(e){return e()})),p.composer.render()},setSize:w,onAfterInit:function(e){i.push(e)},onAfterResize:function(e){h.push(e)},offAfterResize:function(e){h=h.filter((function(t){return t!==e})
|