phantasmal-world/8.02495feeeb9889ce58c0.js

1 line
7.4 KiB
JavaScript
Raw Normal View History

2020-01-05 07:55:24 +08:00
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{"6cU9":function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));var i=s("FXpb"),r=(s("+Mcu"),s("ouMO")),n=s("QmPX");class a extends n.a{constructor(e,t){super(t),this.element=Object(i.m)({className:"core_FileButton core_Button"}),this.input=Object(i.l)({className:"core_FileButton_input core_Button_inner"}),this._files=Object(r.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=[]};const s=Object(i.q)({className:"core_FileButton_inner core_Button_inner"});t&&(null!=t.accept&&(this.input.accept=t.accept),null!=t.multiple&&(this.input.multiple=t.multiple),null!=t.icon_left&&s.append(Object(i.q)({className:"core_FileButton_left core_Button_left"},Object(i.j)(t.icon_left)))),s.append(Object(i.q)({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 n}));var i=s("pVCM"),r=s("Womt");i.a.install({THREE:Object.assign(Object.assign({},r),{MOUSE:Object.assign(Object.assign({},r.MOUSE),{LEFT:r.MOUSE.RIGHT,RIGHT:r.MOUSE.LEFT})})});class n{constructor(e){this._debug=!1,this.scene=new r.Scene,this.light_holder=new r.Group,this.render_scheduled=!1,this.animation_frame_handle=void 0,this.light=new r.HemisphereLight(16777215,5263440,1),this.controls_clock=new r.Clock,this.size=new r.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 r.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(){null==this.animation_frame_handle&&(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 n}));var i=s("nN8q"),r=s("FXpb");class n extends i.a{constructor(e){super(),this.renderer=e,this.element=Object(r.h)({className:"core_RendererWidget"}),this.children=[],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"),r=s("6cU9"),n=s("w6HN"),a=s("KUR2"),o=s("Womt"),h=s("Ftn7"),c=s("Tpfs"),l=s("iR5r");const d=s("rwco").c.get("viewer/rendering/TextureRenderer");class u extends h.a{constructor(e,t){super(e),this.disposer=new c.a,this.quad_meshes=[],this.camera=new o.OrthographicCamera(-400,400,300,-300,1,10),this.disposer.add_all(t.textures.observe(({value:e}