phantasmal-world/9.d88d917be8ad42f54ef4.js

1 line
6.6 KiB
JavaScript
Raw Normal View History

2020-01-02 07:57:15 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{"6cU9":function(e,t,s){"use strict";s.d(t,"a",(function(){return o}));var i=s("FXpb"),n=(s("+Mcu"),s("ouMO")),r=s("QmPX");class o extends r.a{constructor(e,t){super(t),this.element=Object(i.n)({className:"core_FileButton core_Button"}),this.input=Object(i.m)({className:"core_FileButton_input core_Button_inner"}),this._files=Object(n.e)([]),this.files=this._files,this.input.type="file",this.input.onchange=()=>{this.input.files&&this.input.files.length?this._files.val=[...this.input.files]:this._files.val=[]},t&&t.accept&&(this.input.accept=t.accept);const s=Object(i.r)({className:"core_FileButton_inner core_Button_inner"});t&&null!=t.icon_left&&s.append(Object(i.r)({className:"core_FileButton_left core_Button_left"},Object(i.k)(t.icon_left))),s.append(Object(i.r)({className:"core_Button_center"},e)),this.element.append(s,this.input),this.disposables(this.enabled.observe(({value:e})=>{this.input.disabled=!e,e?this.element.classList.remove("disabled"):this.element.classList.add("disabled")})),this.finalize_construction()}click(){this.input.click()}}},Ftn7:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var i=s("pVCM"),n=s("Womt");i.a.install({THREE:Object.assign(Object.assign({},n),{MOUSE:Object.assign(Object.assign({},n.MOUSE),{LEFT:n.MOUSE.RIGHT,RIGHT:n.MOUSE.LEFT})})});class r{constructor(e){this._debug=!1,this.scene=new n.Scene,this.light_holder=new n.Group,this.render_scheduled=!1,this.animation_frame_handle=void 0,this.light=new n.HemisphereLight(16777215,5263440,1),this.controls_clock=new n.Clock,this.size=new n.Vector2(0,0),this.schedule_render=()=>{this.render_scheduled=!0},this.on_mouse_down=e=>{e.currentTarget&&e.currentTarget.focus()},this.call_render=()=>{const e=this.controls.update(this.controls_clock.getDelta()),t=this.render_scheduled||e;this.render_scheduled=!1,t&&this.render(),this.animation_frame_handle=requestAnimationFrame(this.call_render)},this.renderer=e,this.renderer.domElement.tabIndex=0,this.renderer.domElement.addEventListener("mousedown",this.on_mouse_down),this.renderer.domElement.style.outline="none",this.scene.background=new n.Color(1579032),this.light_holder.add(this.light),this.scene.add(this.light_holder)}get debug(){return this._debug}set debug(e){this._debug=e}get canvas_element(){return this.renderer.domElement}set_size(e,t){this.size.set(e,t),this.renderer.setSize(e,t),this.schedule_render()}pointer_pos_to_device_coords(e){e.set(e.x/this.size.width*2-1,e.y/this.size.height*-2+1)}start_rendering(){this.schedule_render(),this.animation_frame_handle=requestAnimationFrame(this.call_render)}stop_rendering(){null!=this.animation_frame_handle&&(cancelAnimationFrame(this.animation_frame_handle),this.animation_frame_handle=void 0)}reset_camera(e,t){this.controls.setLookAt(e.x,e.y,e.z,t.x,t.y,t.z)}dispose(){this.renderer.dispose(),this.controls.dispose()}init_camera_controls(){this.controls=new i.a(this.camera,this.renderer.domElement),this.controls.dampingFactor=1,this.controls.draggingDampingFactor=1}render(){this.renderer.render(this.scene,this.camera)}}},KUR2:function(e,t,s){"use strict";s.d(t,"a",(function(){return r}));var i=s("nN8q"),n=s("FXpb");class r extends i.a{constructor(e){super(),this.renderer=e,this.element=Object(n.i)({className:"core_RendererWidget"}),this.element.append(e.canvas_element),this.disposable(e),this.finalize_construction()}start_rendering(){this.renderer.start_rendering()}stop_rendering(){this.renderer.stop_rendering()}resize(e,t){return super.resize(e,t),this.renderer.set_size(e,t),this}}},Za3H:function(e,t,s){"use strict";s.r(t);var i=s("FXpb"),n=s("nN8q"),r=s("6cU9"),o=s("w6HN"),a=s("KUR2"),h=s("Womt"),c=s("Ftn7"),l=s("Tpfs");class d extends c.a{constructor(e,t){super(e),this.disposer=new l.a,this.quad_meshes=[],this.camera=new h.OrthographicCamera(-400,400,300,-300,1,10),this.disposer.add_all(t.textures.observe(({value:e})=>{this.scene.remove(...this.quad_meshes),this.render_textures(e),this.reset_camera(new h.Vector3(0,0,5),new h.Vector3),this.schedule_render()})),this.init_camera_contro