@jack120/test 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +38 -38
- package/types/asset.d.ts +67 -67
- package/types/index.d.ts +2 -2
- package/types/lib.d.ts +21 -42
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var J=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import{platform as ee}from"node:os";var K=ee()==="darwin"?J("./native-bindings-osx.node"):J("./native-bindings-win.node"),a=class i{static Init(){K.Rpc_RegisterCbHandler((e,t)=>{let n=JSON.parse(t),r=i.keyValueToObject(n.keys,n.values);try{i.callbackRegistry[e](r)}catch(l){console.error(`${l}`)}})}static RegisterCallback(e){let t=Number(i.Call("_RPC::AllocateCallback",{clientId:i.GetClientId()}));return i.callbackRegistry[t]=e,t}static Call(e,t){this.initialized||(this.initialized=!0,i.Init());let n={};for(let[r,l]of Object.entries(t))typeof l=="function"?n[r]=i.RegisterCallback(l):n[r]=l;return JSON.parse(K.Rpc_Call(e,JSON.stringify(this.objectToKeyValue(n)))).result}static GetClientId(){return Number(K.Rpc_GetClientId())}static objectToKeyValue(e){let t=Object.keys(e),n=t.map(r=>e[r]);return{keys:t,values:n}}static keyValueToObject(e,t){let n={};return e.forEach((r,l)=>{n[r]=t[l]}),n}static{this.callbackRegistry={}}static{this.initialized=!1}};var X=class{static OnCmdCallback(e){return a.Call("DebugWindow::GetCommand",{callback:e})}};var j=class{static GetLeftPosition(){return JSON.parse(a.Call("XRI Left/Position",{}))}static GetLeftRotation(){return JSON.parse(a.Call("XRI Left/Rotation",{}))}static GetLeftThumbstick(){return JSON.parse(a.Call("XRI Left/Thumbstick",{}))}static GetLeftSelect(){return JSON.parse(a.Call("XRI Left Interaction/Select Value",{}))}static GetLeftActivate(){return JSON.parse(a.Call("XRI Left Interaction/Activate Value",{}))}static GetLeftTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Turn",{}))}static GetLeftSnapTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Snap Turn",{}))}static GetLeftMove(){return JSON.parse(a.Call("XRI Left Locomotion/Move",{}))}static GetLeftGrabMove(){return JSON.parse(a.Call("XRI Left Locomotion/Grab Move",{}))}static GetRightPosition(){return JSON.parse(a.Call("XRI Right/Position",{}))}static GetRightRotation(){return JSON.parse(a.Call("XRI Right/Rotation",{}))}static GetRightThumbstick(){return JSON.parse(a.Call("XRI Right/Thumbstick",{}))}static GetRightSelect(){return JSON.parse(a.Call("XRI Right Interaction/Select Value",{}))}static GetRightActivate(){return JSON.parse(a.Call("XRI Right Interaction/Activate Value",{}))}static GetRightTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Turn",{}))}static GetRightSnapTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Snap Turn",{}))}static GetRightMove(){return JSON.parse(a.Call("XRI Right Locomotion/Move",{}))}static GetRightGrabMove(){return JSON.parse(a.Call("XRI Right Locomotion/Grab Move",{}))}static GetHeadPosition(){return JSON.parse(a.Call("XRI Head/Position",{}))}static GetHeadRotation(){return JSON.parse(a.Call("XRI Head/Rotation",{}))}static GetLeftWorldPosition(){return JSON.parse(a.Call("XRI Left/WorldPosition",{}))}static GetLeftWorldRotation(){return JSON.parse(a.Call("XRI Left/WorldRotation",{}))}static GetRightWorldPosition(){return JSON.parse(a.Call("XRI Right/WorldPosition",{}))}static GetRightWorldRotation(){return JSON.parse(a.Call("XRI Right/WorldRotation",{}))}static GetHeadWorldPosition(){return JSON.parse(a.Call("XRI Head/WorldPosition",{}))}static GetHeadWorldRotation(){return JSON.parse(a.Call("XRI Head/WorldRotation",{}))}},W=class{static{this.KEYCODE=Object.freeze({LEFT_EYE:"Left Eye",RIGHT_EYE:"Right Eye",LEFT_AIM:"Left Aim",RIGHT_AIM:"Right Aim",LEFT_GRIP:"Left Grip",RIGHT_GRIP:"Right Grip",LEFT_SQUEEZE:"Left Squeeze",RIGHT_SQUEEZE:"Right Squeeze",LEFT_TRIGGER:"Left Trigger",RIGHT_TRIGGER:"Right Trigger",LEFT_THUMBSTICK_X:"Left Thumbstick X",RIGHT_THUMBSTICK_X:"Right Thumbstick X",LEFT_THUMBSTICK_Y:"Left Thumbstick Y",RIGHT_THUMBSTICK_Y:"Right Thumbstick Y",LEFT_TRIGGER_TOUCH:"Left Trigger Touch",RIGHT_TRIGGER_TOUCH:"Right Trigger Touch",LEFT_THUMBSTICK_CLICK:"Left Thumbstick Click",RIGHT_THUMBSTICK_CLICK:"Right Thumbstick Click",LEFT_THUMBSTICK_TOUCH:"Left Thumbstick Touch",RIGHT_THUMBSTICK_TOUCH:"Right Thumbstick Touch",LEFT_X_CLICK:"Left X Click",LEFT_X_TOUCH:"Left X Touch",LEFT_Y_CLICK:"Left Y Click",LEFT_Y_TOUCH:"Left Y Touch",LEFT_MENU_CLICK:"Left Menu Click",RIGHT_A_CLICK:"Right A Click",RIGHT_A_TOUCH:"Right A Touch",RIGHT_B_CLIKC:"Right B Click",RIGHT_B_TOUCH:"Right B Touch",RIGHT_SYSTEM_CLICK:"Right System Click"})}},Y=class{static{this.MOUSE=Object.freeze({BUTTON_LEFT:0,BUTTON_RIGHT:1,BUTTON_MIDDLE:2})}static{this.KEYCODE=Object.freeze({SPACE:32,APOSTROPHE:39,COMMA:44,MINUS:45,PERIOD:46,SLASH:47,NUM_0:48,NUM_1:49,NUM_2:50,NUM_3:51,NUM_4:52,NUM_5:53,NUM_6:54,NUM_7:55,NUM_8:56,NUM_9:57,SEMICOLON:59,EQUAL:61,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_BRACKET:91,BACKSLASH:92,RIGHT_BRACKET:93,GRAVE_ACCENT:96,WORLD_1:161,WORLD_2:162,ESCAPE:256,ENTER:257,TAB:258,BACKSPACE:259,INSERT:260,DELETE:261,RIGHT:262,LEFT:263,DOWN:264,UP:265,PAGE_UP:266,PAGE_DOWN:267,HOME:268,END:269,CAPS_LOCK:280,SCROLL_LOCK:281,NUM_LOCK:282,PRINT_SCREEN:283,PAUSE:284,F1:290,F2:291,F3:292,F4:293,F5:294,F6:295,F7:296,F8:297,F9:298,F10:299,F11:300,F12:301,F13:302,F14:303,F15:304,F16:305,F17:306,F18:307,F19:308,F20:309,F21:310,F22:311,F23:312,F24:313,F25:314,KP_0:320,KP_1:321,KP_2:322,KP_3:323,KP_4:324,KP_5:325,KP_6:326,KP_7:327,KP_8:328,KP_9:329,KP_DECIMAL:330,KP_DIVIDE:331,KP_MULTIPLY:332,KP_SUBTRACT:333,KP_ADD:334,KP_ENTER:335,KP_EQUAL:336,LEFT_SHIFT:340,LEFT_CONTROL:341,LEFT_ALT:342,LEFT_SUPER:343,RIGHT_SHIFT:344,RIGHT_CONTROL:345,RIGHT_ALT:346,RIGHT_SUPER:347,MENU:348})}static{this.ACTION=Object.freeze({RELEASE:0,PRESS:1,REPEAT:2})}static{this.MODIFIER=Object.freeze({SHIFT:1,CONTROL:2,ALT:4,SUPER:8,CAPS_LOCK:16,NUM_LOCK:32})}};var U=class{static Create(e){return Number(a.Call("Entity_Create",{name:e,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Entity_Destroy",{entityHandle:e})}static SetName(e,t){return!!a.Call("Entity_SetName",{entityHandle:e,name:t})}static GetName(e){return a.Call("Entity_GetName",{entityHandle:e})}};var _=class{static Create(e){return!!a.Call("GrabInteractableAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("GrabInteractableAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("GrabInteractableAPI_HasComponent",{entityHandle:e})}static GetTrackPosition(e){return!!a.Call("GrabInteractableAPI_GetTrackPosition",{entityHandle:e})}static SetTrackPosition(e,t){return!!a.Call("GrabInteractableAPI_SetTrackPosition",{entityHandle:e,isTracking:t})}static GetTrackRotation(e){return JSON.parse(a.Call("GrabInteractableAPI_GetTrackRotation",{entityHandle:e}))}static SetTrackRotation(e,t){return JSON.parse(a.Call("GrabInteractableAPI_SetTrackRotation",{entityHandle:e,isTracking:t}))}static GetTrackScale(e){return!!a.Call("GrabInteractableAPI_GetTrackScale",{entityHandle:e})}static SetTrackScale(e,t){return!!a.Call("GrabInteractableAPI_SetTrackScale",{entityHandle:e,isTracking:t})}static GetThrowOnDetach(e){return!!a.Call("GrabInteractableAPI_GetThrowOnDetach",{entityHandle:e})}static SetThrowOnDetach(e,t){return!!a.Call("GrabInteractableAPI_SetThrowOnDetach",{entityHandle:e,enable:t})}static GetAttachEntity(e){return!!a.Call("GrabInteractableAPI_GetAttachEntity",{entityHandle:e})}static SetAttachEntity(e,t){return!!a.Call("GrabInteractableAPI_SetAttachEntity",{entityHandle:e,attachEntityHandle:t})}static AddSelectEnteredCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectEnteredCallback",{entityHandle:e,onSelectEntered:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddSelectExitedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectExitedCallback",{entityHandle:e,onSelectExited:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddActivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddActivatedCallback",{entityHandle:e,onActivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddDeactivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddDeactivatedCallback",{entityHandle:e,onDeactivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}};var q=class i{static{this.stateMap=new Map}static GetNetworkID(){return a.Call("_Main::GetNetworkPrefabIdByPid",{pid:process.pid})}static CreateNetworkState(e,t,n=()=>{}){let r=structuredClone(t);i.stateMap.set(e,r);let l=new Proxy(r,{get(o,u){return Reflect.get(o,u)},set(o,u,g){return Reflect.set(o,u,g),a.Call("_RPC::BroadcastState",{networkId:i.GetNetworkID(),key:e,payload:JSON.stringify({prop:u,value:g})}),!0}});return a.Call("_RPC::AddNewState",{networkId:i.GetNetworkID(),key:e,onReceived:o=>{console.log("onReceived: "+o.data);let u=i.stateMap.get(e);if(!u)return;let{prop:g,value:c}=JSON.parse(o.data);u[g]=c,n(g,c)}}),l}static IsStateAuthority(){return a.Call("_RPC:IsStateAuthority",{networkId:i.GetNetworkID()})}static GetPlayerId(){return a.Call("Multiplayer_GetPlayerId",{})}};import{vec3 as w}from"gl-matrix";var S=class{static CreateBox(e){return Number(a.Call("ColliderAPI_CreateBox",{entityHandle:e}))}static CreateSphere(e){return Number(a.Call("ColliderAPI_CreateSphere",{entityHandle:e}))}static CreateCapsule(e){return Number(a.Call("ColliderAPI_CreateCapsule",{entityHandle:e}))}static Destroy(e,t){return!!a.Call("ColliderAPI_Destroy",{entityHandle:e,colliderHandle:t})}static HasComponent(e,t){return!!a.Call("ColliderAPI_HasComponent",{entityHandle:e,colliderHandle:t})}static GetGameObject(e){return Number(a.Call("ColliderAPI_GetGameObject",{entityHandle:e}))}static GetBoxColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderCenter",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetBoxColliderCenter(e,t){return a.Call("ColliderAPI_SetBoxColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetBoxColliderSize(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderSize",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetBoxColliderSize(e,t){return a.Call("ColliderAPI_SetBoxColliderSize",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetSphereColliderCenter",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetSphereColliderCenter(e,t){return a.Call("ColliderAPI_SetSphereColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderRadius(e){return a.Call("ColliderAPI_GetSphereColliderRadius",{colliderHandle:e})}static SetSphereColliderRadius(e,t){return a.Call("ColliderAPI_SetSphereColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetCapsuleColliderCenter",{colliderHandle:e}));return w.fromValues(t[0],t[1],t[2])}static SetCapsuleColliderCenter(e,t){return a.Call("ColliderAPI_SetCapsuleColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetCapsuleColliderRadius(e){return a.Call("ColliderAPI_GetCapsuleColliderRadius",{colliderHandle:e})}static SetCapsuleColliderRadius(e,t){return a.Call("ColliderAPI_SetCapsuleColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderHeight(e){return a.Call("ColliderAPI_GetCapsuleColliderHeight",{colliderHandle:e})}static SetCapsuleColliderHeight(e,t){return a.Call("ColliderAPI_SetCapsuleColliderHeight",{colliderHandle:e,height:t})}static GetIsTrigger(e){return!!a.Call("ColliderAPI_GetIsTrigger",{entityHandle:e})}static SetIsTrigger(e,t){return!!a.Call("ColliderAPI_SetIsTrigger",{colliderHandle:e,isTrigger:t})}static AddTriggerEnterCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerEnterCallback",{entityHandle:e,onTriggerEnter:t})}static AddTriggerExitCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerExitCallback",{entityHandle:e,onTriggerExit:t})}static AddTriggerStayCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerStayCallback",{entityHandle:e,onTriggerStay:t})}};var h=class{static Create(e){return!!a.Call("RidigbodyAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("RidigbodyAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("RidigbodyAPI_HasComponent",{entityHandle:e})}static GetIsKinematic(e){return!!a.Call("RidigbodyAPI_GetIsKinematic",{entityHandle:e})}static SetIsKinematic(e,t){return!!a.Call("RidigbodyAPI_SetIsKinematic",{entityHandle:e,isKinematic:t})}static GetUseGravity(e){return!!a.Call("RidigbodyAPI_GetUseGravity",{entityHandle:e})}static SetUseGravity(e,t){return!!a.Call("RidigbodyAPI_SetUseGravity",{entityHandle:e,useGravity:t})}static GetMass(e){return Number(a.Call("RidigbodyAPI_GetMass",{entityHandle:e}))}static SetMass(e,t){return!!a.Call("RidigbodyAPI_SetMass",{entityHandle:e,mass:t})}static GetLinearDamping(e){return Number(a.Call("RidigbodyAPI_GetLinearDamping",{entityHandle:e}))}static SetLinearDamping(e,t){return!!a.Call("RidigbodyAPI_SetLinearDamping",{entityHandle:e,linearDamping:t})}static GetAngularDamping(e){return Number(a.Call("RidigbodyAPI_GetAngularDamping",{entityHandle:e}))}static SetAngularDamping(e,t){return!!a.Call("RidigbodyAPI_SetAngularDamping",{entityHandle:e,angularDamping:t})}};var A=class{static Create(e){return!!a.Call("Camera_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Camera_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Camera_HasComponent",{entityHandle:e})}static SetProjection(e,t,n,r,l,o){return!!a.Call("Camera_SetProjection",{entityHandle:e,projectionType:t,fov:n,aspect:r,near:l,far:o})}static SetOrthographic(e,t,n,r,l,o,u){return!!a.Call("Camera_SetOrthographic",{entityHandle:e,left:t,right:n,bottom:r,top:l,near:o,far:u})}static LookAt(e,t,n,r,l,o,u,g,c,I){return!!a.Call("Camera_LookAt",{entityHandle:e,targetX:t,targetY:n,targetZ:r,upX:l,upY:o,upZ:u,worldUpX:g,worldUpY:c,worldUpZ:I})}static SetCullingMask(e,t){return!!a.Call("Camera_SetCullingMask",{entityHandle:e,mask:t})}static SetRenderTexture(e,t){return!!a.Call("Camera_SetRenderTexture",{entityHandle:e,renderTextureHandle:t})}};var f=class{static Create(e,t){return!!a.Call("Light_Create",{entityHandle:e,lightType:t})}static Destroy(e){return!!a.Call("Light_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Light_HasComponent",{entityHandle:e})}static SetType(e,t){return!!a.Call("Light_SetType",{entityHandle:e,lightType:t})}static SetColor(e,t){return!!a.Call("Light_SetColor",{entityHandle:e,r:t[0],g:t[1],b:t[2]})}static SetIntensity(e,t){return!!a.Call("Light_SetIntensity",{entityHandle:e,intensity:t})}static SetRange(e,t){return!!a.Call("Light_SetRange",{entityHandle:e,range:t})}static SetSpotAngle(e,t,n=!0){return!!a.Call("Light_SetSpotAngle",{entityHandle:e,angle:t,value:n})}static SetShadows(e,t){return!!a.Call("Light_SetShadows",{entityHandle:e,shadowType:t})}static SetCullingMask(e,t){return!!a.Call("Light_SetCullingMask",{entityHandle:e,mask:t})}},te=(n=>(n[n.NoShadows=0]="NoShadows",n[n.Hard=1]="Hard",n[n.Soft=2]="Soft",n))(te||{}),Q=(r=>(r[r.Spot=0]="Spot",r[r.Directional=1]="Directional",r[r.Point=2]="Point",r[r.Area=3]="Area",r))(Q||{});var ae=(e=>(e.URP_LIT="Universal Render Pipeline/Lit",e))(ae||{}),ne=(m=>(m.BaseMap="_BaseMap",m.BaseColor="_BaseColor",m.Cutoff="_Cutoff",m.Smoothness="_Smoothness",m.SmoothnessTextureChannel="_SmoothnessTextureChannel",m.Metallic="_Metallic",m.MetallicGlossMap="_MetallicGlossMap",m.SpecColor="_SpecColor",m.SpecGlossMap="_SpecGlossMap",m.SpecularHighlights="_SpecularHighlights",m.EnvironmentReflections="_EnvironmentReflections",m.BumpScale="_BumpScale",m.BumpMap="_BumpMap",m.Parallax="_Parallax",m.ParallaxMap="_ParallaxMap",m.OcclusionStrength="_OcclusionStrength",m.OcclusionMap="_OcclusionMap",m.EmissionColor="_EmissionColor",m.EmissionMap="_EmissionMap",m.DetailMask="_DetailMask",m.DetailAlbedoMapScale="_DetailAlbedoMapScale",m.DetailAlbedoMap="_DetailAlbedoMap",m.DetailNormalMapScale="_DetailNormalMapScale",m.DetailNormalMap="_DetailNormalMap",m))(ne||{}),x=class{static Create(e="Universal Render Pipeline/Lit",t,n=0){let r=Number(a.Call("Material_Create",{shaderName:e,clientId:a.GetClientId()}));return t!==void 0&&a.Call("Renderable_SetMaterial",{entityHandle:t,materialHandle:r,index:n}),r}static Destroy(e){return!!a.Call("Material_Destroy",{materialHandle:e})}static CreateInstance(e){return Number(a.Call("Material_CreateInstance",{materialHandle:e,clientId:a.GetClientId()}))}static SetFloat(e,t,n){return!!a.Call("Material_SetFloat",{materialHandle:e,propertyName:t,value:n})}static SetVector(e,t,n){return!!a.Call("Material_SetVector",{materialHandle:e,propertyName:t,x:n[0],y:n[1],z:n[2],w:n[3]})}static SetColor(e,t,n){return!!a.Call("Material_SetColor",{materialHandle:e,propertyName:t,r:n[0],g:n[1],b:n[2],a:n[3]})}static SetTexture(e,t,n){return!!a.Call("Material_SetTexture",{materialHandle:e,propertyName:t,textureHandle:n})}static GetFloat(e,t){return Number(a.Call("Material_GetFloat",{materialHandle:e,propertyName:t}))}static GetColor(e,t){return a.Call("Material_GetColor",{materialHandle:e,propertyName:t})}};var P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",v=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<P.length;i++)v[P.charCodeAt(i)]=i;var T=i=>{let e=new Uint8Array(i),t,n=e.length,r="";for(t=0;t<n;t+=3)r+=P[e[t]>>2],r+=P[(e[t]&3)<<4|e[t+1]>>4],r+=P[(e[t+1]&15)<<2|e[t+2]>>6],r+=P[e[t+2]&63];return n%3===2?r=r.substring(0,r.length-1)+"=":n%3===1&&(r=r.substring(0,r.length-2)+"=="),r},Be=i=>{let e=i.length*.75,t=i.length,n,r=0,l,o,u,g;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);let c=new ArrayBuffer(e),I=new Uint8Array(c);for(n=0;n<t;n+=4)l=v[i.charCodeAt(n)],o=v[i.charCodeAt(n+1)],u=v[i.charCodeAt(n+2)],g=v[i.charCodeAt(n+3)],I[r++]=l<<2|o>>4,I[r++]=(o&15)<<4|u>>2,I[r++]=(u&3)<<6|g&63;return c};var b=class{static Create(e){let t=Number(a.Call("Mesh_Create",{clientId:a.GetClientId()}));return e!==void 0&&a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}),t}static Destroy(e){return!!a.Call("Mesh_Destroy",{meshHandle:e})}static SetVertices(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=T(r.buffer)}return!!a.Call("Mesh_SetVertices",{meshHandle:e,base64Vertices:n})}static SetTriangles(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=T(r.buffer)}return!!a.Call("Mesh_SetTriangles",{meshHandle:e,base64Triangles:n})}static SetUVs(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*2);for(let l=0;l<t.length;l++){let o=t[l];r[l*2]=o[0],r[l*2+1]=o[1]}n=T(r.buffer)}return!!a.Call("Mesh_SetUVs",{meshHandle:e,base64Uvs:n})}static SetNormals(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let l=0;l<t.length;l++){let o=t[l];r[l*3]=o[0],r[l*3+1]=o[1],r[l*3+2]=o[2]}n=T(r.buffer)}return!!a.Call("Mesh_SetNormals",{meshHandle:e,base64Normals:n})}static RecalcNormals(e){return!!a.Call("Mesh_RecalculateNormals",{meshHandle:e})}static RecalcBounds(e){return!!a.Call("Mesh_RecalculateBounds",{meshHandle:e})}};function Ue(){let i=[[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5],[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5]],e=[[0,2,1],[0,3,2],[4,5,6],[4,6,7],[0,1,5],[0,5,4],[3,7,6],[3,6,2],[0,4,7],[0,7,3],[1,2,6],[1,6,5]],t=b.Create();return b.SetVertices(t,i),b.SetTriangles(t,e),b.RecalcNormals(t),b.RecalcBounds(t),t}function we(){let i=[[-.5,-.5,0],[.5,-.5,0],[.5,.5,0],[-.5,.5,0]],e=[[0,1],[1,1],[1,0],[0,0]],t=[[0,2,1],[0,3,2]],n=b.Create();return b.SetVertices(n,i),b.SetUVs(n,e),b.SetTriangles(n,t),b.RecalcNormals(n),b.RecalcBounds(n),n}var k=class i{static Create(e){return!!a.Call("Renderable_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Renderable_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Renderable_HasComponent",{entityHandle:e})}static SetMesh(e,t){return i.HasComponent(e)?!!a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}):!1}static SetMaterial(e,t,n=0){return!!a.Call("Renderable_SetMaterial",{entityHandle:e,materialHandle:t,index:n})}static SetLayerMask(e,t){return!!a.Call("Renderable_SetLayerMask",{entityHandle:e,layerMask:t})}static SetReceiveShadows(e,t){return!!a.Call("Renderable_SetReceiveShadows",{entityHandle:e,receive:t})}static SetCastShadows(e,t){return!!a.Call("Renderable_SetCastShadows",{entityHandle:e,shadowMode:t})}static SetCulling(e,t){return!!a.Call("Renderable_SetCulling",{entityHandle:e,enabled:t})}};var re=(c=>(c[c.Alpha8=1]="Alpha8",c[c.ARGB4444=2]="ARGB4444",c[c.RGB24=3]="RGB24",c[c.RGBA32=4]="RGBA32",c[c.ARGB32=5]="ARGB32",c[c.RGB565=7]="RGB565",c[c.R16=9]="R16",c[c.DXT1=10]="DXT1",c[c.DXT5=12]="DXT5",c))(re||{}),F=class{static Create2D(e,t,n){return Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}))}static Create2DForMaterial(e,t,n,r,l){let o=Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}));return a.Call("Material_SetTexture",{materialHandle:r,propertyName:l,textureHandle:o}),o}static CreateRenderTexture(e,t,n,r){return Number(a.Call("Texture_CreateRenderTexture",{width:e,height:t,depth:n,format:r,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Texture_Destroy",{textureHandle:e})}static LoadRawTextureData(e,t,n,r){let l=T(t);return!!a.Call("Texture_LoadRawTextureData",{textureHandle:e,base64Rgba:l,width:n,height:r})}static LoadImage(e,t){let n=T(t);return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:n})}static LoadImageBase64(e,t){return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:t})}static SetFilterMode(e,t){return!!a.Call("Texture_SetFilterMode",{textureHandle:e,filterMode:t})}static SetWrapMode(e,t){return!!a.Call("Texture_SetWrapMode",{textureHandle:e,wrapMode:t})}},le=(o=>(o[o.NEAREST=0]="NEAREST",o[o.LINEAR=1]="LINEAR",o[o.NEAREST_MIPMAP_NEAREST=2]="NEAREST_MIPMAP_NEAREST",o[o.LINEAR_MIPMAP_NEAREST=3]="LINEAR_MIPMAP_NEAREST",o[o.NEAREST_MIPMAP_LINEAR=4]="NEAREST_MIPMAP_LINEAR",o[o.LINEAR_MIPMAP_LINEAR=5]="LINEAR_MIPMAP_LINEAR",o))(le||{}),oe=(n=>(n[n.CLAMP_TO_EDGE=0]="CLAMP_TO_EDGE",n[n.REPEAT=1]="REPEAT",n[n.MIRRORED_REPEAT=2]="MIRRORED_REPEAT",n))(oe||{});var N=class{static GetDefault(){return Number(a.Call("Scene_GetDefault",{}))}static SetSkybox(e,t){return!!a.Call("Scene_SetSkybox",{sceneHandle:e,skyboxHandle:t})}static SetAmbientLight(e,t,n,r,l){return!!a.Call("Scene_SetAmbientLight",{sceneHandle:e,r:t,g:n,b:r,intensity:l})}static SetFog(e,t,n,r,l,o){return!!a.Call("Scene_SetFog",{sceneHandle:e,enabled:t,mode:n,density:r,start:l,end:o})}};var Z=class{static GetDefaultCameraEntity(){return console.warn("GetDefaultCameraEntity(): Unity RPC not available"),-1}static GetXRCameras(){return console.warn("GetXRCameras(): Unity RPC not available"),[]}static DestroyMaterialInstance(e){return x.Destroy(e)}static DestroyRenderTarget(e){return F.Destroy(e)}static DestroySkybox(e){return x.Destroy(e)}static DestroyIndirectLight(e){return console.warn("DestroyIndirectLight(): no Unity RPC equivalent"),!1}static SetSkybox(e,t){return N.SetSkybox(e,t)}static SetAmbientLight(e,t,n,r,l){return N.SetAmbientLight(e,t,n,r,l)}static SetFog(e,t,n,r,l,o){return N.SetFog(e,t,n,r,l,o)}};import{mat4 as ie,quat as $,vec3 as V}from"gl-matrix";var G=class{static HasComponent(e){return!!a.Call("Transform_HasComponent",{entityHandle:e})}static SetTransform(e,t){let n=new Array(16);for(let l=0;l<4;l++)for(let o=0;o<4;o++){let u=t[l*4+o];o===2&&(u=-u),n[o*4+l]=u}let r=n.join(",");return!!a.Call("Transform_SetTransform",{entityHandle:e,matrixJson:r})}static GetTransform(e){let n=a.Call("Transform_GetTransform",{entityHandle:e}).split(",").map(r=>parseFloat(r));if(n.length!==16)throw new Error(`Invalid transform data (${n.length} elements)`);return ie.fromValues(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}static SetParent(e,t){return!!a.Call("Transform_SetParent",{entityHandle:e,parentHandle:t})}static GetParent(e){return Number(a.Call("Transform_GetParent",{entityHandle:e}))}static SetWorldPosition(e,t){return!!a.Call("Transform_SetWorldPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static SetLocalPosition(e,t){return!!a.Call("Transform_SetLocalPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetWorldPosition(e){let t=a.Call("Transform_GetWorldPosition",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return V.fromValues(n,r,l)}static GetLocalPosition(e){let t=a.Call("Transform_GetLocalPosition",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return V.fromValues(n,r,l)}static SetWorldRotation(e,t){return!!a.Call("Transform_SetWorldRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static SetLocalRotation(e,t){return!!a.Call("Transform_SetLocalRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static GetWorldRotation(e){let t=a.Call("Transform_GetWorldRotation",{entityHandle:e}),[n,r,l,o]=t.split(",").map(u=>parseFloat(u));return $.fromValues(n,r,l,o)}static GetLocalRotation(e){let t=a.Call("Transform_GetLocalRotation",{entityHandle:e}),[n,r,l,o]=t.split(",").map(u=>parseFloat(u));return $.fromValues(n,r,l,o)}static SetLocalScale(e,t){return!!a.Call("Transform_SetLocalScale",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetLocalScale(e){let t=a.Call("Transform_GetLocalScale",{entityHandle:e}),[n,r,l]=t.split(",").map(o=>parseFloat(o));return V.fromValues(n,r,l)}};import{quat as se,vec3 as M}from"gl-matrix";var dt=async(i,e)=>{let t=e.scene,n=new Map(t.properties.value),r=new Map(t.transforms.value),l=new Map(t.renderables.value),o=new Map(t.lights.value),u=new Map(t.cameras.value),g=new Map(t.colliders.value),c=new Map(t.rigidbodies.value),I=new Map(t.grabbles.value),D=new Map;for(let E of t.entities.value){let s=n.get(E),y=U.Create(s.name);D.set(E,y)}for(let E of t.entities.value){let s=D.get(E),y=r.get(E);if(y)y.parent!=="00000000-0000-0000-0000-000000000000"&&G.SetParent(s,D.get(y.parent)),G.SetLocalPosition(s,M.fromValues(y.localPosition.value[0],y.localPosition.value[1],y.localPosition.value[2])),G.SetLocalScale(s,M.fromValues(y.localScale.value[0],y.localScale.value[1],y.localScale.value[2])),G.SetLocalRotation(s,se.fromEuler([0,0,0,0],y.localRotation.value.x,y.localRotation.value.y,y.localRotation.value.z,"xyz"));else throw Error(`Data corrupted. Entity ${E} has no transform`);let O=l.get(E);if(O&&O.mesh&&O.material){k.Create(s);let C=i.get(O.mesh);if(C)for(let d of C.meshPrimitives){let B=b.Create();b.SetVertices(B,d.base64Vertices),b.SetTriangles(B,d.base64Indices),d.base64Uvs&&b.SetUVs(B,C.base64Uvs),d.base64Normals&&b.SetNormals(B,d.base64Normals),k.SetMesh(s,B)}}let R=o.get(E);R&&(f.Create(s,R.lightType),f.SetColor(s,M.fromValues(R.color.x,R.color.y,R.color.z)),f.SetCullingMask(s,R.cullingMask),f.SetIntensity(s,R.intensity),f.SetRange(s,R.range),f.SetShadows(s,R.shadows),R.lightType==0&&f.SetSpotAngle(s,R.spotAngle));let p=u.get(E);p&&(A.Create(s),A.SetCullingMask(s,p.cullingMask),p.projectionType==0?A.SetProjection(s,0,p.projectionFov,p.projectionAspectRatio,p.projectionNear,p.projectionFar):A.SetOrthographic(s,p.orthoLeft,p.orthoRight,p.orthoBottom,p.orthoTop,p.orthoNear,p.orthoFar));let z=g.get(E);z&&z.colliders.forEach(C=>{switch(C.colliderType){case"Box":{let d=S.CreateBox(s);S.SetBoxColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetBoxColliderSize(d,M.fromValues(C.size.x,C.size.y,C.size.z));break}case"Sphere":{let d=S.CreateSphere(s);S.SetSphereColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetSphereColliderRadius(d,C.radius);break}case"Capsule":{let d=S.CreateCapsule(s);S.SetCapsuleColliderCenter(d,M.fromValues(C.center.x,C.center.y,C.center.z)),S.SetCapsuleColliderRadius(d,C.radius),S.SetCapsuleColliderHeight(d,C.height);break}}});let L=c.get(E);L&&(h.Create(s),h.SetAngularDamping(s,L.angularDamping),h.SetIsKinematic(s,L.isKinematic),h.SetLinearDamping(s,L.linearDamping),h.SetMass(s,L.mass),h.SetUseGravity(s,L.useGravity));let H=I.get(E);H&&(_.Create(s),_.SetThrowOnDetach(s,H.throwOnDetach),_.SetTrackPosition(s,H.trackPosition),_.SetTrackRotation(s,H.trackRotation),_.SetTrackScale(s,H.trackScale),H.attachEntity&&_.SetAttachEntity(s,D.get(H.attachEntity)))}};export{A as CameraManager,S as ColliderManager,X as Debug,j as Device,U as EntityManager,_ as GrabInteractableManager,Y as Keyboard,f as LightManager,te as LightShadowMode,Q as LightType,dt as LoadProject,x as MaterialManager,b as MeshManager,Ue as NewCubeMesh,we as NewQuadMesh,k as RenderableManager,Z as RendererManager,h as RigidbodyManager,a as RpcClient,N as SceneManager,ne as ShaderProperties,ae as ShaderType,q as StateSync,le as TextureFilterMode,re as TextureFormat,F as TextureManager,oe as TextureWrapMode,G as TransformManager,W as XRSystem,Be as base64Decode,T as base64Encode};
|
|
1
|
+
var X=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});import{platform as le}from"node:os";var V=le()==="darwin"?X("./native-bindings-osx.node"):X("./native-bindings-win.node"),a=class i{static Init(){V.Rpc_RegisterCbHandler((e,t)=>{let n=JSON.parse(t),r=i.keyValueToObject(n.keys,n.values);try{i.callbackRegistry[e](r)}catch(o){console.error(`${o}`)}})}static RegisterCallback(e){let t=Number(i.Call("_RPC::AllocateCallback",{clientId:i.GetClientId()}));return i.callbackRegistry[t]=e,t}static Call(e,t){this.initialized||(this.initialized=!0,i.Init());let n={};for(let[r,o]of Object.entries(t))typeof o=="function"?n[r]=i.RegisterCallback(o):n[r]=o;return JSON.parse(V.Rpc_Call(e,JSON.stringify(this.objectToKeyValue(n)))).result}static GetClientId(){return Number(V.Rpc_GetClientId())}static objectToKeyValue(e){let t=Object.keys(e),n=t.map(r=>e[r]);return{keys:t,values:n}}static keyValueToObject(e,t){let n={};return e.forEach((r,o)=>{n[r]=t[o]}),n}static{this.callbackRegistry={}}static{this.initialized=!1}};var j=class{static OnCmdCallback(e){return a.Call("DebugWindow::GetCommand",{callback:e})}};var W=class{static GetLeftPosition(){return JSON.parse(a.Call("XRI Left/Position",{}))}static GetLeftRotation(){return JSON.parse(a.Call("XRI Left/Rotation",{}))}static GetLeftThumbstick(){return JSON.parse(a.Call("XRI Left/Thumbstick",{}))}static GetLeftSelect(){return JSON.parse(a.Call("XRI Left Interaction/Select Value",{}))}static GetLeftActivate(){return JSON.parse(a.Call("XRI Left Interaction/Activate Value",{}))}static GetLeftTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Turn",{}))}static GetLeftSnapTurn(){return JSON.parse(a.Call("XRI Left Locomotion/Snap Turn",{}))}static GetLeftMove(){return JSON.parse(a.Call("XRI Left Locomotion/Move",{}))}static GetLeftGrabMove(){return JSON.parse(a.Call("XRI Left Locomotion/Grab Move",{}))}static GetRightPosition(){return JSON.parse(a.Call("XRI Right/Position",{}))}static GetRightRotation(){return JSON.parse(a.Call("XRI Right/Rotation",{}))}static GetRightThumbstick(){return JSON.parse(a.Call("XRI Right/Thumbstick",{}))}static GetRightSelect(){return JSON.parse(a.Call("XRI Right Interaction/Select Value",{}))}static GetRightActivate(){return JSON.parse(a.Call("XRI Right Interaction/Activate Value",{}))}static GetRightTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Turn",{}))}static GetRightSnapTurn(){return JSON.parse(a.Call("XRI Right Locomotion/Snap Turn",{}))}static GetRightMove(){return JSON.parse(a.Call("XRI Right Locomotion/Move",{}))}static GetRightGrabMove(){return JSON.parse(a.Call("XRI Right Locomotion/Grab Move",{}))}static GetHeadPosition(){return JSON.parse(a.Call("XRI Head/Position",{}))}static GetHeadRotation(){return JSON.parse(a.Call("XRI Head/Rotation",{}))}static GetLeftWorldPosition(){return JSON.parse(a.Call("XRI Left/WorldPosition",{}))}static GetLeftWorldRotation(){return JSON.parse(a.Call("XRI Left/WorldRotation",{}))}static GetRightWorldPosition(){return JSON.parse(a.Call("XRI Right/WorldPosition",{}))}static GetRightWorldRotation(){return JSON.parse(a.Call("XRI Right/WorldRotation",{}))}static GetHeadWorldPosition(){return JSON.parse(a.Call("XRI Head/WorldPosition",{}))}static GetHeadWorldRotation(){return JSON.parse(a.Call("XRI Head/WorldRotation",{}))}},Y=class{static{this.KEYCODE=Object.freeze({LEFT_EYE:"Left Eye",RIGHT_EYE:"Right Eye",LEFT_AIM:"Left Aim",RIGHT_AIM:"Right Aim",LEFT_GRIP:"Left Grip",RIGHT_GRIP:"Right Grip",LEFT_SQUEEZE:"Left Squeeze",RIGHT_SQUEEZE:"Right Squeeze",LEFT_TRIGGER:"Left Trigger",RIGHT_TRIGGER:"Right Trigger",LEFT_THUMBSTICK_X:"Left Thumbstick X",RIGHT_THUMBSTICK_X:"Right Thumbstick X",LEFT_THUMBSTICK_Y:"Left Thumbstick Y",RIGHT_THUMBSTICK_Y:"Right Thumbstick Y",LEFT_TRIGGER_TOUCH:"Left Trigger Touch",RIGHT_TRIGGER_TOUCH:"Right Trigger Touch",LEFT_THUMBSTICK_CLICK:"Left Thumbstick Click",RIGHT_THUMBSTICK_CLICK:"Right Thumbstick Click",LEFT_THUMBSTICK_TOUCH:"Left Thumbstick Touch",RIGHT_THUMBSTICK_TOUCH:"Right Thumbstick Touch",LEFT_X_CLICK:"Left X Click",LEFT_X_TOUCH:"Left X Touch",LEFT_Y_CLICK:"Left Y Click",LEFT_Y_TOUCH:"Left Y Touch",LEFT_MENU_CLICK:"Left Menu Click",RIGHT_A_CLICK:"Right A Click",RIGHT_A_TOUCH:"Right A Touch",RIGHT_B_CLIKC:"Right B Click",RIGHT_B_TOUCH:"Right B Touch",RIGHT_SYSTEM_CLICK:"Right System Click"})}},q=class{static{this.MOUSE=Object.freeze({BUTTON_LEFT:0,BUTTON_RIGHT:1,BUTTON_MIDDLE:2})}static{this.KEYCODE=Object.freeze({SPACE:32,APOSTROPHE:39,COMMA:44,MINUS:45,PERIOD:46,SLASH:47,NUM_0:48,NUM_1:49,NUM_2:50,NUM_3:51,NUM_4:52,NUM_5:53,NUM_6:54,NUM_7:55,NUM_8:56,NUM_9:57,SEMICOLON:59,EQUAL:61,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,LEFT_BRACKET:91,BACKSLASH:92,RIGHT_BRACKET:93,GRAVE_ACCENT:96,WORLD_1:161,WORLD_2:162,ESCAPE:256,ENTER:257,TAB:258,BACKSPACE:259,INSERT:260,DELETE:261,RIGHT:262,LEFT:263,DOWN:264,UP:265,PAGE_UP:266,PAGE_DOWN:267,HOME:268,END:269,CAPS_LOCK:280,SCROLL_LOCK:281,NUM_LOCK:282,PRINT_SCREEN:283,PAUSE:284,F1:290,F2:291,F3:292,F4:293,F5:294,F6:295,F7:296,F8:297,F9:298,F10:299,F11:300,F12:301,F13:302,F14:303,F15:304,F16:305,F17:306,F18:307,F19:308,F20:309,F21:310,F22:311,F23:312,F24:313,F25:314,KP_0:320,KP_1:321,KP_2:322,KP_3:323,KP_4:324,KP_5:325,KP_6:326,KP_7:327,KP_8:328,KP_9:329,KP_DECIMAL:330,KP_DIVIDE:331,KP_MULTIPLY:332,KP_SUBTRACT:333,KP_ADD:334,KP_ENTER:335,KP_EQUAL:336,LEFT_SHIFT:340,LEFT_CONTROL:341,LEFT_ALT:342,LEFT_SUPER:343,RIGHT_SHIFT:344,RIGHT_CONTROL:345,RIGHT_ALT:346,RIGHT_SUPER:347,MENU:348})}static{this.ACTION=Object.freeze({RELEASE:0,PRESS:1,REPEAT:2})}static{this.MODIFIER=Object.freeze({SHIFT:1,CONTROL:2,ALT:4,SUPER:8,CAPS_LOCK:16,NUM_LOCK:32})}};var F=class{static Create(e){return Number(a.Call("Entity_Create",{name:e,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Entity_Destroy",{entityHandle:e})}static SetName(e,t){return!!a.Call("Entity_SetName",{entityHandle:e,name:t})}static GetName(e){return a.Call("Entity_GetName",{entityHandle:e})}};var H=class{static Create(e){return!!a.Call("GrabInteractableAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("GrabInteractableAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("GrabInteractableAPI_HasComponent",{entityHandle:e})}static GetTrackPosition(e){return!!a.Call("GrabInteractableAPI_GetTrackPosition",{entityHandle:e})}static SetTrackPosition(e,t){return!!a.Call("GrabInteractableAPI_SetTrackPosition",{entityHandle:e,isTracking:t})}static GetTrackRotation(e){return JSON.parse(a.Call("GrabInteractableAPI_GetTrackRotation",{entityHandle:e}))}static SetTrackRotation(e,t){return JSON.parse(a.Call("GrabInteractableAPI_SetTrackRotation",{entityHandle:e,isTracking:t}))}static GetTrackScale(e){return!!a.Call("GrabInteractableAPI_GetTrackScale",{entityHandle:e})}static SetTrackScale(e,t){return!!a.Call("GrabInteractableAPI_SetTrackScale",{entityHandle:e,isTracking:t})}static GetThrowOnDetach(e){return!!a.Call("GrabInteractableAPI_GetThrowOnDetach",{entityHandle:e})}static SetThrowOnDetach(e,t){return!!a.Call("GrabInteractableAPI_SetThrowOnDetach",{entityHandle:e,enable:t})}static GetAttachEntity(e){return!!a.Call("GrabInteractableAPI_GetAttachEntity",{entityHandle:e})}static SetAttachEntity(e,t){return!!a.Call("GrabInteractableAPI_SetAttachEntity",{entityHandle:e,attachEntityHandle:t})}static AddSelectEnteredCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectEnteredCallback",{entityHandle:e,onSelectEntered:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddSelectExitedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddSelectExitedCallback",{entityHandle:e,onSelectExited:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddActivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddActivatedCallback",{entityHandle:e,onActivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}static AddDeactivatedCallback(e,t){return!!a.Call("GrabInteractableAPI_AddDeactivatedCallback",{entityHandle:e,onDeactivated:n=>{t(n.interactableEntity,n.interactorEntity)}})}};var Q=class i{static{this.stateMap=new Map}static GetNetworkID(){return a.Call("_Main::GetNetworkPrefabIdByPid",{pid:process.pid})}static CreateNetworkState(e,t,n=()=>{}){let r=structuredClone(t);i.stateMap.set(e,r);let o=new Proxy(r,{get(l,C){return Reflect.get(l,C)},set(l,C,E){return Reflect.set(l,C,E),a.Call("_RPC::BroadcastState",{networkId:i.GetNetworkID(),key:e,payload:JSON.stringify({prop:C,value:E})}),!0}});return a.Call("_RPC::AddNewState",{networkId:i.GetNetworkID(),key:e,onReceived:l=>{console.log("onReceived: "+l.data);let C=i.stateMap.get(e);if(!C)return;let{prop:E,value:u}=JSON.parse(l.data);C[E]=u,n(E,u)}}),o}static IsStateAuthority(){return a.Call("_RPC:IsStateAuthority",{networkId:i.GetNetworkID()})}static GetPlayerId(){return a.Call("Multiplayer_GetPlayerId",{})}};import{vec3 as K}from"gl-matrix";var f=class{static CreateBox(e){return Number(a.Call("ColliderAPI_CreateBox",{entityHandle:e}))}static CreateSphere(e){return Number(a.Call("ColliderAPI_CreateSphere",{entityHandle:e}))}static CreateCapsule(e){return Number(a.Call("ColliderAPI_CreateCapsule",{entityHandle:e}))}static Destroy(e,t){return!!a.Call("ColliderAPI_Destroy",{entityHandle:e,colliderHandle:t})}static HasComponent(e,t){return!!a.Call("ColliderAPI_HasComponent",{entityHandle:e,colliderHandle:t})}static GetGameObject(e){return Number(a.Call("ColliderAPI_GetGameObject",{entityHandle:e}))}static GetBoxColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderCenter",{colliderHandle:e}));return K.fromValues(t[0],t[1],t[2])}static SetBoxColliderCenter(e,t){return a.Call("ColliderAPI_SetBoxColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetBoxColliderSize(e){let t=JSON.parse(a.Call("ColliderAPI_GetBoxColliderSize",{colliderHandle:e}));return K.fromValues(t[0],t[1],t[2])}static SetBoxColliderSize(e,t){return a.Call("ColliderAPI_SetBoxColliderSize",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetSphereColliderCenter",{colliderHandle:e}));return K.fromValues(t[0],t[1],t[2])}static SetSphereColliderCenter(e,t){return a.Call("ColliderAPI_SetSphereColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetSphereColliderRadius(e){return a.Call("ColliderAPI_GetSphereColliderRadius",{colliderHandle:e})}static SetSphereColliderRadius(e,t){return a.Call("ColliderAPI_SetSphereColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderCenter(e){let t=JSON.parse(a.Call("ColliderAPI_GetCapsuleColliderCenter",{colliderHandle:e}));return K.fromValues(t[0],t[1],t[2])}static SetCapsuleColliderCenter(e,t){return a.Call("ColliderAPI_SetCapsuleColliderCenter",{colliderHandle:e,v0:t[0],v1:t[1],v2:t[2]})}static GetCapsuleColliderRadius(e){return a.Call("ColliderAPI_GetCapsuleColliderRadius",{colliderHandle:e})}static SetCapsuleColliderRadius(e,t){return a.Call("ColliderAPI_SetCapsuleColliderRadius",{colliderHandle:e,radius:t})}static GetCapsuleColliderHeight(e){return a.Call("ColliderAPI_GetCapsuleColliderHeight",{colliderHandle:e})}static SetCapsuleColliderHeight(e,t){return a.Call("ColliderAPI_SetCapsuleColliderHeight",{colliderHandle:e,height:t})}static GetIsTrigger(e){return!!a.Call("ColliderAPI_GetIsTrigger",{entityHandle:e})}static SetIsTrigger(e,t){return!!a.Call("ColliderAPI_SetIsTrigger",{colliderHandle:e,isTrigger:t})}static AddTriggerEnterCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerEnterCallback",{entityHandle:e,onTriggerEnter:t})}static AddTriggerExitCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerExitCallback",{entityHandle:e,onTriggerExit:t})}static AddTriggerStayCallback(e,t){return!!a.Call("ColliderAPI_AddTriggerStayCallback",{entityHandle:e,onTriggerStay:t})}};var G=class{static Create(e){return!!a.Call("RidigbodyAPI_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("RidigbodyAPI_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("RidigbodyAPI_HasComponent",{entityHandle:e})}static GetIsKinematic(e){return!!a.Call("RidigbodyAPI_GetIsKinematic",{entityHandle:e})}static SetIsKinematic(e,t){return!!a.Call("RidigbodyAPI_SetIsKinematic",{entityHandle:e,isKinematic:t})}static GetUseGravity(e){return!!a.Call("RidigbodyAPI_GetUseGravity",{entityHandle:e})}static SetUseGravity(e,t){return!!a.Call("RidigbodyAPI_SetUseGravity",{entityHandle:e,useGravity:t})}static GetMass(e){return Number(a.Call("RidigbodyAPI_GetMass",{entityHandle:e}))}static SetMass(e,t){return!!a.Call("RidigbodyAPI_SetMass",{entityHandle:e,mass:t})}static GetLinearDamping(e){return Number(a.Call("RidigbodyAPI_GetLinearDamping",{entityHandle:e}))}static SetLinearDamping(e,t){return!!a.Call("RidigbodyAPI_SetLinearDamping",{entityHandle:e,linearDamping:t})}static GetAngularDamping(e){return Number(a.Call("RidigbodyAPI_GetAngularDamping",{entityHandle:e}))}static SetAngularDamping(e,t){return!!a.Call("RidigbodyAPI_SetAngularDamping",{entityHandle:e,angularDamping:t})}};var x=class{static Create(e){return!!a.Call("Camera_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Camera_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Camera_HasComponent",{entityHandle:e})}static SetProjection(e,t,n,r,o,l){return!!a.Call("Camera_SetProjection",{entityHandle:e,projectionType:t,fov:n,aspect:r,near:o,far:l})}static SetOrthographic(e,t,n,r,o,l,C){return!!a.Call("Camera_SetOrthographic",{entityHandle:e,left:t,right:n,bottom:r,top:o,near:l,far:C})}static LookAt(e,t,n,r,o,l,C,E,u,L){return!!a.Call("Camera_LookAt",{entityHandle:e,targetX:t,targetY:n,targetZ:r,upX:o,upY:l,upZ:C,worldUpX:E,worldUpY:u,worldUpZ:L})}static SetCullingMask(e,t){return!!a.Call("Camera_SetCullingMask",{entityHandle:e,mask:t})}static SetRenderTexture(e,t){return!!a.Call("Camera_SetRenderTexture",{entityHandle:e,renderTextureHandle:t})}};var I=class{static Create(e,t){return!!a.Call("Light_Create",{entityHandle:e,lightType:t})}static Destroy(e){return!!a.Call("Light_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Light_HasComponent",{entityHandle:e})}static SetType(e,t){return!!a.Call("Light_SetType",{entityHandle:e,lightType:t})}static SetColor(e,t){return!!a.Call("Light_SetColor",{entityHandle:e,r:t[0],g:t[1],b:t[2]})}static SetIntensity(e,t){return!!a.Call("Light_SetIntensity",{entityHandle:e,intensity:t})}static SetRange(e,t){return!!a.Call("Light_SetRange",{entityHandle:e,range:t})}static SetSpotAngle(e,t,n=!0){return!!a.Call("Light_SetSpotAngle",{entityHandle:e,angle:t,value:n})}static SetShadows(e,t){return!!a.Call("Light_SetShadows",{entityHandle:e,shadowType:t})}static SetCullingMask(e,t){return!!a.Call("Light_SetCullingMask",{entityHandle:e,mask:t})}},ie=(n=>(n[n.NoShadows=0]="NoShadows",n[n.Hard=1]="Hard",n[n.Soft=2]="Soft",n))(ie||{}),Z=(r=>(r[r.Spot=0]="Spot",r[r.Directional=1]="Directional",r[r.Point=2]="Point",r[r.Area=3]="Area",r))(Z||{});var $=(t=>(t.URP_LIT="Universal Render Pipeline/Lit",t.UnityGLTF="UnityGLTF/PBRGraph",t))($||{}),ee=(s=>(s.BaseColor="baseColorFactor",s.BaseColorMap="baseColorTexture",s.NormalScale="normalScale",s.NormalMap="normalTexture",s.Emission="emissiveFactor",s.EmissionMap="emissiveTexture",s.OcclusionStrength="occlusionStrength",s.OcclusionMap="occlusionTexture",s.Roughness="roughnessFactor",s.RoughnessMap="metallicRoughnessTexture",s.Metalness="metallicFactor",s.MetalnessMap="metallicRoughnessTexture",s.AlphaCutoff="alphaCutoff",s))(ee||{}),m=class{static Create(e="Universal Render Pipeline/Lit",t,n=0){let r=Number(a.Call("Material_Create",{shaderName:e,clientId:a.GetClientId()}));return t!==void 0&&a.Call("Renderable_SetMaterial",{entityHandle:t,materialHandle:r,index:n}),r}static Destroy(e){return!!a.Call("Material_Destroy",{materialHandle:e})}static CreateInstance(e){return Number(a.Call("Material_CreateInstance",{materialHandle:e,clientId:a.GetClientId()}))}static SetFloat(e,t,n){return!!a.Call("Material_SetFloat",{materialHandle:e,propertyName:t,value:n})}static SetVector(e,t,n){return!!a.Call("Material_SetVector",{materialHandle:e,propertyName:t,x:n[0],y:n[1],z:n[2],w:n[3]})}static SetColor(e,t,n){return!!a.Call("Material_SetColor",{materialHandle:e,propertyName:t,r:n[0],g:n[1],b:n[2],a:n[3]})}static SetTexture(e,t,n){return!!a.Call("Material_SetTexture",{materialHandle:e,propertyName:t,textureHandle:n})}static GetFloat(e,t){return Number(a.Call("Material_GetFloat",{materialHandle:e,propertyName:t}))}static GetColor(e,t){return a.Call("Material_GetColor",{materialHandle:e,propertyName:t})}};var k="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",U=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let i=0;i<k.length;i++)U[k.charCodeAt(i)]=i;var A=i=>{let e=new Uint8Array(i),t,n=e.length,r="";for(t=0;t<n;t+=3)r+=k[e[t]>>2],r+=k[(e[t]&3)<<4|e[t+1]>>4],r+=k[(e[t+1]&15)<<2|e[t+2]>>6],r+=k[e[t+2]&63];return n%3===2?r=r.substring(0,r.length-1)+"=":n%3===1&&(r=r.substring(0,r.length-2)+"=="),r},ke=i=>{let e=i.length*.75,t=i.length,n,r=0,o,l,C,E;i[i.length-1]==="="&&(e--,i[i.length-2]==="="&&e--);let u=new ArrayBuffer(e),L=new Uint8Array(u);for(n=0;n<t;n+=4)o=U[i.charCodeAt(n)],l=U[i.charCodeAt(n+1)],C=U[i.charCodeAt(n+2)],E=U[i.charCodeAt(n+3)],L[r++]=o<<2|l>>4,L[r++]=(l&15)<<4|C>>2,L[r++]=(C&3)<<6|E&63;return u};var g=class{static Create(e){let t=Number(a.Call("Mesh_Create",{clientId:a.GetClientId()}));return e!==void 0&&a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}),t}static Destroy(e){return!!a.Call("Mesh_Destroy",{meshHandle:e})}static SetVertices(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let o=0;o<t.length;o++){let l=t[o];r[o*3]=l[0],r[o*3+1]=l[1],r[o*3+2]=l[2]}n=A(r.buffer)}return!!a.Call("Mesh_SetVertices",{meshHandle:e,base64Vertices:n})}static SetTriangles(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let o=0;o<t.length;o++){let l=t[o];r[o*3]=l[0],r[o*3+1]=l[1],r[o*3+2]=l[2]}n=A(r.buffer)}return!!a.Call("Mesh_SetTriangles",{meshHandle:e,base64Triangles:n})}static SetUVs(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*2);for(let o=0;o<t.length;o++){let l=t[o];r[o*2]=l[0],r[o*2+1]=l[1]}n=A(r.buffer)}return!!a.Call("Mesh_SetUVs",{meshHandle:e,base64Uvs:n})}static SetNormals(e,t){let n;if(typeof t=="string")n=t;else{let r=new Float32Array(t.length*3);for(let o=0;o<t.length;o++){let l=t[o];r[o*3]=l[0],r[o*3+1]=l[1],r[o*3+2]=l[2]}n=A(r.buffer)}return!!a.Call("Mesh_SetNormals",{meshHandle:e,base64Normals:n})}static RecalcNormals(e){return!!a.Call("Mesh_RecalculateNormals",{meshHandle:e})}static RecalcBounds(e){return!!a.Call("Mesh_RecalculateBounds",{meshHandle:e})}};function Ke(){let i=[[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5],[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5]],e=[[0,2,1],[0,3,2],[4,5,6],[4,6,7],[0,1,5],[0,5,4],[3,7,6],[3,6,2],[0,4,7],[0,7,3],[1,2,6],[1,6,5]],t=g.Create();return g.SetVertices(t,i),g.SetTriangles(t,e),g.RecalcNormals(t),g.RecalcBounds(t),t}function Ve(){let i=[[-.5,-.5,0],[.5,-.5,0],[.5,.5,0],[-.5,.5,0]],e=[[0,1],[1,1],[1,0],[0,0]],t=[[0,2,1],[0,3,2]],n=g.Create();return g.SetVertices(n,i),g.SetUVs(n,e),g.SetTriangles(n,t),g.RecalcNormals(n),g.RecalcBounds(n),n}var M=class i{static Create(e){return!!a.Call("Renderable_Create",{entityHandle:e})}static Destroy(e){return!!a.Call("Renderable_Destroy",{entityHandle:e})}static HasComponent(e){return!!a.Call("Renderable_HasComponent",{entityHandle:e})}static SetMesh(e,t){return i.HasComponent(e)?!!a.Call("Renderable_SetMesh",{entityHandle:e,meshHandle:t}):!1}static SetMaterial(e,t,n=0){return!!a.Call("Renderable_SetMaterial",{entityHandle:e,materialHandle:t,index:n})}static SetLayerMask(e,t){return!!a.Call("Renderable_SetLayerMask",{entityHandle:e,layerMask:t})}static SetReceiveShadows(e,t){return!!a.Call("Renderable_SetReceiveShadows",{entityHandle:e,receive:t})}static SetCastShadows(e,t){return!!a.Call("Renderable_SetCastShadows",{entityHandle:e,shadowMode:t})}static SetCulling(e,t){return!!a.Call("Renderable_SetCulling",{entityHandle:e,enabled:t})}};var te=(u=>(u[u.Alpha8=1]="Alpha8",u[u.ARGB4444=2]="ARGB4444",u[u.RGB24=3]="RGB24",u[u.RGBA32=4]="RGBA32",u[u.ARGB32=5]="ARGB32",u[u.RGB565=7]="RGB565",u[u.R16=9]="R16",u[u.DXT1=10]="DXT1",u[u.DXT5=12]="DXT5",u))(te||{}),p=class{static Create2D(e,t,n){return Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}))}static Create2DForMaterial(e,t,n,r,o){let l=Number(a.Call("Texture_Create2D",{width:e,height:t,format:n,clientId:a.GetClientId()}));return a.Call("Material_SetTexture",{materialHandle:r,propertyName:o,textureHandle:l}),l}static CreateRenderTexture(e,t,n,r){return Number(a.Call("Texture_CreateRenderTexture",{width:e,height:t,depth:n,format:r,clientId:a.GetClientId()}))}static Destroy(e){return!!a.Call("Texture_Destroy",{textureHandle:e})}static LoadRawTextureData(e,t,n,r){let o=A(t);return!!a.Call("Texture_LoadRawTextureData",{textureHandle:e,base64Rgba:o,width:n,height:r})}static LoadImage(e,t){let n=A(t);return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:n})}static LoadImageBase64(e,t){return!!a.Call("Texture_LoadImage",{textureHandle:e,base64Image:t})}static SetFilterMode(e,t){return!!a.Call("Texture_SetFilterMode",{textureHandle:e,filterMode:t})}static SetWrapMode(e,t){return!!a.Call("Texture_SetWrapMode",{textureHandle:e,wrapMode:t})}},se=(l=>(l[l.NEAREST=0]="NEAREST",l[l.LINEAR=1]="LINEAR",l[l.NEAREST_MIPMAP_NEAREST=2]="NEAREST_MIPMAP_NEAREST",l[l.LINEAR_MIPMAP_NEAREST=3]="LINEAR_MIPMAP_NEAREST",l[l.NEAREST_MIPMAP_LINEAR=4]="NEAREST_MIPMAP_LINEAR",l[l.LINEAR_MIPMAP_LINEAR=5]="LINEAR_MIPMAP_LINEAR",l))(se||{}),ce=(n=>(n[n.CLAMP_TO_EDGE=0]="CLAMP_TO_EDGE",n[n.REPEAT=1]="REPEAT",n[n.MIRRORED_REPEAT=2]="MIRRORED_REPEAT",n))(ce||{});var D=class{static GetDefault(){return Number(a.Call("Scene_GetDefault",{}))}static SetSkybox(e,t){return!!a.Call("Scene_SetSkybox",{sceneHandle:e,skyboxHandle:t})}static SetAmbientLight(e,t,n,r,o){return!!a.Call("Scene_SetAmbientLight",{sceneHandle:e,r:t,g:n,b:r,intensity:o})}static SetFog(e,t,n,r,o,l){return!!a.Call("Scene_SetFog",{sceneHandle:e,enabled:t,mode:n,density:r,start:o,end:l})}};var ae=class{static GetDefaultCameraEntity(){return console.warn("GetDefaultCameraEntity(): Unity RPC not available"),-1}static GetXRCameras(){return console.warn("GetXRCameras(): Unity RPC not available"),[]}static DestroyMaterialInstance(e){return m.Destroy(e)}static DestroyRenderTarget(e){return p.Destroy(e)}static DestroySkybox(e){return m.Destroy(e)}static DestroyIndirectLight(e){return console.warn("DestroyIndirectLight(): no Unity RPC equivalent"),!1}static SetSkybox(e,t){return D.SetSkybox(e,t)}static SetAmbientLight(e,t,n,r,o){return D.SetAmbientLight(e,t,n,r,o)}static SetFog(e,t,n,r,o,l){return D.SetFog(e,t,n,r,o,l)}};import{mat4 as ue,quat as ne,vec3 as z}from"gl-matrix";var B=class{static HasComponent(e){return!!a.Call("Transform_HasComponent",{entityHandle:e})}static SetTransform(e,t){let n=new Array(16);for(let o=0;o<4;o++)for(let l=0;l<4;l++){let C=t[o*4+l];l===2&&(C=-C),n[l*4+o]=C}let r=n.join(",");return!!a.Call("Transform_SetTransform",{entityHandle:e,matrixJson:r})}static GetTransform(e){let n=a.Call("Transform_GetTransform",{entityHandle:e}).split(",").map(r=>parseFloat(r));if(n.length!==16)throw new Error(`Invalid transform data (${n.length} elements)`);return ue.fromValues(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],n[9],n[10],n[11],n[12],n[13],n[14],n[15])}static SetParent(e,t){return!!a.Call("Transform_SetParent",{entityHandle:e,parentHandle:t})}static GetParent(e){return Number(a.Call("Transform_GetParent",{entityHandle:e}))}static SetWorldPosition(e,t){return!!a.Call("Transform_SetWorldPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static SetLocalPosition(e,t){return!!a.Call("Transform_SetLocalPosition",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetWorldPosition(e){let t=a.Call("Transform_GetWorldPosition",{entityHandle:e}),[n,r,o]=t.split(",").map(l=>parseFloat(l));return z.fromValues(n,r,o)}static GetLocalPosition(e){let t=a.Call("Transform_GetLocalPosition",{entityHandle:e}),[n,r,o]=t.split(",").map(l=>parseFloat(l));return z.fromValues(n,r,o)}static SetWorldRotation(e,t){return!!a.Call("Transform_SetWorldRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static SetLocalRotation(e,t){return!!a.Call("Transform_SetLocalRotation",{entityHandle:e,x:t[0],y:t[1],z:t[2],w:t[3]})}static GetWorldRotation(e){let t=a.Call("Transform_GetWorldRotation",{entityHandle:e}),[n,r,o,l]=t.split(",").map(C=>parseFloat(C));return ne.fromValues(n,r,o,l)}static GetLocalRotation(e){let t=a.Call("Transform_GetLocalRotation",{entityHandle:e}),[n,r,o,l]=t.split(",").map(C=>parseFloat(C));return ne.fromValues(n,r,o,l)}static SetLocalScale(e,t){return!!a.Call("Transform_SetLocalScale",{entityHandle:e,x:t[0],y:t[1],z:t[2]})}static GetLocalScale(e){let t=a.Call("Transform_GetLocalScale",{entityHandle:e}),[n,r,o]=t.split(",").map(l=>parseFloat(l));return z.fromValues(n,r,o)}};import{quat as Ce,vec3 as N,vec4 as re}from"gl-matrix";var gt=async(i,e)=>{let t=e.scene,n=new Map(t.properties.value),r=new Map(t.transforms.value),o=new Map(t.renderables.value),l=new Map(t.lights.value),C=new Map(t.cameras.value),E=new Map(t.colliders.value),u=new Map(t.rigidbodies.value),L=new Map(t.grabbles.value),w=new Map;for(let h of t.entities.value){let s=n.get(h),S=F.Create(s.name);w.set(h,S)}for(let h of t.entities.value){let s=w.get(h),S=r.get(h);if(S)S.parent!=="00000000-0000-0000-0000-000000000000"&&B.SetParent(s,w.get(S.parent)),B.SetLocalPosition(s,N.fromValues(S.localPosition.value[0],S.localPosition.value[1],S.localPosition.value[2])),B.SetLocalScale(s,N.fromValues(S.localScale.value[0],S.localScale.value[1],S.localScale.value[2])),B.SetLocalRotation(s,Ce.fromEuler([0,0,0,0],S.localRotation.value.x,S.localRotation.value.y,S.localRotation.value.z,"xyz"));else throw Error(`Data corrupted. Entity ${h} has no transform`);let oe=(c,b)=>{let y=m.Create("Universal Render Pipeline/Lit");if(m.SetColor(y,"baseColorFactor",re.fromValues(c.baseColor.x,c.baseColor.y,c.baseColor.z,c.baseColor.w)),c.baseColorMap){let d=p.Create2D(1,1,4),_=i.get(c.baseColorMap);p.LoadImageBase64(d,_.base64Image),m.SetTexture(y,"baseColorTexture",d)}if(c.normalMap){let d=p.Create2D(1,1,4),_=i.get(c.normalMap);p.LoadImageBase64(d,_.base64Image),m.SetTexture(y,"normalTexture",d),m.SetFloat(y,"normalScale",c.normalScale)}if(m.SetColor(y,"emissiveFactor",re.fromValues(c.emissionColor.x,c.emissionColor.y,c.emissionColor.z,1)),c.emissionMap){let d=p.Create2D(1,1,4),_=i.get(c.emissionMap);p.LoadImageBase64(d,_.base64Image),m.SetTexture(y,"emissiveTexture",d)}if(c.occlusionMap){let d=p.Create2D(1,1,4),_=i.get(c.occlusionMap);p.LoadImageBase64(d,_.base64Image),m.SetTexture(y,"occlusionTexture",d),m.SetFloat(y,"occlusionStrength",c.occlusionStrength)}if(M.SetMaterial(s,y),c.roughnessMap||c.metalnessMap){let d=p.Create2D(1,1,4),_=i.get(c.roughnessMap||c.metalnessMap);p.LoadImageBase64(d,_.base64Image),m.SetTexture(y,"metallicRoughnessTexture",d)}m.SetFloat(y,"metallicFactor",c.metalness),m.SetFloat(y,"roughnessFactor",c.roughness),M.SetMaterial(s,y,b)},O=o.get(h);if(O&&O.mesh){M.Create(s);let c=i.get(O.mesh);if(c){let b=a.Call("Internal:Mesh_Create",{clientId:a.GetClientId(),meshAsset:JSON.stringify(c)});M.SetMesh(s,b),M.SetCulling(s,O.culling)}O.materialList.forEach((b,y)=>{let d=i.get(b);d&&oe(d,y)})}let T=l.get(h);T&&(I.Create(s,T.lightType),I.SetColor(s,N.fromValues(T.color.x,T.color.y,T.color.z)),I.SetCullingMask(s,T.cullingMask),I.SetIntensity(s,T.intensity),I.SetRange(s,T.range),I.SetShadows(s,T.shadows),T.lightType==0&&I.SetSpotAngle(s,T.spotAngle));let R=C.get(h);R&&(x.Create(s),x.SetCullingMask(s,R.cullingMask),R.projectionType==0?x.SetProjection(s,0,R.projectionFov,R.projectionAspectRatio,R.projectionNear,R.projectionFar):x.SetOrthographic(s,R.orthoLeft,R.orthoRight,R.orthoBottom,R.orthoTop,R.orthoNear,R.orthoFar));let J=E.get(h);J&&J.colliders.forEach(c=>{switch(c.colliderType){case"Box":{let b=f.CreateBox(s);f.SetBoxColliderCenter(b,N.fromValues(c.center.x,c.center.y,c.center.z)),f.SetBoxColliderSize(b,N.fromValues(c.size.x,c.size.y,c.size.z));break}case"Sphere":{let b=f.CreateSphere(s);f.SetSphereColliderCenter(b,N.fromValues(c.center.x,c.center.y,c.center.z)),f.SetSphereColliderRadius(b,c.radius);break}case"Capsule":{let b=f.CreateCapsule(s);f.SetCapsuleColliderCenter(b,N.fromValues(c.center.x,c.center.y,c.center.z)),f.SetCapsuleColliderRadius(b,c.radius),f.SetCapsuleColliderHeight(b,c.height);break}}});let v=u.get(h);v&&(G.Create(s),G.SetAngularDamping(s,v.angularDamping),G.SetIsKinematic(s,v.isKinematic),G.SetLinearDamping(s,v.linearDamping),G.SetMass(s,v.mass),G.SetUseGravity(s,v.useGravity));let P=L.get(h);P&&(H.Create(s),H.SetThrowOnDetach(s,P.throwOnDetach),H.SetTrackPosition(s,P.trackPosition),H.SetTrackRotation(s,P.trackRotation),H.SetTrackScale(s,P.trackScale),P.attachEntity&&H.SetAttachEntity(s,w.get(P.attachEntity)))}};export{x as CameraManager,f as ColliderManager,j as Debug,W as Device,F as EntityManager,H as GrabInteractableManager,q as Keyboard,I as LightManager,ie as LightShadowMode,Z as LightType,gt as LoadProject,m as MaterialManager,g as MeshManager,Ke as NewCubeMesh,Ve as NewQuadMesh,M as RenderableManager,ae as RendererManager,G as RigidbodyManager,a as RpcClient,D as SceneManager,ee as ShaderProperties,$ as ShaderType,Q as StateSync,se as TextureFilterMode,te as TextureFormat,p as TextureManager,ce as TextureWrapMode,B as TransformManager,Y as XRSystem,ke as base64Decode,A as base64Encode};
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@jack120/test",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Adamas Typescript interface",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"compile": "npx cmake-js compile",
|
|
8
|
-
"start": "npx ts-node index.ts",
|
|
9
|
-
"format": "npx prettier . --write",
|
|
10
|
-
"esbuild": "npx esbuild library/index.ts --bundle --minify --format=esm --outfile=dist/index.js --platform=node --external:\"*.node\" --packages=external",
|
|
11
|
-
"dts": "npx dts-bundle-generator -o types/lib.d.ts library/index.ts"
|
|
12
|
-
},
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "git+ssh://git@github.com:adamas-vr/prefab-interface.git"
|
|
16
|
-
},
|
|
17
|
-
"author": "Adamas VR, Inc.",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/adamas-vr/prefab-interface/issues"
|
|
20
|
-
},
|
|
21
|
-
"types": "./types/index.d.ts",
|
|
22
|
-
"files": [
|
|
23
|
-
"dist",
|
|
24
|
-
"types"
|
|
25
|
-
],
|
|
26
|
-
"homepage": "https://github.com/adamas-vr/prefab-interface#readme",
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"gl-matrix": "^3.4.4"
|
|
29
|
-
},
|
|
30
|
-
"devDependencies": {
|
|
31
|
-
"@types/node": "^24.0.3",
|
|
32
|
-
"cmake-js": "^7.3.1",
|
|
33
|
-
"ts-node": "^10.0.0",
|
|
34
|
-
"tsconfig-paths": "^4.2.0",
|
|
35
|
-
"typescript": "^5.0.0",
|
|
36
|
-
"node-addon-api": "^8.4.0"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@jack120/test",
|
|
3
|
+
"version": "0.2.12",
|
|
4
|
+
"description": "Adamas Typescript interface",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"compile": "npx cmake-js compile",
|
|
8
|
+
"start": "npx ts-node index.ts",
|
|
9
|
+
"format": "npx prettier . --write",
|
|
10
|
+
"esbuild": "npx esbuild library/index.ts --bundle --minify --format=esm --outfile=dist/index.js --platform=node --external:\"*.node\" --packages=external",
|
|
11
|
+
"dts": "npx dts-bundle-generator -o types/lib.d.ts library/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+ssh://git@github.com:adamas-vr/prefab-interface.git"
|
|
16
|
+
},
|
|
17
|
+
"author": "Adamas VR, Inc.",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/adamas-vr/prefab-interface/issues"
|
|
20
|
+
},
|
|
21
|
+
"types": "./types/index.d.ts",
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"types"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/adamas-vr/prefab-interface#readme",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"gl-matrix": "^3.4.4"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^24.0.3",
|
|
32
|
+
"cmake-js": "^7.3.1",
|
|
33
|
+
"ts-node": "^10.0.0",
|
|
34
|
+
"tsconfig-paths": "^4.2.0",
|
|
35
|
+
"typescript": "^5.0.0",
|
|
36
|
+
"node-addon-api": "^8.4.0"
|
|
37
|
+
}
|
|
38
|
+
}
|
package/types/asset.d.ts
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
declare module "*.mat" {
|
|
2
|
-
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
3
|
-
const value: {
|
|
4
|
-
assetType: "Material";
|
|
5
|
-
|
|
6
|
-
baseMap?: UUID;
|
|
7
|
-
baseColor: { x: number; y: number; z: number; w: number };
|
|
8
|
-
|
|
9
|
-
cutoff: number;
|
|
10
|
-
|
|
11
|
-
smoothness: number;
|
|
12
|
-
smoothnessTextureChannel: number;
|
|
13
|
-
|
|
14
|
-
metallic: number;
|
|
15
|
-
metallicGlossMap?: UUID;
|
|
16
|
-
|
|
17
|
-
specColor: { x: number; y: number; z: number };
|
|
18
|
-
specGlossMap?: UUID;
|
|
19
|
-
|
|
20
|
-
specularHighlights: number;
|
|
21
|
-
environmentReflections: number;
|
|
22
|
-
|
|
23
|
-
bumpScale: number;
|
|
24
|
-
bumpMap?: UUID;
|
|
25
|
-
|
|
26
|
-
parallax: number;
|
|
27
|
-
parallaxMap?: UUID;
|
|
28
|
-
|
|
29
|
-
occlusionStrength: number;
|
|
30
|
-
occlusionMap?: UUID;
|
|
31
|
-
|
|
32
|
-
emissionColor: { x: number; y: number; z: number };
|
|
33
|
-
emissionMap?: UUID;
|
|
34
|
-
|
|
35
|
-
detailMask?: UUID;
|
|
36
|
-
detailAlbedoMapScale: number;
|
|
37
|
-
detailAlbedoMap?: UUID;
|
|
38
|
-
|
|
39
|
-
detailNormalMapScale: number;
|
|
40
|
-
detailNormalMap?: UUID;
|
|
41
|
-
};
|
|
42
|
-
export default value;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
declare module "*.tex" {
|
|
46
|
-
const value: {
|
|
47
|
-
assetType: "Texture";
|
|
48
|
-
|
|
49
|
-
base64Image: string;
|
|
50
|
-
mineType: string;
|
|
51
|
-
filterMode: number;
|
|
52
|
-
wrapMode: number;
|
|
53
|
-
};
|
|
54
|
-
export default value;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
declare module "*.mesh" {
|
|
58
|
-
const value: {
|
|
59
|
-
assetType: "Mesh";
|
|
60
|
-
|
|
61
|
-
base64Vertices: string;
|
|
62
|
-
base64Indices: string;
|
|
63
|
-
base64Normals?: string;
|
|
64
|
-
base64Uvs?: string;
|
|
65
|
-
};
|
|
66
|
-
export default value;
|
|
67
|
-
}
|
|
1
|
+
declare module "*.mat" {
|
|
2
|
+
type UUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
3
|
+
const value: {
|
|
4
|
+
assetType: "Material";
|
|
5
|
+
|
|
6
|
+
baseMap?: UUID;
|
|
7
|
+
baseColor: { x: number; y: number; z: number; w: number };
|
|
8
|
+
|
|
9
|
+
cutoff: number;
|
|
10
|
+
|
|
11
|
+
smoothness: number;
|
|
12
|
+
smoothnessTextureChannel: number;
|
|
13
|
+
|
|
14
|
+
metallic: number;
|
|
15
|
+
metallicGlossMap?: UUID;
|
|
16
|
+
|
|
17
|
+
specColor: { x: number; y: number; z: number };
|
|
18
|
+
specGlossMap?: UUID;
|
|
19
|
+
|
|
20
|
+
specularHighlights: number;
|
|
21
|
+
environmentReflections: number;
|
|
22
|
+
|
|
23
|
+
bumpScale: number;
|
|
24
|
+
bumpMap?: UUID;
|
|
25
|
+
|
|
26
|
+
parallax: number;
|
|
27
|
+
parallaxMap?: UUID;
|
|
28
|
+
|
|
29
|
+
occlusionStrength: number;
|
|
30
|
+
occlusionMap?: UUID;
|
|
31
|
+
|
|
32
|
+
emissionColor: { x: number; y: number; z: number };
|
|
33
|
+
emissionMap?: UUID;
|
|
34
|
+
|
|
35
|
+
detailMask?: UUID;
|
|
36
|
+
detailAlbedoMapScale: number;
|
|
37
|
+
detailAlbedoMap?: UUID;
|
|
38
|
+
|
|
39
|
+
detailNormalMapScale: number;
|
|
40
|
+
detailNormalMap?: UUID;
|
|
41
|
+
};
|
|
42
|
+
export default value;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare module "*.tex" {
|
|
46
|
+
const value: {
|
|
47
|
+
assetType: "Texture";
|
|
48
|
+
|
|
49
|
+
base64Image: string;
|
|
50
|
+
mineType: string;
|
|
51
|
+
filterMode: number;
|
|
52
|
+
wrapMode: number;
|
|
53
|
+
};
|
|
54
|
+
export default value;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
declare module "*.mesh" {
|
|
58
|
+
const value: {
|
|
59
|
+
assetType: "Mesh";
|
|
60
|
+
|
|
61
|
+
base64Vertices: string;
|
|
62
|
+
base64Indices: string;
|
|
63
|
+
base64Normals?: string;
|
|
64
|
+
base64Uvs?: string;
|
|
65
|
+
};
|
|
66
|
+
export default value;
|
|
67
|
+
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import "./asset.d";
|
|
2
|
-
export * from "./lib.d";
|
|
1
|
+
import "./asset.d";
|
|
2
|
+
export * from "./lib.d";
|
package/types/lib.d.ts
CHANGED
|
@@ -417,57 +417,36 @@ export declare class RigidbodyManager {
|
|
|
417
417
|
}
|
|
418
418
|
export type MaterialHandle = number;
|
|
419
419
|
export declare enum ShaderType {
|
|
420
|
-
URP_LIT = "Universal Render Pipeline/Lit"
|
|
420
|
+
URP_LIT = "Universal Render Pipeline/Lit",
|
|
421
|
+
UnityGLTF = "UnityGLTF/PBRGraph"
|
|
421
422
|
}
|
|
422
423
|
export declare enum ShaderProperties {
|
|
423
|
-
/** 2D Texture */
|
|
424
|
-
BaseMap = "_BaseMap",
|
|
425
424
|
/** vec4 [0.0, 1.0] */
|
|
426
|
-
BaseColor = "
|
|
427
|
-
/** float [0.0, 1.0] */
|
|
428
|
-
Cutoff = "_Cutoff",
|
|
429
|
-
/** float [0.0, 1.0] */
|
|
430
|
-
Smoothness = "_Smoothness",
|
|
431
|
-
/** float */
|
|
432
|
-
SmoothnessTextureChannel = "_SmoothnessTextureChannel",
|
|
433
|
-
/** float [0.0, 1.0] */
|
|
434
|
-
Metallic = "_Metallic",
|
|
435
|
-
/** 2D Texture */
|
|
436
|
-
MetallicGlossMap = "_MetallicGlossMap",
|
|
437
|
-
/** vec3 [0.0, 1.0] */
|
|
438
|
-
SpecColor = "_SpecColor",
|
|
439
|
-
/** 2D Texture */
|
|
440
|
-
SpecGlossMap = "_SpecGlossMap",
|
|
441
|
-
/** float */
|
|
442
|
-
SpecularHighlights = "_SpecularHighlights",
|
|
443
|
-
/** float */
|
|
444
|
-
EnvironmentReflections = "_EnvironmentReflections",
|
|
445
|
-
/** float */
|
|
446
|
-
BumpScale = "_BumpScale",
|
|
425
|
+
BaseColor = "baseColorFactor",
|
|
447
426
|
/** 2D Texture */
|
|
448
|
-
|
|
449
|
-
/** float [0.
|
|
450
|
-
|
|
451
|
-
/** 2D Texture */
|
|
452
|
-
ParallaxMap = "_ParallaxMap",
|
|
453
|
-
/** float [0.0, 1.0] */
|
|
454
|
-
OcclusionStrength = "_OcclusionStrength",
|
|
427
|
+
BaseColorMap = "baseColorTexture",
|
|
428
|
+
/** float [0.0, 2.0] */
|
|
429
|
+
NormalScale = "normalScale",
|
|
455
430
|
/** 2D Texture */
|
|
456
|
-
|
|
431
|
+
NormalMap = "normalTexture",
|
|
457
432
|
/** vec3 [0.0, 1.0] */
|
|
458
|
-
|
|
433
|
+
Emission = "emissiveFactor",
|
|
459
434
|
/** 2D Texture */
|
|
460
|
-
EmissionMap = "
|
|
461
|
-
/**
|
|
462
|
-
|
|
463
|
-
/** float [0.0, 2.0] */
|
|
464
|
-
DetailAlbedoMapScale = "_DetailAlbedoMapScale",
|
|
435
|
+
EmissionMap = "emissiveTexture",
|
|
436
|
+
/** float [0.0, 1.0] */
|
|
437
|
+
OcclusionStrength = "occlusionStrength",
|
|
465
438
|
/** 2D Texture */
|
|
466
|
-
|
|
467
|
-
/** float [0.0,
|
|
468
|
-
|
|
439
|
+
OcclusionMap = "occlusionTexture",
|
|
440
|
+
/** float [0.0, 1.0] */
|
|
441
|
+
Roughness = "roughnessFactor",
|
|
442
|
+
/** float */
|
|
443
|
+
RoughnessMap = "metallicRoughnessTexture",
|
|
444
|
+
/** float [0.0, 1.0] */
|
|
445
|
+
Metalness = "metallicFactor",
|
|
469
446
|
/** 2D Texture */
|
|
470
|
-
|
|
447
|
+
MetalnessMap = "metallicRoughnessTexture",
|
|
448
|
+
/** float [0.0, 1.0] */
|
|
449
|
+
AlphaCutoff = "alphaCutoff"
|
|
471
450
|
}
|
|
472
451
|
export declare class MaterialManager {
|
|
473
452
|
/**
|