import{a as t,r as e}from"./index.fbca08c6.js";import{d as o,H as s,_ as a,$ as i,a0 as n,a1 as r,a2 as l,a3 as p,r as u,o as h,c as d,w as m,a as c}from"./vendor.6afcf1a6.js";let w,y;var f=o({mounted(){this.setupPhysics(),t(this.update)},beforeUnmount(){e(this.update)},setup:()=>({radius:.3,posY:0,restitution:.7,lastTime:s(Date.now()),ballColor:s("white")}),methods:{setupPhysics(){w=new a({gravity:new i(0,-9.82,0)}),y=new n({mass:1,shape:new r(this.radius),material:new l({restitution:this.restitution})}),w.addBody(y);const t=new n({type:n.STATIC,shape:new p,material:new l({restitution:this.restitution})});t.quaternion.setFromEuler(-Math.PI/2,0,0),w.addBody(t)},update(){const t=.001*Date.now()-this.lastTime;this.lastTime=.001*Date.now(),w.step(1/60,t);const e=this.$refs.sphere;if(!e)return;const o=e.instance;o.position.copy(y.position),o.quaternion.copy(y.quaternion)},jump(){y&&(y.velocity.y<0&&y.velocity.set(0,0,0),y.applyImpulse(new i(0,4,0)))}}});f.render=function(t,e,o,s,a,i){const n=u("ambientLight"),r=u("spotLight"),l=u("icosahedronGeometry"),p=u("meshPhongMaterial"),w=u("planeBufferGeometry"),y=u("group");return h(),d(y,null,{default:m((()=>[c(n,{color:"#505050"}),c(r,{color:"peachpuff","shadow-mapSize-width":2048,"shadow-mapSize-height":2048,intensity:.5,castShadow:!0,"position-y":5},null,8,["intensity"]),c(y,null,{default:m((()=>[c("mesh",{ref:"sphere","position-y":t.posY,castShadow:!0,onPointerDown:e[1]||(e[1]=(...e)=>t.jump&&t.jump(...e)),onPointerEnter:e[2]||(e[2]=e=>t.ballColor="tomato"),onPointerLeave:e[3]||(e[3]=e=>t.ballColor="white")},[c(l,{args:[t.radius,6]},null,8,["args"]),c(p,{color:t.ballColor},null,8,["color"])],40,["position-y"]),c("mesh",{"rotation-x":-.5*Math.PI,receiveShadow:!0},[c(w,{args:[2,2]}),c(p)],8,["rotation-x"])])),_:1})])),_:1})};export{f as _};
