mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 15:28:29 +08:00
1 line
7.4 KiB
JavaScript
1 line
7.4 KiB
JavaScript
![]() |
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{"6cU9":function(e,t,s){"use strict";s.d(t,"a",(function(){return a}));var r=s("FXpb"),i=(s("+Mcu"),s("ouMO")),n=s("QmPX");class a extends n.a{constructor(e,t){super(t),this.element=Object(r.n)({className:"core_FileButton core_Button"}),this.input=Object(r.m)({className:"core_FileButton_input core_Button_inner"}),this._files=Object(i.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(r.r)({className:"core_FileButton_inner core_Button_inner"});t&&null!=t.icon_left&&s.append(Object(r.r)({className:"core_FileButton_left core_Button_left"},Object(r.k)(t.icon_left))),s.append(Object(r.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 n}));var r=s("pVCM"),i=s("Womt");r.a.install({THREE:Object.assign(Object.assign({},i),{MOUSE:Object.assign(Object.assign({},i.MOUSE),{LEFT:i.MOUSE.RIGHT,RIGHT:i.MOUSE.LEFT})})});class n{constructor(e){this._debug=!1,this.scene=new i.Scene,this.light_holder=new i.Group,this.render_scheduled=!1,this.animation_frame_handle=void 0,this.light=new i.HemisphereLight(16777215,5263440,1),this.controls_clock=new i.Clock,this.size=new i.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 i.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 r.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 r=s("nN8q"),i=s("FXpb");class n extends r.a{constructor(e){super(),this.renderer=e,this.element=Object(i.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 r=s("FXpb"),i=s("nN8q"),n=s("6cU9"),a=s("w6HN"),o=s("KUR2"),h=s("Womt"),c=s("Ftn7"),l=s("Tpfs"),d=s("iR5r");const u=s("rwco").c.get("viewer/rendering/TextureRenderer");class _ 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.current_xvm.observe(({value:e})=>{this.scene.remove(...this.quad_meshes),e&&this.render_textures(e),this.reset_camera(new h.V
|