@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 27.6 kB
JavaScript
import{version as e,revision as t}from"../core/core.js";import{string as r}from"../core/string.js";import{now as o}from"../core/time.js";import{math as n}from"../core/math/math.js";import{Color as s}from"../core/math/color.js";import{Mat4 as i}from"../core/math/mat4.js";import{Vec2 as a}from"../core/math/vec2.js";import{Vec3 as p}from"../core/math/vec3.js";import{Vec4 as c}from"../core/math/vec4.js";import{BoundingBox as l}from"../core/shape/bounding-box.js";import{BoundingSphere as m}from"../core/shape/bounding-sphere.js";import{Frustum as f}from"../core/shape/frustum.js";import{Plane as u}from"../core/shape/plane.js";import{TYPE_INT8 as d,TYPE_UINT8 as h,TYPE_INT16 as y,TYPE_UINT16 as g,TYPE_INT32 as E,TYPE_UINT32 as _,TYPE_FLOAT32 as T,PIXELFORMAT_LA8 as b,PIXELFORMAT_RGB565 as S,PIXELFORMAT_RGBA5551 as j,PIXELFORMAT_RGBA4 as I,PIXELFORMAT_RGB8 as C,PIXELFORMAT_RGBA8 as O,BLENDMODE_CONSTANT as L,BLENDMODE_ONE_MINUS_CONSTANT as A,ADDRESS_CLAMP_TO_EDGE as M,ADDRESS_MIRRORED_REPEAT as P,ADDRESS_REPEAT as R,BLENDMODE_ZERO as N,BLENDMODE_ONE as B,BLENDMODE_SRC_COLOR as D,BLENDMODE_ONE_MINUS_SRC_COLOR as w,BLENDMODE_DST_COLOR as F,BLENDMODE_ONE_MINUS_DST_COLOR as v,BLENDMODE_SRC_ALPHA as x,BLENDMODE_SRC_ALPHA_SATURATE as k,BLENDMODE_ONE_MINUS_SRC_ALPHA as V,BLENDMODE_DST_ALPHA as U,BLENDMODE_ONE_MINUS_DST_ALPHA as G,BUFFER_STATIC as W,BUFFER_DYNAMIC as X,BUFFER_STREAM as $,CULLFACE_NONE as H,CULLFACE_BACK as K,CULLFACE_FRONT as Y,CULLFACE_FRONTANDBACK as q,FILTER_NEAREST as z,FILTER_LINEAR as Q,FILTER_NEAREST_MIPMAP_NEAREST as J,FILTER_NEAREST_MIPMAP_LINEAR as Z,FILTER_LINEAR_MIPMAP_NEAREST as ee,FILTER_LINEAR_MIPMAP_LINEAR as te,INDEXFORMAT_UINT8 as re,INDEXFORMAT_UINT16 as oe,INDEXFORMAT_UINT32 as ne,PRIMITIVE_POINTS as se,PRIMITIVE_LINES as ie,PRIMITIVE_LINELOOP as ae,PRIMITIVE_LINESTRIP as pe,PRIMITIVE_TRIANGLES as ce,PRIMITIVE_TRISTRIP as le,PRIMITIVE_TRIFAN as me,SEMANTIC_POSITION as fe,SEMANTIC_NORMAL as ue,SEMANTIC_COLOR as de,SEMANTIC_TEXCOORD as he,SEMANTIC_TEXCOORD0 as ye,SEMANTIC_TEXCOORD1 as ge,SEMANTIC_ATTR0 as Ee,SEMANTIC_ATTR1 as _e,SEMANTIC_ATTR2 as Te,SEMANTIC_ATTR3 as be,TEXTURELOCK_READ as Se,TEXTURELOCK_WRITE as je,TEXTURETYPE_RGBM as Ie,TEXTURETYPE_DEFAULT as Ce,TEXTURETYPE_SWIZZLEGGGR as Oe}from"../platform/graphics/constants.js";import{ShaderGenerator as Le}from"../scene/shader-lib/programs/shader-generator.js";import{drawQuadWithShader as Ae}from"../scene/graphics/quad-render-utils.js";import{shaderChunks as Me}from"../scene/shader-lib/chunks/chunks.js";import{GraphicsDevice as Pe}from"../platform/graphics/graphics-device.js";import{IndexBuffer as Re}from"../platform/graphics/index-buffer.js";import{LayerComposition as Ne}from"../scene/composition/layer-composition.js";import{PostEffect as Be}from"../scene/graphics/post-effect.js";import{PostEffectQueue as De}from"../framework/components/camera/post-effect-queue.js";import{ProgramLibrary as we}from"../scene/shader-lib/program-library.js";import{getProgramLibrary as Fe,setProgramLibrary as ve}from"../scene/shader-lib/get-program-library.js";import{RenderTarget as xe}from"../platform/graphics/render-target.js";import{ScopeId as ke}from"../platform/graphics/scope-id.js";import{Shader as Ve}from"../platform/graphics/shader.js";import{WebglShaderInput as Ue}from"../platform/graphics/webgl/webgl-shader-input.js";import{Texture as Ge}from"../platform/graphics/texture.js";import{VertexBuffer as We}from"../platform/graphics/vertex-buffer.js";import{VertexFormat as Xe}from"../platform/graphics/vertex-format.js";import{VertexIterator as $e}from"../platform/graphics/vertex-iterator.js";import{ShaderUtils as He}from"../platform/graphics/shader-utils.js";import{BlendState as Ke}from"../platform/graphics/blend-state.js";import{DepthState as Ye}from"../platform/graphics/depth-state.js";import{PROJECTION_ORTHOGRAPHIC as qe,PROJECTION_PERSPECTIVE as ze,LAYERID_WORLD as Qe,LAYERID_IMMEDIATE as Je}from"../scene/constants.js";import{CylinderGeometry as Ze}from"../scene/geometry/cylinder-geometry.js";import{BoxGeometry as et}from"../scene/geometry/box-geometry.js";import{CapsuleGeometry as tt}from"../scene/geometry/capsule-geometry.js";import{ConeGeometry as rt}from"../scene/geometry/cone-geometry.js";import{PlaneGeometry as ot}from"../scene/geometry/plane-geometry.js";import{SphereGeometry as nt}from"../scene/geometry/sphere-geometry.js";import{TorusGeometry as st}from"../scene/geometry/torus-geometry.js";import{calculateTangents as it}from"../scene/geometry/geometry-utils.js";import{BasicMaterial as at}from"../scene/materials/basic-material.js";import{ForwardRenderer as pt}from"../scene/renderer/forward-renderer.js";import{GraphNode as ct}from"../scene/graph-node.js";import{Material as lt}from"../scene/materials/material.js";import{Mesh as mt}from"../scene/mesh.js";import{Morph as ft}from"../scene/morph.js";import{MeshInstance as ut}from"../scene/mesh-instance.js";import{Model as dt}from"../scene/model.js";import{ParticleEmitter as ht}from"../scene/particle-system/particle-emitter.js";import{Picker as yt}from"../framework/graphics/picker.js";import{Scene as gt}from"../scene/scene.js";import{Skin as Et}from"../scene/skin.js";import{SkinInstance as _t}from"../scene/skin-instance.js";import{StandardMaterial as Tt}from"../scene/materials/standard-material.js";import{Batch as bt}from"../scene/batching/batch.js";import{getDefaultMaterial as St}from"../scene/materials/default-material.js";import{StandardMaterialOptions as jt}from"../scene/materials/standard-material-options.js";import{LitShaderOptions as It}from"../scene/shader-lib/programs/lit-shader-options.js";import{Layer as Ct}from"../scene/layer.js";import{Animation as Ot,Key as Lt,Node as At}from"../scene/animation/animation.js";import{Skeleton as Mt}from"../scene/animation/skeleton.js";import{Channel as Pt}from"../platform/audio/channel.js";import{Channel3d as Rt}from"../platform/audio/channel3d.js";import{Listener as Nt}from"../platform/sound/listener.js";import{Sound as Bt}from"../platform/sound/sound.js";import{SoundManager as Dt}from"../platform/sound/manager.js";import{AssetRegistry as wt}from"../framework/asset/asset-registry.js";import{XrInputSource as Ft}from"../framework/xr/xr-input-source.js";import{Controller as vt}from"../platform/input/controller.js";import{ElementInput as xt}from"../framework/input/element-input.js";import{GamePads as kt}from"../platform/input/game-pads.js";import{Keyboard as Vt}from"../platform/input/keyboard.js";import{KeyboardEvent as Ut}from"../platform/input/keyboard-event.js";import{Mouse as Gt}from"../platform/input/mouse.js";import{MouseEvent as Wt}from"../platform/input/mouse-event.js";import{TouchDevice as Xt}from"../platform/input/touch-device.js";import{getTouchTargetCoords as $t,Touch as Ht,TouchEvent as Kt}from"../platform/input/touch-event.js";import{AppBase as Yt}from"../framework/app-base.js";import{getApplication as qt}from"../framework/globals.js";import{CameraComponent as zt}from"../framework/components/camera/component.js";import{LightComponent as Qt}from"../framework/components/light/component.js";import{ModelComponent as Jt}from"../framework/components/model/component.js";import{RenderComponent as Zt}from"../framework/components/render/component.js";import{BODYTYPE_STATIC as er,BODYTYPE_DYNAMIC as tr,BODYTYPE_KINEMATIC as rr,BODYFLAG_STATIC_OBJECT as or,BODYFLAG_KINEMATIC_OBJECT as nr,BODYFLAG_NORESPONSE_OBJECT as sr,BODYSTATE_ACTIVE_TAG as ir,BODYSTATE_ISLAND_SLEEPING as ar,BODYSTATE_WANTS_DEACTIVATION as pr,BODYSTATE_DISABLE_DEACTIVATION as cr,BODYSTATE_DISABLE_SIMULATION as lr}from"../framework/components/rigid-body/constants.js";import{RigidBodyComponent as mr}from"../framework/components/rigid-body/component.js";import{RigidBodyComponentSystem as fr}from"../framework/components/rigid-body/system.js";import{basisInitialize as ur}from"../framework/handlers/basis.js";import{Geometry as dr}from"../scene/geometry/geometry.js";const hr=0,yr=1,gr=2,Er={write:function(e){console.log(e)},open:function(){Er.write(`Powered by PlayCanvas ${e} ${t}`)},info:function(e){console.info(`INFO: ${e}`)},debug:function(e){console.debug(`DEBUG: ${e}`)},error:function(e){console.error(`ERROR: ${e}`)},warning:function(e){console.warn(`WARNING: ${e}`)},alert:function(e){Er.write(`ALERT: ${e}`),alert(e)},assert:function(e,t){!1===e&&Er.write(`ASSERT: ${t}`)}};r.endsWith=function(e,t){return e.endsWith(t)},r.startsWith=function(e,t){return e.startsWith(t)};const _r={now:o,Timer:class{constructor(){this._isRunning=!1,this._a=0,this._b=0}start(){this._isRunning=!0,this._a=o()}stop(){this._isRunning=!1,this._b=o()}getMilliseconds(){return this._b-this._a}}};function Tr(e,t){const r=function(){},o=function(r,o,n,s,i,a,p,c){t.call(this,r,o,n,s,i,a,p,c),e.call(this,r,o,n,s,i,a,p,c)};return o._super=t.prototype,r.prototype=t.prototype,o.prototype=new r,o}function br(e){return Array.prototype.slice.call(e)}function Sr(e){const t=document.createElement("style");return t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e)),t}Object.defineProperty(s.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(4)),this._data[0]=this.r,this._data[1]=this.g,this._data[2]=this.b,this._data[3]=this.a,this._data}}),Object.defineProperty(s.prototype,"data3",{get:function(){return this._data3||(this._data3=new Float32Array(3)),this._data3[0]=this.r,this._data3[1]=this.g,this._data3[2]=this.b,this._data3}}),n.INV_LOG2=Math.LOG2E,n.intToBytes=n.intToBytes32,n.bytesToInt=n.bytesToInt32,Object.defineProperty(a.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(2)),this._data[0]=this.x,this._data[1]=this.y,this._data}}),a.prototype.scale=a.prototype.mulScalar,Object.defineProperty(p.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(3)),this._data[0]=this.x,this._data[1]=this.y,this._data[2]=this.z,this._data}}),p.prototype.scale=p.prototype.mulScalar,Object.defineProperty(c.prototype,"data",{get:function(){return this._data||(this._data=new Float32Array(4)),this._data[0]=this.x,this._data[1]=this.y,this._data[2]=this.z,this._data[3]=this.w,this._data}}),c.prototype.scale=c.prototype.mulScalar;const jr={Aabb:l,Sphere:m,Plane:u};m.prototype.intersectRay=m.prototype.intersectsRay,f.prototype.update=function(e,t){const r=new i;r.mul2(e,t),this.setFromMat4(r)};const Ir=d,Cr=h,Or=y,Lr=g,Ar=E,Mr=_,Pr=T,Rr=b,Nr=S,Br=j,Dr=I,wr=C,Fr=O,vr=L,xr=A,kr=L,Vr=A;function Ur(e){this.name="UnsupportedBrowserError",this.message=e||""}function Gr(e){this.name="ContextCreationError",this.message=e||""}Ur.prototype=Error.prototype,Gr.prototype=Error.prototype;const Wr={begin:Le.begin,dummyFragmentCode:He.dummyFragmentCode,end:Le.end,fogCode:Le.fogCode,gammaCode:Le.gammaCode,precisionCode:He.precisionCode,skinCode:Le.skinCode,tonemapCode:Le.tonemapCode,versionCode:He.versionCode},Xr={ADDRESS_CLAMP_TO_EDGE:M,ADDRESS_MIRRORED_REPEAT:P,ADDRESS_REPEAT:R,BLENDMODE_ZERO:N,BLENDMODE_ONE:B,BLENDMODE_SRC_COLOR:D,BLENDMODE_ONE_MINUS_SRC_COLOR:w,BLENDMODE_DST_COLOR:F,BLENDMODE_ONE_MINUS_DST_COLOR:v,BLENDMODE_SRC_ALPHA:x,BLENDMODE_SRC_ALPHA_SATURATE:k,BLENDMODE_ONE_MINUS_SRC_ALPHA:V,BLENDMODE_DST_ALPHA:U,BLENDMODE_ONE_MINUS_DST_ALPHA:G,BUFFER_STATIC:W,BUFFER_DYNAMIC:X,BUFFER_STREAM:$,CULLFACE_NONE:H,CULLFACE_BACK:K,CULLFACE_FRONT:Y,CULLFACE_FRONTANDBACK:q,ELEMENTTYPE_INT8:d,ELEMENTTYPE_UINT8:h,ELEMENTTYPE_INT16:y,ELEMENTTYPE_UINT16:g,ELEMENTTYPE_INT32:E,ELEMENTTYPE_UINT32:_,ELEMENTTYPE_FLOAT32:T,FILTER_NEAREST:z,FILTER_LINEAR:Q,FILTER_NEAREST_MIPMAP_NEAREST:J,FILTER_NEAREST_MIPMAP_LINEAR:Z,FILTER_LINEAR_MIPMAP_NEAREST:ee,FILTER_LINEAR_MIPMAP_LINEAR:te,INDEXFORMAT_UINT8:re,INDEXFORMAT_UINT16:oe,INDEXFORMAT_UINT32:ne,PIXELFORMAT_RGB565:S,PIXELFORMAT_RGB8:C,PIXELFORMAT_RGBA8:O,PRIMITIVE_POINTS:se,PRIMITIVE_LINES:ie,PRIMITIVE_LINELOOP:ae,PRIMITIVE_LINESTRIP:pe,PRIMITIVE_TRIANGLES:ce,PRIMITIVE_TRISTRIP:le,PRIMITIVE_TRIFAN:me,SEMANTIC_POSITION:fe,SEMANTIC_NORMAL:ue,SEMANTIC_COLOR:de,SEMANTIC_TEXCOORD:he,SEMANTIC_TEXCOORD0:ye,SEMANTIC_TEXCOORD1:ge,SEMANTIC_ATTR0:Ee,SEMANTIC_ATTR1:_e,SEMANTIC_ATTR2:Te,SEMANTIC_ATTR3:be,TEXTURELOCK_READ:Se,TEXTURELOCK_WRITE:je,drawQuadWithShader:Ae,programlib:Wr,shaderChunks:Me,ContextCreationError:Gr,Device:Pe,IndexBuffer:Re,ProgramLibrary:we,RenderTarget:xe,ScopeId:ke,Shader:Ve,ShaderInput:Ue,Texture:Ge,UnsupportedBrowserError:Ur,VertexBuffer:We,VertexFormat:Xe,VertexIterator:$e},$r=new c;function Hr(e,t){return mt.fromGeometry(e,new nt(t))}function Kr(e,t){return mt.fromGeometry(e,new ot(t))}function Yr(e,t){return mt.fromGeometry(e,new et(t))}function qr(e,t){return mt.fromGeometry(e,new st(t))}function zr(e,t){return mt.fromGeometry(e,new tt(t))}function Qr(e,t){return mt.fromGeometry(e,new rt(t))}function Jr(e,t){return mt.fromGeometry(e,new Ze(t))}function Zr(e,t,r={}){const o=new dr;return o.positions=t,o.normals=r.normals,o.tangents=r.tangents,o.colors=r.colors,o.uvs=r.uvs,o.uvs1=r.uvs1,o.blendIndices=r.blendIndices,o.blendWeights=r.blendWeights,o.indices=r.indices,mt.fromGeometry(e,o,r)}function eo(e,t,r,o,n){let s;if(n){const r=t?t.width:e.width,o=t?t.height:e.height;s=$r.set(n.x*r,n.y*o,n.z*r,n.w*o)}Ae(e,t,o,s)}const to={createFullscreenQuad:e=>e.quadVertexBuffer,drawFullscreenQuad:eo,PostEffect:Be,PostEffectQueue:De};Object.defineProperty(Me,"transformSkinnedVS",{get:function(){return`#define SKIN\n${Me.transformVS}`}});Object.keys({"ambientPrefilteredCube.frag":"ambientEnv.frag","ambientPrefilteredCubeLod.frag":"ambientEnv.frag","dpAtlasQuad.frag":null,"genParaboloid.frag":null,"prefilterCubemap.frag":null,"reflectionDpAtlas.frag":"reflectionEnv.frag","reflectionPrefilteredCube.frag":"reflectionEnv.frag","reflectionPrefilteredCubeLod.frag":"reflectionEnv.frag"}).forEach((e=>{Object.defineProperty(Me,e,{get:function(){return null},set:function(){}})})),Object.defineProperties(xe.prototype,{_glFrameBuffer:{get:function(){return this.impl._glFrameBuffer},set:function(e){}}}),Object.defineProperty(Xe,"defaultInstancingFormat",{get:function(){return null}}),Object.defineProperties(Ge.prototype,{rgbm:{get:function(){return this.type===Ie},set:function(e){this.type=e?Ie:Ce}},swizzleGGGR:{get:function(){return this.type===Oe},set:function(e){this.type=e?Oe:Ce}},_glTexture:{get:function(){return this.impl._glTexture}},autoMipmap:{get:function(){return this._mipmaps},set:function(e){this._mipmaps=e}}}),Object.defineProperty(Pe.prototype,"webgl2",{get:function(){return this.isWebGL2}}),Pe.prototype.getProgramLibrary=function(){return Fe(this)},Pe.prototype.setProgramLibrary=function(e){ve(this,e)},Pe.prototype.removeShaderFromCache=function(e){Fe(this).removeFromCache(e)},Ke.DEFAULT=Object.freeze(new Ke);const ro=new Ke,oo=new Ye;Pe.prototype.setBlendFunction=function(e,t){const r=this.blendState;ro.copy(r),ro.setColorBlend(r.colorOp,e,t),ro.setAlphaBlend(r.alphaOp,e,t),this.setBlendState(ro)},Pe.prototype.setBlendFunctionSeparate=function(e,t,r,o){const n=this.blendState;ro.copy(n),ro.setColorBlend(n.colorOp,e,t),ro.setAlphaBlend(n.alphaOp,r,o),this.setBlendState(ro)},Pe.prototype.setBlendEquation=function(e){const t=this.blendState;ro.copy(t),ro.setColorBlend(e,t.colorSrcFactor,t.colorDstFactor),ro.setAlphaBlend(e,t.alphaSrcFactor,t.alphaDstFactor),this.setBlendState(ro)},Pe.prototype.setBlendEquationSeparate=function(e,t){const r=this.blendState;ro.copy(r),ro.setColorBlend(e,r.colorSrcFactor,r.colorDstFactor),ro.setAlphaBlend(t,r.alphaSrcFactor,r.alphaDstFactor),this.setBlendState(ro)},Pe.prototype.setColorWrite=function(e,t,r,o){const n=this.blendState;ro.copy(n),ro.setColorWrite(e,t,r,o),this.setBlendState(ro)},Pe.prototype.getBlending=function(){return this.blendState.blend},Pe.prototype.setBlending=function(e){ro.copy(this.blendState),ro.blend=e,this.setBlendState(ro)},Pe.prototype.setDepthWrite=function(e){oo.copy(this.depthState),oo.write=e,this.setDepthState(oo)},Pe.prototype.setDepthFunc=function(e){oo.copy(this.depthState),oo.func=e,this.setDepthState(oo)},Pe.prototype.setDepthTest=function(e){oo.copy(this.depthState),oo.test=e,this.setDepthState(oo)},Pe.prototype.getCullMode=function(){return this.cullMode};const no=Tt,so=It,io={procedural:{calculateTangents:it,createMesh:Zr,createTorus:qr,createCylinder:Jr,createCapsule:zr,createCone:Qr,createSphere:Hr,createPlane:Kr,createBox:Yr},BasicMaterial:at,ForwardRenderer:pt,GraphNode:ct,Material:lt,Mesh:mt,MeshInstance:ut,Model:dt,ParticleEmitter:ht,PhongMaterial:Tt,Picker:yt,Projection:{ORTHOGRAPHIC:qe,PERSPECTIVE:ze},Scene:gt,Skin:Et,SkinInstance:_t};function ao(e,t){Object.defineProperty(Tt.prototype,t,{get:function(){return this[e]},set:function(t){this[e]=t}})}function po(e,t){"pass"!==e&&Object.defineProperty(jt.prototype,e,{get:function(){return this.litOptions[t||e]},set:function(r){this.litOptions[t||e]=r}})}Object.defineProperty(gt.prototype,"defaultMaterial",{get:function(){return St(qt().graphicsDevice)}}),Object.defineProperty(Ne.prototype,"_meshInstances",{get:function(){return null}}),Object.defineProperty(gt.prototype,"drawCalls",{get:function(){return null}}),["128","64","32","16","8","4"].forEach(((e,t)=>{Object.defineProperty(gt.prototype,`skyboxPrefiltered${e}`,{get:function(){return this._prefilteredCubemaps[t]},set:function(e){this._prefilteredCubemaps[t]=e,this.updateShaders=!0}})})),Object.defineProperty(gt.prototype,"models",{get:function(){return this._models||(this._models=[]),this._models}}),Object.defineProperty(Ct.prototype,"renderTarget",{set:function(e){this._renderTarget=e,this._dirtyComposition=!0},get:function(){return this._renderTarget}}),gt.prototype.addModel=function(e){if(this.containsModel(e))return;const t=this.layers.getLayerById(Qe);t&&(t.addMeshInstances(e.meshInstances),this.models.push(e))},gt.prototype.addShadowCaster=function(e){const t=this.layers.getLayerById(Qe);t&&t.addShadowCasters(e.meshInstances)},gt.prototype.removeModel=function(e){const t=this.models.indexOf(e);if(-1!==t){const r=this.layers.getLayerById(Qe);if(!r)return;r.removeMeshInstances(e.meshInstances),this.models.splice(t,1)}},gt.prototype.removeShadowCasters=function(e){const t=this.layers.getLayerById(Qe);t&&t.removeShadowCasters(e.meshInstances)},gt.prototype.containsModel=function(e){return this.models.indexOf(e)>=0},gt.prototype.getModels=function(e){return this.models},Object.defineProperty(bt.prototype,"model",{get:function(){return null}}),pt.prototype.renderComposition=function(e){qt().renderComposition(e)},ut.prototype.syncAabb=function(){},ft.prototype.getTarget=function(e){return this.targets[e]},ct.prototype._dirtify=function(e){e?this._dirtifyLocal():this._dirtifyWorld()},ct.prototype.addLabel=function(e){this._labels[e]=!0},ct.prototype.getLabels=function(){return Object.keys(this._labels)},ct.prototype.hasLabel=function(e){return!!this._labels[e]},ct.prototype.removeLabel=function(e){delete this._labels[e]},ct.prototype.findByLabel=function(e,t=[]){this.hasLabel(e)&&t.push(this);for(let r=0;r<this._children.length;++r)t=this._children[r].findByLabel(e,t);return t},ct.prototype.getChildren=function(){return this.children},ct.prototype.getName=function(){return this.name},ct.prototype.getPath=function(){return this.path},ct.prototype.getRoot=function(){return this.root},ct.prototype.getParent=function(){return this.parent},ct.prototype.setName=function(e){this.name=e},lt.prototype.getName=function(){return this.name},lt.prototype.setName=function(e){this.name=e},lt.prototype.getShader=function(){return this.shader},lt.prototype.setShader=function(e){this.shader=e},Object.defineProperty(lt.prototype,"blend",{set:function(e){this.blendState.blend=e},get:function(){return this.blendState.blend}}),Object.defineProperty(lt.prototype,"blendSrc",{set:function(e){const t=this.blendState;ro.copy(t),ro.setColorBlend(t.colorOp,e,t.colorDstFactor),ro.setAlphaBlend(t.alphaOp,e,t.alphaDstFactor),this.blendState=ro},get:function(){return this.blendState.colorSrcFactor}}),Object.defineProperty(lt.prototype,"blendDst",{set:function(e){const t=this.blendState;ro.copy(t),ro.setColorBlend(t.colorOp,t.colorSrcFactor,e),ro.setAlphaBlend(t.alphaOp,t.alphaSrcFactor,e),this.blendState=ro},get:function(){return this.blendState.colorDstFactor}}),Object.defineProperty(Tt.prototype,"shininess",{get:function(){return 100*this.gloss},set:function(e){this.gloss=.01*e}}),ao("diffuseTint","diffuseMapTint"),ao("specularTint","specularMapTint"),ao("emissiveTint","emissiveMapTint"),ao("aoVertexColor","aoMapVertexColor"),ao("diffuseVertexColor","diffuseMapVertexColor"),ao("specularVertexColor","specularMapVertexColor"),ao("emissiveVertexColor","emissiveMapVertexColor"),ao("metalnessVertexColor","metalnessMapVertexColor"),ao("glossVertexColor","glossMapVertexColor"),ao("opacityVertexColor","opacityMapVertexColor"),ao("lightVertexColor","lightMapVertexColor"),ao("sheenGloss","sheenGlossiess"),ao("clearCoatGloss","clearCostGlossiness"),po("refraction","useRefraction");const co=new It,lo=Object.getOwnPropertyNames(co);for(const e in lo)po(lo[e]);const mo={Animation:Ot,Key:Lt,Node:At,Skeleton:Mt};Ot.prototype.getDuration=function(){return this.duration},Ot.prototype.getName=function(){return this.name},Ot.prototype.getNodes=function(){return this.nodes},Ot.prototype.setDuration=function(e){this.duration=e},Ot.prototype.setName=function(e){this.name=e},Mt.prototype.getAnimation=function(){return this.animation},Mt.prototype.getCurrentTime=function(){return this.currentTime},Mt.prototype.getLooping=function(){return this.looping},Mt.prototype.getNumNodes=function(){return this.numNodes},Mt.prototype.setAnimation=function(e){this.animation=e},Mt.prototype.setCurrentTime=function(e){this.currentTime=e},Mt.prototype.setLooping=function(e){this.looping=e};const fo={AudioManager:Dt,Channel:Pt,Channel3d:Rt,Listener:Nt,Sound:Bt};Dt.prototype.getListener=function(){return this.listener},Dt.prototype.getVolume=function(){return this.volume},Dt.prototype.setVolume=function(e){this.volume=e};const uo={ASSET_ANIMATION:"animation",ASSET_AUDIO:"audio",ASSET_IMAGE:"image",ASSET_JSON:"json",ASSET_MODEL:"model",ASSET_MATERIAL:"material",ASSET_TEXT:"text",ASSET_TEXTURE:"texture",ASSET_CUBEMAP:"cubemap",ASSET_SCRIPT:"script"};wt.prototype.getAssetById=function(e){return this.get(e)},Object.defineProperty(Ft.prototype,"ray",{get:function(){return this._rayLocal}}),Object.defineProperty(Ft.prototype,"position",{get:function(){return this._localPosition}}),Object.defineProperty(Ft.prototype,"rotation",{get:function(){return this._localRotation}});const ho={getTouchTargetCoords:$t,Controller:vt,GamePads:kt,Keyboard:Vt,KeyboardEvent:Ut,Mouse:Gt,MouseEvent:Wt,Touch:Ht,TouchDevice:Xt,TouchEvent:Kt};Object.defineProperty(xt.prototype,"wheel",{get:function(){return-2*this.wheelDelta}}),Object.defineProperty(Wt.prototype,"wheel",{get:function(){return-2*this.wheelDelta}});const yo=er,go=tr,Eo=rr,_o=or,To=nr,bo=sr,So=ir,jo=ar,Io=pr,Co=cr,Oo=lr;function Lo(e,t,r){ur({glueUrl:e,wasmUrl:t,fallbackUrl:r,lazyInit:!0})}function Ao(e){}Yt.prototype.isFullscreen=function(){return!!document.fullscreenElement},Yt.prototype.enableFullscreen=function(e,t,r){e=e||this.graphicsDevice.canvas;const o=function e(){t(),document.removeEventListener("fullscreenchange",e)},n=function e(){r(),document.removeEventListener("fullscreenerror",e)};t&&document.addEventListener("fullscreenchange",o,!1),r&&document.addEventListener("fullscreenerror",n,!1),e.requestFullscreen?e.requestFullscreen(Element.ALLOW_KEYBOARD_INPUT):r()},Yt.prototype.disableFullscreen=function(e){const t=function t(){e(),document.removeEventListener("fullscreenchange",t)};e&&document.addEventListener("fullscreenchange",t,!1),document.exitFullscreen()},Yt.prototype.getSceneUrl=function(e){const t=this.scenes.find(e);return t?t.url:null},Yt.prototype.loadScene=function(e,t){this.scenes.loadScene(e,t)},Yt.prototype.loadSceneHierarchy=function(e,t){this.scenes.loadSceneHierarchy(e,t)},Yt.prototype.loadSceneSettings=function(e,t){this.scenes.loadSceneSettings(e,t)},Yt.prototype.renderMeshInstance=function(e,t){const r=null!=t&&t.layer?t.layer:this.scene.defaultDrawLayer;this.scene.immediate.drawMesh(null,null,null,e,r)},Yt.prototype.renderMesh=function(e,t,r,o){const n=null!=o&&o.layer?o.layer:this.scene.defaultDrawLayer;this.scene.immediate.drawMesh(t,r,e,null,n)},Yt.prototype._addLines=function(e,t,r){const o=r&&r.layer?r.layer:this.scene.layers.getLayerById(Je),n=!r||void 0===r.depthTest||r.depthTest;this.scene.immediate.getBatch(o,n).addLines(e,t)},Yt.prototype.renderLine=function(e,t,r){let o,n=r;const i=arguments[3],a=arguments[4];i instanceof s?(n=i,o="number"==typeof a?1===a?{layer:this.scene.layers.getLayerById(Je),depthTest:!1}:{layer:this.scene.layers.getLayerById(Je),depthTest:!0}:a):"number"==typeof i?(n=r,o=1===i?{layer:this.scene.layers.getLayerById(Je),depthTest:!1}:{layer:this.scene.layers.getLayerById(Je),depthTest:!0}):i&&(o=i),this._addLines([e,t],[r,n],o)},Yt.prototype.renderLines=function(e,t,r){r?"number"==typeof r&&(r=1===r?{layer:this.scene.layers.getLayerById(Je),depthTest:!1}:{layer:this.scene.layers.getLayerById(Je),depthTest:!0}):r={layer:this.scene.layers.getLayerById(Je),depthTest:!0};!t.length||e.length===t.length?e.length%2==0?this._addLines(e,t,r):console.error("renderLines: array length is not divisible by 2"):console.error("renderLines: position/color arrays have different lengths")},Yt.prototype.enableVr=function(){},Object.defineProperty(zt.prototype,"node",{get:function(){return this.entity}}),Object.defineProperty(Qt.prototype,"enable",{get:function(){return this.enabled},set:function(e){this.enabled=e}}),Jt.prototype.setVisible=function(e){this.enabled=e},Object.defineProperty(Jt.prototype,"aabb",{get:function(){return null},set:function(e){}}),Object.defineProperty(Zt.prototype,"aabb",{get:function(){return null},set:function(e){}}),Object.defineProperty(mr.prototype,"bodyType",{get:function(){return this.type},set:function(e){this.type=e}}),mr.prototype.syncBodyToEntity=function(){this._updateDynamic()},fr.prototype.setGravity=function(){1===arguments.length?this.gravity.copy(arguments[0]):this.gravity.set(arguments[0],arguments[1],arguments[2])};export{kr as BLENDMODE_CONSTANT_ALPHA,vr as BLENDMODE_CONSTANT_COLOR,Vr as BLENDMODE_ONE_MINUS_CONSTANT_ALPHA,xr as BLENDMODE_ONE_MINUS_CONSTANT_COLOR,Gr as ContextCreationError,Pr as ELEMENTTYPE_FLOAT32,Or as ELEMENTTYPE_INT16,Ar as ELEMENTTYPE_INT32,Ir as ELEMENTTYPE_INT8,Lr as ELEMENTTYPE_UINT16,Mr as ELEMENTTYPE_UINT32,Cr as ELEMENTTYPE_UINT8,gr as LINEBATCH_GIZMO,yr as LINEBATCH_OVERLAY,hr as LINEBATCH_WORLD,so as LitOptions,Rr as PIXELFORMAT_L8_A8,Dr as PIXELFORMAT_R4_G4_B4_A4,Br as PIXELFORMAT_R5_G5_B5_A1,Nr as PIXELFORMAT_R5_G6_B5,wr as PIXELFORMAT_R8_G8_B8,Fr as PIXELFORMAT_R8_G8_B8_A8,no as PhongMaterial,So as RIGIDBODY_ACTIVE_TAG,To as RIGIDBODY_CF_KINEMATIC_OBJECT,bo as RIGIDBODY_CF_NORESPONSE_OBJECT,_o as RIGIDBODY_CF_STATIC_OBJECT,Co as RIGIDBODY_DISABLE_DEACTIVATION,Oo as RIGIDBODY_DISABLE_SIMULATION,jo as RIGIDBODY_ISLAND_SLEEPING,go as RIGIDBODY_TYPE_DYNAMIC,Eo as RIGIDBODY_TYPE_KINEMATIC,yo as RIGIDBODY_TYPE_STATIC,Io as RIGIDBODY_WANTS_DEACTIVATION,Ur as UnsupportedBrowserError,mo as anim,uo as asset,fo as audio,Lo as basisSetDownloadConfig,Yr as createBox,zr as createCapsule,Qr as createCone,Jr as createCylinder,Zr as createMesh,Kr as createPlane,Hr as createSphere,Sr as createStyle,qr as createTorus,eo as drawFullscreenQuad,Xr as gfx,Tr as inherits,ho as input,Er as log,br as makeArray,to as posteffect,Ao as prefilterCubemap,Wr as programlib,io as scene,jr as shape,_r as time};